:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0b5cad;
  --primary-hover: #094a8b;
  --primary-soft: #e6f0fa;
  --danger: #c0262d;
  --danger-soft: #fdecec;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --info: #0369a1;
  --info-soft: #e5f3fb;
  --gray-soft: #eef1f5;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c232c;
    --border: #2a323d;
    --text: #e6edf3;
    --muted: #8b98a8;
    --primary: #4c9be8;
    --primary-hover: #6aaef0;
    --primary-soft: #16283b;
    --danger: #f06c6c;
    --danger-soft: #3a1a1c;
    --ok: #4cc27a;
    --ok-soft: #13301f;
    --warn: #e9a23b;
    --warn-soft: #362610;
    --info: #52b4ea;
    --info-soft: #102c3d;
    --gray-soft: #232b35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a {
  padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500;
}
.topnav a.active, .topnav a:hover { background: var(--primary-soft); color: var(--primary); }
.spacer { flex: 1; }
.user-chip { color: var(--muted); font-size: 13px; }
.user-chip strong { color: var(--text); }

/* ---------- Layout ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.stats .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 16px 20px; }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .grow { flex: 1 1 220px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-hover); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--gray-soft); }
button.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; }
.stat .num { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- Table ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { min-width: 220px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td .sub { color: var(--muted); font-size: 12px; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-pending, .b-booked, .b-at_origin { background: var(--gray-soft); color: var(--muted); }
.b-in_transit { background: var(--info-soft); color: var(--info); }
.b-arrived { background: var(--warn-soft); color: var(--warn); }
.b-delivered { background: var(--ok-soft); color: var(--ok); }
.b-not_found, .b-error { background: var(--danger-soft); color: var(--danger); }
.carrier { font-weight: 700; font-size: 12px; }

.spinner {
  width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, .2);
}
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h3 { margin: 0; font-size: 18px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0 0 20px; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 1px; }
.kv dd { margin: 0; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 24px 0 10px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--primary-soft);
}
.timeline li.planned .dot { background: var(--surface); border: 2px dashed var(--muted); }
.timeline li.planned .ev-desc { color: var(--muted); }
.timeline li.current .dot { background: var(--ok); border-color: var(--ok-soft); }
.ev-desc { font-weight: 600; }
.ev-meta { color: var(--muted); font-size: 12px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 0 12px; min-height: 44px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; }
.login-card h1 { margin: 16px 0 4px; font-size: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.remember-row { min-height: 0; color: var(--text); font-weight: 500; }
.login-card button { justify-content: center; min-height: 40px; }

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog.wide { width: min(520px, calc(100vw - 32px)); }
.code-input { font-size: 20px; letter-spacing: .35em; text-align: center; }
.qr { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 6px; }
.setup-steps { margin: 4px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.setup-steps li::marker { color: var(--muted); font-weight: 700; }
.recovery { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.7; margin: 0; }
dialog h3 { margin: 0 0 4px; }
dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

/* ---------- Stat kartları (tıklanabilir filtre) ---------- */
button.stat { display: block; text-align: left; min-height: 0; font-weight: 400; cursor: pointer; }
button.stat:hover { background: var(--surface-2); }
button.stat.active { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---------- Segment (Liste / Harita) ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; padding: 2px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; min-height: 30px; padding: 0 12px; border-radius: 7px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

textarea { width: 100%; resize: vertical; min-height: 110px; line-height: 1.45; }
.bulk-errors { margin: 10px 0 0; padding-left: 20px; color: var(--danger); font-size: 13px; }

/* ---------- Toplu işlem çubuğu ---------- */
.bulk-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
  background: var(--primary-soft); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 5;
}
.col-check { width: 36px; padding-right: 0; }
.col-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); cursor: pointer; }
tbody tr.selected { background: var(--primary-soft); }
td .err { color: var(--danger); }

.link-cell { all: unset; cursor: pointer; display: block; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.link-cell:hover { background: var(--primary-soft); }
.link-cell:focus-visible { outline: 2px solid var(--primary); }
.sub.link { color: var(--primary); font-weight: 600; }
button.link { all: unset; cursor: pointer; color: var(--primary); font-weight: 600; font-family: ui-monospace, Consolas, monospace; }
button.link:hover { text-decoration: underline; }
.text-warn { color: var(--warn); }

/* ---------- Popover (kilometre taşları) ---------- */
.popover {
  position: fixed; z-index: 70; width: 340px; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22); padding: 14px 16px 16px;
}
.popover.sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 75vh;
  border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.popover-close { position: absolute; top: 6px; right: 6px; }
.popover-title { font-weight: 700; margin-bottom: 2px; padding-right: 30px; }

.milestones { list-style: none; margin: 10px 0 12px; padding: 0; }
.milestones li { position: relative; padding: 0 0 12px 22px; }
.milestones li::before { content: ""; position: absolute; left: 4px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.milestones li:last-child::before { display: none; }
.milestones li::after { content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.milestones li.planned::after { background: var(--surface); border: 2px dashed var(--muted); width: 6px; height: 6px; }
.ms-title { font-weight: 600; }
.ms-date { font-variant-numeric: tabular-nums; }
.milestones li.planned .ms-title, .milestones li.planned .ms-date { color: var(--muted); }
.ms-meta { color: var(--muted); font-size: 12px; }

/* ---------- Detay paneli ekleri ---------- */
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .brand-input { flex: 0 1 130px; text-transform: uppercase; }
body.no-scroll { overflow: hidden; }
table.mini th, table.mini td { padding: 6px 8px; font-size: 12px; }

.cmp-table th[scope=row] { background: transparent; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--muted); white-space: nowrap; position: static; }
.cmp-table td { font-size: 13px; }
.cmp { font-size: 12px; font-weight: 600; }
.cmp.ok { color: var(--ok); }
.cmp.warn { color: var(--warn); }
.cmp.unknown { color: var(--muted); font-weight: 500; }

/* ---------- Harita ---------- */
.map { width: 100%; background: var(--surface-2); border-top: 1px solid var(--border); }
.map-small { height: 280px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 10px; }
.map-large { height: min(70vh, 640px); border-radius: 0 0 var(--radius) var(--radius); }
.map-info { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ship-icon { background: none; border: 0; }
.ship-marker svg { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); transform-origin: 50% 50%; }
.ship-marker path { fill: var(--primary); stroke: #fff; stroke-width: 1.5; }
.ship-marker.stale path { fill: var(--muted); }
.map-popup { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.map-ship-list { list-style: none; padding: 0; margin: 4px 0 0; max-height: 180px; overflow-y: auto; }
.map-ship-list li { padding: 4px 0; border-top: 1px solid var(--border); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-container { font: inherit; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
}

/* ---------- Sayfa başlığı, etiket, özet ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.page-head p { margin: 2px 0 0; }
.page-head > div { flex: 1; min-width: 0; }
.chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; vertical-align: 2px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary);
}
.ref-title { font-weight: 700; font-size: 14px; white-space: nowrap; }
.col-ref .sub { white-space: nowrap; }
.col-route { min-width: 150px; font-size: 13px; }
.col-last { min-width: 170px; max-width: 240px; }
.ev-line { font-weight: 500; }
.head-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.drawer-head h3 .chip { font-size: 11px; }
.tone-info .num { color: var(--info); }
.tone-ok .num { color: var(--ok); }
.tone-danger .num { color: var(--danger); }
.tabs .close-add { align-self: center; min-height: 30px; border: 0; }
.list-head { position: sticky; top: 56px; z-index: 6; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.rtable th { top: 0; }
.rtable tbody tr td { transition: background-color .15s; }
.rtable td[data-copy] { cursor: cell; user-select: none; }
/* Sütun genişliği sabitlendiğinde tablo içeriğe göre genişler, gerekirse yatay kayar */
.rtable.fixed-cols { table-layout: fixed; width: max-content; min-width: 100%; }
.rtable.fixed-cols td, .rtable.fixed-cols th { overflow-wrap: anywhere; }
.rtable.fixed-cols td.actions, .rtable.fixed-cols td.col-check { overflow: visible; }
.rtable thead th { position: sticky; top: 0; }
.rtable thead th { position: relative; }
.col-grip {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2;
}
.col-grip::after { content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 1px; background: var(--border); }
.col-grip:hover::after { background: var(--primary); left: 2px; width: 3px; }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }
.rtable td.cell-sel { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.rtable td.cell-focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.rtable:focus { outline: none; }
.sel-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.lang-btn { font-weight: 700; letter-spacing: .06em; min-width: 38px; justify-content: center; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ref-link {
  all: unset; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--text);
  border-bottom: 1px dotted var(--muted);
}
.ref-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.ref-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.rtable td.actions { width: 1%; }
.rtable td.actions .btn-text { display: none; }
.rtable td.actions button { min-width: 32px; justify-content: center; font-size: 15px; }

.brand-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.brand-chip {
  min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .03em; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.brand-chip:hover { background: var(--surface-2); }
.brand-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-manual { background: var(--warn-soft); color: var(--warn); margin-left: 5px; }
.chip-share { background: var(--info-soft); color: var(--info); }
.chip-pay { border: 0; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; min-height: 0; padding: 1px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.pay-paid { background: var(--ok-soft); color: var(--ok); }
.pay-unpaid { background: var(--danger-soft); color: var(--danger); }
.pay-none { background: var(--gray-soft); color: var(--muted); opacity: .8; }
.chip-pay:hover { filter: brightness(.95); }
.pay-btn.paid { color: var(--ok); }
.pay-btn.unpaid { color: var(--danger); }
.pay-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 14px 14px; margin: 12px 0; background: var(--surface-2); }
.share-list { display: flex; flex-direction: column; gap: 2px; max-height: 45vh; overflow-y: auto; margin: 6px 0; }
.share-row { font-weight: 500; color: var(--text); min-height: 32px; }
.col-ref .note { color: var(--warn); }
tbody tr.has-manual td.col-ref { box-shadow: inset 3px 0 0 var(--warn); }
.drag-handle { cursor: grab; color: var(--muted); letter-spacing: -2px; user-select: none; padding-right: 2px; font-size: 15px; }
.drag-handle:active { cursor: grabbing; }
tbody tr.dragging { opacity: .45; }
tbody tr.drop-before td { box-shadow: inset 0 3px 0 var(--primary); }
tbody tr.drop-after td { box-shadow: inset 0 -3px 0 var(--primary); }
.move-btn { font-size: 11px; padding: 0 7px; }
.toast-action { margin-left: 12px; background: transparent; color: inherit; border-color: currentColor; }
.sort-hint { margin: 10px 20px 0; }
.manual-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 14px 14px; margin: 12px 0; background: var(--surface-2); }
.manual-box .section-title { margin-top: 12px; }
label.check { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); min-height: 36px; }
label.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  .container { padding: 12px; }
  .topbar { padding: 0 12px; gap: 6px; height: 52px; }
  .brand-text { display: none; }
  .topnav { margin-left: 0; }
  .topnav a { padding: 6px 10px; }
  .user-chip { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .hide-sm { display: none; }

  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
  .stat { padding: 10px; }
  .stat .num { font-size: 20px; }
  .stat .lbl { font-size: 11px; line-height: 1.2; }

  .card-head { padding: 12px; }
  .card-body { padding: 12px; }
  .tabs { padding: 0 8px; overflow-x: auto; }
  .form-row { gap: 10px; }
  .form-row > label { flex: 1 1 100%; }
  .form-row > label.field:not(.grow) { flex: 1 1 calc(50% - 5px); }
  .form-row > button { flex: 1 1 100%; justify-content: center; min-height: 42px; }
  input, select, textarea { font-size: 16px; } /* iOS otomatik zoom yapmasın */
  .toolbar { width: 100%; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 100%; }
  .toolbar select, .toolbar button { flex: 1 1 calc(50% - 5px); min-width: 0; }
  /* "kontrol: ..." satırı mobilde gereksiz yer kaplıyor */
  .rtable td[data-label="Durum"] .sub:last-child, .rtable td[data-label="Status"] .sub:last-child { display: none; }
  .rtable td[data-label]::before { font-size: 9.5px; }
  .rtable tr { gap: 5px 10px; padding: 10px 10px 8px 36px; line-height: 1.35; }
  .rtable td.col-check { left: 10px; top: 12px; }
  .rtable td .sub { line-height: 1.3; }
  .rtable td.actions { margin-top: 2px; padding-top: 6px; }
  .rtable td.col-last .link-cell { padding: 0; margin: 0; }
  .rtable td.col-ref .sub { margin-top: 1px; }
  .bulk-bar { top: 52px; padding: 8px 12px; }

  /* Tablo -> kartlar */
  .rtable thead { display: none; }
  .rtable, .rtable tbody { display: block; }
  .rtable tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; position: relative;
    padding: 12px 12px 10px 44px; border-bottom: 1px solid var(--border);
  }
  .rtable td { display: block; padding: 0; border: 0; min-width: 0; }
  .rtable td[data-label]::before {
    content: attr(data-label); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
  }
  .rtable td.col-check { position: absolute; left: 12px; top: 14px; width: auto; display: flex; align-items: center; gap: 6px; }
  .drag-handle { display: none; }
  .rtable td.col-ref { grid-column: 1 / -1; }
  .rtable td.col-ref::before { display: none; }
  .rtable td.col-ref .ref-title { font-size: 16px; white-space: normal; }
  .rtable td.col-ref .sub { white-space: normal; }
  .rtable td.col-last, .rtable td.col-route { grid-column: 1 / -1; max-width: none; min-width: 0; }
  .page-head { align-items: center; margin-bottom: 12px; }
  .page-head h1 { font-size: 19px; }
  .page-head .primary { padding: 0 12px; }
  .list-head { position: static; }
  .stats { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .stat { padding: 8px 6px; text-align: center !important; }
  .stat .num { font-size: 18px; }
  .stat .lbl { font-size: 10px; }
  /* İşlem düğmeleri tek satırda, kart içinde ayrı bir şerit */
  .rtable td.actions {
    grid-column: 1 / -1; width: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border);
  }
  .rtable td.actions button { border-color: var(--border); font-size: 12px; min-height: 34px; min-width: 0; padding: 0 10px; }
  .rtable td.actions .btn-text { display: inline; }
  .rtable td.actions .move-btn { padding: 0 9px; }
  .rtable td.actions button:last-child { margin-left: auto; }
  /* Booking numarası zaten fatura satırının altında; kartta tekrar etmesin */
  .rtable td.col-booking { display: none; }
  .col-grip { display: none; }
  .rtable.fixed-cols { table-layout: auto; }
  .rtable.fixed-cols td { overflow: visible; }
  .rtable tr { padding: 12px 12px 10px 40px; gap: 8px 10px; }
  .rtable td[data-label]::before { margin-bottom: 1px; }
  .drawer .inline-form { flex-wrap: wrap; }
  .drawer .inline-form input { flex: 1 1 140px; }
  .drawer .inline-form .brand-input { flex: 1 1 100px; }
  .drawer .inline-form button { flex: 1 1 100%; justify-content: center; }
  .pay-box .form-row > label { flex: 1 1 100%; }
  .pay-box .form-row > button { flex: 1 1 100%; justify-content: center; }
  .manual-box .form-row > label { flex: 1 1 100%; }
  .sel-bar { display: none; }
  .rtable tr.empty-row { display: block; padding: 0; }
  .rtable tr.empty-row td { padding: 32px 12px; }
  #users-body tr { padding-left: 12px; }
  #users-body td:first-child { grid-column: 1 / -1; }

  .drawer { width: 100vw; border-left: 0; }
  .drawer-body { padding: 14px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .drawer-head { padding: 14px; }
  .drawer .toolbar > * { flex: 1 1 auto; justify-content: center; }

  .cmp-table thead { display: none; }
  .cmp-table, .cmp-table tbody, .cmp-table tr { display: block; }
  .cmp-table tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .cmp-table th[scope=row] { display: block; padding: 0 0 2px; border: 0; font-weight: 700; color: var(--text); }
  .cmp-table td { display: block; padding: 1px 0; border: 0; }
  .cmp-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  .map-large { height: 65vh; }
  .map-small { height: 240px; }
}
@media (max-width: 380px) {
  .stats { gap: 4px; } .stat .lbl { font-size: 9.5px; }
  .btn-text { display: none; }
}
