/* Tezkasa · by Teknoçözüm — ortak tasarım sistemi */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e9eef6;
  --border: #e2e8f0;
  --border-strong: #cfd8e5;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --brand: #2f5bea;
  --brand-hover: #2449c7;
  --brand-2: #7c3aed;
  --brand-soft: #e9efff;
  --brand-text: #2449c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info-soft: #e0f2fe;
  /* Dolgu renkleri yazı renklerinden ayrı (R-240): beyaz yazılı düğme/kart her iki modda da okunur (≥4,5:1).
     --brand / --bad yalnız yazı, odak halkası ve grafik çizgisi içindir. */
  --on-fill: #ffffff;
  --brand-fill: #2f5bea;
  --brand-fill-hover: #2449c7;
  --bad-fill: #dc2626;
  --bad-fill-hover: #b91c1c;
  /* Marka gradyanı her iki modda sabit */
  --grad-a: #2f5bea;
  --grad-b: #7c3aed;
  --brand-gradient: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  --c1: #3b6cf6; --c2: #10b981; --c3: #f59e0b; --c4: #8b5cf6; --c5: #ef4444; --c6: #06b6d4; --c7: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --sidebar-w: 252px;
  --topbar-h: 60px;
  /* Telefon çentiği / Dynamic Island / gezinme çubuğu boşlukları (viewport-fit=cover ile dolar; masaüstünde 0) */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #17213a;
    --surface-3: #1e2a46;
    --border: #22304d;
    --border-strong: #2f3f61;
    --text: #e6ebf5;
    --text-2: #c3cde0;
    --muted: #8b9ab5;
    --brand: #5b82ff;
    --brand-hover: #7596ff;
    --brand-soft: #1b2a55;
    --brand-text: #9db5ff;
    --brand-2: #a78bfa;
    /* Dolgular açık moddakiyle aynı koyu tonda kalır; açık mavi (#5b82ff) yalnız odak ve grafik çizgisinde */
    --brand-fill: #2f5bea;
    --brand-fill-hover: #2449c7;
    --bad-fill: #dc2626;
    --bad-fill-hover: #b91c1c;
    --ok: #4ade80;
    --ok-soft: #0f3324;
    --bad: #f87171;
    --bad-soft: #3d1618;
    --warn: #fbbf24;
    --warn-soft: #3a2a0b;
    --info-soft: #0c2a3f;
    --c1: #5b82ff; --c2: #34d399; --c3: #fbbf24; --c4: #a78bfa; --c5: #f87171; --c6: #22d3ee; --c7: #64748b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num, .r { text-align: right; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sp { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.two, .grid.three, .grid.wide-left { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Butonlar ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550; font-size: 13.5px; line-height: 1;
  padding: 9px 14px; min-height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
button.primary:hover, .btn.primary:hover { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); }
button.danger { color: var(--bad); }
button.danger.solid { background: var(--bad-fill); border-color: var(--bad-fill); color: var(--on-fill); }
button.danger.solid:hover { background: var(--bad-fill-hover); border-color: var(--bad-fill-hover); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); }
button.sm, .btn.sm { padding: 6px 10px; min-height: 30px; font-size: 12.5px; }
button.icon { padding: 0; width: 36px; min-height: 36px; }
button.icon.sm { width: 30px; min-height: 30px; }
button svg, .btn svg { width: 16px; height: 16px; flex: none; }
button.busy { pointer-events: none; opacity: .75; }
button.busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- Formlar ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; cursor: pointer; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  padding: 8px 11px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--brand); flex: none; }
input[type=date] { min-width: 0; }
textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field-row label { margin-top: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.search { position: relative; min-width: 200px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-weight: 550; color: var(--text);
}
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }

/* ---------- Uygulama iskeleti ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 40;
  padding: calc(16px + var(--sat)) 12px calc(16px + var(--sab)) calc(12px + var(--sal));
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand b { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 550; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand-text); }
.nav a.active svg { color: var(--brand-text); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-gradient); color: var(--on-fill); font-weight: 700; font-size: 13px;
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { font-size: 11.5px; color: var(--muted); }
.made-by { font-size: 11px; color: var(--muted); padding: 6px 8px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar-h) + var(--sat)); box-sizing: border-box;
  display: flex; align-items: center; gap: 12px; padding: var(--sat) calc(24px + var(--sar)) 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn { display: none; }
.topbar select { width: auto; max-width: 260px; min-height: 36px; font-weight: 550; }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tabbar { display: none; }
.scrim { display: none; }

@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 35; }
  .topbar { padding: var(--sat) calc(12px + var(--sar)) 0 calc(12px + var(--sal)); gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar h1 { font-size: 16px; }
  .topbar select { max-width: 42vw; }
  .topbar .hide-sm { display: none; }
  .topbar .show-sm { display: inline; }
  .content { padding: 14px calc(12px + var(--sar)) calc(84px + var(--sab)) calc(12px + var(--sal)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding: 4px calc(4px + var(--sar)) calc(4px + var(--sab)) calc(4px + var(--sal));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; min-height: 0;
    border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none; border-radius: 8px;
  }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--brand-text); }
  .page-head h2 { font-size: 18px; }
}

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; min-width: 0; }
.card.flush { padding: 0; }
.card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card.flush .card-h { padding: 16px 18px 0; }
.card-h h2 { margin-right: auto; }
.card-h .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-left: 4px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.note {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--info-soft); color: var(--text-2); font-size: 12.5px;
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note.warn { background: var(--warn-soft); }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { position: relative; overflow: hidden; }
.kpi .l { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .l i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font-style: normal; }
.kpi .l i svg { width: 16px; height: 16px; }
.kpi .v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: var(--brand-gradient); border-color: transparent; color: var(--on-fill); }
.kpi.accent .l, .kpi.accent .s { color: rgba(255, 255, 255, .92); }
.kpi.accent .l i { background: rgba(255, 255, 255, .18); color: #fff; }
@media (max-width: 768px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 19px; }
  .kpis .kpi.accent:first-child { grid-column: 1 / -1; }
}

/* ---------- Rozetler ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--brand-soft); color: var(--brand-text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c7); flex: none; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
.dot.off { background: var(--c7); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
/* Yalnız dar ekranda görünen kısa metin (üst çubukta .hide-sm'nin yerine) */
.show-sm { display: none; }

/* ---------- Tablolar ---------- */
.table-wrap { overflow: auto; max-height: 560px; border-top: 1px solid var(--border); }
.card:not(.flush) .table-wrap { margin: 0 -18px -18px; border-radius: 0 0 var(--radius) var(--radius); }
.table-wrap.tall { max-height: 70vh; }
.table-wrap.free { max-height: none; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: "↕"; opacity: .35; margin-left: 4px; font-size: 10px; }
th.sorted-asc::after { content: "↑"; opacity: 1; }
th.sorted-desc::after { content: "↓"; opacity: 1; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
tr.click { cursor: pointer; }
tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: 0; }
td.wcol { min-width: 200px; }
@media (max-width: 768px) { td.wcol { min-width: 160px; } }
td .sub { display: block; font-size: 12px; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
tr.dim td { color: var(--muted); }
tr.detail > td { background: var(--surface-2); padding-top: 4px; padding-bottom: 12px; }
tr.detail table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
tr.detail table td, tr.detail table th { padding: 6px 10px; }
tr.detail thead th { position: static; }
.caret { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; transition: transform .15s; color: var(--muted); }
.caret svg { width: 14px; height: 14px; }
tr.open .caret { transform: rotate(90deg); color: var(--brand-text); }
.share-bar { display: inline-block; width: 60px; height: 6px; background: var(--surface-3); border-radius: 3px; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.share-bar i { display: block; height: 100%; background: var(--c1); border-radius: 3px; }

/* ---------- Boş durum / yükleniyor ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 8px; }
.empty b { display: block; color: var(--text-2); font-size: 14.5px; margin-bottom: 4px; }
.empty p { margin: 0 auto; max-width: 380px; font-size: 13px; }
.empty .row { justify-content: center; margin-top: 14px; }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.skel-line { height: 12px; margin: 10px 0; }
.skel-block { height: 180px; }
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; vertical-align: middle; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Sekmeler / çipler ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; border-radius: 0; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { color: var(--brand-text); border-bottom-color: var(--brand); }
@media (max-width: 768px) {
  /* dar ekranda sekmeler gizlenmesin: alt satıra kayar */
  .tabs { flex-wrap: wrap; overflow: visible; gap: 4px; border-bottom: 0; }
  .tabs button { padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; margin: 0; font-size: 12.5px; background: var(--surface); }
  .tabs button.active { background: var(--brand-soft); border-color: var(--brand); }
}
.content, .stack > *, #repBody { min-width: 0; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; min-height: 30px; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.seg button:hover { background: none; color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .dates { display: flex; gap: 6px; align-items: center; }
.toolbar .dates input { width: 150px; }
@media (max-width: 768px) {
  .toolbar .dates { width: 100%; }
  .toolbar .dates input { flex: 1; width: auto; }
  .search { min-width: 0; flex: 1; }
  /* Satır içi "flex:1" verilmiş aramalar da (Cari) dar ekranda tam satır olsun; yer tutucu metin kesilmesin */
  .toolbar .search { flex: 1 1 100% !important; max-width: none !important; }
  .toolbar .search input { width: 100%; text-overflow: ellipsis; }
}

/* ---------- Grafikler ---------- */
.chart { position: relative; width: 100%; min-height: 60px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .axis { stroke: var(--border-strong); }
.chart .bar { fill: var(--c1); transition: opacity .15s; }
.chart .bar.alt { fill: var(--c2); }
.chart .bar-bg { fill: var(--surface-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart g.col:hover .bar { opacity: .8; }
.chart g.col:hover .hit { fill: color-mix(in srgb, var(--brand) 6%, transparent); }
.chart .lbl { fill: var(--text-2); font-size: 12.5px; }
.chart .val { fill: var(--text); font-weight: 650; font-size: 12px; }
.chart .donut-total { fill: var(--text); font-size: 17px; font-weight: 700; }
.chart .donut-sub { fill: var(--muted); font-size: 11px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; transform: translate(-50%, calc(-100% - 10px));
  background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.4; padding: 6px 10px; border-radius: 7px;
  white-space: nowrap; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s;
}
.chart-tip.show { opacity: 1; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap .chart { width: 190px; flex: none; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; }
.legend li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.legend li:last-child { border-bottom: 0; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend span { flex: 1; }
.legend b { font-variant-numeric: tabular-nums; }
.legend em { font-style: normal; color: var(--muted); font-size: 12px; width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Canlı akış ---------- */
.feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); cursor: pointer; }
.feed li:hover { background: var(--surface-2); }
.feed .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.feed .ic svg { width: 17px; height: 17px; }
.feed .mid { flex: 1; min-width: 0; }
.feed .mid b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .mid span { font-size: 12px; color: var(--muted); }
.feed li.empty-li { display: block; cursor: default; padding: 0; }
.feed li.empty-li:hover { background: none; }
.feed .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flash { animation: flash 2.6s ease; }
.flash .ic { background: var(--ok-soft); color: var(--ok); }
@keyframes flash { 0% { background: color-mix(in srgb, #22c55e 28%, transparent); } 100% { background: transparent; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 2px; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ---------- Diyaloglar ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(2, 6, 23, .5); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .16s ease; }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog form, dialog .dlg { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg-h h3 { margin-right: auto; font-size: 16px; }
.dlg-b { padding: 6px 20px 18px; overflow: auto; }
.dlg-b > label:first-child, .dlg-b > .field-row:first-child { margin-top: 12px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); border-radius: 0; border-width: 0 0 0 1px; animation: slidein .2s ease; }
dialog.drawer .dlg { height: 100%; max-height: 100vh; }
dialog.drawer .dlg-b { flex: 1; }
dialog.drawer .dlg-f { border-radius: 0; padding-bottom: calc(14px + var(--sab)); }
dialog.drawer .dlg-h { padding-top: calc(16px + var(--sat)); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 768px) {
  dialog:not(.drawer) { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; max-height: 92vh; }
  dialog:not(.drawer) .dlg-f { border-radius: 0; padding-bottom: calc(14px + var(--sab)); }
  dialog:not(.drawer) { max-height: calc(92vh - var(--sat)); }
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }
.code { font: 700 26px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .14em; text-align: center; padding: 16px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); margin: 12px 0; user-select: all; }
.total-box { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-weight: 650; }
.total-box b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- Bildirimler ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; max-width: min(420px, calc(100vw - 32px));
  background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; pointer-events: auto; animation: toastin .2s ease;
}
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--c7); margin-top: 6px; flex: none; }
.toast.ok i { background: #22c55e; } .toast.bad i { background: #ef4444; } .toast.warn i { background: #f59e0b; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 768px) { .toasts { left: 12px; right: 12px; bottom: calc(76px + var(--sab)); align-items: stretch; } .toast { max-width: none; } }

/* ---------- Otomatik tamamlama ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; max-height: 280px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px;
  min-width: 260px;
}
.ac-list div { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.ac-list div:hover, .ac-list div.hl { background: var(--brand-soft); }
.ac-list div small { display: block; color: var(--muted); font-size: 11.5px; }
.ac-list .ac-empty { color: var(--muted); cursor: default; }
.ac-list .ac-empty:hover { background: none; }

/* ---------- Alış satırları ---------- */
.lines-editor td { padding: 6px 6px; vertical-align: top; }
.lines-editor td:first-child { padding-left: 12px; }
.lines-editor input, .lines-editor select { min-height: 34px; padding: 6px 8px; font-size: 13.5px; }
.lines-editor input.num { text-align: right; }
.lines-editor select { min-width: 78px; padding-right: 4px; }
.lines-editor input.mono { min-width: 120px; }
.lines-editor .lt { padding-top: 13px; font-weight: 650; }
@media (max-width: 768px) {
  .lines-editor thead { display: none; }
  .lines-editor, .lines-editor tbody, .lines-editor tr, .lines-editor td { display: block; width: 100%; }
  .lines-editor tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
  .lines-editor td { padding: 0 !important; border: 0; }
  .lines-editor td.c-name { grid-column: 1 / -1; }
  .lines-editor td.lt { padding-top: 8px !important; }
  .lines-editor td::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
}

/* ---------- Giriş ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .14), transparent 40%), linear-gradient(135deg, #1e3fb8 0%, #2f5bea 45%, #7c3aed 100%);
}
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .07); }
.login-art h2 { font-size: 34px; line-height: 1.15; max-width: 460px; letter-spacing: -.03em; }
.login-art p { opacity: .92; max-width: 440px; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.login-art li { display: flex; gap: 10px; align-items: center; opacity: .92; }
.login-art li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 12px; }
.login-side { display: grid; place-items: center; padding: calc(32px + var(--sat)) calc(20px + var(--sar)) calc(32px + var(--sab)) calc(20px + var(--sal)); }
.login-box { width: min(380px, 100%); }
.login-box .brand { padding: 0 0 26px; }
.login-box .brand svg { width: 46px; height: 46px; }
.login-box .brand b { font-size: 24px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box button.primary { width: 100%; min-height: 44px; margin-top: 18px; font-size: 15px; }
.login-err { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; font-size: 13px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- Ekstre / yazdırma ---------- */
.print-head { display: none; }
.party-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.party-head .bal { margin-left: auto; text-align: right; }
.party-head .bal b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- Üst uyarı şeritleri (lisans, destek görünümü) ---------- */
.banners:empty { display: none; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 24px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border); background: var(--info-soft); color: var(--text);
}
.banner svg { width: 17px; height: 17px; flex: none; }
.banner span { flex: 1; min-width: 200px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--brand-soft); color: var(--brand-text); }
@media (max-width: 768px) { .banner { padding: 9px calc(12px + var(--sar)) 9px calc(12px + var(--sal)); font-size: 12.5px; } .banner span { min-width: 0; } }

/* ---------- Kasa kartları ---------- */
.store-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.store-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; }
.store-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.store-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.store-card.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.store-card.alert { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
.sc-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sc-head b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-head .sub { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-head > div { min-width: 0; flex: 1; }
.sc-today { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sc-today b { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sc-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; margin: 0; font-size: 12.5px; }
.sc-kv dt { color: var(--muted); }
.sc-kv dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.sc-kv dd.neg, td.neg, .neg-text { color: var(--bad); font-weight: 650; }
.warn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.warn-list li { display: flex; align-items: flex-start; gap: 6px; color: var(--bad); font-size: 12.5px; font-weight: 600; }
.warn-list li svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
tr.warn-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.err-text { color: var(--bad); font-size: 12px; overflow-wrap: anywhere; background: var(--bad-soft); border-radius: var(--radius-sm); padding: 6px 9px; }

/* ---------- İşaret listesi (kasa erişimi) ---------- */
.check-list { display: grid; gap: 2px; max-height: 230px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; margin-top: 6px; }
.check-list label.inline { margin: 0; padding: 6px 8px; border-radius: 6px; }
.check-list label.inline:hover { background: var(--surface-2); }

/* ---------- Fatura ---------- */
.cust-chip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.cust-chip > div:not(.avatar) { flex: 1; min-width: 160px; }
.vat-break { margin: 0; padding: 0; list-style: none; font-size: 13px; min-width: 240px; }
.vat-break li { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.inv-foot { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 768px) { .inv-foot { justify-content: stretch; } .inv-foot > * { width: 100%; } }
.lines-editor select.unit { min-width: 64px; }

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --text: #000; --muted: #555; --border: #ccc; color-scheme: light; }
  body { background: #fff; font-size: 11px; }
  .sidebar, .topbar, .tabbar, .toasts, .no-print, .scrim, button { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .table-wrap { max-height: none !important; overflow: visible !important; margin: 0 !important; }
  thead th { position: static; background: #eee !important; color: #000; }
  tfoot td { position: static; }
  tr { break-inside: avoid; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
  .print-head b { font-size: 16px; }
  tr.detail > td { background: #fff; }
  .caret { display: none; }
}

/* ---------- Giriş: yasal onay ve bağlantılar ---------- */
.login-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 10px; font-size: 12px; }
.login-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.login-legal a:hover { color: var(--brand-text); }
.terms-check { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0 0; font-size: 12.5px; font-weight: 500; color: var(--text-2); line-height: 1.45; cursor: pointer; }
.terms-check input { width: 18px; height: 18px; min-height: 0; flex: none; margin: 1px 0 0; accent-color: var(--brand); }
.terms-check a { color: var(--brand-text); }

/* ---------- Yasal metin sayfaları (gizlilik, KVKK, kullanım koşulları) ---------- */
.legal-page { min-height: 100vh; padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(40px + var(--sab)) calc(16px + var(--sal)); }
.legal-wrap { max-width: 860px; margin: 0 auto; }
.legal-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.legal-top .brand { padding: 0; margin-right: auto; text-decoration: none; color: var(--text); }
.legal-top .brand svg, .legal-top .brand img { width: 34px; height: 34px; flex: none; }
.legal-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.legal-nav a { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.legal-nav a[aria-current="page"] { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.legal { padding: 28px 32px; line-height: 1.65; color: var(--text-2); }
.legal h1 { font-size: 26px; letter-spacing: -.02em; color: var(--text); margin: 0 0 4px; }
.legal .meta { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.legal h2 { font-size: 17px; color: var(--text); margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid var(--border); }
.legal h3 { font-size: 15px; color: var(--text); margin: 18px 0 6px; }
.legal p, .legal li { font-size: 14.5px; }
.legal ul, .legal ol { padding-left: 22px; margin: 6px 0 12px; }
.legal li { margin: 4px 0; }
.legal table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13.5px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 9px 10px; border: 1px solid var(--border); }
.legal th { background: var(--surface-2); color: var(--text); font-weight: 650; }
.legal .ph { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 0 4px; font-weight: 600; }
.legal .note { background: var(--brand-soft); color: var(--brand-text); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.legal-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.legal-foot a { color: var(--muted); }
@media (max-width: 768px) {
  .legal { padding: 18px 16px; }
  .legal h1 { font-size: 21px; }
  .legal-table-wrap { overflow-x: auto; }
}
@media print { .legal-top .legal-nav, .legal-foot { display: none; } .legal { border: 0; box-shadow: none; padding: 0; } }
