/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #101820;
  --ink-2: #33414f;
  --muted: #66727f;
  --line: #dfe4ea;
  --line-2: #eef1f4;
  --accent: #0f3b7a;        /* lacivert */
  --accent-ink: #0b2b59;
  --accent-soft: #e6edf7;
  --home: #b91c1c;          /* ana üniversite işareti */
  --home-soft: #fbe9e9;
  --pos: #0e7c7b;
  --pos-soft: #e1f2f1;
  --neg: #b45309;
  --neg-soft: #fdf1e0;
  --burslu: #0f3b7a;
  --i50: #5b8def;
  --i25: #a9c4f5;
  --ucretli: #c9d3df;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 6px 20px -12px rgba(16, 24, 32, .18);
  --rail: 300px;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); line-height: 1.45;
  font-feature-settings: 'ss01', 'tnum';
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.eyebrow { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ─── Shell ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 18px; height: 56px;
}
.brand .sub { display: none; }
@media (min-width: 1500px) { .brand .sub { display: inline; } }
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand .yr { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--accent); }
.brand .name { font-weight: 600; letter-spacing: .01em; }
.brand .sub { color: var(--muted); font-size: .8rem; }
nav.tabs { display: flex; gap: 2px; margin-left: 10px; height: 100%; }
nav.tabs a {
  display: flex; align-items: center; padding: 0 10px; color: var(--ink-2); font-weight: 500; font-size: .9rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
nav.tabs a:hover { text-decoration: none; color: var(--ink); }
nav.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); }
.user b { color: var(--ink); font-weight: 500; }
.user a { color: var(--muted); }

.page { max-width: 1440px; margin: 0 auto; padding: 26px 22px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h2, .card-h h3 { font-size: 1.05rem; }
.card-b { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ─── Stat tiles ─────────────────────────────────────────── */
.stat { padding: 14px 18px; }
.stat .lbl { font-size: .8rem; color: var(--muted); }
.stat .val { font-family: var(--font-display); font-size: 1.85rem; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: .95rem; color: var(--muted); font-family: var(--font-body); margin-left: 4px; }
.stat .sub { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.delta { font-family: var(--font-mono); font-size: .8rem; padding: 1px 6px; border-radius: 4px; }
.delta.up { color: var(--pos); background: var(--pos-soft); }
.delta.down { color: var(--neg); background: var(--neg-soft); }
.delta.flat { color: var(--muted); background: var(--surface-2); }

/* ─── Sector strip (Tablo 1) ─────────────────────────────── */
.sector { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 0; font-size: .9rem; }
.sector > div { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.sector .hd { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.sector .row-h { font-weight: 500; }
.sector .vak { background: var(--accent-soft); }
.fill-bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.fill-bar > i { display: block; height: 100%; background: var(--accent); }
.fill-bar.home > i { background: var(--home); }

/* ─── Toolbar / controls ─────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.input, .select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0;
}
.input:focus, .select:focus { border-color: var(--accent); }
.select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366727f' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.btn {
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 500; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.sm { height: 28px; padding: 0 10px; font-size: .8rem; }
.btn.ghost { border-color: transparent; }
.btn.danger { color: var(--home); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 34px; font-size: .88rem; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); }
.chip.burslu { background: var(--burslu); color: #fff; border-color: var(--burslu); }
.chip.i50 { background: #dbe7fb; color: #1e4fa8; border-color: #cbdaf6; }
.chip.i25 { background: #eaf1fd; color: #3b6cc4; border-color: #dbe7fb; }
.chip.ucretli { background: #f1f4f8; color: var(--ink-2); }
.chip.home { background: var(--home-soft); color: var(--home); border-color: #f3caca; }
.chip.lisans { background: var(--accent-soft); color: var(--accent); border-color: #d3dff0; }
.chip.onlisans { background: #f0eef9; color: #5b4ba8; border-color: #e0dcf1; }

/* ─── Tables ─────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { padding: 8px 9px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; white-space: nowrap; }
.tbl th { font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface); border-bottom: 1px solid var(--line); }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th.sorted { color: var(--accent); }
.tbl th.sorted::after { content: ' ↓'; }
.tbl th.sorted.asc::after { content: ' ↑'; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.home td { background: var(--home-soft); }
.tbl tr.home td:first-child { box-shadow: inset 3px 0 0 var(--home); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.uni-cell { display: flex; align-items: center; gap: 10px; }
.uni-cell img, .logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line-2); flex: none; }
.uni-cell .nm { font-weight: 500; }
.uni-cell .il { font-size: .75rem; color: var(--muted); }
.mini-bar { display: inline-flex; align-items: center; gap: 8px; }
.mini-bar .fill-bar { width: 70px; }
.rank { font-family: var(--font-mono); color: var(--muted); font-size: .8rem; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line-2); }

/* ─── Overview layout with tray ──────────────────────────── */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); gap: 20px; align-items: start; }
@media (max-width: 1180px) { .with-rail { grid-template-columns: 1fr; } .tray { position: static !important; } }
.tray { position: sticky; top: 76px; }
.tray-list { list-style: none; margin: 0; padding: 0; }
.tray-list li { display: grid; grid-template-columns: 26px 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.tray-list li .slot { font-family: var(--font-display); font-style: italic; color: var(--muted); font-size: 1.05rem; text-align: center; }
.tray-list li.home .slot { color: var(--home); }
.tray-list li.empty-slot { color: var(--muted); font-size: .85rem; }
.tray-list li .nm { font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-list li .rm { border: 0; background: transparent; color: var(--muted); font-size: 1rem; line-height: 1; padding: 4px; }
.tray-list li .rm:hover { color: var(--home); }
.tray-foot { padding: 12px 14px; display: flex; gap: 8px; }
.add-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; width: 26px; height: 26px; font-size: 1rem; line-height: 1; color: var(--accent); }
.add-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.add-btn:disabled { opacity: .35; cursor: default; }

/* ─── Compare view ───────────────────────────────────────── */
.cmp-head { display: grid; gap: 14px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.cmp-uni { padding: 14px 16px; position: relative; }
.cmp-uni.home { border-color: #f0c9c9; box-shadow: inset 0 3px 0 var(--home), var(--shadow); }
.cmp-uni img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; }
.cmp-uni .nm { font-weight: 600; margin-top: 8px; font-size: .95rem; line-height: 1.25; }
.cmp-uni .il { color: var(--muted); font-size: .8rem; }
.cmp-uni .rm { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; }
.cmp-metrics { font-size: .88rem; }
.cmp-metrics th, .cmp-metrics td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); text-align: right; }
.cmp-metrics th { text-align: left; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.cmp-metrics th.grp { background: var(--surface-2); color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding-top: 12px; }
.cmp-metrics td.best { color: var(--pos); font-weight: 600; }
.cmp-metrics td.home { background: var(--home-soft); }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 360px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ─── Program group (bölüm) view ────────────────────────── */
.grp-list { max-height: 70vh; overflow: auto; }
.grp-list button { display: flex; width: 100%; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px 14px; border-bottom: 1px solid var(--line-2); font-size: .88rem; }
.grp-list button:hover { background: var(--surface-2); }
.grp-list button.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.grp-list button small { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }
.fee-scale { display: flex; align-items: center; gap: 8px; }
.fee-scale .fill-bar { width: 90px; }

/* ─── Login ──────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 10% -10%, #dfe8f5 0, transparent 60%),
  radial-gradient(900px 500px at 100% 110%, #f6e2e2 0, transparent 60%), var(--bg); }
.login-card { width: min(440px, 100%); padding: 34px 34px 28px; }
.login-card h1 { font-size: 1.6rem; margin-top: 10px; }
.login-card .lead { color: var(--muted); margin: 8px 0 22px; }
.ms-btn { width: 100%; height: 44px; justify-content: center; font-size: .95rem; }
.ms-btn svg { flex: none; }
.notice { padding: 10px 12px; border-radius: 8px; font-size: .85rem; margin-bottom: 14px; }
.notice.err { background: var(--home-soft); color: var(--home); }
.footnote { font-size: .75rem; color: var(--muted); margin-top: 18px; line-height: 1.5; }

/* ─── Admin ──────────────────────────────────────────────── */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-list .chip button { border: 0; background: transparent; padding: 0; color: var(--muted); font-size: .9rem; line-height: 1; }
.pill-list .chip button:hover { color: var(--home); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }

/* ─── Misc ───────────────────────────────────────────────── */
.src-list { font-size: .8rem; color: var(--muted); line-height: 1.7; }
.loading { padding: 60px; text-align: center; color: var(--muted); font-family: var(--font-display); font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .35s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  nav.tabs { order: 3; width: 100%; overflow-x: auto; margin-left: 0; height: 40px; }
  .page { padding: 16px 12px 60px; }
  .cmp-head { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
}
