/* Warsaw production scheduler, web copy. Plain, dense, readable on the floor's screens; no framework. */
:root {
  --ink: #1b2430; --muted: #5b6672; --line: #d9dee5; --bg: #f4f6f8; --card: #ffffff; --accent: #1f3864;
  --ok: #2e7d32; --warn: #b26a00; --bad: #b3261e; --info: #1a5f8a;
  --pack: #1f77b4; --mix: #8c564b; --ship: #2ca02c; --truck: #ff7f0e; --late: #d62728; --label: #9467bd; --pick: #17becf; --plan: #7f7f7f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.wrap { white-space: normal; max-width: 42em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
main { padding: 14px 18px 40px; max-width: 1800px; margin: 0 auto; }
.narrow { max-width: 460px; margin: 60px auto; }
.lead { font-size: 16px; }

/* header */
.top { display: flex; align-items: center; gap: 18px; padding: 8px 18px; background: var(--accent); color: #fff; flex-wrap: wrap; }
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 600; font-size: 15px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #e3e8ef; color: var(--ink); vertical-align: middle; white-space: nowrap; }
.brand .tag, .who .tag { background: rgba(255,255,255,.2); color: #fff; }
.tag.ok { background: #d8f0d9; color: var(--ok); }
.tag.warn { background: #fde9c8; color: var(--warn); }
.tag.bad { background: #f8d7d5; color: var(--bad); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { padding: 5px 10px; border-radius: 4px; }
.main-nav a.active, .main-nav a:hover { background: rgba(255,255,255,.18); }
.who { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.foot { padding: 10px 18px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
form.inline { display: inline; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.who button.link { color: #fff; }

/* notices */
.flash, .banner { padding: 8px 12px; border-radius: 4px; margin: 0 0 10px; border: 1px solid var(--line); background: var(--card); }
.flash.ok { border-color: #bfe3c0; background: #eef9ee; }
.flash.bad, .banner.bad { border-color: #f1b8b4; background: #fdecea; }
.banner.warn { border-color: #f5d79b; background: #fff6e5; }
.banner.info { border-color: #bcd8ea; background: #eaf4fb; }

/* layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 0 0 12px; }
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cards.wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card.metric { text-decoration: none; color: inherit; display: block; }
.card.metric h3 { margin: 0 0 4px; }
.card.metric .value { font-size: 26px; font-weight: 600; margin: 0; }
.card.metric .sub { margin: 2px 0 6px; color: var(--muted); font-size: 12px; }
.card.metric.indent { margin-left: 12px; }
.spark { display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.page-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.run-picker select { max-width: 420px; }
.run-line strong { font-family: Consolas, monospace; font-weight: 600; }
.big { font-size: 18px; margin: 4px 0; }
.links { padding-left: 18px; }
.notes { padding-left: 18px; margin: 4px 0; }
.notes li { margin-bottom: 3px; }
.note { background: #fbfcfd; border-left: 3px solid var(--line); padding: 6px 10px; margin: 6px 0; color: var(--muted); }
.gap { height: 8px; }
.prose p { margin: 4px 0; }
.prose .kv span { display: inline-block; margin-right: 16px; }
.prose .kv span:first-child { font-weight: 600; min-width: 220px; }
pre.log { background: #fbfcfd; border: 1px solid var(--line); padding: 10px; white-space: pre-wrap; font-size: 12px; max-height: 80vh; overflow: auto; }

/* forms */
.form label { display: block; margin: 8px 0; }
.form input:not([type=checkbox]), .form select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.inline-form label { display: inline-block; margin-right: 10px; }
.inline-form input:not([type=checkbox]) { width: auto; }
.inline-label { display: inline-block !important; margin-left: 8px; }
button, .button { font: inherit; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.small { padding: 2px 7px; font-size: 12px; }
button.active { background: #e3e8ef; }
.actions { margin-top: 10px; }
.actions-cell form { margin-right: 6px; }
.actions-cell input { width: 130px; padding: 2px 6px; font-size: 12px; }
.error { color: var(--bad); }
dialog { border: 1px solid var(--line); border-radius: 6px; max-width: 520px; width: 90%; }
dialog::backdrop { background: rgba(0,0,0,.3); }
dialog input, dialog select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
dialog label { display: block; margin: 8px 0; }

/* tables */
.table-wrap { overflow: auto; max-width: 100%; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
table.data th { background: #eef1f5; position: sticky; top: 0; white-space: nowrap; font-weight: 600; }
table.sortable th { cursor: pointer; }
table.sortable th.sorted-asc::after { content: " \25B2"; font-size: 10px; }
table.sortable th.sorted-desc::after { content: " \25BC"; font-size: 10px; }
table.data.compact th, table.data.compact td { padding: 2px 6px; font-size: 12.5px; }
table.data td.n, table.data th.n { color: var(--muted); text-align: right; width: 1%; }
table.data tr.total td { font-weight: 600; background: #f7f8fa; }
table.data tr.hidden-row { display: none; }
.table-tools { display: flex; gap: 10px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.table-tools input[type=search] { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; min-width: 260px; font: inherit; }
.table-tools select, .table-tools input[type=date] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; align-items: center; }
.chip { padding: 2px 8px; border: 1px solid rgba(0,0,0,.12); border-radius: 10px; font-size: 12px; }
.pager { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: 6px 0 10px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 5px 10px; text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0; }
.tabs a.active { background: #fff; border-color: var(--line); font-weight: 600; }
.tabs-list { columns: 2; padding-left: 18px; margin: 4px 0; }
.kpis .card.metric .value { font-size: 22px; }
details.inline { display: inline; }
figure.chart { margin: 8px 0 12px; }
figure.chart figcaption { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.chart-box svg { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; }

/* production late grid */
table.late-grid td.edit { min-width: 150px; }
table.late-grid td.notes { min-width: 260px; }
table.late-grid textarea, table.late-grid input, table.late-grid select { width: 100%; font: inherit; font-size: 12.5px; border: 1px solid var(--line); border-radius: 3px; padding: 3px 5px; background: #fffef5; }
table.late-grid input.short { width: 70px; }
table.late-grid tr.order-first td { border-top: 2px solid #c9d0d9; }
table.late-grid td.order-cell { font-family: Consolas, monospace; white-space: nowrap; }
.late-input.saving { outline: 2px solid #bcd8ea; }
.late-input.saved { outline: 2px solid #bfe3c0; }
.late-input.failed { outline: 2px solid #f1b8b4; }
.pending-tag { display: block; margin-top: 2px; width: max-content; }

/* calendar */
.cal-controls .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.cal-controls .nav strong { margin-left: 8px; font-size: 16px; }
.cal-controls .filters input[type=search] { min-width: 260px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.cal-controls select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.layer-toggle { padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); font-size: 12.5px; }
.layer-toggle::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; background: var(--plan); }
.layer-pack::before { background: var(--pack); } .layer-mix::before { background: var(--mix); } .layer-ship::before { background: var(--ship); }
.layer-truck::before { background: var(--truck); } .layer-late::before { background: var(--late); } .layer-label::before { background: var(--label); }
.layer-pick::before { background: var(--pick); } .layer-plan::before { background: var(--plan); }
.calendar { min-height: 300px; padding: 8px; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.month .dow { font-weight: 600; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.day { border: 1px solid var(--line); border-radius: 4px; min-height: 96px; padding: 2px 4px; background: #fff; }
.day.other { background: #f7f8fa; color: var(--muted); }
.day.today { outline: 2px solid var(--accent); }
.day.weekend { background: #fbfbfc; }
.day .dnum { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.day .dnum .badge { background: var(--ship); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; cursor: pointer; }
.week .day { min-height: 320px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ev { display: block; font-size: 11.5px; line-height: 1.25; padding: 1px 4px; margin: 1px 0; border-radius: 3px; border-left: 3px solid var(--plan); background: #f3f5f8; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ev.l-pack { border-left-color: var(--pack); } .ev.l-mix { border-left-color: var(--mix); } .ev.l-ship { border-left-color: var(--ship); }
.ev.l-truck { border-left-color: var(--truck); } .ev.l-late { border-left-color: var(--late); } .ev.l-label { border-left-color: var(--label); }
.ev.l-pick { border-left-color: var(--pick); } .ev.l-plan { border-left-color: var(--plan); }
.more { font-size: 11px; color: var(--accent); cursor: pointer; }
.lanes { overflow: auto; }
.lanes .lane-grid { position: relative; min-width: 100%; }
.lanes .lane-row { display: grid; grid-template-columns: 180px 1fr; border-bottom: 1px solid var(--line); }
.lanes .lane-name { padding: 4px 6px; font-size: 12.5px; font-weight: 600; background: #f7f8fa; position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
.lanes .lane-body { position: relative; }
.lanes .lane-days { display: grid; }
.lanes .lane-day { border-left: 1px solid #eef1f5; min-height: 100%; }
.lanes .lane-day.weekend { background: #fbfbfc; }
.lanes .bar { position: absolute; height: 20px; font-size: 11px; line-height: 20px; padding: 0 5px; border-radius: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; border: 1px solid rgba(0,0,0,.15); color: #111; }
.lanes .head { display: grid; grid-template-columns: 180px 1fr; }
.lanes .head .days { display: grid; }
.lanes .head .days div { font-size: 11.5px; color: var(--muted); padding: 2px 4px; border-left: 1px solid #eef1f5; }
.drawer { position: fixed; top: 0; right: 0; width: min(560px, 95vw); height: 100vh; background: #fff; border-left: 1px solid var(--line); box-shadow: -4px 0 16px rgba(0,0,0,.12); padding: 12px 14px; overflow: auto; z-index: 20; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer table.kv td:first-child { color: var(--muted); white-space: nowrap; padding-right: 10px; }
.drawer table.kv td { padding: 2px 4px; border-bottom: 1px solid #f0f2f5; vertical-align: top; font-size: 12.5px; }
.drawer .day-list .ev { white-space: normal; }
@media print { .top, .foot, .cal-controls, .table-tools, .run-picker, button { display: none !important; } main { padding: 0; } }
