/* Allegro Drop — panel operacyjny.
   Kierunek: biurko pakowania. Spokojna, chłodna baza (papier, granat tuszu), jeden mocny akcent
   w kolorze taśmy pakowej dla rzeczy „do zrobienia teraz". Szczegóły zamówienia wyglądają jak
   etykieta wysyłkowa — to jedyny ozdobny element; reszta jest cicha i gęsta. */

:root {
  --paper: #eef1f4;
  --sheet: #ffffff;
  --ink: #14213d;
  --ink-2: #4a5671;
  --line: #d5dbe3;
  --tape: #f2a900;      /* akcent: do kupienia / wymaga uwagi */
  --tape-ink: #5a3e00;
  --ok: #0f766e;        /* wysłane */
  --bad: #b42318;       /* problem */
  --info: #2c5282;      /* kupione */
  --mute: #8a94a6;      /* anulowane */
  --radius-s: 4px;
  --radius-m: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1626;
    --sheet: #18213a;
    --ink: #e6ebf3;
    --ink-2: #a9b3c7;
    --line: #2b3754;
    --tape: #f2b632;
    --tape-ink: #2a1d00;
    --ok: #34b3a6;
    --bad: #f0786c;
    --info: #7fa7dd;
    --mute: #6f7a90;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--font); }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--tape); outline-offset: 2px; }

/* ---------- logowanie ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 4px; font-weight: 600; }

/* ---------- układ ---------- */
.app { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #dfe5f0; display: flex; flex-direction: column; padding: 18px 10px; gap: 2px; position: sticky; top: 0; height: 100vh; }
@media (prefers-color-scheme: dark) { .side { background: #0a1020; } }
.brand { font-weight: 800; font-size: 16px; padding: 4px 10px 18px; color: #fff; }
.side a { text-decoration: none; padding: 8px 10px; border-radius: var(--radius-s); display: flex; justify-content: space-between; align-items: center; color: #c9d2e3; }
.side a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.side a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--tape); }
.side .count { background: var(--tape); color: var(--tape-ink); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.side .count:empty { display: none; }
.side-foot { margin-top: auto; padding: 10px; font-size: 13px; color: #9fabc2; display: grid; gap: 4px; }
.side-foot .link { color: #c9d2e3; justify-self: start; }

.main { padding: 24px 28px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin-right: auto; }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; }
  .brand, .side-foot { display: none; }
  .side a { white-space: nowrap; }
  .main { padding: 16px; }
}

/* ---------- elementy ---------- */
a.btn { text-decoration: none; display: inline-block; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); border-radius: var(--radius-s); padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.btn.tape { background: var(--tape); border-color: var(--tape); color: var(--tape-ink); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 7px 9px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
.error { color: var(--bad); min-height: 1em; margin: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.chip b { font-variant-numeric: tabular-nums; margin-left: 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { max-width: 260px; }
.toolbar select { width: auto; }

/* statusy */
.st { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.st-do_kupienia { background: var(--tape); border-color: var(--tape); color: var(--tape-ink); }
.st-kupione { color: var(--info); }
.st-wyslane { color: var(--ok); }
.st-problem { background: var(--bad); border-color: var(--bad); color: #fff; }
.st-anulowane { color: var(--mute); }
.st-zgloszony { color: var(--tape-ink); background: var(--tape); border-color: var(--tape); }
.st-odebrany { color: var(--info); }
.st-odeslany, .st-zamkniety { color: var(--mute); }
.st-na_stanie { color: var(--ok); }

/* tabele */
.table-wrap { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 650; color: var(--ink-2); background: var(--paper); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.nowrap, th.nowrap { white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: color-mix(in srgb, var(--paper) 60%, var(--sheet)); }
td .thumb { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius-s); background: var(--paper); display: block; }
.flag { font-size: 12px; font-weight: 650; }
.flag.bad { color: var(--bad); }
.flag.warn { color: var(--tape-ink); background: var(--tape); padding: 1px 6px; border-radius: var(--radius-s); }
.flag.ok { color: var(--ok); }
.empty { padding: 32px; text-align: center; color: var(--ink-2); }

/* ---------- pulpit: taśma zamówień w kolejności pracy ---------- */
.flow { display: grid; grid-template-columns: repeat(3, 1fr) 0.8fr; gap: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 20px; }
.lane { padding: 16px 18px; border-right: 1px solid var(--line); cursor: pointer; text-decoration: none; display: block; }
.lane:last-child { border-right: 0; }
.lane:hover { background: var(--paper); }
.lane .n { font-size: 34px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; display: block; margin-bottom: 4px; }
.lane.now { background: var(--tape); color: var(--tape-ink); }
.lane.now:hover { background: color-mix(in srgb, var(--tape) 88%, #000); }
.lane.alarm .n { color: var(--bad); }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr 1fr; } .lane { border-bottom: 1px solid var(--line); } }

.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; }
.panel h2 { margin-bottom: 10px; }
.money { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; }
.money .total { font-weight: 750; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attention button { width: 100%; text-align: left; font: inherit; background: var(--paper); border: 0; border-left: 3px solid var(--tape); padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; color: var(--ink); }
.attention .problem button, .attention .gone button { border-left-color: var(--bad); }

/* ---------- panel boczny ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 32, 0.4); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--paper); overflow-y: auto; padding: 44px 22px 22px; box-shadow: -8px 0 30px rgba(10, 16, 32, 0.25); }
.drawer-close { position: absolute; top: 10px; right: 12px; font-size: 26px; background: none; border: 0; cursor: pointer; color: var(--ink-2); line-height: 1; }
.drawer section { margin-top: 18px; }
.drawer h3 { margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Etykieta wysyłkowa — jedyny ozdobny element panelu */
.label { background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--radius-s); display: grid; grid-template-columns: 1fr auto; }
.label > div { padding: 12px 14px; }
.label .to { border-right: 2px solid var(--ink); }
.label .to small, .label .meta small { display: block; font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.label .to strong { font-size: 16px; display: block; }
.label .meta { display: grid; gap: 8px; align-content: start; min-width: 170px; }
.label .order-no { font: 700 22px/1 var(--mono); letter-spacing: 0.02em; }
.label .bars { grid-column: 1 / -1; border-top: 2px solid var(--ink); height: 30px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 13px); opacity: 0.85; }
@media (max-width: 520px) { .label { grid-template-columns: 1fr; } .label .to { border-right: 0; border-bottom: 2px solid var(--ink); } .form-grid { grid-template-columns: 1fr; } }

.lines { display: grid; gap: 8px; }
.line { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; display: grid; gap: 4px; }
.line .top { display: flex; justify-content: space-between; gap: 10px; }
.history { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.history li { padding: 4px 0 8px 12px; position: relative; font-size: 13px; }
.history li::before { content: ""; position: absolute; left: -5px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: var(--radius-s); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); color: #fff; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
