/* Rüsselsheim – retro workbench look with modern standards (contrast, focus, scaling). */
:root {
  --scale: 1;
  --bg: #1b3a5c;
  --bar: #0f2338;
  --bar-text: #f4f1e6;
  --panel: #c9c5b8;
  --panel-2: #b7b3a6;
  --panel-3: #dedacd;
  --ink: #111111;
  --muted: #4a473f;
  --light: #ffffff;
  --shadow: #4b483f;
  --accent: #e07a1f;
  --primary: #1f5fa8;
  --primary-ink: #ffffff;
  --danger: #8a1c14;
  --good: #1d6b2f;
  --bad: #a3180e;
  --warn: #8a5300;
  --wall: #6c5237;
  --wainscot: #4d3a26;
  --floor: #2e231a;
  --rug: #6a2a24;
  --desk: #8a5e36;
  --desk-front: #644327;
  --focus: #ffcf3f;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(16px * var(--scale)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Trebuchet MS", sans-serif;
  line-height: 1.45;
  min-height: 100vh;
}
.app { min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 0.7rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: #000; padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- bars ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  background: var(--bar); color: var(--bar-text);
  padding: 0.4rem 0.8rem; border-bottom: 3px solid #000;
}
.topbar .brand strong { font-size: 1.25rem; letter-spacing: 0.04em; }
.brand-company { display: flex; align-items: center; gap: 0.6rem; background: none; border: 0; color: inherit; cursor: pointer; padding: 0.15rem; min-height: 44px; text-align: left; }
.brand-company small { display: block; opacity: 0.8; }
.co-name strong { display: block; }
.topbar .stat small { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }
.topbar .stat strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.topbar .bad { color: #ff9e92; }
.header-actions { margin-left: auto; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.warn-badge { background: #8a1c14; color: #fff; }

.crumbs { display: flex; align-items: center; gap: 0.8rem; padding: 0.5rem 0.8rem 0; max-width: 1240px; width: 100%; margin: 0 auto; }
.crumbs:empty { display: none; }
.screen-title { color: #fff; margin: 0; font-size: 1.4rem; }
.screen { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 0.8rem; outline: none; }
.screen > .screen-title { margin-bottom: 0.8rem; }

.helpbar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; justify-content: space-between;
  background: var(--bar); color: var(--bar-text); padding: 0.4rem 0.8rem; border-top: 3px solid #000; font-size: 0.92rem;
  min-height: 3rem;
}
.help-text { flex: 1 1 300px; }
.next-action { background: var(--accent); color: #111; border: 2px solid; border-color: #ffd9a8 #6a3a00 #6a3a00 #ffd9a8; padding: 0.3rem 0.7rem; cursor: pointer; text-align: left; flex: 1 1 280px; min-height: 40px; font: inherit; }
.next-action[hidden] { display: none; }

/* ---- panels and buttons --------------------------------------------- */
.panel {
  background: var(--panel); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  padding: 0.9rem; margin-bottom: 0.9rem; box-shadow: 2px 2px 0 #000;
}
.btn {
  background: var(--panel-2); color: var(--ink); font: inherit; cursor: pointer;
  border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  padding: 0.4rem 0.8rem; min-height: 44px; min-width: 44px;
}
.btn:hover:not(:disabled) { background: #d6d2c4; }
.btn:active:not(:disabled) { border-color: var(--shadow) var(--light) var(--light) var(--shadow); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { background: #2a72c4; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 0.2rem 0.55rem; font-size: 0.9rem; }
.btn.big { font-size: 1.15rem; padding: 0.7rem 1.2rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 0.6rem; }
.segmented { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.presets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.3rem 0 0.6rem; }
.tag { display: inline-block; background: var(--panel-3); border: 1px solid var(--shadow); padding: 0 0.4rem; font-size: 0.78rem; margin-left: 0.4rem; }
.tag.warn { background: #f3d9a8; }
.tag.new { background: var(--accent); }
.alert-box { border: 2px solid; padding: 0.6rem; margin: 0.6rem 0; background: #f5d4cf; }
.warn-list { margin: 0; padding-left: 1.2rem; }
.warn-list .bad { color: var(--bad); font-weight: 600; }
.warn-list .warn { color: var(--warn); }
.kv { display: grid; grid-template-columns: minmax(10rem, 1fr) auto; gap: 0.25rem 1rem; margin: 0 0 0.7rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.check input { width: 1.3rem; height: 1.3rem; }

input[type="text"], input[type="number"], select {
  font: inherit; color: var(--ink); background: #fff; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  min-height: 44px; padding: 0.2rem 0.5rem; max-width: 100%;
}
input[type="range"] { accent-color: var(--primary); min-height: 44px; }
.field { display: grid; gap: 0.2rem; margin-bottom: 0.6rem; }
.field.inline { display: inline-grid; margin: 0; }
.field-label { font-weight: 600; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.85rem; }

.numctl { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.3rem 0; }
.numctl input[type="range"] { flex: 1 1 140px; min-width: 120px; }
.numctl .step { padding: 0 0.3rem; }
.numctl .num-input { width: 7.5rem; text-align: right; }
.numctl .num-out { min-width: 7rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; background: var(--panel-3); }
.tbl caption { text-align: left; font-weight: 700; padding: 0.3rem 0; }
.tbl th, .tbl td { border: 1px solid var(--shadow); padding: 0.35rem 0.55rem; text-align: left; vertical-align: top; }
.tbl thead th { background: #46607a; color: #fff; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl tbody th { background: var(--panel-2); font-weight: 600; }
.override-row { background: #f3d9a8; }

/* ---- title / new game ------------------------------------------------- */
.title-screen { display: grid; place-items: center; padding: 1rem 0; }
.title-card { max-width: 560px; width: 100%; text-align: center; }
.logo { font-size: clamp(2.2rem, 8vw, 3.6rem); letter-spacing: 0.06em; color: var(--primary); text-shadow: 3px 3px 0 #000; margin-bottom: 0.4rem; }
.lead { font-size: 1.1rem; }
.credits { color: #dfe6ee; text-align: center; max-width: 560px; margin-top: 0.8rem; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }
/* A link that looks and sizes like the other title screen buttons. */
.home-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.company-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.company-card { display: flex; gap: 0.7rem; align-items: center; text-align: left; background: var(--panel-3); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.6rem; font: inherit; cursor: pointer; min-height: 64px; }
.company-card small { display: block; color: var(--muted); }
.company-card .perk { color: var(--ink); }
.company-card.selected { outline: 3px solid var(--primary); background: #fff; }
.company-card:disabled { opacity: 0.45; cursor: not-allowed; }
.diff-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.diff small { display: block; }
fieldset.pick { border: 2px solid var(--shadow); }
.handover { max-width: 560px; margin: 2rem auto; text-align: center; }

/* ---- office scene ----------------------------------------------------- */
.scene-wrap { background: #000; border: 3px solid #000; box-shadow: 3px 3px 0 #000; margin-bottom: 0.9rem; }
.scene { display: block; width: 100%; height: auto; }
.scene .obj { cursor: pointer; }
.scene .hit { fill: transparent; }
.scene .frame { fill: #3a2a1a; stroke: #000; stroke-width: 4; }
.scene .cab { fill: #6b7076; stroke: #000; stroke-width: 4; }
.scene .drawer { fill: #8a9097; stroke: #000; stroke-width: 2; }
.scene .table-top { fill: #8a5e36; stroke: #000; stroke-width: 3; }
.scene .blueprint { fill: #1f4f8a; stroke: #000; stroke-width: 3; }
.scene .plate { fill: #f4f1e6; stroke: #000; stroke-width: 2; }
.scene .plate-text { font: 700 13px "Segoe UI", system-ui, sans-serif; fill: #111; }
.scene .obj:hover .plate, .scene .obj:focus-visible .plate { fill: var(--accent); }
.scene .obj:focus-visible { outline: none; }
.scene .obj:focus-visible .hit { stroke: var(--focus); stroke-width: 4; stroke-dasharray: 8 4; }
.scene .obj:hover { filter: brightness(1.12); }
.scene .badge { fill: var(--primary); stroke: #fff; stroke-width: 2; }
.scene .badge.bad { fill: var(--bad); }
.scene .badge.good { fill: var(--good); }
.scene .badge-text { font: 700 13px system-ui, sans-serif; fill: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; }
.kpi small { display: block; color: var(--muted); font-size: 0.78rem; }
.kpi strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
.dept { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-start; position: relative; }
.dept .icon { font-size: 1.3rem; }
.dept .count { margin-left: auto; background: var(--primary); color: #fff; border-radius: 10px; padding: 0 0.45rem; font-size: 0.8rem; }
.alerts .linklike { color: inherit; }

/* ---- design ----------------------------------------------------------- */
.design { display: grid; grid-template-columns: 240px 1fr; gap: 0.9rem; align-items: start; }
.slot-list { display: grid; gap: 0.4rem; }
.slot { text-align: left; background: var(--panel-3); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.5rem; font: inherit; cursor: pointer; min-height: 52px; }
.slot.selected { outline: 3px solid var(--primary); background: #fff; }
.slot small { display: block; color: var(--muted); }
.design-top { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 1rem; margin-bottom: 0.8rem; }
.car-preview svg { width: 100%; height: auto; background: #cfe3ee; border: 2px solid #000; }
.car-svg { display: block; }
.statbar { display: grid; grid-template-columns: 8.5rem 1fr 2.5rem; gap: 0.5rem; align-items: center; margin-bottom: 0.3rem; }
.statbar-track { position: relative; display: block; height: 16px; background: #fff; border: 2px solid #000; }
.statbar-fill { display: block; height: 100%; background: var(--primary); }
.statbar-mark { position: absolute; top: -4px; width: 4px; height: 20px; background: var(--accent); border: 1px solid #000; transform: translateX(-2px); }
.statbar-value { text-align: right; font-variant-numeric: tabular-nums; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.6rem; margin-bottom: 0.8rem; }
.part-picker { border: 2px solid var(--shadow); margin: 0; padding: 0.4rem; }
.part-picker legend { font-weight: 700; padding: 0 0.3rem; }
.part-options { display: grid; gap: 0.3rem; max-height: 280px; overflow-y: auto; }
.part { display: flex; justify-content: space-between; gap: 0.5rem; text-align: left; background: var(--panel-3); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.3rem 0.5rem; font: inherit; cursor: pointer; min-height: 44px; align-items: center; }
.part.selected { outline: 3px solid var(--primary); background: #fff; font-weight: 700; }
.part small { color: var(--muted); white-space: nowrap; }

/* ---- research / factories --------------------------------------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.9rem; }
.meter { display: inline-block; flex: 1; height: 14px; background: #fff; border: 2px solid #000; min-width: 100px; }
.meter-fill { display: block; height: 100%; background: var(--good); }
.meter.bad .meter-fill { background: var(--bad); }
.tech-chain { list-style: none; margin: 0 0 0.6rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tech { background: var(--panel-3); border: 2px solid var(--shadow); padding: 0.2rem 0.45rem; font-size: 0.82rem; display: flex; gap: 0.35rem; }
.tech-year { font-weight: 700; color: var(--muted); }
.tech.done { background: #bfe3bf; border-color: var(--good); }
.tech.current { outline: 3px solid var(--accent); background: #fff; }
.tech.locked { opacity: 0.75; }
.factory-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: center; }
.level-bar { display: flex; gap: 3px; }
.lvl { width: 18px; height: 22px; background: #fff; border: 2px solid #000; }
.lvl.on { background: var(--accent); }
.lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.6rem; margin-top: 0.6rem; }
.line { background: var(--panel-3); border: 2px solid var(--shadow); padding: 0.5rem; }
.line-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.build-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.4rem; }
.build-list .btn { width: 100%; text-align: left; }

/* ---- labour ------------------------------------------------------------ */
.wage-ruler { position: relative; height: 54px; margin: 1.2rem 0.5rem 1.6rem; background: #d8f0d0; border: 2px solid #000; }
.wage-ruler .zone { position: absolute; top: 0; bottom: 0; }
.wage-ruler .zone.risk { background: #e8a198; }
.wage-ruler .zone.low { background: #f3d9a8; }
.wage-ruler .mark { position: absolute; top: -6px; bottom: -6px; width: 4px; background: #000; transform: translateX(-2px); }
.wage-ruler .mark span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 0.78rem; white-space: nowrap; background: var(--panel); padding: 0 3px; }
.wage-ruler .mark.own { background: var(--primary); width: 6px; }
.wage-ruler .mark.own span { top: auto; bottom: 100%; }

/* ---- sales matrix ------------------------------------------------------ */
.bulk { margin-bottom: 0.8rem; }
.cell { display: grid; gap: 0.15rem; min-width: 150px; }
.cell select.override { border-color: var(--accent); }
.cell .est { color: var(--primary); }
.matrix th, .matrix td { vertical-align: top; }

/* ---- map ---------------------------------------------------------------- */
.map-wrap { background: #000; border: 3px solid #000; margin-bottom: 0.8rem; }
.worldmap { display: block; width: 100%; height: auto; }
.region { cursor: pointer; }
.region:hover path { stroke: #fff; stroke-width: 3; }
.region:focus-visible { outline: none; }
.region:focus-visible path { stroke: var(--focus); stroke-width: 5; }
.map-name { font: 700 12px "Segoe UI", system-ui, sans-serif; fill: #111; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.map-value { font: 700 13px "Segoe UI", system-ui, sans-serif; fill: #111; paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.map-badge { font: 700 10px system-ui, sans-serif; fill: #fff; pointer-events: none; }
.map-badge.dark { fill: #000; }
.map-controls { margin-bottom: 0.7rem; }
.map-wrap + .muted { margin: 0.4rem 0.6rem; color: #fff; }
.channel-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.5rem; }

/* ---- reports / messages -------------------------------------------------- */
.reports { display: grid; grid-template-columns: 300px 1fr; gap: 0.9rem; align-items: start; }
.report-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.report-btn { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 0.4rem; }
.report-head { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.print-meta { display: none; }
.chart { width: 100%; max-width: 640px; height: auto; background: #f1efe6; border: 2px solid #000; margin-bottom: 0.8rem; }
.chart-label { font: 12px system-ui, sans-serif; fill: #111; }
.chart-value { font: 700 12px system-ui, sans-serif; fill: #111; }
.legend { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 0.8rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border: 1px solid #000; vertical-align: -2px; }
.msg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.msg { background: var(--panel); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.6rem 0.8rem; border-left: 8px solid var(--shadow); }
.msg.good { border-left-color: var(--good); }
.msg.warn { border-left-color: var(--warn); }
.msg.bad { border-left-color: var(--bad); }
.msg.event { border-left-color: var(--primary); }
.msg-head { display: flex; gap: 0.5rem; align-items: center; color: var(--muted); font-size: 0.85rem; }
.msg h3 { margin: 0.2rem 0; }
.msg p { margin: 0; }
.news-list { margin: 0; padding-left: 1.1rem; }

/* ---- dialogs, toasts, tutorial ------------------------------------------- */
dialog.modal {
  width: min(94vw, 560px); max-height: 88vh; overflow: auto; padding: 0; color: var(--ink);
  background: var(--panel); border: 3px solid; border-color: var(--light) #000 #000 var(--light); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.6);
}
dialog.modal.wide { width: min(94vw, 760px); }
dialog.modal::backdrop { background: rgba(10, 20, 35, 0.7); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; background: #46607a; color: #fff; padding: 0.4rem 0.7rem; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 0.9rem; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding: 0.7rem 0.9rem; border-top: 2px solid var(--shadow); }
.toasts { position: fixed; right: 0.8rem; bottom: 4.6rem; display: grid; gap: 0.4rem; z-index: 60; max-width: min(92vw, 420px); }
.toast { background: var(--bar); color: #fff; border: 2px solid #fff; padding: 0.5rem 0.8rem; box-shadow: 3px 3px 0 #000; }
.toast.error { background: var(--danger); }
.toast.good { background: #1d4f2a; }
.tutorial-host { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0.6rem 0.8rem 0; }
.tutorial-host:empty { display: none; }
.tutorial { background: #fff8d8; border: 3px solid #000; box-shadow: 4px 4px 0 #000; padding: 0.7rem; }
.tut-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.tut-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tut-hl { outline: 4px dashed var(--accent) !important; outline-offset: 3px; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
  .design { grid-template-columns: 1fr; }
  .design-top { grid-template-columns: 1fr; }
  .reports { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .btn.small { min-height: 44px; }
  .screen { padding: 0.5rem; }
  .topbar { gap: 0.3rem 0.6rem; }
  .header-actions { width: 100%; justify-content: stretch; }
  .header-actions .btn { flex: 1 1 auto; }
  .statbar { grid-template-columns: 6.5rem 1fr 2rem; }
  .numctl .num-input { width: 100%; }
  .tbl.responsive thead { position: absolute; left: -9999px; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive th, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border: 2px solid var(--shadow); margin-bottom: 0.6rem; background: var(--panel-3); }
  .tbl.responsive td, .tbl.responsive tbody th { border: 0; border-bottom: 1px solid #aaa; text-align: right; display: flex; justify-content: space-between; gap: 0.6rem; }
  .tbl.responsive td::before { content: attr(data-label); font-weight: 700; text-align: left; }
  .tbl.responsive tbody th::before { content: attr(data-label); }
  .cell { min-width: 0; width: 55%; }
  .toasts { bottom: 5.6rem; }
  .helpbar { font-size: 0.85rem; }
}
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .btn, .panel { border: 2px solid CanvasText; } }

/* ---- print ------------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .helpbar, .crumbs, .toasts, .tutorial-host, .report-list, .no-print, .skip, dialog { display: none !important; }
  .screen { max-width: none; padding: 0; }
  .reports { display: block; }
  .panel { border: 0; box-shadow: none; background: #fff; padding: 0; }
  .print-meta { display: block; font-weight: 700; }
  .tbl thead th { background: #ddd; color: #000; }
  .tbl, .tbl th, .tbl td { border-color: #000; }
  .chart { border-color: #000; background: #fff; }
  .report-body { break-inside: avoid; }
}

/* ---- mobile refinements --------------------------------------------------- */
.office { display: flex; flex-direction: column; }
@media (max-width: 720px) {
  .office .alerts { order: 0; }
  .office .kpis { order: 1; }
  .office .dept-panel { order: 2; }
  .office .scene-wrap { order: 3; }
  .helpbar { position: static; }
  .tutorial p { font-size: 0.95rem; }
  .tut-head { flex-wrap: wrap; }
  .dept-grid { grid-template-columns: repeat(2, 1fr); }
  .company-card { min-height: 72px; }
  .crumbs { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .cell { width: 100%; min-width: 0; flex: 1; }
  .cell select { width: 100%; }
  .tbl.responsive td > .cell, .tbl.responsive th > div { flex: 1; min-width: 0; }
  .bulk { flex-direction: column; align-items: stretch; }
  .bulk .row { flex-wrap: wrap; }
  .bulk select { max-width: 100%; flex: 1; }
  .tbl.responsive tbody th { flex-wrap: wrap; }
  .topbar { padding: 0.3rem 0.5rem; }
  .brand-company { min-height: 40px; }
}
fieldset { min-width: 0; }
.design > *, .reports > *, .design-top > * { min-width: 0; }
.part { flex-wrap: wrap; }
@media (max-width: 720px) {
  .settings .tbl thead { position: absolute; left: -9999px; }
  .settings .tbl, .settings .tbl tbody, .settings .tbl tr, .settings .tbl td { display: block; width: 100%; }
  .settings .tbl tr { border: 2px solid var(--shadow); margin-bottom: 0.5rem; }
  .settings .tbl td { border: 0; border-bottom: 1px solid #aaa; }
  .settings .tbl td::before { content: attr(data-label); font-weight: 700; display: block; }
}
@media (max-width: 720px) { .slot-list { grid-template-columns: repeat(2, 1fr); } }

.factory-head { align-items: flex-end; }
.factory-art { background: #cfe3ee; border: 2px solid #000; flex: 0 0 auto; }
.factory-head h2 { flex: 1; margin: 0; }

.factory-art { max-width: 100%; height: auto; }
.factory-head { flex-wrap: wrap; }

/* ---- research visuals ---- */
.lab-hero { border: 3px solid #000; box-shadow: 3px 3px 0 #000; margin-bottom: 0.9rem; background: #3d5666; }
.lab-banner { display: block; width: 100%; height: auto; }
.area-head { display: flex; gap: 0.7rem; align-items: flex-start; }
.area-head > div:nth-child(2) { flex: 1; min-width: 0; }
.area-icon { flex: 0 0 auto; background: #e8e4d4; border: 2px solid #000; padding: 3px; }
.flask { display: grid; justify-items: center; flex: 0 0 auto; }
.tech-chain { position: relative; flex-wrap: nowrap; overflow-x: auto; padding: 0.4rem 0 0.8rem; gap: 0.6rem; }
.tech-chain::before { content: ""; position: absolute; left: 0.6rem; right: 0.6rem; top: 1.75rem; height: 4px; background: #6b6759; z-index: 0; }
.tech { position: relative; z-index: 1; flex: 0 0 auto; flex-direction: column; align-items: center; text-align: center; width: 7.2rem; background: var(--panel-3); }
.tech-node { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 3px solid #000; background: #fff; font-weight: 700; }
.tech.done .tech-node { background: #3fa35a; color: #fff; }
.tech.current .tech-node { background: var(--accent); }
.tech.locked .tech-node { background: #bbb7a8; }
.tech-name { font-size: 0.78rem; line-height: 1.15; }

/* ---- design studio ---- */
.studio { display: block; width: 100%; height: auto; border: 3px solid #000; box-shadow: 3px 3px 0 #000; background: #888; }
.small-seg { margin: 0.5rem 0 0.2rem; }
.picker-legend { display: flex; align-items: center; gap: 0.5rem; }
.picker-legend .area-icon { width: 34px; height: 34px; }
.spec-sheet dd { font-family: ui-monospace, Consolas, monospace; }

.line-art { display: block; width: 100%; height: auto; border: 2px solid #000; margin: 0.3rem 0; }
.factory-art { flex: 0 1 360px; }

/* ---- executive (Konzernführung) ---- */
.exec-head { gap: 0.6rem; margin-bottom: 0.7rem; }
.exec-head .kpi { background: var(--panel); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.4rem 0.8rem; }
.tabs { margin-bottom: 0.8rem; }
.tabs .btn { display: inline-flex; gap: 0.4rem; align-items: center; }
.btn .count { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 0.45rem; font-size: 0.78rem; }
.executive .kpis, .exec-tab .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-bottom: 0.8rem; }
.executive .kpi { background: var(--panel-3); padding: 0.4rem 0.6rem; border: 1px solid var(--shadow); }
.executive .kpi small { display: block; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.6rem; margin-top: 0.6rem; }
.option-card { display: grid; gap: 0.2rem; text-align: left; background: var(--panel-3); border: 2px solid; border-color: var(--light) var(--shadow) var(--shadow) var(--light); padding: 0.6rem; font: inherit; cursor: pointer; min-height: 44px; }
.option-card:hover { outline: 3px solid var(--primary); }
.advice { border-left: 8px solid var(--primary); }
.advice.warn { border-left-color: var(--warn); }
.advice h3 { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.mut-list { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 0.3rem; }
.mut-list li { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; background: var(--panel-3); border: 1px solid var(--shadow); padding: 0.2rem 0.5rem; }
.quote { margin-bottom: 0.7rem; }
.section-title { color: #fff; }
.alert-box.warn { background: #f3e2b8; border-color: var(--warn); }

/* ---- production planning ---- */
.planning .tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 0.6rem; }
.tools summary, .factory.compact summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; font-weight: 600; }
.shift-ctl { margin: 0.4rem 0; display: grid; gap: 0.2rem; }
.lines-compact { display: grid; gap: 0.3rem; margin-top: 0.5rem; }
.lc-row { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 5.5rem 4.5rem; gap: 0.4rem; align-items: center; }
.lc-row select, .lc-row .num-input { width: 100%; min-width: 0; }
.lc-head { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.lc-out { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .lc-row { grid-template-columns: 2rem minmax(0, 1fr) 4.6rem 3.6rem; gap: 0.3rem; } }

/* ---- regional prices ---- */
.region-prices { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.region-price { background: var(--panel-3); border: 2px solid var(--shadow); padding: 0.5rem; }
.region-price.own { border-color: var(--warn); background: #f6e6c2; }
.rp-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; }
.rp-head .segmented { margin: 0; }

/* purchasing (Einkauf) */
.supplier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; }
.supplier.current { outline: 3px solid var(--good, #2e7d32); }
.plain-list { margin: 0; padding-left: 1.2rem; }
.tag.good { background: #cfe8c9; }

/* Text that sits directly on the dark blue background (not inside a panel) must be light. */
#main > div > p,
#main > div > .muted,
#main > div > section:not(.panel) > p,
#main > div > section:not(.panel) > .muted,
#main .exec-tab > section:not(.panel) > p,
#main .exec-tab > section:not(.panel) > .muted,
#main .exec-tab > section:not(.panel) > h2,
#main > div > h2,
#main > div > h3 { color: #f7f4e8; }
#main > div > p.bad, #main > div > p.good, #main > div > p.warn { color: #ffd27a; }

/* Muted text is light by default (dark background); inside light containers it is dark again. */
#main .muted, #main .hint { color: #f1eee2; }
#main :is(.panel, .tbl, .table-wrap, .line, .slot, .part, .tech, .company-card, .kpi, .alert-box, .supplier, .region-price, .field, .btn, dialog) :is(.muted, .hint) { color: var(--muted); }
.kv dt { color: var(--muted); }
dialog .muted, dialog .hint { color: var(--muted); }
:root { --good: #14551f; }

/* header bar and footer are dark: muted text must be light there too */
.brand .muted, header .muted, footer .muted { color: #e6e2d3; }
