:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafb;
  --text: #17212b;
  --muted: #5d6b78;
  --line: #e2e7ec;
  --line-strong: #cfd7de;
  --accent: #0d6e6e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1f0;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --crit: #c0392b;
  --crit-soft: #fbe5e2;
  --ok: #2f7d4f;
  --ok-soft: #e1f2e7;
  --star: #e0a100;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .05);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161b; --panel: #181f26; --panel-2: #1d252d; --text: #e5ebf0; --muted: #94a3b0;
    --line: #29333d; --line-strong: #364350; --accent: #3fb6ad; --accent-ink: #0b1a1a; --accent-soft: #173331;
    --warn: #e6b04a; --warn-soft: #3a2f17; --crit: #ef6b5b; --crit-soft: #3d1e1a; --ok: #5cc486; --ok-soft: #173325;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161b; --panel: #181f26; --panel-2: #1d252d; --text: #e5ebf0; --muted: #94a3b0;
  --line: #29333d; --line-strong: #364350; --accent: #3fb6ad; --accent-ink: #0b1a1a; --accent-soft: #173331;
  --warn: #e6b04a; --warn-soft: #3a2f17; --crit: #ef6b5b; --crit-soft: #3d1e1a; --ok: #5cc486; --ok-soft: #173325;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.gizli { display: none !important; }

/* ---------- Üst bar ---------- */
.ust {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-isaret {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: -.5px;
}
.menu { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.menu a {
  padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.menu a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.menu a.secili { background: var(--accent-soft); color: var(--accent); }
.kim { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.kim b { color: var(--text); font-weight: 600; }

/* ---------- Genel ---------- */
main { max-width: 1600px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.kart { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kart-ic { padding: 16px; }
.soluk { color: var(--muted); }
.kucuk { font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ana { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ana:hover { filter: brightness(1.07); }
.btn.tehlike { color: var(--crit); }
.btn.tehlike:hover { background: var(--crit-soft); }
.btn.ince { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.bos { border-color: transparent; background: transparent; }
.btn.bos:hover { background: var(--panel-2); }

input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent);
}
label.alan { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.alan input, label.alan select, label.alan textarea { font-size: 14px; font-weight: 400; color: var(--text); }

/* ---------- Özet kartları ---------- */
.ozetler { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ozet {
  text-align: left; padding: 12px 14px; cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.ozet:hover { border-color: var(--line-strong); }
.ozet.secili { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ozet .sayi { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ozet .etiket { font-size: 12px; color: var(--muted); font-weight: 600; }
.ozet.uyari .sayi { color: var(--warn); }
.ozet.kritik .sayi { color: var(--crit); }
.ozet.yildiz .sayi { color: var(--star); }

/* ---------- Sekmeler ve filtreler ---------- */
.sekmeler { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sekmeler button {
  border: 0; background: none; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sekmeler button.secili { color: var(--accent); border-bottom-color: var(--accent); }
.filtreler { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filtreler .ara { flex: 1 1 260px; }
.filtreler select { max-width: 200px; }
.filtreler .bosluk { flex: 1; }
.tarih-aralik { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.tarih-aralik input { width: 140px; }
.anahtar { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.etkin-filtreler { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.cip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600;
}
.cip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }

/* ---------- Tablo ---------- */
.tablo-kap { overflow: auto; max-height: calc(100vh - 330px); min-height: 240px; }
table.liste { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.liste th {
  position: sticky; top: 0; z-index: 2; background: var(--panel-2); text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
.liste th.sirali { color: var(--accent); }
.liste td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.liste tbody tr { cursor: pointer; }
.liste tbody tr:hover td { background: var(--panel-2); }
.liste tr.uyari td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.liste tr.kritik td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.liste td.firma { font-weight: 600; white-space: nowrap; }
.liste td.nowrap, .liste th.nowrap { white-space: nowrap; }
.liste td.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; white-space: nowrap; }
.liste td.notlar { min-width: 280px; max-width: 520px; }
.liste .not-satir { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.liste .not-satir + .not-satir { margin-top: 3px; }
.liste .not-etiket { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-right: 4px; }
.liste tr.grup td {
  background: var(--panel-2); font-weight: 700; font-size: 13px; cursor: default; padding-top: 12px; position: sticky; top: 33px; z-index: 1;
}
.yildiz-btn { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--line-strong); padding: 0; }
.yildiz-btn.acik { color: var(--star); }
.guncel { white-space: nowrap; font-size: 12px; }
.nokta { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.uyari .nokta, .nokta.uyari { background: var(--warn); }
.kritik .nokta, .nokta.kritik { background: var(--crit); }
.rozet { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.rozet.aktif { background: var(--accent-soft); color: var(--accent); }
.rozet.bitti { background: var(--ok-soft); color: var(--ok); }
.rozet.iptal { background: var(--crit-soft); color: var(--crit); }
.sayfalama { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.bos-durum { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- Detay ---------- */
.detay-ust { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detay-ust h1 { margin: 0; }
.detay-ust .bosluk { flex: 1; }
.detay { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.form-izgara { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.form-izgara .genis2 { grid-column: span 2; }
.form-izgara .tam { grid-column: 1 / -1; }
.form-alt { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.form-alt .bilgi { flex: 1; color: var(--muted); font-size: 12px; }
.degisti { border-color: var(--warn) !important; background: var(--warn-soft) !important; }
.akis { display: flex; flex-direction: column; gap: 0; }
.akis-oge { padding: 10px 0; border-bottom: 1px solid var(--line); }
.akis-oge:last-child { border-bottom: 0; }
.akis-bas { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.akis-bas b { color: var(--text); }
.akis-metin { white-space: pre-wrap; word-break: break-word; }
.fark { font-size: 12px; margin-top: 2px; }
.fark .eski { color: var(--crit); text-decoration: line-through; word-break: break-word; }
.fark .yeni { color: var(--ok); word-break: break-word; }
.not-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.not-form .btn { align-self: flex-end; }

/* ---------- Giriş ---------- */
.giris-kap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.giris { width: 100%; max-width: 380px; padding: 28px; }
.giris .logo { justify-content: center; margin-bottom: 6px; font-size: 18px; }
.giris p { text-align: center; margin: 0 0 20px; }
.giris form { display: flex; flex-direction: column; gap: 12px; }
.hata { background: var(--crit-soft); color: var(--crit); padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* ---------- Bildirim ---------- */
.bildirim {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow);
  transition: .2s; z-index: 100; max-width: calc(100vw - 32px); pointer-events: none;
}
.bildirim.goster { opacity: 1; transform: translateX(-50%) translateY(0); }
.bildirim.hata-b { background: var(--crit); color: #fff; }

/* ---------- Basit tablolar (kullanıcılar) ---------- */
table.basit { width: 100%; border-collapse: collapse; }
.basit th, .basit td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.basit th { font-size: 12px; color: var(--muted); }
.yan-yana { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }

/* ---------- Duyarlı ---------- */
@media (max-width: 1100px) {
  .detay, .yan-yana { grid-template-columns: 1fr; }
  .ozetler { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  main { padding: 12px 16px; }
  .ust { padding: 0 12px; gap: 8px; }
  .logo span:last-child { display: none; }
  .kim .ad { display: none; }
  .ozetler { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-izgara { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtreler select, .tarih-aralik input { max-width: none; flex: 1 1 140px; }
  .tablo-kap { max-height: none; }
}
@media print {
  .ust, .filtreler, .ozetler, .sekmeler, .sayfalama { display: none !important; }
  .tablo-kap { max-height: none; overflow: visible; }
}
