/* Kargo Etiket — arayüz. Tek dosyalık sürümün renk ve bileşen dili korunmuştur. */
:root {
  --bg: #f4f5f7; --card: #fff; --line: #e1e4e8; --line2: #c9ced6; --text: #1b1f24; --muted: #5b6370; --faint: #8a919c;
  --accent: #2457c5; --accent-d: #1b449d; --accent-bg: #eaf0fc;
  --ok: #17703a; --ok-bg: #e5f4ea; --warn: #8a5300; --warn-bg: #fdf2dc; --bad: #b42318; --bad-bg: #fdecea; --info: #3d4b66; --info-bg: #eef1f6;
  --r: 10px; --sh: 0 1px 2px rgba(16,24,40,.05); --sh2: 0 8px 30px rgba(16,24,40,.18);
  --side: 232px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, "Noto Sans", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #7aa2ef; outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Yerleşim */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: #141a24; color: #d9dee7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 18px 14px; font-weight: 700; font-size: 16px; color: #fff; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 400; color: #8f9aab; font-size: 12px; margin-top: 2px; }
.nav { flex: 1; overflow: auto; padding: 4px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c7cfdb; text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.nav a:hover { background: #1f2836; color: #fff; }
.nav a.on { background: #2457c5; color: #fff; }
.nav a .cnt { margin-left: auto; background: #b42318; color: #fff; border-radius: 999px; font-size: 11.5px; padding: 0 7px; font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .me { border-top: 1px solid #263041; padding: 12px 14px; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.side .me .row { margin-top: 8px; gap: 6px; }
.side .me button { background: #232d3d; border: 1px solid #334055; color: #d9dee7; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.top h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.top .spacer { flex: 1; }
.content { padding: 20px 24px 120px; max-width: 1500px; width: 100%; }
.demo-band { background: #b42318; color: #fff; text-align: center; font-weight: 700; padding: 6px; letter-spacing: .02em; }
.offline-band { background: #8a5300; color: #fff; text-align: center; padding: 6px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav a { margin: 0; }
  .side .me { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .content { padding: 14px 12px 140px; }
  .top { padding: 12px; }
}

/* Bileşenler */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 small, .muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.faint { color: var(--faint); font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text); min-height: 34px; }
.btn:hover:not(:disabled) { background: #f2f4f7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-d); }
.btn.danger { color: var(--bad); border-color: #efb7b1; }
.btn.danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; min-height: 28px; border-radius: 7px; }
.btn.lg { padding: 10px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; min-height: 0; text-decoration: underline; font-weight: 500; }
label.f { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
.field { margin-bottom: 10px; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; min-height: 34px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); outline: none; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.problem { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-bg) !important; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.full { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 7px; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.b-ok { color: var(--ok); background: var(--ok-bg); }
.b-warn { color: var(--warn); background: var(--warn-bg); }
.b-bad { color: var(--bad); background: var(--bad-bg); }
.b-info { color: var(--info); background: var(--info-bg); }
.b-acc { color: var(--accent); background: var(--accent-bg); }
.b-plain { color: var(--muted); background: #fafbfc; border-color: var(--line); font-weight: 500; }
.tag { display: inline-block; font-size: 11.5px; border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; margin: 2px 4px 0 0; color: var(--muted); background: #fafbfc; }
.tag.mark { color: #5a3e00; background: #fff6d6; border-color: #f1dc94; font-weight: 600; }

.note { border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.note.info { background: var(--info-bg); color: var(--info); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note b { font-weight: 700; }

/* Özet kartları */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-align: left; cursor: pointer; box-shadow: var(--sh); }
.stat:hover { border-color: var(--accent); }
.stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; display: block; }
.stat .l { color: var(--muted); font-size: 13px; }

/* Tablo */
.toolbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .field { margin: 0; min-width: 120px; }
.toolbar .search { flex: 1 1 220px; }
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: #f7f9fc; }
table.t tbody tr.sel { background: var(--accent-bg); }
table.t tbody tr.active { box-shadow: inset 3px 0 0 var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.who { font-weight: 600; }
.sub { font-size: 12.5px; color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.selbanner { background: var(--accent-bg); color: var(--accent-d); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Toplu işlem çubuğu */
.bulkbar { position: fixed; left: var(--side); right: 0; bottom: 0; background: #141a24; color: #fff; padding: 12px 24px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 30; box-shadow: 0 -4px 16px rgba(0,0,0,.2); }
.bulkbar .btn { background: #232d3d; border-color: #3a475c; color: #fff; }
.bulkbar .btn.primary { background: var(--accent); border-color: var(--accent); }
.bulkbar .count { font-weight: 700; margin-right: 6px; }
@media (max-width: 900px) { .bulkbar { left: 0; padding: 10px 12px; } }

/* Çekmece (sipariş detayı) */
.drawer-back { position: fixed; inset: 0; background: rgba(15,20,30,.28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(920px, 100%); background: var(--bg); z-index: 41; box-shadow: var(--sh2); display: flex; flex-direction: column; }
.drawer header { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drawer header h2 { margin: 0; font-size: 17px; }
.drawer .body { overflow: auto; padding: 16px 18px 40px; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
@media (max-width: 860px) { .dgrid { grid-template-columns: 1fr; } }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 13.5px; }
.issues li.missing { background: var(--bad-bg); color: var(--bad); }
.issues li.check { background: var(--warn-bg); color: var(--warn); }
.issues li.warn { background: var(--info-bg); color: var(--info); }
.issues li.ready { background: var(--ok-bg); color: var(--ok); }
.pv { background: #e7e9ee; border-radius: 10px; padding: 12px; display: flex; justify-content: center; }
.pv svg { width: 100%; max-width: 320px; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(16,24,40,.15); display: block; }
.pv.sm svg { max-width: 120px; }

/* Diyalog */
dialog.dlg { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: var(--sh2); color: var(--text); }
dialog.dlg.wide { width: min(980px, calc(100% - 24px)); }
dialog.dlg::backdrop { background: rgba(15,20,30,.4); }
dialog.dlg .dh { padding: 16px 20px 0; display: flex; align-items: center; gap: 10px; }
dialog.dlg .dh h3 { margin: 0; font-size: 17px; flex: 1; }
dialog.dlg .db { padding: 14px 20px; max-height: 70vh; overflow: auto; }
dialog.dlg .df { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* Bildirimler */
#toasts { position: fixed; right: 20px; bottom: 80px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 440px; }
.toast { background: #1b1f24; color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 13.5px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* İlerleme */
.progress { height: 8px; background: #e6e9ee; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }

/* Hızlı mod */
.scan { font-size: 20px !important; padding: 12px 14px !important; font-family: ui-monospace, Consolas, monospace; }
.feedback { border-radius: 10px; padding: 14px 16px; font-size: 16px; font-weight: 600; margin: 12px 0; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback.warn { background: var(--warn-bg); color: var(--warn); }
.lines .done { color: var(--ok); }

/* Şablon */
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tpl { border: 1px solid var(--line2); background: #fff; border-radius: 10px; padding: 8px; cursor: pointer; text-align: center; }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.tpl svg { width: 100%; height: auto; border: 1px solid var(--line); }

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 26px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }

/* Yazdırma: toplama listesi gibi ekranlar */
@media print {
  .side, .top, .bulkbar, .noprint, #toasts, .demo-band { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  table.t th { position: static; }
  body { background: #fff; }
}
