/* ==========================================================================
   Fidan Tur — Transit Yönetim Sistemi, tasarım sistemi
   Düzen: kurumsal yönetim paneli. Solda açılır/daraltılabilir menü, üstte sayfa
   başlığı; Ana Sayfa özet panosu, diğer ekranlar ayrı sayfalar.
   Marka renkleri logodan alınır: yeşil #006035, kırmızı #E21E24.
   Renkler token olarak tanımlıdır; açık tema :root'ta, koyu tema iki blokta.
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-400.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-500.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-600.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-700.woff") format("woff"); }

:root {
  /* Yazı */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --fs-xs: 0.6875rem;   /* 11px — etiketler */
  --fs-sm: 0.75rem;     /* 12px — tablo yardımcı */
  --fs-md: 0.8125rem;   /* 13px — tablo gövdesi */
  --fs-base: 0.875rem;  /* 14px — arayüz */
  --fs-lg: 1rem;
  --fs-xl: 1.375rem;    /* özet rakamları */

  /* Zemin ve yüzeyler (hafif yeşil eğilimli nötrler) */
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #ecf0ee;
  --border: #dfe5e2;
  --border-strong: #c5cfca;
  --text: #15201b;
  --text-2: #44514a;
  --text-3: #66736c;

  /* Marka: logodaki yeşil ve kırmızı */
  --brand-green: #006035;
  --brand-red: #e21e24;
  --accent: #006035;
  --accent-hover: #004a29;
  --accent-soft: #e2f0e8;
  --accent-text: #00552f;
  --on-accent: #ffffff;

  /* Beyan kategorisi (dosya, etiket, özet) */
  --blue: #2350d8;    --blue-soft: #e8edfd;

  /* Anlamsal renkler */
  --ok: #157f4a;      --ok-soft: #e3f4ea;
  --warn: #9a5800;    --warn-soft: #fcf0dc;
  --danger: #c8323a;  --danger-soft: #fcebec;  --danger-hover: #a9262d;  --on-danger: #ffffff;

  /* Kategori renkleri: gümrükçü / gönderici / varış */
  --violet: #6338c9;  --violet-soft: #efe9fc;
  --teal: #0a737a;    --teal-soft: #e0f2f2;
  --amber: #845400;   --amber-soft: #faf0d4;   --amber-line: #e8d39c;

  /* Plaka rozeti */
  --plate-bg: #ffffff;
  --plate-line: #b9c2d0;
  --plate-band: #1f47b8;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 8px rgba(16, 24, 40, .08);
  --focus: 0 0 0 3px rgba(0, 96, 53, .26);
  --scrim: rgba(10, 20, 15, .45);

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --header-h: 64px;
  --nav-w: 260px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b100e;
    --surface: #111815;
    --surface-2: #151d19;
    --surface-3: #1b2520;
    --border: #232f29;
    --border-strong: #34433b;
    --text: #e4ebe7;
    --text-2: #a5b2ab;
    --text-3: #84928a;
    --brand-green: #4cc38a;
    --brand-red: #ff6b6f;
    --accent: #3fb67c;
    --accent-hover: #5bc890;
    --accent-soft: rgba(63, 182, 124, .14);
    --accent-text: #7dd6a6;
    --on-accent: #04130b;
    --blue: #7b9bff;    --blue-soft: rgba(123, 155, 255, .14);
    --ok: #4cc98f;      --ok-soft: rgba(76, 201, 143, .13);
    --warn: #f0a845;    --warn-soft: rgba(240, 168, 69, .13);
    --danger: #ff6f73;  --danger-soft: rgba(255, 111, 115, .13);  --danger-hover: #ff8a8d;  --on-danger: #1a0708;
    --violet: #b8a0ff;  --violet-soft: rgba(184, 160, 255, .14);
    --teal: #55d0cf;    --teal-soft: rgba(85, 208, 207, .12);
    --amber: #f0c65e;   --amber-soft: rgba(240, 198, 94, .12);   --amber-line: rgba(240, 198, 94, .3);
    --plate-bg: #1a2130;
    --plate-line: #3a465c;
    --plate-band: #3b63de;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
    --focus: 0 0 0 3px rgba(63, 182, 124, .38);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b100e;
  --surface: #111815;
  --surface-2: #151d19;
  --surface-3: #1b2520;
  --border: #232f29;
  --border-strong: #34433b;
  --text: #e4ebe7;
  --text-2: #a5b2ab;
  --text-3: #84928a;
  --brand-green: #4cc38a;
  --brand-red: #ff6b6f;
  --accent: #3fb67c;
  --accent-hover: #5bc890;
  --accent-soft: rgba(63, 182, 124, .14);
  --accent-text: #7dd6a6;
  --on-accent: #04130b;
  --blue: #7b9bff;    --blue-soft: rgba(123, 155, 255, .14);
  --ok: #4cc98f;      --ok-soft: rgba(76, 201, 143, .13);
  --warn: #f0a845;    --warn-soft: rgba(240, 168, 69, .13);
  --danger: #ff6f73;  --danger-soft: rgba(255, 111, 115, .13);  --danger-hover: #ff8a8d;  --on-danger: #1a0708;
  --violet: #b8a0ff;  --violet-soft: rgba(184, 160, 255, .14);
  --teal: #55d0cf;    --teal-soft: rgba(85, 208, 207, .12);
  --amber: #f0c65e;   --amber-soft: rgba(240, 198, 94, .12);   --amber-line: rgba(240, 198, 94, .3);
  --plate-bg: #1a2130;
  --plate-line: #3a465c;
  --plate-band: #3b63de;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --focus: 0 0 0 3px rgba(63, 182, 124, .38);
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  font-feature-settings: "cv05", "cv08";
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: var(--accent-soft); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.95em; letter-spacing: -0.01em; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: 12px; top: -40px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--radius-s); }
.skip-link:focus { top: 12px; }

.shell { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md); font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-soft-danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn-soft-danger:hover { background: var(--danger); color: var(--on-danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 28px; padding: 0 9px; font-size: var(--fs-sm); }
.btn .badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--warn); color: var(--surface); font-size: 10.5px; font-weight: 700;
}
.btn .caret { width: .9em; height: .9em; margin-right: -3px; opacity: .7; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius-s);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.kbd {
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1;
  padding: 3px 5px; border-radius: 4px;
  border: 1px solid var(--border-strong); color: var(--text-3); background: var(--surface-2);
}

/* ---------- Uygulama iskeleti: sol menü + içerik ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; z-index: 61;
  height: env(safe-area-inset-top, 0px); background: var(--surface);
}
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow: hidden auto; overscroll-behavior: contain;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--header-h); padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
/* Logo her temada beyaz zemin üzerinde durur (yeşil, koyu zeminde kaybolmasın) */
.brand-logo {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: #ffffff; border: 1px solid var(--border);
}
.brand-logo img { width: 36px; height: 36px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand-text .brand-g { color: var(--brand-green); }
.brand-text .brand-r { color: var(--brand-red); }
.brand-text > span { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; letter-spacing: .01em; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; }
.nav-item {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none;
  color: var(--text-2); font-size: var(--fs-base); font-weight: 500; text-align: left; white-space: nowrap;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--text-3); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item[aria-current="page"] .icon { color: var(--accent); }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-item .count {
  margin-left: auto; min-width: 24px; padding: 1px 7px; border-radius: 10px; text-align: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2);
}
.nav-item[aria-current="page"] .count { background: var(--surface); color: var(--accent-text); }

.nav-group { margin-top: 14px; }
.nav-group-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px 6px; border: 0; background: none; border-radius: 6px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3);
}
.nav-group-btn:hover { color: var(--text); }
.nav-group-btn .icon { width: 14px; height: 14px; transition: transform .15s; }
.nav-group-btn[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group.is-closed .nav-group-items { display: none; }

.sidebar-foot {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}
.collapse-btn { font-size: var(--fs-md); }
.maker { margin: 2px 10px 0; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }

/* Masaüstünde daraltılmış menü: yalnızca simgeler */
@media (min-width: 1025px) {
  .app.nav-collapsed { --nav-w: 72px; }
  .nav-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
  .nav-collapsed .brand-text,
  .nav-collapsed .nav-label,
  .nav-collapsed .nav-item .count,
  .nav-collapsed .maker { display: none; }
  .nav-collapsed .nav-item { justify-content: center; padding: 0; }
  .nav-collapsed .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .nav-collapsed .nav-group-btn { display: none; }
  .nav-collapsed .nav-group.is-closed .nav-group-items { display: flex; }
  .nav-collapsed .collapse-btn .icon { transform: scaleX(-1); }
}

.nav-scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); }

/* Üst başlık */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--header-h);
  padding: 8px var(--gutter-r) 8px var(--gutter-l);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; margin-left: -6px; }
.page-title { flex: 1; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.crumb .icon { width: 12px; height: 12px; }
.page-title h1 { margin: 1px 0 0; font-size: 19px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.save-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--text-3); padding: 0 6px; white-space: nowrap;
}
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-state[data-state="saving"] .dot { background: var(--warn); }
.save-state[data-state="error"] .dot { background: var(--danger); }

/* ---------- Sayfa düzeni ---------- */
.main { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-block: 20px 20px; }
.page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-intro h2 { margin: 0; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.page-intro p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-3); }

.app-foot {
  margin-top: auto; padding-top: 8px;
  display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--text-3);
}
.app-foot strong { color: var(--text-2); font-weight: 600; }

/* Kartlar (ana sayfa) */
.card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 50px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); font-weight: 600; }
.card-head h3 .icon { color: var(--text-3); }
.card-head .btn .icon { width: 14px; height: 14px; margin-right: -3px; }
.card-body { padding: 16px; }
.card-empty { padding: 32px 16px; text-align: center; color: var(--text-3); font-size: var(--fs-md); }
.card-empty .btn { margin-top: 10px; }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid > .span-2 { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
.table-wrap .list-table th { position: static; }
.table-wrap .list-table tbody tr:last-child td { border-bottom: 0; }
.table-wrap .list-table .right { text-align: right; }
.table-wrap .list-table .btn .icon { width: 14px; height: 14px; margin-right: -3px; }

/* İşlem durumu: iki parçalı oran çubukları */
.status-metric + .status-metric { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.status-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.status-top span { font-size: var(--fs-md); font-weight: 600; }
.status-top strong { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.split { display: flex; gap: 2px; height: 10px; }
.split > span { height: 100%; min-width: 0; }
.split > span:first-child { border-radius: 4px 0 0 4px; }
.split > span:last-child { border-radius: 0 4px 4px 0; }
.split > span:only-child { border-radius: 4px; }
/* Çubuk parçaları ve açıklama kutucukları aynı sınıfları kullanır */
.seg-ok { background: var(--ok); }
.seg-warn { background: var(--warn); }
.seg-violet { background: var(--violet); }
.seg-none { background: var(--surface-3); }
.legend .seg-none { background: var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Gümrükçü dağılımı: yatay çubuk listesi */
.bar-list { list-style: none; margin: 0; padding: 8px; }
.bar-row {
  width: 100%;
  display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) 3.5rem; align-items: center; gap: 12px;
  padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left;
  font-size: var(--fs-md); color: var(--text);
}
button.bar-row:hover { background: var(--surface-2); }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar-row.is-other .bar-name { color: var(--text-3); font-weight: 400; }
.bar-track { height: 8px; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--violet); }
.bar-row.is-other .bar-fill { background: var(--border-strong); }
.bar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Kısayollar */
.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.shortcut {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: left;
  transition: border-color .15s, background-color .15s;
}
.shortcut:hover { border-color: var(--accent); background: var(--surface-2); }
.shortcut-ic { width: 38px; height: 38px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.shortcut-body { display: flex; flex-direction: column; min-width: 0; }
.shortcut-body strong { font-weight: 600; font-size: var(--fs-base); }
.shortcut-body span { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Son yüklenen dosyalar */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.recent li:last-child { border-bottom: 0; }
.recent .icon { color: var(--ok); }
.recent .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.recent .meta { display: block; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Yükleme sayfası: yardım kartı */
.help ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.help ol strong { color: var(--text); }
.help p { margin: 0 0 14px; font-size: var(--fs-sm); }

.preview-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-sm);
}
.preview-banner strong { font-weight: 600; }

/* Özet şeridi */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px;
  text-align: left; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  transition: border-color .15s, box-shadow .15s;
}
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.kpi-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.kpi-label .icon { color: var(--kpi-tone, var(--text-3)); }
.kpi-value { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.kpi-meter { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.kpi-meter > span { display: block; height: 100%; width: 0; background: var(--kpi-tone, var(--accent)); border-radius: 2px; transition: width .3s ease; }
.kpi.tone-ok { --kpi-tone: var(--ok); }
.kpi.tone-violet { --kpi-tone: var(--violet); }
.kpi.tone-warn { --kpi-tone: var(--warn); }
.kpi.tone-blue { --kpi-tone: var(--blue); }

/* Excel yükleme alanları */
.intake { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 20px; min-height: 220px;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-l);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop:focus-within { border-color: var(--drop-tone); }
.drop.is-over { border-style: solid; border-color: var(--drop-tone); background: var(--drop-soft); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-icon {
  width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  background: var(--drop-soft); color: var(--drop-tone);
}
.drop-icon .icon { width: 22px; height: 22px; }
.drop-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drop-step { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.drop-title { font-weight: 650; font-size: var(--fs-lg); }
.drop-desc { font-size: var(--fs-md); color: var(--text-2); }
.drop-meta { margin-top: auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.drop-cta { font-size: var(--fs-sm); color: var(--text-3); }
.drop[data-kind="beyan"] { --drop-tone: var(--blue); --drop-soft: var(--blue-soft); }
.drop[data-kind="teminat"] { --drop-tone: var(--ok); --drop-soft: var(--ok-soft); }
.drop[data-kind="rehber"] { --drop-tone: var(--violet); --drop-soft: var(--violet-soft); }
.drop.is-busy .drop-icon .icon { display: none; }
.drop.is-busy .drop-icon::after {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--drop-tone); border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.drop .chip { background: var(--drop-soft); color: var(--drop-tone); }

/* ---------- Çalışma alanı ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  min-width: 0;
}
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
.search {
  position: relative; display: flex; align-items: center;
  width: min(300px, 100%);
}
.search .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 34px; padding: 0 34px 0 32px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface); outline: none;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--accent); box-shadow: var(--focus); }
.search .kbd { position: absolute; right: 8px; }
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none; }

.select {
  height: 34px; padding: 0 28px 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687387' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  appearance: none; font-size: var(--fs-md);
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }

.seg {
  display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 2px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s); background: var(--surface-2);
}
.seg-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); padding: 0 6px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.seg button {
  height: 28px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

.view-meta { font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.view-meta strong { color: var(--text); font-weight: 600; }

/* Açılır menü */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0;
  min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.menu.align-left { left: 0; right: auto; }
.menu-title { display: flex; align-items: center; gap: 6px; padding: 6px 8px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border: 0; border-radius: var(--radius-s); background: none;
  font-size: var(--fs-md); text-align: left; color: var(--text);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); box-shadow: none; }
.menu-item .icon { color: var(--text-3); }
.menu-item .end { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-s); font-size: var(--fs-md); cursor: pointer; }
.menu-check:hover { background: var(--surface-3); }
.menu-check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* Dönem çubuğu (Beyanlar ve Gümrükçüler): Ocak 2026 · Şubat 2026 … */
.donem-bar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
}
.mark-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.donem-bar .label { display: inline-flex; align-items: center; gap: 6px; width: 64px; flex: none; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.donem-chip.is-warn { border-style: dashed; color: var(--warn); }
.mark-cta { margin-left: auto; color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.mark-cta:hover { background: var(--warn-soft); filter: brightness(.97); }
.donem-bar .label .icon { color: var(--accent); }
.donem-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 6px 0 11px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--fs-md); font-weight: 500; color: var(--text); white-space: nowrap;
}
.donem-chip .n { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.donem-chip:hover { border-color: var(--accent); }
.donem-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.donem-chip[aria-pressed="true"] .n { background: rgba(255, 255, 255, .22); color: var(--on-accent); }

/* Tablo düzeni: Gümrükçüler sayfasında solda gümrükçü listesi, sağda tablo */
.table-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.table-layout.has-side { grid-template-columns: 272px minmax(0, 1fr); }
.table-main { min-width: 0; display: flex; flex-direction: column; }

.broker-side {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface-2); border-right: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-l);
}
.donem-bar[hidden] + .table-layout .broker-side { border-top-left-radius: var(--radius-l); }
.broker-side-head { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.broker-side-head .search { width: 100%; }
.broker-side-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--text-3); }
.seg.seg-sm { height: 28px; }
.seg.seg-sm button { height: 22px; padding: 0 8px; font-size: var(--fs-xs); }
.broker-items {
  list-style: none; margin: 0; padding: 6px;
  overflow: auto; overscroll-behavior: contain;
  max-height: calc(100vh - var(--header-h) - 290px); min-height: 220px;
}
.broker-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 8px; border: 0; border-radius: 6px; background: none;
  font-size: var(--fs-md); color: var(--text); text-align: left;
}
.broker-item .icon { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.broker-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.broker-item .n {
  flex: none; min-width: 26px; padding: 1px 7px; border-radius: 10px; text-align: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2);
}
.broker-item:hover { background: var(--surface-3); }
.broker-item.is-all { font-weight: 600; }
.broker-item[aria-pressed="true"] { background: var(--violet); color: var(--surface); font-weight: 600; }
.broker-item[aria-pressed="true"] .icon { color: var(--surface); }
.broker-item[aria-pressed="true"] .n { background: rgba(255, 255, 255, .22); color: var(--surface); }
.broker-empty { padding: 12px 8px; font-size: var(--fs-sm); color: var(--text-3); }

/* Seçim çubuğu */
.selection-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--accent-soft); color: var(--accent-text);
  border-bottom: 1px solid var(--border); font-size: var(--fs-md);
}
.selection-bar strong { font-weight: 700; }

/* ---------- Veri tablosu ---------- */
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - var(--header-h) - 276px);
  min-height: 260px;
  overscroll-behavior: contain;
}
.grid {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  table-layout: fixed;
  font-size: var(--fs-md);
}
.grid th, .grid td { padding: 0 8px; text-align: left; vertical-align: middle; }
.grid thead th {
  position: sticky; z-index: 2;
  background: var(--surface-2);
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.grid thead tr.head-row th { top: 0; height: 42px; border-bottom: 1px solid var(--border); white-space: normal; line-height: 1.15; }
.grid thead tr.filter-row th { top: 42px; height: 38px; border-bottom: 1px solid var(--border); background: var(--surface); }
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { color: var(--text); }
.grid th .th-inner { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.grid th .th-inner span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.grid th .sort-ic { width: 13px; height: 13px; color: var(--text-3); opacity: .45; }
.grid th[aria-sort="ascending"] .sort-ic, .grid th[aria-sort="descending"] .sort-ic { color: var(--accent); opacity: 1; }
.grid th.right .th-inner { justify-content: flex-end; width: 100%; }
.grid th.center .th-inner { justify-content: center; width: 100%; }
.grid th.cat-gonderici { color: var(--teal); }
.grid th.cat-gumrukcu { color: var(--violet); }
.grid th.cat-teminat { color: var(--ok); }
.grid th.cat-varis { color: var(--amber); }

.col-filter {
  width: 100%; height: 28px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface-2); font-size: var(--fs-sm); font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--text);
}
.col-filter::placeholder { color: var(--text-3); }
.col-filter:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.col-filter.has-value { border-color: var(--accent); background: var(--accent-soft); }

.grid tbody td { height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tbody tr.is-selected td { background: var(--accent-soft); }
.grid td.center, .grid th.center { text-align: center; text-overflow: clip; }
.grid td.num { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.grid td.right { text-align: right; }
.grid .check { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.grid .cell-strong { font-weight: 600; }
.grid .cell-muted { color: var(--text-3); }

.mrn { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.mrn .mrn-pre { color: var(--text-3); font-weight: 500; margin-right: 3px; }
.dup-tag {
  display: inline-block; margin-left: 5px; padding: 1px 4px; border-radius: 4px;
  font-family: var(--font-sans); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--warn-soft); color: var(--warn); vertical-align: 1px;
}
.code { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

.status {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-text);
}
.status.neutral { background: var(--surface-3); color: var(--text-2); }

/* Türk plakası görünümü: mavi TR şeridi + numara */
.plate {
  display: inline-flex; align-items: stretch; height: 22px;
  border: 1px solid var(--plate-line); border-radius: 4px; overflow: hidden;
  background: var(--plate-bg); vertical-align: middle; max-width: 100%;
}
.plate-tr {
  display: grid; place-items: center; width: 15px; flex: none;
  background: var(--plate-band); color: #fff;
  font-size: 7.5px; font-weight: 700; letter-spacing: .02em;
}
.plate-no { padding: 0 6px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: -0.02em; line-height: 20px; color: var(--text); overflow: hidden; text-overflow: ellipsis; }

.office {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  background: var(--amber-soft); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber-line);
}

/* Satır içi düzenlenebilir hücreler */
.cell-input {
  width: 100%; height: 28px; padding: 0 8px;
  border: 1px dashed var(--border-strong); border-radius: 5px;
  background: transparent; font-size: var(--fs-md); color: var(--text);
  text-overflow: ellipsis;
  transition: border-color .12s, background-color .12s;
}
.cell-input::placeholder { color: var(--text-3); font-size: var(--fs-sm); }
.cell-input:not(.filled) { border-color: transparent; }
.grid tbody tr:hover .cell-input:not(.filled) { border-color: var(--border-strong); }
.cell-input:hover { border-style: solid; border-color: var(--border-strong); background: var(--surface); }
.cell-input:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.cell-input.filled { border-style: solid; border-color: transparent; font-weight: 600; }
.cell-input.tone-teal.filled { background: var(--teal-soft); color: var(--teal); }
.cell-input.tone-violet.filled { background: var(--violet-soft); color: var(--violet); }
.cell-input.tone-ok.filled { background: var(--ok-soft); color: var(--ok); }
.cell-input.tone-ok { text-align: right; font-variant-numeric: tabular-nums; }
.cell-input.filled:focus { color: var(--text); background: var(--surface); }
.cell-input.is-manual { box-shadow: inset 2px 0 0 var(--warn); }

.row-actions { display: flex; justify-content: center; }

/* Boş durum */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 56px 16px;
  white-space: normal;
}
.empty .empty-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty .empty-ic .icon { width: 24px; height: 24px; }
.empty h3 { margin: 0; font-size: var(--fs-lg); font-weight: 650; text-wrap: balance; }
.empty p { margin: 0; max-width: 52ch; color: var(--text-2); font-size: var(--fs-base); text-wrap: pretty; }
.empty .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.grid tbody td.empty-cell { height: auto; border-bottom: 0; white-space: normal; }
.grid tbody tr.empty-row:hover td { background: transparent; }

/* Sayfalama */
.pager {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-2);
}
.pager-ctrl { display: flex; align-items: center; gap: 4px; }
.pager .select { height: 28px; font-size: var(--fs-sm); }
.pager .page-info { padding: 0 8px; font-variant-numeric: tabular-nums; }

/* ---------- Rehber ve dosyalar ---------- */
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.section-head h2 .icon { color: var(--section-tone, var(--accent)); }
.section-head p { margin: 4px 0 0; color: var(--text-3); font-size: var(--fs-sm); max-width: 70ch; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.rehber-form {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end;
  padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.input {
  height: 34px; padding: 0 10px; width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s); background: var(--surface);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input::placeholder { color: var(--text-3); }

.list-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.list-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.list-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tbody tr:hover td { background: var(--surface-2); }
.list-table tr.is-selected td { background: var(--accent-soft); }
.list-table .num { text-align: right; }
.list-scroll { overflow: auto; max-height: calc(100vh - var(--header-h) - 120px); }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.tag.beyan { background: var(--blue-soft); color: var(--blue); }
.tag.teminat { background: var(--ok-soft); color: var(--ok); }
.tag.rehber { background: var(--violet-soft); color: var(--violet); }
.tag.demo { background: var(--warn-soft); color: var(--warn); }
.txt-teal { color: var(--teal); font-weight: 600; }
.txt-violet { color: var(--violet); font-weight: 600; }
.unmarked-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  background: var(--warn-soft); color: var(--warn); font-size: var(--fs-md); font-weight: 500;
}
.unmarked-banner .btn { margin-left: auto; }
.warn-text { color: var(--warn); font-weight: 600; }
.btn-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.donem-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--text); white-space: nowrap;
}
.donem-btn .icon { width: 14px; height: 14px; color: var(--accent); }
.donem-btn .edit-ic { color: var(--text-3); opacity: 0; transition: opacity .12s; }
.donem-btn:hover { border-color: var(--accent); }
.donem-btn:hover .edit-ic, .donem-btn:focus-visible .edit-ic { opacity: 1; }
.donem-btn.is-empty { color: var(--warn); border-style: dashed; }
.file-name { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.file-name .icon { color: var(--ok); }
.file-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Bildirimler ---------- */
.toasts {
  position: fixed; z-index: 60;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 12px 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--toast-tone, var(--accent));
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  font-size: var(--fs-md);
  animation: toast-in .2s ease-out;
}
.toast .icon { color: var(--toast-tone, var(--accent)); margin-top: 1px; }
.toast.success { --toast-tone: var(--ok); }
.toast.warn { --toast-tone: var(--warn); }
.toast.error { --toast-tone: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Diyalog ---------- */
.dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-l);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-2);
}
.dialog::backdrop { background: var(--scrim); }
.dialog-body { padding: 20px 20px 8px; display: flex; gap: 14px; }
.dialog-ic { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dialog.danger .dialog-ic { background: var(--danger-soft); color: var(--danger); }
.dialog-ic .icon { width: 20px; height: 20px; }
.dialog h2 { margin: 2px 0 6px; font-size: var(--fs-lg); font-weight: 650; text-wrap: balance; }
.dialog p { margin: 0 0 8px; color: var(--text-2); text-wrap: pretty; }
.dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface-2); font-size: var(--fs-md); }
.dialog dt { color: var(--text-3); }
.dialog dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.dialog-content { min-width: 0; flex: 1; }
.dialog .confirm-input { margin-top: 6px; }
.dialog .confirm-input .muted { font-size: var(--fs-sm); }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
/* Firma ve ay işaretleme diyaloğu */
.mark-firma { margin-top: 12px; }
.mark-firma > span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.mark-firma .input { height: 38px; font-size: var(--fs-base); font-weight: 600; }
.firma-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.firma-pick {
  height: 28px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 14px;
  background: var(--surface-2); font-size: var(--fs-sm); font-weight: 500; color: var(--text);
}
.firma-pick:hover { border-color: var(--accent); color: var(--accent-text); }
.donem-pick { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; margin: 12px 0 6px; }
.donem-pick .field > span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.donem-pick .select { width: 100%; height: 38px; font-size: var(--fs-base); font-weight: 600; }
.donem-note { font-size: var(--fs-sm); color: var(--text-3) !important; }

/* ---------- Giriş ekranı ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.login-card {
  width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px;
  padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-2);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login h1 { margin: 6px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.login-sub { margin: -8px 0 2px; color: var(--text-3); font-size: var(--fs-md); }
.login .field label { text-transform: none; letter-spacing: 0; font-size: var(--fs-md); }
.login .input { height: 40px; font-size: var(--fs-base); }
.btn-block { width: 100%; justify-content: center; height: 40px; font-size: var(--fs-base); }
.login-error { margin: 0; padding: 8px 10px; border-radius: var(--radius-s); background: var(--danger-soft); color: var(--danger); font-size: var(--fs-md); }
.login-kvkk { display: flex; gap: 8px; margin: 2px 0 0; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; }
.login-kvkk .icon { margin-top: 1px; }
.app-loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); }
.app-loading[hidden] { display: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }

/* Kullanıcı kutusu (sol menü altı) */
.user-box { display: flex; align-items: center; gap: 8px; padding: 4px 2px 10px 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700;
}
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-text strong { font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text span { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1025px) {
  .nav-collapsed .user-box { flex-direction: column; padding: 4px 0 10px; }
  .nav-collapsed #passwordBtn { display: none; }
}

/* Yetkiye göre gizleme: body'de p-<yetki> sınıfı yoksa ilgili düğmeler görünmez (asıl denetim sunucuda) */
body:not(.p-beyan-yukle) [data-perm="beyan.yukle"],
body:not(.p-beyan-duzenle) [data-perm="beyan.duzenle"],
body:not(.p-beyan-sil) [data-perm="beyan.sil"],
body:not(.p-rehber-duzenle) [data-perm="rehber.duzenle"],
body:not(.p-disari-aktar) [data-perm="disari.aktar"],
body:not(.p-muhasebe-duzenle) [data-perm="muhasebe.duzenle"],
body:not(.demo-ok) [data-act="demo"] { display: none !important; }

.migrate-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius); background: var(--blue-soft); color: var(--blue); font-size: var(--fs-md); font-weight: 500;
}
.migrate-banner .spacer { flex: 1; }

/* ---------- Muhasebe ve yönetim sayfaları ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 130px; }
.filters .field.grow { flex: 1; min-width: 200px; }
.filters .select, .filters .input { width: 100%; }
.filters .actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-table td.money, .list-table th.money { text-align: right; }
.bakiye-borc { font-weight: 700; color: var(--text); }
.bakiye-alacak { font-weight: 700; color: var(--ok); }
.bakiye-sifir { color: var(--text-3); }
.list-table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); border-bottom: 0; }
.list-table tr.devir td { background: var(--surface-2); color: var(--text-2); font-style: italic; }
.list-table tr.clickable { cursor: pointer; }
.list-table td .muted-line { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.list-table .actions-cell { text-align: right; white-space: nowrap; }
.table-wrap.tall { max-height: calc(100vh - var(--header-h) - 260px); overflow: auto; }
.table-wrap.tall .list-table th { position: sticky; top: 0; z-index: 1; }
.money-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.money-card { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); }
.money-card .label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.money-card .value { margin-top: 2px; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.money-card .sub { font-size: var(--fs-xs); color: var(--text-3); }
.tag.tur-beyan { background: var(--blue-soft); color: var(--blue); }
.tag.tur-tahsilat, .tag.tur-alacak { background: var(--ok-soft); color: var(--ok); }
.tag.tur-odeme, .tag.tur-borc { background: var(--warn-soft); color: var(--warn); }
.tag.rol { background: var(--accent-soft); color: var(--accent-text); }
.tag.pasif { background: var(--surface-3); color: var(--text-3); }
.tag.islem { background: var(--surface-3); color: var(--text-2); }
.tag.islem.giris { background: var(--ok-soft); color: var(--ok); }
.tag.islem.uyari { background: var(--danger-soft); color: var(--danger); }
.tag.islem.ziyaret { background: var(--blue-soft); color: var(--blue); }
.perm-count { font-size: var(--fs-sm); color: var(--text-2); }
.loc { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.loc .icon { width: 13px; height: 13px; color: var(--text-3); }
.report-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-s); background: var(--surface-2); }
.report-tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 4px; background: none; font-size: var(--fs-md); color: var(--text-2); font-weight: 500; }
.report-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }
.hareket-form { display: grid; grid-template-columns: 150px 150px 150px minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; font-size: var(--fs-md); }
.cari-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cari-title h2 { margin: 0; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; }

/* Geniş diyalog: kullanıcı ve cari formları */
.dialog.wide { width: min(720px, calc(100vw - 32px)); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .field > span:not(.form-hint) { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.form-grid .input, .form-grid .select { width: 100%; }
.form-hint { font-size: var(--fs-xs); color: var(--text-3); }
.switch-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); cursor: pointer; }
.switch-line input { width: 16px; height: 16px; accent-color: var(--accent); }
.perm-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; max-height: 46vh; overflow: auto; }
.perm-group h4 { margin: 0 0 6px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.perm-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: var(--fs-md); }
.perm-item:hover { border-color: var(--border-strong); }
.perm-item input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.perm-item small { display: block; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.35; }
.check-list { max-height: 40vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-s); padding: 4px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: var(--fs-md); cursor: pointer; }
.check-list label:hover { background: var(--surface-2); }
.check-list input { width: 15px; height: 15px; accent-color: var(--accent); }
.check-list .n { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Duyarlı düzen ---------- */
@media (max-width: 1280px) {
  .save-state span:not(.dot) { display: none; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Dar ekranda gümrükçü listesi tablonun üstüne geçer */
@media (max-width: 1100px) {
  .table-layout.has-side { grid-template-columns: minmax(0, 1fr); }
  .broker-side { border-right: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
  .broker-items { max-height: 240px; min-height: 0; }
}
/* Tablet ve telefon: menü soldan açılan çekmece olur */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: min(290px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: var(--shadow-2);
  }
  .app.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-grid; }
  .collapse-btn { display: none; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intake { grid-template-columns: 1fr; }
  .drop { min-height: 0; }
  .rehber-form { grid-template-columns: 1fr 1fr; }
  .rehber-form .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .hareket-form { grid-template-columns: 1fr 1fr; }
  .hareket-form .grow { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  /* Liste tabloları kart görünümünde: her satır bir kart, her bilginin üstünde başlığı (ui/tablo.js etiketler) */
  .list-table.stack thead { display: none; }
  .list-table.stack, .list-table.stack tbody, .list-table.stack tfoot { display: block; width: 100%; }
  .list-table.stack tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
  }
  .list-table.stack td {
    display: block; min-width: 0; padding: 0; border: 0; background: none;
    text-align: left; white-space: normal; overflow-wrap: anywhere;
  }
  .list-table.stack td.num, .list-table.stack td.money, .list-table.stack td.right { text-align: left; }
  .list-table.stack td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 1px;
    font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
  }
  .list-table.stack td[data-st="title"], .list-table.stack td[data-st="full"] { grid-column: 1 / -1; }
  .list-table.stack td[data-st="title"] { font-size: var(--fs-base); }
  .list-table.stack td[data-st="title"]::before, .list-table.stack td[data-st="actions"]::before { display: none; }
  .list-table.stack td[data-st="hide"] { display: none; }
  .list-table.stack td[data-st="actions"] { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; }
  .list-table.stack tbody tr:hover td { background: none; }
  .list-table.stack tfoot tr, .list-table.stack tr.devir { background: var(--surface-2); }
  .list-table.stack tfoot td { border: 0; }
  .list-table.stack .row-actions { justify-content: flex-end; }

  /* Beyanlar: firma/ay seçicileri tek satır, yana kaydırılır */
  .mark-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -12px; padding-right: 12px; }
  .mark-row::-webkit-scrollbar { display: none; }
  .donem-bar .label { width: auto; }
  .donem-chip, .mark-cta { flex: none; }

  /* Tutar kartları sıkı: başlık solda, tutar sağda */
  .money-cards { gap: 8px; }
  .money-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 10px; padding: 10px 14px; }
  .money-card .value { margin: 0; font-size: var(--fs-lg); }
  .money-card .sub { grid-column: 1 / -1; }

  .form-grid, .perm-grid { grid-template-columns: 1fr; }
  .crumb { display: none; }
  .page-title h1 { font-size: 17px; }
  .kpi { padding: 10px 12px; }
  .kpi-sub { grid-column: 1 / -1; text-align: left; }
  .shortcuts { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr) 3rem; gap: 8px; }
  .search { width: 100%; }
  .toolbar .spacer { display: none; }
  .rehber-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
