:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --ink: #0f172a;
    --ink-soft: #475569;
    --muted: #64748b;
    --brand: #2563eb;
    --brand-700: #1d4ed8;
    --brand-50: #eff6ff;
    --ok: #059669; --ok-bg: #ecfdf5; --ok-line: #a7f3d0;
    --warn: #d97706; --warn-bg: #fffbeb; --warn-line: #fde68a;
    --bad: #e11d48; --bad-bg: #fff1f2; --bad-line: #fecdd3;
    --off: #475569; --off-bg: #f1f5f9; --off-line: #cbd5e1;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 14px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2 { margin: 0; letter-spacing: -.02em; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .92em; }
.upper { text-transform: uppercase; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

/* Marka */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 17px; }
.brand b { color: var(--brand); font-weight: 800; }
.brand img { height: 40px; width: auto; object-fit: contain; }
.brand small { font-weight: 600; font-size: 12px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #1d4ed8); color: #fff; font-size: 15px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

/* Üst bar */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.topbar-actions form { margin: 0; }
@media (max-width: 560px) { .brand small { display: none; } }

.main { padding-top: 24px; padding-bottom: 64px; }

/* Düğmeler */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
    font: inherit; font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: #059669; color: #fff; box-shadow: 0 8px 20px rgba(5, 150, 105, .3); }
.btn-accent:hover { background: #047857; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border-color: #c7d2fe; }
.btn-soft:hover { background: #e0e7ff; }
.btn-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.btn-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; }

/* Kart, uyarı */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
@media (min-width: 720px) { .card { padding: 26px; } }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: 13px; border: 1px solid; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.alert-err { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.back-link { display: inline-block; margin: 4px 0 16px; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* Giriş */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, #e0e7ff, transparent); }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 24px; margin-top: 8px; }
.login p { margin: -6px 0 4px; }
.login .back-link { margin: 0; text-align: center; }

/* Başlık alanı */
.hero {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding: 28px; margin-bottom: 20px; border-radius: 24px; color: #fff;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #0f172a 100%);
    box-shadow: 0 20px 40px rgba(15, 23, 42, .18);
}
.hero h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; }
.hero-text { color: #cbd5e1; max-width: 70ch; margin: 8px 0 0; }
.hero-sm { padding: 22px 28px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-actions form { margin: 0; }
.hero .btn-soft { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }
.hero .pill { vertical-align: middle; }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #a5b4fc; }

/* İstatistikler */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.stat strong { display: block; font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat strong span { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat em { display: block; font-style: normal; font-size: 11px; font-weight: 700; margin-top: 4px; }

/* Arama + tablo */
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; min-width: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
.table th { text-align: left; padding: 12px 14px; background: #f8fafc; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.table td { padding: 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafbff; }
.table .empty { text-align: center; color: var(--muted); padding: 32px; }
.school-name { font-weight: 700; font-size: 14px; text-decoration: none; }
.school-name:hover { color: var(--brand); }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.code { font-family: "JetBrains Mono", monospace; background: var(--line-soft); padding: 1px 6px; border-radius: 6px; color: var(--ink-soft); font-weight: 600; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.meter { height: 4px; border-radius: 4px; background: var(--line-soft); margin-top: 6px; overflow: hidden; width: 90px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-ok { color: var(--ok); } .pill.st-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.st-warn { color: var(--warn); } .pill.st-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.st-bad { color: var(--bad); } .pill.st-bad { background: var(--bad-bg); border-color: var(--bad-line); }
.st-off { color: var(--off); } .pill.st-off { background: var(--off-bg); border-color: var(--off-line); }

/* Form */
.form h2 { font-size: 16px; margin: 8px 0 14px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.form h2:first-of-type { border-top: 0; padding-top: 0; }
.form > p { margin: -6px 0 14px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 8px; }
.span-2 { grid-column: span 2; }
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px;
    background: #f8fafc; font: inherit; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea { resize: vertical; }
.quick { display: flex; gap: 6px; }
.quick button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 9px; font: inherit; font-size: 11px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.quick button:hover { border-color: var(--brand); color: var(--brand); }
.keybox { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 11px; background: #fff; }
.check { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-soft); font-weight: 600; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

.danger { border-color: var(--bad-line); }
.danger h2 { font-size: 15px; color: var(--bad); margin-bottom: 6px; }
.danger p { margin: 0 0 12px; }
.danger-row { display: flex; gap: 8px; max-width: 420px; }
