/* ── Tema değişkenleri ─────────────────────────────────────────────── */
:root {
    color-scheme: light;

    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e3e6ea;
    --border-strong: #cfd4da;

    --text: #12161c;
    --text-2: #5a6472;
    --text-3: #8b95a3;

    --accent: #3b5bdb;
    --accent-hover: #2f4bc4;
    --accent-soft: #edf1fe;
    --accent-text: #ffffff;

    --ok: #0f8b4c;
    --ok-soft: #e6f5ec;
    --warn: #a86a00;
    --warn-soft: #fdf2dd;
    --alert: #c2500f;
    --alert-soft: #fdece1;
    --bad: #c0342b;
    --bad-soft: #fdeceb;
    --muted-soft: #eef0f3;

    --sidebar-bg: #161b24;
    --sidebar-text: #a9b3c2;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: #212836;
    --sidebar-border: #262d3b;

    --radius: 8px;
    --radius-sm: 5px;
    --shadow: 0 1px 2px rgba(16, 22, 32, .05), 0 2px 8px rgba(16, 22, 32, .04);
    --shadow-lg: 0 4px 12px rgba(16, 22, 32, .1), 0 12px 32px rgba(16, 22, 32, .08);

    --sidebar-w: 232px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "SF Mono", "Cascadia Mono", ui-monospace, "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --bg: #0d1017;
        --surface: #151a22;
        --surface-2: #1a202a;
        --border: #252c38;
        --border-strong: #333c4c;

        --text: #e8ecf2;
        --text-2: #9aa5b5;
        --text-3: #6b7688;

        --accent: #5b7cfa;
        --accent-hover: #6f8bfb;
        --accent-soft: #1c2440;
        --accent-text: #ffffff;

        --ok: #45c07d;
        --ok-soft: #14291f;
        --warn: #e0a63a;
        --warn-soft: #2b2313;
        --alert: #ef8b4f;
        --alert-soft: #2e1d13;
        --bad: #ef6b60;
        --bad-soft: #2d1717;
        --muted-soft: #1e242e;

        --sidebar-bg: #0a0d13;
        --sidebar-border: #1c222c;

        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0d1017;
    --surface: #151a22;
    --surface-2: #1a202a;
    --border: #252c38;
    --border-strong: #333c4c;

    --text: #e8ecf2;
    --text-2: #9aa5b5;
    --text-3: #6b7688;

    --accent: #5b7cfa;
    --accent-hover: #6f8bfb;
    --accent-soft: #1c2440;

    --ok: #45c07d;
    --ok-soft: #14291f;
    --warn: #e0a63a;
    --warn-soft: #2b2313;
    --alert: #ef8b4f;
    --alert-soft: #2e1d13;
    --bad: #ef6b60;
    --bad-soft: #2d1717;
    --muted-soft: #1e242e;

    --sidebar-bg: #0a0d13;
    --sidebar-border: #1c222c;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
}

/* ── Temel ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

code, .mono { font-family: var(--mono); font-size: .92em; }

/* ── Yerleşim ──────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand strong { color: #fff; font-size: 15px; display: block; letter-spacing: -.01em; }
.sidebar-brand span { color: var(--sidebar-text); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-nav .group {
    color: #5d6879;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .09em;
    padding: 14px 10px 6px;
    font-weight: 600;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    margin-bottom: 1px;
    transition: background .12s, color .12s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--accent); color: #fff; font-weight: 500; }
.sidebar-nav a svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.sidebar-nav .count {
    margin-left: auto;
    background: rgba(255, 255, 255, .12);
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-nav a.active .count { background: rgba(0, 0, 0, .22); }
.sidebar-nav .count.hot { background: var(--bad); color: #fff; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .who { color: var(--sidebar-text); font-size: 12px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who b { color: #fff; display: block; font-size: 13px; font-weight: 500; }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions button, .sidebar-actions a {
    flex: 1;
    background: var(--sidebar-hover);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
}
.sidebar-actions button:hover, .sidebar-actions a:hover { color: #fff; background: #2a3242; text-decoration: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 26px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.topbar .spacer { flex: 1; }
.topbar .crumb { color: var(--text-3); font-size: 12.5px; }

.content { padding: 22px 26px 48px; }
.content > * + * { margin-top: 18px; }

/* ── Kartlar ───────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-head h2 { flex: 1; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 780px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

/* ── İstatistik kutuları ───────────────────────────────────────────── */
.stat { padding: 15px 16px; }
.stat .k { color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 5px; line-height: 1.1; }
.stat .n { color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.stat .v.ok { color: var(--ok); }
.stat .v.warn { color: var(--warn); }
.stat .v.bad { color: var(--bad); }

/* ── Rozetler ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.alert { background: var(--alert-soft); color: var(--alert); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--muted-soft); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.chip {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 11.5px;
    color: var(--text-2);
    margin: 0 3px 3px 0;
}

/* ── Tablolar ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
    text-align: left;
    padding: 9px 14px;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.shrink, table.tbl th.shrink { width: 1%; white-space: nowrap; }
table.tbl .muted { color: var(--text-3); }
table.tbl .strong { font-weight: 600; }

.empty { padding: 34px 16px; text-align: center; color: var(--text-3); }
.empty p { margin: 0 0 12px; }

/* ── Formlar ───────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }

.check { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13.5px; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.check label { margin: 0; font-weight: 400; color: var(--text); cursor: pointer; }

.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; min-width: 0; }
@media (max-width: 640px) { .form-row { flex-direction: column; gap: 0; } }

.validation { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
.validation-summary {
    background: var(--bad-soft);
    border: 1px solid var(--bad);
    color: var(--bad);
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}
.validation-summary ul { margin: 0; padding-left: 18px; }

/* ── Butonlar ──────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { opacity: .88; background: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--muted-soft); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ── Bildirimler ───────────────────────────────────────────────────── */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    border: 1px solid transparent;
    display: flex;
    gap: 9px;
    align-items: flex-start;
}
.alert.success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.alert.error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.alert.info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert strong { font-weight: 650; }

/* ── Filtre çubuğu ─────────────────────────────────────────────────── */
.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 150px; }
.filters .f.wide { flex: 1; min-width: 220px; }
.filters .f label { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Anahtar gösterimi ─────────────────────────────────────────────── */
.keybox {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
}
.keybox .key { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .04em; flex: 1; word-break: break-all; }

.secret-reveal {
    background: var(--warn-soft);
    border: 1px solid var(--warn);
    border-radius: var(--radius-sm);
    padding: 13px;
}
.secret-reveal .val { font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--surface); padding: 9px; border-radius: 4px; margin-top: 8px; }

/* ── Tanım listesi ─────────────────────────────────────────────────── */
dl.defs { margin: 0; display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 9px 18px; font-size: 13.5px; }
dl.defs dt { color: var(--text-3); font-size: 12.5px; }
dl.defs dd { margin: 0; }

/* ── Mini grafik ───────────────────────────────────────────────────── */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 84px; padding-top: 8px; }
.spark .bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .82; position: relative; }
.spark .bar:hover { opacity: 1; }
.spark .bar span {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--surface);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
    margin-bottom: 4px;
}
.spark .bar:hover span { opacity: 1; }
.spark-labels { display: flex; gap: 3px; margin-top: 6px; }
.spark-labels div { flex: 1; text-align: center; font-size: 10px; color: var(--text-3); overflow: hidden; }

/* ── Giriş ekranı ──────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}
.login-box { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand strong { display: block; font-size: 19px; letter-spacing: -.02em; }
.login-brand span { color: var(--text-3); font-size: 12.5px; }

/* ── Yardımcılar ───────────────────────────────────────────────────── */
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt0 { margin-top: 0 !important; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.inline-form { display: inline; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
