/* yazveciz · Sipariş Toplama (sunucu sürümü) — tek dosyalık sürümle aynı renkler; telefonda büyük, okunaklı */
:root {
  --bg: #f4f4f1; --surface: #ffffff; --surface-2: #efeee9; --text: #1a1a19; --muted: #595954;
  --line: #d4d3cc; --line-strong: #a9a8a0; --accent: #1d4f91; --accent-ink: #ffffff; --accent-soft: #e5edf8;
  --ok: #17703a; --ok-bg: #e2f3e7; --warn: #855000; --warn-bg: #fff2d1; --err: #b0251c; --err-bg: #fde6e3;
  --info: #1d4f91; --info-bg: #e5edf8; --focus: #1d4f91; --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --radius: 10px; --tap: 48px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121314; --surface: #1b1d1f; --surface-2: #24272a; --text: #ecece9; --muted: #a6a6a0;
    --line: #353a3f; --line-strong: #555b61; --accent: #8db8f2; --accent-ink: #0d1726; --accent-soft: #1b2a40;
    --ok: #74d394; --ok-bg: #133120; --warn: #f3c56c; --warn-bg: #3a2b0a; --err: #ff9389; --err-bg: #3e1613;
    --info: #8db8f2; --info-bg: #17263b; --focus: #8db8f2; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121314; --surface: #1b1d1f; --surface-2: #24272a; --text: #ecece9; --muted: #a6a6a0;
  --line: #353a3f; --line-strong: #555b61; --accent: #8db8f2; --accent-ink: #0d1726; --accent-soft: #1b2a40;
  --ok: #74d394; --ok-bg: #133120; --warn: #f3c56c; --warn-bg: #3a2b0a; --err: #ff9389; --err-bg: #3e1613;
  --info: #8db8f2; --info-bg: #17263b; --focus: #8db8f2; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: 1rem; margin: .8rem 0 .4rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; margin: .25rem 0 .6rem; }
.small { font-size: .88rem; }
.pad { padding: 1rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: .5rem; }
.print-only { display: none; }
.loading { padding: 2rem 1rem; color: var(--muted); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: .6rem; }
.nowrap { white-space: nowrap; }

/* ---- üst çubuk ve menüler ---- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .5rem .9rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.topnav { display: none; gap: .25rem; flex: 1 1 auto; }
.who { margin-left: auto; font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.who button { margin-left: .3rem; }
.conn { font-size: .82rem; white-space: nowrap; }
.conn .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.conn.ok .dot { background: var(--ok); }
.conn.bad { color: var(--err); font-weight: 600; }
.conn.bad .dot { background: var(--err); }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a, .topnav a {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; padding: .3rem .2rem; text-decoration: none; color: var(--muted); font-size: .74rem; text-align: center;
}
.bottomnav a .ic, .topnav a .ic { font-size: 1.25rem; line-height: 1; }
.bottomnav a[aria-current="page"], .topnav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.bottomnav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--accent); }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .topnav { display: flex; }
  .topnav a { flex: 0 0 auto; flex-direction: row; min-height: 40px; padding: .3rem .7rem; font-size: .95rem; border-radius: 8px; }
  .topnav a[aria-current="page"] { background: var(--accent-soft); }
}
main { overflow-x: clip; max-width: 1200px; margin: 0 auto; padding: .9rem .9rem 1.5rem; outline: none; }
.banner { padding: .55rem .9rem; font-weight: 600; text-align: center; }
.banner.err { background: var(--err-bg); color: var(--err); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--info-bg); color: var(--info); }

/* ---- düğmeler ve formlar ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--tap);
  padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface);
  cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; line-height: 1.2; text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.btn.danger { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.btn.big { min-height: 64px; font-size: 1.15rem; padding: .7rem 1.2rem; width: 100%; }
.btn.small { min-height: 38px; padding: .3rem .7rem; font-weight: 500; font-size: .92rem; }
.btn.link { border: none; background: none; color: var(--accent); padding: .2rem .3rem; min-height: 0; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.btn-grid .wide { grid-column: 1 / -1; }
label { display: block; font-weight: 600; margin: .5rem 0 .2rem; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; margin: .2rem .8rem .2rem 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; min-height: var(--tap); padding: .5rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); }
textarea { min-height: 7rem; }
.scan { font-size: 1.25rem; font-family: ui-monospace, Consolas, monospace; }
.fields { display: grid; gap: .3rem .8rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
details.box > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; gap: .4rem; }
details.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .8rem; margin: .6rem 0; }

/* ---- kartlar, sayaçlar ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow); }
.cards { display: grid; gap: .6rem; }
.counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 640px) { .counters { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .counters { grid-template-columns: repeat(5, 1fr); } }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem; }
.counter .n { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter .l { font-size: .85rem; color: var(--muted); }
.counter.hl { border-color: var(--accent); }
.counter.warn { border-color: var(--warn); }
.nums { display: flex; gap: .4rem; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.nums span { background: var(--surface-2); border-radius: 6px; padding: .1rem .45rem; max-width: 100%; overflow-wrap: anywhere; }
.nums b { font-size: 1.05em; }

/* ---- durum rozetleri: renk + simge + metin ---- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px; font-size: .84rem; font-weight: 600; border: 1px solid transparent; white-space: normal; }
.st-bekliyor { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.st-toplaniyor { background: var(--info-bg); color: var(--info); }
.st-toplandi { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.st-hazir { background: var(--ok-bg); color: var(--ok); }
.st-kargoda { background: var(--ok); color: #fff; }
.st-eksik { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.st-iptal { background: var(--err-bg); color: var(--err); }
.st-ikasta { background: var(--surface-2); color: var(--muted); }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-info { background: var(--info-bg); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: .25rem .65rem; background: var(--surface); font-size: .9rem; cursor: pointer; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tote { display: inline-flex; align-items: baseline; gap: .35rem; border: 2px solid var(--accent); border-radius: 8px; padding: .2rem .55rem; font-weight: 700; }
.tote .code { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; }

/* ---- mesajlar ---- */
.msg { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .8rem; border-radius: var(--radius); border: 1px solid; margin: .5rem 0; }
.msg .ic { font-size: 1.2rem; line-height: 1.2; }
.msg.ok, .msg.done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.msg.warn, .msg.choose { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.msg.err { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.msg.info, .msg.pending { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.msg.big { font-size: 1.1rem; font-weight: 600; }
.msg .body { flex: 1 1 auto; min-width: 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; width: min(560px, calc(100vw - 24px)); }
@media (min-width: 900px) { .toast { bottom: 20px; } }
.empty { padding: 1.2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---- listeler ve tablolar ---- */
.list { display: grid; gap: .5rem; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem; }
.item.click { cursor: pointer; }
.item.click:hover { border-color: var(--accent); }
.item .head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.item .no { font-weight: 800; font-size: 1.05rem; }
.thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); flex: 0 0 auto; }
.thumb.big { width: 120px; height: 120px; }
.noimg { display: inline-grid; place-items: center; color: var(--muted); font-size: .7rem; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .45rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.done td { color: var(--muted); }
.agg-row { display: grid; grid-template-columns: 56px 1fr; gap: .6rem; }
.agg-row .loc { font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.sku { font-family: ui-monospace, Consolas, monospace; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.tabs a { padding: .55rem .85rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin: .8rem 0; }

/* ---- akıllı toplama ---- */
.task { border: 2px solid var(--accent); }
.task .where { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.task .loc-big { font-size: 2.2rem; font-weight: 900; font-family: ui-monospace, Consolas, monospace; letter-spacing: .03em; }
.task .loc-none { font-size: 1.2rem; font-weight: 800; color: var(--warn); }
.task .sku-big { font-size: 1.6rem; font-weight: 800; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.task .name { font-size: 1.05rem; }
.bignums { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .7rem 0; text-align: center; }
.bignums div { background: var(--surface-2); border-radius: 8px; padding: .35rem .2rem; }
.bignums b { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bignums .rem b { color: var(--accent); }
.dist { display: flex; flex-wrap: wrap; gap: .4rem; }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); width: 0; }
video.cam { width: 100%; max-height: 50vh; background: #000; border-radius: var(--radius); }

/* ---- paket etiketi ---- */
.label { border: 1px dashed var(--line-strong); border-radius: 8px; padding: .6rem; background: #fff; color: #000; max-width: 380px; }
.label svg { width: 100%; height: 80px; display: block; }
.label .code { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; font-weight: 800; text-align: center; letter-spacing: .05em; }
.label .meta { display: flex; justify-content: space-between; font-size: .9rem; }

.dlg { border: none; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--text); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg form { padding: 1rem; }
.dlg h2 { margin-top: 0; }
.summary { background: var(--surface-2); border-radius: 8px; padding: .6rem .8rem; }
.summary dt { font-weight: 700; }
.summary dd { margin: 0 0 .4rem; }

/* ---- yazdırma ---- */
@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  .top, .bottomnav, .toast, .banner, .no-print, .btn, details.box > summary::marker { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block; }
  body.printing-labels main { display: none; }
  .card, .item, .tbl-wrap { border-color: #999; box-shadow: none; break-inside: avoid; }
  th { position: static; }
  .labels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .label { border: 1px solid #000; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* ---- telefonda tablo yerine kart görünümü ---- */
.row > input.grow { width: auto; flex: 1 1 150px; min-width: 0; }
@media (max-width: 699px) {
  table.resp thead { display: none; }
  table.resp, table.resp tbody { display: block; }
  table.resp tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem .6rem; padding: .7rem .75rem; border-bottom: 1px solid var(--line); }
  table.resp.c2 tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.resp td { display: block; border: none; padding: 0; text-align: left; }
  table.resp td.num { text-align: left; font-size: 1.05rem; }
  table.resp td.full { grid-column: 1 / -1; }
  table.resp td[data-l]::before { content: attr(data-l); display: block; font-size: .74rem; color: var(--muted); font-weight: 600; }
  table.resp td:empty { display: none; }
}
