:root {
  --bg: #f4f6f9; --panel: #fff; --line: #e2e8f0; --line2: #f1f5f9;
  --text: #0f172a; --body: #334155; --mute: #64748b;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --acc: #1d4ed8;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--body); font: 14px/1.45 Inter, system-ui, sans-serif; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.wrap { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.top { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--text); letter-spacing: .02em; }
h1 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand p { margin: 1px 0 0; color: var(--mute); font-size: 13px; }
.meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--mute); }
.upd b { color: var(--body); font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mute); }
.live.on { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.live.on .dot { background: var(--ok); animation: pulse 2s infinite; }
.live.err { color: var(--bad); border-color: #fecaca; background: #fef2f2; }
.live.err .dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } }

main { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; padding-bottom: 40px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.hint { color: var(--mute); font-size: 12px; }
.count { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--line2); color: var(--mute); font-size: 12px; font-weight: 600; }

/* Özet */
.hero { display: grid; grid-template-columns: minmax(200px, 1fr) 3fr; gap: 28px; align-items: center; }
.lbl, .stat .l { color: var(--mute); font-size: 12px; font-weight: 500; }
.big { font-size: 44px; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big-sub { color: var(--mute); font-size: 13px; }
.seg { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line2); gap: 2px; }
.seg i { display: block; height: 100%; transition: width .6s ease; }
.seg.sm { height: 6px; gap: 1px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.stat { padding-left: 12px; border-left: 3px solid var(--c); }
.stat .v { font-size: 24px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Üniteler: ana ünite + alt üniteler */
.units { display: flex; flex-direction: column; gap: 16px; }
.unit { border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.unit-head, .sub { display: flex; flex-direction: column; gap: 8px; width: 100%; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; cursor: pointer; color: inherit; }
.unit-head { padding: 12px 14px; }
.sub { padding: 12px; border-color: var(--line); background: #fff; }
.unit-head:hover, .sub:hover { background: var(--line2); }
.unit-head[aria-pressed="true"], .sub[aria-pressed="true"] { background: #eff6ff; border-color: #bfdbfe; }
.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.unit-head .lbl { display: block; margin-bottom: 2px; }
.unit-n { font-size: 18px; font-weight: 700; color: var(--text); }
.unit-p { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.c { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.subs-lbl { padding: 4px 14px 8px; color: var(--mute); font-size: 12px; font-weight: 500; }
.subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; padding: 0 8px 8px; }
.sub .name { font-size: 13px; font-weight: 600; color: var(--text); }
.sub .p { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
#detay { scroll-margin-top: 84px; }

/* Tablo araçları */
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#q { width: 280px; max-width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; outline: none; }
#q:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--line2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--body); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: #cbd5e1; }
.chip .k { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.chip[aria-pressed="true"] .k { color: rgba(255, 255, 255, .8); }
.sec-clear { padding: 6px 12px; border-radius: 999px; border: 1px solid #bfdbfe; background: #eff6ff; color: var(--acc); font-size: 13px; font-weight: 500; cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mono { font-family: "JetBrains Mono", monospace; font-weight: 600; color: var(--text); }
.flag { color: var(--warn); font-weight: 600; }
.tabulator-row.tabulator-group .gh { color: var(--mute); font-weight: 500; margin-left: 10px; font-size: 12px; }

/* Tabulator uyarlaması */
.tabulator { border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; font-family: inherit; }
.tabulator .tabulator-header { background: #f8fafc; border-bottom: 1px solid var(--line); color: var(--mute); font-weight: 600; }
.tabulator .tabulator-header .tabulator-col { background: transparent; border-right: none; }
.tabulator .tabulator-tableholder .tabulator-table { background: #fff; color: var(--body); }
.tabulator-row { border-bottom: 1px solid var(--line2); }
.tabulator-row.tabulator-row-even { background: #fff; }
.tabulator-row.tabulator-selectable:hover { background: #f8fafc; }
.tabulator-row .tabulator-cell { border-right: none; padding: 10px 12px; }
.tabulator-row.tabulator-group { background: #f8fafc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); padding: 9px 12px; font-weight: 600; }
.tabulator-row.tabulator-group:hover { background: #f1f5f9; }
.tabulator .tabulator-placeholder .tabulator-placeholder-contents { color: var(--mute); font-size: 14px; font-weight: 500; }

@media (max-width: 960px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .hero { grid-template-columns: 1fr; }
  .hero { gap: 16px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tools, #q { width: 100%; }
  #q { flex: 1; }
}

/* Dil seçimi */
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { padding: 5px 10px; border: 0; background: #fff; color: var(--mute); font-size: 12px; font-weight: 600; cursor: pointer; }
.lang button + button { border-left: 1px solid var(--line); }
.lang button[aria-pressed="true"] { background: var(--text); color: #fff; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #1e293b; }
.foot { padding-bottom: 28px; color: var(--mute); font-size: 12px; text-align: center; }

/* PDF rapor: yazdırırken sadece #print görünür */
#print { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #0f172a; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print h1 { font-size: 20px; }
  #print h2 { font-size: 14px; margin: 18px 0 6px; }
  #print h2 small { font-weight: 500; color: var(--mute); font-size: 11px; }
  #print .pm { margin: 2px 0 12px; color: var(--mute); }
  #print .pk { display: flex; gap: 10px; }
  #print .pk div { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
  #print .pk span { display: block; color: var(--mute); font-size: 10px; }
  #print .pk b { font-size: 18px; }
  #print table { width: 100%; border-collapse: collapse; }
  #print thead td { font-weight: 600; color: var(--mute); background: #f8fafc; }
  #print td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
  #print tr.main td { background: #f1f5f9; }
  #print tr { break-inside: avoid; }
  #print thead { display: table-header-group; }
}
