:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #5f6b80;
  --border: #dfe4ee;
  --primary: #2453d4;
  --primary-soft: #e8eefc;
  --green: #1e8a4c;
  --green-soft: #e3f5ea;
  --amber: #a86400;
  --amber-soft: #fdf1dc;
  --red: #c0352b;
  --red-soft: #fbe6e4;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151d;
    --surface: #1a202b;
    --text: #e6e9ef;
    --muted: #9aa4b5;
    --border: #2d3544;
    --primary: #6d93ff;
    --primary-soft: #232f4d;
    --green: #5cc98a;
    --green-soft: #1b3326;
    --amber: #f0b45a;
    --amber-soft: #3a2d17;
    --red: #f07a70;
    --red-soft: #3d1f1d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); }

.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

h1 { font-size: 1.6rem; margin: 28px 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); }
.logo span { color: var(--primary); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600;
}
.tab:hover { background: var(--primary-soft); color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 10px; background: rgba(0,0,0,.15); font-size: .8rem;
}

@media (max-width: 520px) {
  .header-inner { gap: 6px; }
  .tabs { gap: 2px; flex-wrap: nowrap; }
  .tab { padding: 6px 8px; font-size: .85rem; white-space: nowrap; }
}

.panel { display: none; padding-bottom: 40px; }
.panel.active { display: block; }

/* Cards & grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }

/* Ders girişi */
.ders-tablo { display: grid; grid-template-columns: 1fr 70px 70px 60px; gap: 6px 10px; align-items: center; }
.ders-tablo .baslik { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ders-tablo .grup { grid-column: 1 / -1; font-size: .85rem; font-weight: 700; color: var(--primary); margin-top: 8px; }
.ders-tablo .net { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

input, select {
  width: 100%; padding: 7px 9px; font: inherit;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text);
}
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a94a6' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input.hata { border-color: var(--red); background: var(--red-soft); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0; font-size: .9rem; }
.check input { width: auto; }

.btn {
  border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600;
  cursor: pointer; background: var(--primary); color: #fff;
}
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }

/* Tablolar */
.tablo-sarici { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.sayi { text-align: right; font-variant-numeric: tabular-nums; }
.sonuc-tablo td:nth-child(2), .sonuc-tablo td:nth-child(3) { font-variant-numeric: tabular-nums; font-weight: 700; }
.uyari { color: var(--amber); font-size: .9rem; margin: 10px 0 0; }

/* Robot */
.filtreler { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.filtreler .geniş { grid-column: span 2; }
@media (max-width: 520px) { .filtreler .geniş { grid-column: auto; } }

.lejant { margin: 14px 0 0; font-size: .85rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.etiket { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.etiket.guvenli { background: var(--green-soft); color: var(--green); }
.etiket.uygun { background: var(--amber-soft); color: var(--amber); }
.etiket.riskli { background: var(--red-soft); color: var(--red); }
.bos { text-align: center; padding: 20px 0; }
.bos:empty, .bos:has(> [hidden]:only-child) { padding: 0; }
.sonuc-sayisi { margin: 12px 0 0; font-size: .9rem; }
.program-tablo th, .program-tablo td { padding-left: 8px; padding-right: 8px; }
.program-tablo td { vertical-align: top; }
.program-tablo thead tr:first-child th { white-space: normal; vertical-align: bottom; }
.program-tablo thead tr:first-child th:nth-child(n+6) { text-align: right; }
.program-tablo td.sayi { min-width: 64px; }
.program-tablo td:first-child { white-space: normal; min-width: 200px; }
.program-tablo td.program-ad { white-space: normal; min-width: 190px; }
.filtreler .check { margin: 0; align-self: center; }
.filtre-satiri th { text-transform: none; letter-spacing: 0; padding-top: 0; font-weight: 400; }
.filtre-satiri input, .filtre-satiri select { font-size: .85rem; padding-top: 5px; padding-bottom: 5px; min-width: 110px; }
.filtre-satiri input { padding-left: 8px; padding-right: 8px; }
.filtre-satiri th:last-child { white-space: normal; }
.filtre-satiri input.dolu, .filtre-satiri select.dolu { border-color: var(--primary); background-color: var(--primary-soft); }

/* Tercih listesi */
.tercih-listesi { list-style: none; padding: 0; margin: 16px 0 0; counter-reset: sira; }
.tercih-listesi li {
  counter-increment: sira;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 8px;
}
.tercih-listesi li::before {
  content: counter(sira);
  font-weight: 800; color: var(--primary); min-width: 24px; text-align: center;
}
.tercih-listesi .bilgi { flex: 1; min-width: 0; }
.tercih-listesi .bilgi strong { display: block; }
.tercih-listesi .bilgi small { color: var(--muted); }
.tercih-listesi .aksiyon { display: flex; gap: 4px; }
.liste-aksiyon { display: flex; gap: 8px; margin-top: 12px; }

.site-footer { border-top: 1px solid var(--border); padding: 18px 0; font-size: .85rem; }

@media print {
  .site-header, .site-footer, .liste-aksiyon, .aksiyon, .panel:not(#liste) { display: none !important; }
  #liste { display: block !important; }
}
