:root {
  --primary: #006948;
  --primary-soft: #e3f3ec;
  --secondary: #fd9d1a;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --text: #191c1b;
  --muted: #5f6763;
  --border: #dde3e0;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --warn-soft: #fff4e0;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(0, 60, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #4fd1a0;
    --primary-soft: #16362b;
    --bg: #101413;
    --surface: #181d1b;
    --text: #e6ebe8;
    --muted: #9aa5a0;
    --border: #2a322f;
    --danger: #ff8a80;
    --danger-soft: #3a1c1a;
    --warn-soft: #3a2c14;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; font-weight: 800; margin-bottom: 14px; }
.hidden { display: none !important; }
.mt { margin-top: 22px; }

/* ── Giriş ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 20px;
  padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand h1 { font-size: 20px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; background: #84b957; color: #fff;
  display: grid; place-items: center; font-weight: 800; flex-shrink: 0;
}
.brand.small .logo { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.brand.small p { font-size: 12px; word-break: break-all; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 12px 0 0; }

/* ── Form ── */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }

.btn {
  font: inherit; font-weight: 700; border-radius: 10px; padding: 11px 16px;
  cursor: pointer; border: 1.5px solid transparent;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }

/* ── Yerleşim ── */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 0; height: 100vh;
}
nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
nav button {
  font: inherit; font-weight: 700; text-align: left; background: none; border: 0;
  padding: 10px 12px; border-radius: 10px; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
nav button.active { background: var(--primary-soft); color: var(--primary); }
main { padding: 24px 28px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar h2 { font-size: 24px; font-weight: 800; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .num { font-size: 30px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.stat .sub { color: var(--primary); font-size: 12px; font-weight: 700; margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* Grafik */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: 40%; max-width: 22px; border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.bar.started { background: #b7dccb; }
.bar.completed { background: var(--primary); }
.bar-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar-value { font-size: 11px; font-weight: 800; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.dot.started { background: #b7dccb; }
.dot.completed { background: var(--primary); }

.roles { display: flex; flex-direction: column; gap: 10px; }
.role-row { display: grid; grid-template-columns: 80px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.role-track { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.role-fill { height: 100%; border-radius: 5px; }
.list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* Rozetler */
.pill {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--secondary); color: #fff;
}
.tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.tag.admin { background: #ede7f6; color: #4527a0; }
.tag.tester-admin { background: #e3f2fd; color: #0d47a1; }
.tag.tester-default { background: #e0f2f1; color: #00695c; }
.tag.vip { background: #fff3e0; color: #b25b00; }
.tag.free { background: var(--bg); color: var(--muted); }
.tag.open { background: var(--warn-soft); color: #b25b00; }
.tag.resolved { background: var(--primary-soft); color: var(--primary); }
.tag.dismissed { background: var(--bg); color: var(--muted); }

/* Tablo */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; }
.table-card { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .who strong { display: block; }
td .who span { color: var(--muted); font-size: 12px; }
td select { padding: 6px 8px; font-size: 13px; }
.muted { color: var(--muted); }

/* Şikayet kartı */
.report { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.report .word { font-size: 18px; font-weight: 800; }
.report .tr { color: var(--primary); font-weight: 700; }
.report .ex { color: var(--muted); font-style: italic; font-size: 13px; margin-top: 4px; }
.report .note { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
.report .meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.report .actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.report textarea { margin-top: 10px; width: 100%; font-size: 13px; }

/* Duyuru */
.ann { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ann.inactive { opacity: .55; }
.ann-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.ann p { margin: 6px 0 0; font-size: 14px; white-space: pre-wrap; }
.ann .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ── Mobil ── */
@media (max-width: 820px) {
  /* minmax(0,1fr): yatay kayan sekme çubuğu sütunu genişletip sayfayı taşırmasın */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar .brand { margin: 0; flex: 1; }
  nav { flex-direction: row; overflow-x: auto; order: 3; flex-basis: 100%; min-width: 0; }
  .sidebar > * { min-width: 0; }
  nav button { white-space: nowrap; }
  main { padding: 16px 16px 40px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .report { grid-template-columns: 1fr; }
  .report .actions { flex-direction: row; flex-wrap: wrap; }
}

/* ── Giriş notu ── */
.hint.center { text-align: center; margin-top: 16px; }

/* ── Kullanıcı satırı eylemleri ── */
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Bildirim mesajları ── */
.card.info { font-size: 14px; line-height: 1.5; margin-bottom: 18px; background: var(--primary-soft); border-color: transparent; }
.rem-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.rem-side { position: sticky; top: 16px; }
.times { display: flex; gap: 14px; flex-wrap: wrap; }
.times label { flex: 1; min-width: 140px; }
.tpl { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; }
.tpl-label { font-weight: 800; font-size: 13px; color: var(--primary); }
.warn { background: var(--warn-soft); color: #8a4b00; border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.notif-preview {
  background: var(--bg); border-radius: 14px; padding: 10px 12px;
  border-left: 4px solid var(--primary);
}
.np-app { font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.np-title { font-weight: 800; font-size: 14px; }
.np-body { font-size: 13px; color: var(--muted); margin-top: 2px; }
.add-variant { align-self: flex-start; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.codes { font-size: 13px; }
.codes td, .codes th { padding: 8px 6px; }
.code-chip {
  font: 700 12px ui-monospace, monospace; background: var(--primary-soft); color: var(--primary);
  border: 0; border-radius: 6px; padding: 4px 7px; cursor: pointer; white-space: nowrap;
}
.code-chip:hover { outline: 2px solid var(--primary); }
.preview-vars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

@media (max-width: 820px) {
  .rem-grid { grid-template-columns: minmax(0, 1fr); }
  .rem-side { position: static; order: -1; }
}
