/* Client Yönetim — koyu-öncelikli yönetim paneli.
   Düzen fikri: sabit sol menü + üst başlık + kart tabanlı içerik; ayrıntılar sağdan çekmece. */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #e2e7ef;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7686;
  --accent: #3b74f0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(59, 116, 240, .10);
  --ok: #18a46a;
  --warn: #c98612;
  --bad: #db4c4c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 24px rgba(16, 24, 40, .06);
  --radius: 12px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1118; --surface: #131a24; --surface-2: #18212d; --line: #232e3c;
    --ink: #e8eef6; --ink-2: #c3ccd8; --muted: #8592a5;
    --accent: #5b8dff; --accent-soft: rgba(91, 141, 255, .14);
    --ok: #3ccb8b; --warn: #f0b44c; --bad: #f06e6e;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1118; --surface: #131a24; --surface-2: #18212d; --line: #232e3c;
  --ink: #e8eef6; --ink-2: #c3ccd8; --muted: #8592a5;
  --accent: #5b8dff; --accent-soft: rgba(91, 141, 255, .14);
  --ok: #3ccb8b; --warn: #f0b44c; --bad: #f06e6e;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 22px; } h2 { font-size: 20px; } h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .lead { margin-bottom: 16px; max-width: 70ch; }
.mono { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---- ikonlar ---- */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- marka işareti ---- */
.mark { width: 40px; height: 40px; border-radius: 11px; flex: none; position: relative;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #12c6c0)); }
.mark::after { content: ""; position: absolute; inset: 9px; border: 2px solid rgba(255,255,255,.85);
  transform: rotate(45deg); border-radius: 3px; }
.mark.small { width: 30px; height: 30px; border-radius: 9px; } .mark.small::after { inset: 7px; }

/* ---- butonlar & alanlar ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; transition: border-color .15s, background .15s, color .15s; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { width: auto; }
.form-error { color: var(--bad); min-height: 1.4em; margin-top: 10px; font-size: 13px; }
.hint { color: var(--ink-2); font-size: 13px; margin-bottom: 12px; }
.stack > * + * { margin-top: 2px; }

/* ---- giriş ---- */
.auth { min-height: 100%; display: grid; place-content: center; gap: 16px; padding: 24px 16px;
  background: radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.brand-row { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.auth-card .btn.primary { margin-top: 6px; padding: 11px; }
.auth-card .btn.ghost { margin-top: 6px; }
.auth-foot { text-align: center; font-size: 12px; }

/* ---- kabuk ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-size: 15px; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 600; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.me { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.me-text { display: grid; min-width: 0; } .me-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; gap: 6px; } .side-actions .btn.ghost:last-child { flex: 1; justify-content: flex-start; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; color: #fff; background: var(--accent); text-transform: uppercase; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 22px 32px 12px; }
.topbar .top-actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; }
main { padding: 8px 32px 40px; display: grid; gap: 20px; }
.page { display: grid; gap: 20px; }

/* ---- kartlar ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: grid; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .value { font: 700 28px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat.bad .value { color: var(--bad); } .stat.ok .value { color: var(--ok); }

.alert { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 4px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.alert .ico { color: var(--warn); width: 22px; height: 22px; }
.alert .text { flex: 1; } .alert b { display: block; }
.alert + .alert { margin-top: 10px; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; padding-top: 0; }
.activity .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.sev.ok { background: var(--ok); } .sev.warn { background: var(--warn); } .sev.bad { background: var(--bad); }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 40px; align-items: center; gap: 12px; font-size: 13px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---- araç çubuğu & tablo ---- */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 34px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg-btn { font: inherit; font-weight: 600; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: 7px; padding: 5px 11px; cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover { background: var(--surface-2); }
.table .empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.user-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.user-cell .avatar { width: 34px; height: 34px; }
.user-cell .name { font-weight: 650; } .user-cell .note { color: var(--muted); font-size: 12px; }
.chev { color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 3px 9px;
  border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.pill.plain::before { display: none; }

/* ---- özellik kartları ---- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 6px; }
.feature .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.feature code { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---- çekmece ---- */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(5, 9, 15, .5); backdrop-filter: blur(2px); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0,0,0,.25); z-index: 50; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.drawer-title { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-title .avatar { width: 42px; height: 42px; font-size: 16px; }
.drawer-title h3 { font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 18px; align-content: start; }
.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; font-weight: 650; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 12px; cursor: pointer; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.perm-list { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.perm { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.perm:first-child { border-top: 0; }
.perm:hover { background: var(--surface-2); }
.perm .txt { flex: 1; display: grid; min-width: 0; }
.perm .txt b { font-weight: 650; } .perm .txt span { font-size: 12px; color: var(--muted); }

.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.switch i::after { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.inline-form { display: flex; gap: 8px; } .inline-form input { flex: 1; }
.panel-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); display: grid; gap: 10px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.timeline li { position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted); }
.timeline li.ok::before { border-color: var(--ok); } .timeline li.bad::before { border-color: var(--bad); } .timeline li.warn::before { border-color: var(--warn); }
.timeline .t { color: var(--muted); font-size: 12px; }

/* ---- 2FA ---- */
.secret { font-family: var(--mono); font-size: 16px; letter-spacing: .08em; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--line); word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--mono); font-size: 14px; }
.codes span { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); font-size: 13.5px; }

/* ---- pencere ---- */
.modal-backdrop { display: grid; place-items: center; padding: 16px; z-index: 60; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.35); padding: 22px; }
.modal h3 { font-size: 17px; margin-bottom: 6px; }
.modal .desc { color: var(--ink-2); margin-bottom: 16px; }
.modal .perm-list { margin-bottom: 14px; }

/* ---- bildirimler ---- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { display: flex; gap: 10px; align-items: center; min-width: 260px; max-width: 380px; padding: 11px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; font-size: 13.5px;
  animation: pop .18s ease-out; }
.toast .ico { width: 18px; height: 18px; } .toast.ok .ico { color: var(--ok); } .toast.bad .ico { color: var(--bad); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .switch i, .switch i::after { transition: none; } }

/* ---- duyarlı ---- */
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 45; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 16px 16px 8px; }
  main { padding: 8px 16px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
}
@media (max-width: 480px) {
  .seg { width: 100%; } .seg-btn { flex: 1; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 32px; }
}
