/* Symulator przepływu pracy – style. Idiom Object UI: teal tło z siatką kropek,
   treść na „papierze”, ostre rogi, bez cieni, mono (IBM Plex Mono, wersaliki)
   do adnotacji technicznych, pomarańcz tylko dla akcji i aktywnej zakładki. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 300; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-300-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 300; font-display: swap; src: url(fonts/ibm-plex-sans-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Phosphor-Thin'; font-display: block; src: url(fonts/Phosphor-Thin.woff2) format('woff2'); }

.ph-thin { font-family: 'Phosphor-Thin' !important; speak: never; font-style: normal; font-weight: normal; line-height: 1; letter-spacing: 0; text-transform: none; -webkit-font-smoothing: antialiased; display: inline-block; }
.ph-play:before { content: "\e3d0"; }
.ph-pause:before { content: "\e39e"; }
.ph-skip-forward:before { content: "\e5a6"; }
.ph-fast-forward:before { content: "\e6a6"; }
.ph-arrow-counter-clockwise:before { content: "\e038"; }
.ph-question:before { content: "\e3e8"; }
.ph-warning:before { content: "\e4e0"; }
.ph-sun:before { content: "\e472"; }
.ph-moon:before { content: "\e330"; }
.ph-sliders-horizontal:before { content: "\e434"; }
.ph-x:before { content: "\e4f6"; }
.ph-check:before { content: "\e182"; }
.ph-star:before { content: "\e46a"; }
.ph-arrow-up:before { content: "\e08e"; }
.ph-arrow-down:before { content: "\e03e"; }
.ph-caret-down:before { content: "\e136"; }
.ph-lightning:before { content: "\e2de"; }

/* ---------- tokeny: motyw jasny ---------- */
:root {
  color-scheme: light;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;

  --bg-base: #2c7a6e;
  --bg-top: #4ab3a2;
  --dot: rgba(255, 255, 255, .28);
  --on-bg: #ffffff;
  --on-bg-muted: rgba(255, 255, 255, .82);
  --glass: rgba(255, 255, 255, .08);
  --glass-hover: rgba(255, 255, 255, .16);
  --glass-line: rgba(255, 255, 255, .5);

  --paper: rgba(244, 247, 246, .96);
  --surface-0: #f4f7f6;
  --surface-1: #f7faf9;
  --card: rgba(15, 33, 30, .04);
  --card-hover: rgba(15, 33, 30, .08);
  --text-primary: #0f211e;
  --text-secondary: rgba(15, 33, 30, .72);
  --text-muted: rgba(15, 33, 30, .55);
  --border: rgba(15, 33, 30, .2);
  --border-focus: rgba(15, 33, 30, .45);
  --grid: rgba(15, 33, 30, .1);

  --accent: #ff9800;
  --accent-hover: #e68900;
  --accent-active: #cc7a00;
  --primary: #4ab3a2;
  --primary-soft: rgba(74, 179, 162, .18);

  /* dane: paleta bez zmian */
  --feature: #2a78d6;
  --bug: #eb6834;
  --critical: #e34948;
  --release: #6250d6;
  --t-feature: #2a78d6;
  --t-bug: #eb6834;
  --t-review: #1baf7a;
  --t-test: #eda100;
  --t-rework: #e87ba4;
  --t-switch: #008300;
  --t-release: #6250d6;
  --t-idle: #d9d8d4;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbeaea;
  --cfd-done: #0d366b;
  --cfd-ready: #1c5cab;
  --cfd-test: #2a78d6;
  --cfd-review: #5598e7;
  --cfd-dev: #86b6ef;
  --cfd-backlog: #c3c2b7;
  --card-ink: #ffffff;
}

/* ---------- tokeny: motyw ciemny (własne odcienie, nie odwrócenie) ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0b1917;
  --bg-top: #143a33;
  --dot: rgba(255, 255, 255, .10);
  --on-bg: #f1f5f4;
  --on-bg-muted: rgba(241, 245, 244, .78);
  --glass: rgba(255, 255, 255, .06);
  --glass-hover: rgba(255, 255, 255, .12);
  --glass-line: rgba(255, 255, 255, .34);

  --paper: rgba(26, 40, 37, .97);
  --surface-0: #15231f;
  --surface-1: #1a2825;
  --card: rgba(241, 245, 244, .06);
  --card-hover: rgba(241, 245, 244, .11);
  --text-primary: #eef3f1;
  --text-secondary: rgba(238, 243, 241, .74);
  --text-muted: rgba(238, 243, 241, .56);
  --border: rgba(238, 243, 241, .22);
  --border-focus: rgba(238, 243, 241, .5);
  --grid: rgba(238, 243, 241, .11);

  --accent: #ffa826;
  --accent-hover: #ffb84d;
  --accent-active: #e69420;
  --primary: #5cc2b1;
  --primary-soft: rgba(92, 194, 177, .2);

  --feature: #5a9ff0;
  --bug: #f3875a;
  --critical: #f26b69;
  --release: #9486f0;
  --t-feature: #5a9ff0;
  --t-bug: #f3875a;
  --t-review: #3ccf98;
  --t-test: #f5bd3f;
  --t-rework: #f29bbf;
  --t-switch: #58c25a;
  --t-release: #9486f0;
  --t-idle: #3b4b47;
  --status-critical: #f26b69;
  --status-critical-bg: rgba(242, 107, 105, .16);
  --cfd-done: #2e5c93;
  --cfd-ready: #3f7fc4;
  --cfd-test: #5f9ee0;
  --cfd-review: #8dbbee;
  --cfd-dev: #bcd6f4;
  --cfd-backlog: #5d6a66;
  --card-ink: #0f1a18;
}

/* ---------- rama strony ---------- */
* { box-sizing: border-box; }
html { height: 100%; background: var(--bg-base); }
body {
  margin: 0; min-height: 100vh;
  font: 14px/1.45 var(--font-sans); color: var(--on-bg);
  -webkit-font-smoothing: antialiased;
}
.bg-layer {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px), linear-gradient(0deg, var(--bg-top) 0%, var(--bg-base) 78%);
  background-size: 24px 24px, 100% 100%; background-position: center;
}
.app { display: flex; flex-direction: column; height: 100vh; min-height: 640px; padding: 12px 16px; gap: 12px; }

h1, h2, h3 { margin: 0; font-weight: 500; }
h1 { font-size: 17px; line-height: 1.2; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
p { margin: 0; }
a { color: inherit; }
a:hover { color: var(--accent-hover); }
.mono, .cap {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .5px; text-transform: uppercase;
}
.cap { color: var(--text-secondary); }
.hint { color: var(--text-secondary); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- pasek górny ---------- */
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand .cap { color: var(--on-bg-muted); font-size: 9px; letter-spacing: 1px; }
.tabs { display: flex; justify-self: center; gap: 0; }
.tab {
  position: relative; height: 36px; padding: 0 18px; border: 1px solid var(--glass-line); border-right-width: 0;
  background: var(--glass); color: var(--on-bg-muted); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
.tab:last-child { border-right-width: 1px; }
.tab:hover { background: var(--glass-hover); color: var(--on-bg); }
.tab[aria-selected="true"] { color: var(--on-bg); background: var(--glass-hover); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 4px; background: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ---------- przyciski i pola ---------- */
button, select, input { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); background: transparent; color: var(--text-primary); cursor: pointer; border-radius: 0;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
  transition: border-color .15s, background-color .15s;
}
.btn:hover { border-color: var(--border-focus); background: var(--card); }
.btn:disabled { opacity: .5; cursor: default; }
.btn i { font-size: 15px; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.accent:active { background: var(--accent-active); }
[data-theme="dark"] .btn.accent { color: #0b1917; }
.btn.ghost { border-color: var(--glass-line); color: var(--on-bg); background: var(--glass); }
.btn.ghost:hover { background: var(--glass-hover); border-color: var(--on-bg); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 10px; }
.btn.icon { width: 32px; padding: 0; }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.field > span.cap { font-size: 10px; }
input[type=number], select, input[type=text] {
  height: 28px; padding: 0 6px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); border-radius: 0;
  font-variant-numeric: tabular-nums; font-size: 13px;
}
input[type=number]:focus, select:focus { outline: 1px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
input.short { width: 64px; }
input[type=range] { accent-color: var(--primary); width: 90px; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }

/* ---------- widoki ---------- */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: grid; }
.view-sim { grid-template-columns: 232px minmax(0, 1fr) 312px; gap: 12px; }
.view-params, .view-compare { grid-template-columns: minmax(0, 1fr); align-content: start; overflow: auto; }

.sheet {
  background: var(--paper); color: var(--text-primary);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sheet-head h2 { display: flex; align-items: center; gap: 6px; }

/* pomoc „?” */
.help {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; flex: 0 0 15px;
  border: 1px solid var(--border); color: var(--text-secondary); font-family: var(--font-mono); font-size: 10px; cursor: help; vertical-align: 1px; margin-left: 2px;
}
.help:hover { border-color: var(--border-focus); color: var(--text-primary); }

/* ---------- lewa szpalta: strategie ---------- */
.strat-list { display: flex; flex-direction: column; gap: 4px; overflow: auto; min-height: 0; flex: 1; }
.strat {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 1px solid transparent; background: transparent; cursor: pointer; color: inherit;
}
.strat:hover { background: var(--card); }
.strat.active { background: var(--card); border-color: var(--border-focus); cursor: default; }
.strat .name { display: block; font-size: 13px; font-weight: 500; line-height: 1.25; }
.strat .dna { display: flex; flex-wrap: wrap; gap: 3px 4px; margin-top: 4px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .3px; text-transform: uppercase; color: var(--text-secondary); line-height: 1.3; }
.strat .dna b { font-weight: 500; color: var(--text-primary); }
.strat .dna .flag { padding: 0 4px; border: 1px solid var(--border); white-space: nowrap; }
.strat .dna .flag.on { border-color: var(--primary); background: var(--primary-soft); color: var(--text-primary); }
.strat .desc { font-size: 12px; color: var(--text-secondary); margin-top: 6px; text-wrap: pretty; line-height: 1.4; }
.strat .actions { margin-top: 8px; display: flex; gap: 6px; }

/* szuflada edytora strategii */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 20; padding: 16px 18px; overflow: auto;
  background: var(--paper); color: var(--text-primary); border-left: 1px solid var(--glass-line);
  display: flex; flex-direction: column; gap: 12px; transform: translateX(100%); transition: transform .25s cubic-bezier(.16, 1, .3, 1);
}
.drawer.open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(0, 0, 0, .35); display: none; }
.drawer-backdrop.open { display: block; }
#strategyEditor { display: flex; flex-wrap: wrap; gap: 20px 28px; }
.editor-col { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.editor-col h3 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; }
.editor-col label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.order-list { list-style: none; margin: 0; padding: 0; min-width: 280px; }
.order-list li { display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin-bottom: 2px; background: var(--card); border: 1px solid var(--border); font-size: 13px; }
.order-list li.off span { color: var(--text-muted); text-decoration: line-through; }
.order-list li span { flex: 1; }
.order-list .n { flex: 0 0 18px; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.order-list button { height: 22px; width: 22px; padding: 0; border: 1px solid var(--border); background: transparent; cursor: pointer; color: inherit; }
.order-list button:disabled { opacity: .35; cursor: default; }
.weights { display: grid; grid-template-columns: auto 80px; gap: 4px 10px; align-items: center; font-size: 13px; }

/* ---------- środek: tablica ---------- */
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.transport .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.clock { display: flex; flex-direction: column; gap: 3px; flex: 1 1 150px; margin-left: auto; }
.clock .t { font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); text-align: right; }
.clock .bar { height: 3px; background: var(--grid); }
.clock .bar i { display: block; height: 100%; background: var(--primary); width: 0; }
.board-area { position: relative; flex: 1 1 0; min-height: 300px; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 12px; color: var(--card-ink); font-style: normal; font-size: 9px; font-weight: 700; }
.sw.rework { background-image: linear-gradient(135deg, transparent 22%, var(--card-ink) 22%, var(--card-ink) 38%, transparent 38%) !important; }

/* ludzie: jeden wiersz na osobę, nic się nie ucina */
.people { display: grid; grid-template-columns: 1fr; gap: 3px; border-top: 1px solid var(--grid); padding-top: 8px; }
.person { display: grid; grid-template-columns: 62px 10px minmax(0, 1fr) 96px 150px; gap: 8px; align-items: center; font-size: 12px; min-height: 20px; }
.person .pname { font-weight: 500; }
.person .dot { width: 10px; height: 10px; }
.person .what { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .what b { color: var(--text-primary); font-weight: 500; }
.person .left, .person .mine { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11.5px; }
.person .left { text-align: right; }
.person .duty { font-family: var(--font-mono); font-size: 9px; letter-spacing: .5px; text-transform: uppercase; border: 1px solid var(--primary); background: var(--primary-soft); padding: 0 4px; margin-left: 4px; }

/* ---------- prawa szpalta: metryki ---------- */
.metrics { overflow: auto; }
.callout { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 8px 10px; border: 1px solid var(--status-critical); background: var(--status-critical-bg); }
.callout i { grid-row: 1 / 3; font-size: 20px; color: var(--status-critical); align-self: center; }
.callout .cap { color: var(--status-critical); }
.callout .where { font-size: 14px; font-weight: 500; line-height: 1.2; }
.callout small { grid-column: 2; font-size: 11.5px; color: var(--text-secondary); line-height: 1.35; }
.callout.none { border-color: var(--border); background: transparent; }
.callout.none i, .callout.none .cap { color: var(--text-secondary); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kpi { padding: 8px 10px; background: var(--card); min-width: 0; display: flex; flex-direction: column; }
.kpi .l { display: flex; align-items: center; gap: 2px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-secondary); line-height: 1.2; min-height: 24px; }
.kpi .v { font-size: 26px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.3px; margin-top: 2px; }
.kpi .v small { font-size: 13px; font-weight: 400; color: var(--text-secondary); margin-left: 2px; }
.kpi .s { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.alert .v { color: var(--status-critical); }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary i { font-size: 14px; transition: transform .15s; }
details.more[open] > summary i { transform: rotate(180deg); }
details.more dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; margin: 6px 0 2px; font-size: 12.5px; }
details.more dt { color: var(--text-secondary); display: flex; align-items: center; gap: 2px; }
details.more dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
details.more .sep { grid-column: 1 / -1; border-top: 1px solid var(--grid); margin: 3px 0; }

.chart { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--grid); padding-top: 8px; }
.chart .sheet-head { align-items: baseline; }
.chart h3 { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; }
.chart label { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-secondary); }
#cfd { width: 100%; height: 170px; display: block; }
.trow { display: grid; grid-template-columns: 56px 1fr 44px; gap: 8px; align-items: center; font-size: 11.5px; }
.trow .lbl { color: var(--text-secondary); }
.trow .val { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 1px; height: 12px; }
.stack i { display: block; height: 100%; }

/* ---------- parametry ---------- */
.params-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-secondary); font-size: 13px; }
.params-note .state { flex: none; white-space: nowrap; font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--border); color: var(--text-primary); }
#params { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; align-items: start; }
.pcol { display: flex; flex-direction: column; min-width: 0; }
fieldset { border: 0; border-top: 1px solid var(--border); margin: 0 0 18px; padding: 8px 0 0; min-width: 0; }
legend { font-family: var(--font-mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); padding: 0 8px 0 0; font-weight: 500; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 3px 0; font-size: 14px; }
.prow label { color: var(--text-primary); }
.prow input[type=number] { width: 72px; }
.prow .range { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: 12px; }
.prow .range input { width: 58px; }

/* ---------- porównanie ---------- */
.cmp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cmp-summary { font-size: 18px; line-height: 1.4; text-wrap: pretty; }
.cmp-summary b { font-weight: 500; }
.cmp-summary .cap { display: block; margin-bottom: 2px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.cmp-table th, .cmp-table td { padding: 9px 12px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; vertical-align: middle; }
.cmp-table th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; white-space: normal; line-height: 1.25; vertical-align: bottom; min-width: 96px; }
.cmp-table th .unit { display: block; color: var(--text-muted); text-transform: none; letter-spacing: 0; white-space: nowrap; margin-top: 2px; }
.cmp-table th:first-child, .cmp-table td:first-child, .cmp-table td.txt, .cmp-table th.txt, .cmp-table td.name { text-align: left; }
.cmp-table td.name { font-size: 17px; font-weight: 500; }
.cmp-table td.rank { font-family: var(--font-mono); color: var(--text-secondary); width: 40px; }
.cmp-table td.best { font-weight: 600; }
.cmp-table td.best .star { color: var(--accent-active); margin-right: 4px; }
[data-theme="dark"] .cmp-table td.best .star { color: var(--accent); }
.cmp-table tr.cur td { background: var(--primary-soft); }
.cmp-table tr.cur td.name::after { content: "selected"; font-family: var(--font-mono); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; border: 1px solid var(--primary); padding: 1px 5px; margin-left: 8px; vertical-align: 2px; font-weight: 500; }
.cmp-table .score { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cmp-table .scorebar { display: inline-block; height: 12px; background: var(--primary); }
.cmp-table .scorebar.neg { background: var(--status-critical); }
.cmp-table td.extra, .cmp-table th.extra { display: none; }
.cmp-table.all td.extra, .cmp-table.all th.extra { display: table-cell; }
.cmp-table .pick { height: 26px; }
.cmp-note { color: var(--text-secondary); font-size: 13px; max-width: 900px; text-wrap: pretty; }

/* ---------- podpowiedź, komunikat ---------- */
.tip {
  position: fixed; pointer-events: none; z-index: 30; background: var(--text-primary); color: var(--surface-1);
  padding: 7px 10px; font-size: 12.5px; line-height: 1.4; max-width: 300px; text-wrap: pretty;
}
.tip .row { display: flex; gap: 10px; justify-content: space-between; }
.tip i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 16px); z-index: 25; opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--text-primary); color: var(--surface-1);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .4px; text-transform: uppercase; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast i { font-size: 15px; }

/* ---------- węższe ekrany ---------- */
@media (max-width: 1280px) {
  .app { height: auto; min-height: 100vh; }
  .view-sim { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto auto; }
  .view-sim .metrics { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto 1fr; gap: 12px 24px; overflow: visible; }
  .view-sim .metrics .callout, .view-sim .metrics .kpis, .view-sim .metrics .more { grid-column: 1; }
  .view-sim .metrics .chart { grid-row: 1 / 4; grid-column: 2; border-top: 0; padding-top: 0; }
  .view-sim .metrics .chart + .chart { grid-column: 3; }
  .board-area { min-height: 460px; }
  .person { grid-template-columns: 62px 10px minmax(0, 1fr) 96px; }
  .person .mine { display: none; }
  #params { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .view-sim { grid-template-columns: minmax(0, 1fr); }
  .view-sim .metrics { grid-template-columns: 1fr; grid-template-rows: none; }
  .view-sim .metrics .chart { grid-row: auto; grid-column: 1 !important; }
  .topbar { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; justify-self: start; }
  #params { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .toast, .tab { transition: none; }
}
