/* ==========================================================================
   Otomotiv Yönetim — "gece detailing bölmesi": koyu yüzeyler, tek camgöbeği vurgu
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: oklch(0.165 0.008 200);
  --bg-2: oklch(0.185 0.009 200);
  --surface: oklch(0.21 0.010 200);
  --surface-2: oklch(0.245 0.012 200);
  --surface-3: oklch(0.285 0.013 200);
  --line: oklch(0.31 0.012 200);
  --line-2: oklch(0.38 0.014 200);
  --ink: oklch(0.965 0.004 200);
  --ink-2: oklch(0.80 0.012 200);
  --ink-3: oklch(0.68 0.014 200);
  --primary: oklch(0.74 0.115 180);
  --primary-hover: oklch(0.80 0.115 180);
  --primary-ink: oklch(0.19 0.03 180);
  --primary-soft: oklch(0.74 0.115 180 / 0.14);
  --warn: oklch(0.82 0.14 78);
  --warn-soft: oklch(0.82 0.14 78 / 0.14);
  --danger: oklch(0.70 0.17 25);
  --danger-soft: oklch(0.70 0.17 25 / 0.15);
  --ok: oklch(0.76 0.14 152);
  --ok-soft: oklch(0.76 0.14 152 / 0.14);
  --info: oklch(0.74 0.10 245);
  --info-soft: oklch(0.74 0.10 245 / 0.15);
  --car-part: oklch(0.30 0.012 200);
  --car-stroke: oklch(0.48 0.014 200);

  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --shadow: 0 10px 30px -10px oklch(0 0 0 / 0.6);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --side-w: 248px;
  --top-h: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-sticky: 10; --z-nav: 20; --z-drawer: 30; --z-dialog: 40; --z-toast: 50;
}

/* Açık tema: aynı camgöbeği kimlik, beyaz yüzeyler; vurgu renkleri beyaz zeminde AA kontrast için koyulaştırıldı */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: oklch(0.975 0.004 200);
  --bg-2: oklch(0.955 0.006 200);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.005 200);
  --surface-3: oklch(0.925 0.008 200);
  --line: oklch(0.905 0.008 200);
  --line-2: oklch(0.84 0.010 200);
  --ink: oklch(0.20 0.012 200);
  --ink-2: oklch(0.40 0.014 200);
  --ink-3: oklch(0.50 0.014 200);
  --primary: oklch(0.52 0.10 182);
  --primary-hover: oklch(0.46 0.10 182);
  --primary-ink: oklch(0.99 0.005 180);
  --primary-soft: oklch(0.52 0.10 182 / 0.10);
  --warn: oklch(0.55 0.13 65);
  --warn-soft: oklch(0.80 0.14 78 / 0.20);
  --danger: oklch(0.54 0.19 25);
  --danger-soft: oklch(0.62 0.19 25 / 0.10);
  --ok: oklch(0.50 0.13 152);
  --ok-soft: oklch(0.62 0.14 152 / 0.12);
  --info: oklch(0.50 0.13 250);
  --info-soft: oklch(0.60 0.12 250 / 0.11);
  --car-part: oklch(0.94 0.006 200);
  --car-stroke: oklch(0.62 0.014 200);
  --shadow: 0 12px 32px -12px oklch(0.25 0.02 200 / 0.28);
}
:root[data-theme="light"] :is(input, select, textarea) { background-color: var(--surface); }
:root[data-theme="light"] .plate { box-shadow: inset 0 0 0 1px oklch(0.80 0.01 200); }
:root[data-theme="light"] .car-pane .car-part[data-part="jantlar"] { fill: oklch(0.35 0.01 200); }
:root[data-theme="light"] .btn.wa { background: oklch(0.52 0.13 150); border-color: oklch(0.52 0.13 150); }
:root[data-theme="light"] .btn.wa:hover { background: oklch(0.47 0.13 150); }
:root[data-theme="light"] dialog.dlg::backdrop { background: oklch(0.25 0.02 200 / 0.45); }
.theme-btn .i-sun { display: none; }
:root[data-theme="light"] .theme-btn .i-sun { display: block; }
:root[data-theme="light"] .theme-btn .i-moon { display: none; }
body, .side, .topbar, .panel { transition: background-color .2s, border-color .2s, color .2s; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14.5px; line-height: 1.5; font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; } h4 { font-size: 0.9rem; }
p { margin: 0 0 0.6em; }
.num, td.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-2); } .dim { color: var(--ink-3); } .small { font-size: 0.85em; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.hidden { display: none !important; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: var(--bg-2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px 16px;
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brandmark img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; }
.brandmark .logo-fallback { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-weight: 800; }
.brandmark b { display: block; font-size: 0.95rem; line-height: 1.2; }
.brandmark span { font-size: 0.75rem; color: var(--ink-3); }
.nav-group { margin-top: 14px; }
.nav-group > .ng-title { font-size: 0.72rem; color: var(--ink-3); padding: 0 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--ink-2);
  font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; flex: none; }
.side-foot .who { min-width: 0; flex: 1; } .side-foot .who b { display: block; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-nav); height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { padding-left: 38px; background: var(--surface); }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; z-index: var(--z-drawer); max-height: 60vh; overflow-y: auto;
}
.search-results a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.sel { background: var(--surface-3); }
.search-results .t { font-size: 0.72rem; color: var(--ink-3); min-width: 74px; }
.wa-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--ink-2); padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.wa-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.wa-pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.wa-pill.bad .dot { background: var(--danger); }
.wa-pill.qr .dot { background: var(--warn); }
.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }
.content.wide { max-width: none; }

.bottom-nav { display: none; }

/* ---------- Page header ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.ph .crumbs { font-size: 0.8rem; color: var(--ink-3); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.ph .crumbs a { color: var(--ink-3); } .ph .crumbs a:hover { color: var(--ink); }
.ph .sub { color: var(--ink-2); margin-top: 4px; font-size: 0.9rem; }
.ph .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: inherit;
  font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s;
  -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.btn:hover { background: var(--surface-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 40%, var(--line)); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.wa { background: oklch(0.62 0.14 150); border-color: oklch(0.62 0.14 150); color: #fff; }
.btn.wa:hover { background: oklch(0.67 0.14 150); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 0.85rem; border-radius: 8px; }
.btn.icon { padding: 0; width: 38px; } .btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 9px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); padding: 0; }
input[type=color] { padding: 3px; height: 40px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239aa' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--ink-2); font-weight: 500; min-width: 0; }
label.f .req { color: var(--danger); }
label.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 0.9rem; color: var(--ink); min-height: 40px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.fgrid .span2 { grid-column: span 2; } .fgrid .full { grid-column: 1 / -1; }
.fsec { font-size: 0.8rem; color: var(--primary); font-weight: 650; grid-column: 1 / -1; margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.hint { font-size: 0.78rem; color: var(--ink-3); }
.input-group { display: flex; gap: 8px; } .input-group > * { flex: 1; } .input-group > .btn { flex: none; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; background: none; border: 0; color: var(--ink-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 550; font-size: 0.86rem; min-height: 32px; }
.seg button.on { background: var(--surface-3); color: var(--ink); }
.seg button:hover:not(.on) { color: var(--ink); }

/* ---------- Panels / tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel > .hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel > .hd h3 { display: flex; align-items: center; gap: 8px; }
.panel > .bd { padding: 18px; }
.panel > .bd.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.cols-2-1 { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 0.76rem; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; transition: background .12s; }
table.t tbody tr.click:hover { background: var(--surface-2); }
table.t .r, table.t th.r { text-align: right; }
table.t .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.cell-main { font-weight: 600; } .cell-sub { font-size: 0.8rem; color: var(--ink-3); margin-top: 1px; }
.plate { display: inline-flex; align-items: center; font-weight: 700; font-size: 0.82rem; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 5px; background: oklch(0.95 0.005 200); color: oklch(0.2 0.01 200); border-left: 7px solid oklch(0.45 0.16 260); white-space: nowrap; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: 0.92rem; }
.kv > dt { color: var(--ink-3); } .kv > dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-2); }
.empty svg.i { width: 34px; height: 34px; color: var(--ink-3); margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 42ch; margin: 0 auto 14px; font-size: 0.9rem; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Stat strip (dashboard) ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat { padding: 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stat .l { font-size: 0.78rem; color: var(--ink-3); font-weight: 500; }
.stat .v { font-size: 1.35rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 0.78rem; color: var(--ink-2); }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.li:last-child { border-bottom: 0; }
a.li:hover { background: var(--surface-2); color: var(--ink); }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .grow span { font-size: 0.8rem; color: var(--ink-3); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; background: none; border: 0; color: var(--ink-2); padding: 10px 14px; cursor: pointer; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--primary); }
.tabs button .count { font-size: 0.72rem; background: var(--surface-3); padding: 1px 7px; border-radius: 99px; color: var(--ink-2); }

/* ---------- Dialog ---------- */
dialog.dlg {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 16px; padding: 0;
  width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow); overflow: hidden;
}
dialog.dlg.lg { width: min(1000px, calc(100vw - 24px)); }
dialog.dlg.sm { width: min(460px, calc(100vw - 24px)); }
dialog.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .22s var(--ease); }
dialog.dlg::backdrop { background: oklch(0.08 0.01 200 / 0.7); backdrop-filter: blur(3px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.dlg .dh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.dlg .db { padding: 20px; overflow-y: auto; flex: 1; }
.dlg .df { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--ink); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow); max-width: 380px; display: flex; gap: 10px; align-items: center; animation: toast-in .25s var(--ease); font-size: 0.9rem; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo .x { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: oklch(0 0 0 / .6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.7rem; padding: 3px 7px; background: oklch(0 0 0 / .55); color: #fff; }
.photo-add { aspect-ratio: 4 / 3; border-radius: 10px; border: 1.5px dashed var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ink-2); cursor: pointer; font-size: 0.82rem; font-weight: 550; background: none; font-family: inherit; }
.photo-add:hover { border-color: var(--primary); color: var(--primary); }
.photo-add input { display: none; }
.upload-progress { font-size: 0.8rem; color: var(--primary); }
.lightbox { position: fixed; inset: 0; background: oklch(0 0 0 / .92); z-index: var(--z-toast); display: grid; place-items: center; }
.lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 8px; }
.lightbox .nav-l, .lightbox .nav-r, .lightbox .close { position: absolute; background: oklch(1 0 0 / .1); border: 0; color: #fff; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.lightbox .nav-l { left: 16px; } .lightbox .nav-r { right: 16px; } .lightbox .close { top: 16px; right: 16px; }

/* ---------- Signature ---------- */
.sig-wrap { border: 1px solid var(--line-2); border-radius: 10px; background: #fff; position: relative; touch-action: none; }
.sig-wrap canvas { width: 100%; height: 180px; display: block; border-radius: 10px; }
.sig-wrap .clear { position: absolute; top: 8px; right: 8px; }
.sig-wrap .line { position: absolute; left: 20px; right: 20px; bottom: 36px; border-bottom: 1px dashed #cbd5e1; pointer-events: none; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.tl::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--line-2); }
.tl:last-child::before { display: none; }
.tl .dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--primary); background: var(--surface); margin-top: 4px; }
.tl b { font-weight: 600; } .tl .m { font-size: 0.8rem; color: var(--ink-3); }

/* ---------- Steps (job status) ---------- */
.steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.step { flex: 1; min-width: 108px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-3); cursor: pointer; font-family: inherit; text-align: left; transition: border-color .15s, background .15s; }
.step b { display: block; color: var(--ink-2); font-size: 0.86rem; font-weight: 600; }
.step.done { border-color: color-mix(in oklch, var(--primary) 35%, var(--line)); }
.step.done b { color: var(--ink); }
.step.cur { background: var(--primary-soft); border-color: var(--primary); }
.step.cur b { color: var(--primary); }
.step:hover:not(.cur) { border-color: var(--line-2); }

/* ---------- Calendar (rental gantt) ---------- */
.gantt { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.gantt table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.gantt th, .gantt td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; height: 44px; }
.gantt th { font-size: 0.72rem; color: var(--ink-3); font-weight: 600; min-width: 38px; text-align: center; padding: 6px 0; height: auto; background: var(--surface); }
.gantt th.we, .gantt td.we { background: var(--bg-2); }
.gantt th.today { color: var(--primary); }
.gantt .m-col { position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 150px; padding: 0 12px; text-align: left; }
.gantt .row { position: relative; }
.gantt .bar { position: absolute; top: 7px; height: 30px; border-radius: 7px; padding: 0 8px; font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1; }
.gantt .bar.aktif { background: var(--primary); color: var(--primary-ink); }
.gantt .bar.rezervasyon { background: var(--info-soft); color: var(--info); border: 1px solid var(--info); }
.gantt .bar.tamamlandi { background: var(--surface-3); color: var(--ink-2); }

/* ---------- Quote builder ---------- */
.qb { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); gap: 18px; align-items: start; }
.qb-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.catalog { display: grid; grid-template-columns: 250px 1fr; gap: 0; min-height: 520px; }
.catalog .car-pane { border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.car-svg { width: 100%; max-width: 210px; height: auto; user-select: none; }
.car-pane .car-part { cursor: pointer; transition: fill .15s var(--ease), opacity .15s; fill: var(--car-part); }
.car-pane .car-part[data-part="jantlar"] { fill: oklch(0.13 0.008 200); stroke: var(--car-stroke); }
.car-pane .car-part:hover { fill: var(--surface-3); }
.car-pane.damage .car-part.on { fill: var(--warn); }
.car-pane .car-part.focus { fill: var(--warn) !important; }
.car-pane .car-part.on { fill: var(--primary); }
.car-pane .legend { display: flex; gap: 12px; font-size: 0.75rem; color: var(--ink-3); flex-wrap: wrap; justify-content: center; }
.car-pane .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 0.82rem; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); cursor: pointer; white-space: nowrap; font-weight: 500; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.cat-pane { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.svc-list { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow-y: auto; padding-right: 2px; }
.svc {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left; font: inherit; color: var(--ink);
  padding: 11px 13px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.svc:hover { border-color: var(--line-2); background: var(--surface-2); }
.svc:active { transform: scale(.995); }
.svc.added { border-color: color-mix(in oklch, var(--primary) 55%, var(--line)); background: color-mix(in oklch, var(--primary) 7%, var(--bg-2)); }
.svc .n { font-weight: 600; font-size: 0.92rem; }
.svc .d { font-size: 0.78rem; color: var(--ink-3); grid-column: 1; }
.svc .p { font-weight: 700; font-variant-numeric: tabular-nums; grid-row: 1 / span 2; grid-column: 2; text-align: right; }
.svc .p small { display: block; font-weight: 500; color: var(--ink-3); font-size: 0.72rem; }
.svc .add-ic { color: var(--primary); }

.cart { position: sticky; top: calc(var(--top-h) + 16px); }
.cart-items { display: flex; flex-direction: column; }
.ci { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; }
.ci .n { font-weight: 600; font-size: 0.92rem; }
.ci .meta { font-size: 0.76rem; color: var(--ink-3); }
.ci .ctrl { grid-column: 1 / -1; display: grid; grid-template-columns: 64px 1fr 70px auto; gap: 6px; align-items: center; }
.ci .ctrl input { min-height: 34px; padding: 6px 8px; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.ci .ctrl .lbl { font-size: 0.68rem; color: var(--ink-3); display: block; margin-bottom: 2px; }
.ci .tot { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.ci .tot s { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.78rem; }
.totals { padding: 14px 18px; display: flex; flex-direction: column; gap: 7px; font-size: 0.92rem; }
.totals .row { display: flex; justify-content: space-between; gap: 10px; }
.totals .row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.totals .row.disc span:last-child { color: var(--warn); }
.totals .grand { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 1.3rem; font-weight: 750; }
.totals .grand span:last-child { color: var(--primary); font-weight: 750; }
.disc-box { padding: 14px 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr 90px; gap: 8px; align-items: center; }
.disc-box .seg, .disc-box .chk { justify-self: start; }
.cart-actions { padding: 14px 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-actions .btn.primary { grid-column: 1 / -1; min-height: 44px; }
.mobile-cart-bar { display: none; }

.pdf-frame { width: 100%; height: 75vh; border: 0; border-radius: 10px; background: #fff; }

/* ---------- Accounting ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 10px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .pair i { width: 42%; max-width: 18px; border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.bars .pair i.g { background: var(--primary); } .bars .pair i.e { background: var(--danger); opacity: .75; }
.bars .b span { font-size: 0.68rem; color: var(--ink-3); }
.legend-row { display: flex; gap: 14px; font-size: 0.78rem; color: var(--ink-2); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.split { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.split i { display: block; height: 100%; }
.line-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
a.line-card:hover { background: var(--surface-2); color: var(--ink); }
.line-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.line-row > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 80% -10%, oklch(0.74 0.115 180 / .10), transparent 60%), var(--bg); }
.login-box { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-box .brandmark { padding: 0 0 22px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.err-msg { color: var(--danger); font-size: 0.86rem; background: var(--danger-soft); padding: 9px 12px; border-radius: 8px; }

.note-box { background: var(--info-soft); color: var(--ink); border: 1px solid color-mix(in oklch, var(--info) 35%, transparent); border-radius: 10px; padding: 12px 14px; font-size: 0.88rem; }
.note-box.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 35%, transparent); }
.note-box.danger { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 35%, transparent); }
.code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.82rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; white-space: pre-wrap; }
.copy-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.copy-row span { color: var(--ink-3); } .copy-row b { font-weight: 550; overflow-wrap: anywhere; }
.copy-row.missing b { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .qb { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; }
  .cols-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: var(--z-drawer); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow); }
  .app.drawer-open .side { transform: none; }
  .app.drawer-open::after { content: ''; position: fixed; inset: 0; background: oklch(0 0 0 / .55); z-index: calc(var(--z-drawer) - 1); }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .wa-pill .txt, .topbar .qtxt { display: none; }
  .topbar #quick { width: 38px; padding: 0; min-height: 38px; }
  .content { padding: 16px 14px 96px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
    background: color-mix(in oklch, var(--bg-2) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 0.68rem; color: var(--ink-3); padding: 6px 0; background: none; border: 0; font-family: inherit; cursor: pointer; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav svg.i { width: 22px; height: 22px; }
  .toasts { left: 12px; right: 12px; bottom: 84px; }
  .toast { max-width: none; }
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .catalog .car-pane { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: flex-start; }
  .catalog .car-pane .car-svg { max-width: 130px; flex: none; }
  .svc-list { max-height: none; }
  .mobile-cart-bar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: var(--z-sticky);
    background: var(--primary); color: var(--primary-ink); border-radius: 14px; padding: 12px 16px; align-items: center; justify-content: space-between; font-weight: 700; box-shadow: var(--shadow); border: 0; font-family: inherit; font-size: 0.95rem; cursor: pointer;
  }
}
@media (max-width: 640px) {
  h1 { font-size: 1.25rem; }
  .ph { align-items: flex-start; }
  .ph .actions { width: 100%; }
  .ph .actions .btn { flex: 1; }
  .qb-head { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr) !important; }
  .fgrid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .fgrid .span2 { grid-column: 1 / -1; }
  .fgrid > label.f.wide-m { grid-column: 1 / -1; }
  .panel > .bd { padding: 14px; }
  .panel > .hd { padding: 12px 14px; }
  .dlg .db { padding: 16px; }
  dialog.dlg { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; border: 0; }
  .kv { grid-template-columns: 1fr 1.4fr; }
  .copy-row { grid-template-columns: 1fr auto; } .copy-row span { grid-column: 1 / -1; }
  /* tablo -> kart */
  table.t.stackable thead { display: none; }
  table.t.stackable, table.t.stackable tbody, table.t.stackable tr, table.t.stackable td { display: block; width: 100%; }
  table.t.stackable tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.stackable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.t.stackable td::before { content: attr(data-l); color: var(--ink-3); font-size: 0.8rem; text-align: left; flex: none; }
  table.t.stackable td.main-cell { display: block; text-align: left; padding-bottom: 6px; }
  table.t.stackable td.main-cell::before { display: none; }
  table.t.stackable td.actions-cell { justify-content: flex-end; width: 100%; padding-top: 8px; }
  table.t.stackable td.actions-cell::before { display: none; }
  table.t.stackable td:empty { display: none; }
  .ci .ctrl { grid-template-columns: 56px 1fr 60px auto; }
  .disc-box { grid-template-columns: 1fr 90px; }
  .disc-box > .lbl { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .side, .topbar, .bottom-nav, .ph .actions { display: none !important; }
  .app { display: block; }
}

/* Demo verileri bandı */
.demo-bar { display: flex; align-items: center; gap: 10px; padding: 8px 24px; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid color-mix(in oklch, var(--warn) 35%, transparent); font-size: 0.86rem; }
.demo-bar svg.i { color: var(--warn); }
.demo-bar a { margin-left: auto; font-weight: 600; }
@media (max-width: 960px) { .demo-bar { padding: 8px 14px; } }
.gantt .bar.late { background: var(--danger); color: #fff; }
