:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5d6b7a;
  --line: #dfe5eb;
  --brand: #0b6fb3;
  --brand-ink: #ffffff;
  --brand-soft: #e6f1f9;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --warn: #b54708;
  --warn-soft: #fdeee2;
  --info: #6941c6;
  --info-soft: #efeafc;
  --transit: #0b6fb3;
  --transit-soft: #e6f1f9;
  --danger: #c0352b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #1a2129;
    --ink: #e6ebf0;
    --muted: #9aa7b4;
    --line: #2b3541;
    --brand: #4aa3e0;
    --brand-ink: #0b1620;
    --brand-soft: #16324a;
    --ok: #4cc283;
    --ok-soft: #173426;
    --warn: #f09a5b;
    --warn-soft: #3a2618;
    --info: #a98bf0;
    --info-soft: #2a2242;
    --transit: #4aa3e0;
    --transit-soft: #16324a;
    --danger: #f07167;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 32px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.top-gap { margin-top: 12px; }

/* Üst bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--brand); display: inline-block;
  box-shadow: inset -6px -6px 0 rgba(255,255,255,.25); }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.topnav a.on, .topnav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.who-name { color: var(--muted); }
.who form { margin: 0; }

/* Butonlar ve formlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }
input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 500; }
label input, label select { color: var(--ink); font-size: 15px; font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; font-size: .95rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline input { flex: 1 1 200px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Kartlar ve düzen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + * { margin-top: 16px; }
.pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pagehead h1 { margin: 0; }
.back { font-size: .9rem; }
.notice { background: var(--brand-soft); color: var(--ink); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.alert { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); }

.auth-card { max-width: 420px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 640px; }
.copybox { display: flex; gap: 8px; margin: 12px 0; }
.copybox input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* Filtreler */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.filters .grow { flex: 1 1 260px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem; }
.chip b { font-variant-numeric: tabular-nums; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); }
.chip:hover { text-decoration: none; border-color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Durum etiketleri */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.big { font-size: .95rem; padding: 4px 14px; }
.st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-transit { background: var(--transit-soft); color: var(--transit); }
.st-out { background: var(--info-soft); color: var(--info); }
.st-problem { background: var(--warn-soft); color: var(--warn); }
.dot.st-delivered { background: var(--ok); }
.dot.st-transit { background: var(--transit); }
.dot.st-out { background: var(--info); }
.dot.st-problem { background: var(--warn); }

/* Tablolar */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.card .tablewrap { box-shadow: none; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--brand-soft); }
td.clip { max-width: 280px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.pager .muted { margin-right: auto; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.subnav a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.subnav a.on { color: var(--brand); border-bottom-color: var(--brand); }
.subnav a:hover { text-decoration: none; color: var(--ink); }

.assignbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.userrow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rowactions { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.rowactions form { margin: 0; }

/* Detay */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
ol.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
ol.timeline li { position: relative; padding: 0 0 14px 14px; }
ol.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
ol.timeline li:first-child::before { background: var(--brand); }
ol.timeline li.warn::before { border-color: var(--warn); }
.t-when { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.foot { color: var(--muted); font-size: .8rem; padding-bottom: 24px; }

/* Telefon */
@media (max-width: 760px) {
  .grid2, .row2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; padding-bottom: 8px; }
  .topbar-in { gap: 12px; }
  .filters > label, .filters .btn { flex: 1 1 100%; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list td { border: 0; padding: 3px 12px; display: flex; gap: 12px; }
  table.list td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .8rem; min-width: 92px; flex-shrink: 0; }
  table.list .num { text-align: left; }
  td.clip { max-width: none; }
  .userrow { flex-direction: column; }
}
