/* Okna dialogowe, toasty, wykresy, skaner, widoki mobilne. */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 24px 70px rgba(18, 26, 43, .35); color: var(--text); }
dialog::backdrop { background: rgba(18, 26, 43, .5); }
dialog.wide { width: min(880px, calc(100vw - 24px)); }
.dlg { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 24px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.dlg-body { padding: 8px 22px 18px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbfd; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 24px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--text); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 600; }
.toast.ok { background: #166534; } .toast.err { background: #991b1b; }

/* Wykresy SVG */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--font); fill: var(--faint); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-in { fill: var(--primary); } .chart .bar-out { fill: var(--accent); }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); padding: 0 20px 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.donut-wrap { display: grid; place-items: center; padding: 14px 0 6px; }
.donut-wrap .donut-label { text-align: center; }
.donut-label b { display: block; font-size: 1.7rem; line-height: 1.1; }
.donut-legend { display: grid; gap: 6px; padding: 0 20px 16px; font-size: .86rem; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Logowanie */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #e8f0ff, #fff1e6); }
.auth-card { width: min(440px, 100%); padding: 28px; display: grid; gap: 18px; }
.auth-card .brand { padding: 0; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-switch { text-align: center; color: var(--muted); font-size: .92rem; }
.auth-switch button { background: none; border: 0; color: var(--primary); font: 600 .92rem var(--font); cursor: pointer; padding: 0; }

/* Skaner */
.scan-view { display: grid; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%; }
.scan-frame { position: relative; border-radius: 18px; overflow: hidden; background: #0b1220; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.scan-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-reticle { position: relative; width: 72%; height: 44%; border-radius: 12px; }
.scan-reticle::before, .scan-reticle::after { content: ""; position: absolute; width: 28px; height: 28px; border: 4px solid #fff; border-radius: 6px; }
.scan-reticle::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-reticle::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-hint { position: absolute; bottom: 12px; left: 12px; right: 12px; text-align: center; color: #fff; font-size: .85rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.scan-result { padding: 16px; display: grid; gap: 12px; }
.scan-result .qty-big { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.actions-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.actions-3 .btn { flex-direction: column; min-height: 64px; gap: 4px; font-size: .86rem; }
.pick-card { padding: 16px; display: grid; gap: 10px; border-left: 5px solid var(--accent); }
.pick-card .where { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.pick-card.done { border-left-color: var(--ok); opacity: .7; }

.qty-input { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.qty-input input { text-align: center; font-size: 1.5rem; font-weight: 800; min-height: 56px; }
.qty-input button { min-height: 56px; font-size: 1.6rem; }
.lines-table input { min-width: 80px; }
.lines-table .btn.sm { min-height: 34px; }
.lines-table th.num, .lines-table td.num { text-align: left; }
.lines-table input[type=number] { max-width: 120px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

@media (max-width: 960px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.halves { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 14px; } .kpi .value { font-size: 1.55rem; }
  dialog { width: 100vw; max-width: 100vw; max-height: 94vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .dlg-foot .btn { flex: 1; min-height: var(--tap); }
  .toasts { left: 12px; right: 12px; bottom: 96px; max-width: none; }
  .table th, .table td { padding: 10px 12px; }
  .hide-mobile { display: none; }
}
@media print { .sidebar, .topbar, .bottomnav, .fab-scan, .no-print { display: none !important; } body { background: #fff; } .shell { display: block; } .content { padding: 0; } }
