/* Designstudio – drei Designrichtungen als Token-Sätze. Alle Schriften sind Systemschriften (keine externen Server). */
:root, .th-amt {
  --font-head: "Bahnschrift", "DIN Alternate", "Arial Narrow", Arial, sans-serif;
  --font-body: "Bahnschrift", "Segoe UI", Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, monospace;
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #e9edf3; --text: #14213d; --muted: #5a6478;
  --primary: #1d4e89; --on-primary: #fff; --accent: #f2a900; --on-accent: #14213d;
  --ok: #2e7d32; --warn: #b26a00; --err: #c62828; --info: #1565c0;
  --border: #c7d0dc; --radius: 2px; --gap: 8px; --pad: 14px;
  --focus: 0 0 0 3px #f2a900; --sel-bg: #dbe6f4; --sel-bar: inset 4px 0 0 var(--primary);
  --map-water: #a9cbe8; --map-land: #eef1ea; --map-road: #ffffff; --map-main: #f6d36b; --map-forest: #cfdcc4; --map-rail: #5a6478; --map-town: #e2ddd3;
  --shadow: 0 1px 2px rgba(0,0,0,.12);
}
.th-amt[data-mode="dark"], [data-mode="dark"] .th-amt:not(.light), .th-amt.dark {
  --bg: #0e1626; --surface: #16213a; --surface-2: #1e2c4a; --text: #e6ecf5; --muted: #9aa8bf;
  --primary: #4f8fd6; --border: #2c3d5e; --sel-bg: #22375c; --map-land: #1c2a3d; --map-water: #22446a; --map-road: #2f4363; --map-forest: #1f3a32; --map-town: #29374f; --map-main:#b8913a;
}
.th-region {
  --font-head: Georgia, Constantia, "Times New Roman", serif;
  --font-body: "Segoe UI", Candara, Arial, sans-serif;
  --bg: #f5efe4; --surface: #fffaf1; --surface-2: #efe5d3; --text: #2b2118; --muted: #6e5f4f;
  --primary: #2f5d46; --on-primary: #fff; --accent: #c4622d; --on-accent: #fff;
  --ok: #3f7d3a; --warn: #b07816; --err: #b23a2a; --info: #2f6b8f;
  --border: #d9c9ad; --radius: 8px; --gap: 10px; --pad: 16px;
  --focus: 0 0 0 2px var(--surface), 0 0 0 5px #c4622d; --sel-bg: #f3dccb; --sel-bar: inset 0 0 0 2px var(--accent);
  --map-water: #9cc3c9; --map-land: #ede4cf; --map-road: #fbf6ea; --map-main: #e9b872; --map-forest: #b9cca0; --map-rail: #6e5f4f; --map-town: #e2d2b6;
  --shadow: 0 2px 6px rgba(60,40,20,.12);
}
.th-region[data-mode="dark"], [data-mode="dark"] .th-region:not(.light), .th-region.dark {
  --bg: #1d1712; --surface: #2a221a; --surface-2: #372c21; --text: #f1e7d6; --muted: #bba98f;
  --primary: #6fae8a; --border: #4a3c2d; --sel-bg: #4a3222; --map-land: #2f271d; --map-water: #24464b; --map-road: #4a3d2d; --map-forest: #2c3a24; --map-town: #3b3024; --map-main:#9a6f37;
}
.th-kompakt {
  --font-head: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #e4e9ee; --text: #0f172a; --muted: #5b6676;
  --primary: #0e8f8e; --on-primary: #fff; --accent: #f59e0b; --on-accent: #0f172a;
  --ok: #16a34a; --warn: #c26a05; --err: #dc2626; --info: #2563eb;
  --border: #d3dae2; --radius: 6px; --gap: 6px; --pad: 10px;
  --focus: 0 0 0 2px #0ea5a4, 0 0 0 5px rgba(14,165,164,.25); --sel-bg: #d5f1f0; --sel-bar: inset 0 -2px 0 var(--primary);
  --map-water: #7fb3d5; --map-land: #e5e9ec; --map-road: #ffffff; --map-main: #fcd34d; --map-forest: #c3d6c0; --map-rail: #475569; --map-town: #d9dee3;
  --shadow: 0 1px 3px rgba(15,23,42,.12);
}
.th-kompakt[data-mode="dark"], [data-mode="dark"] .th-kompakt:not(.light), .th-kompakt.dark {
  --bg: #0b0f14; --surface: #141a22; --surface-2: #1c2430; --text: #e2e8f0; --muted: #94a3b8;
  --primary: #2cc9c7; --border: #263241; --sel-bg: #123b3d; --map-land: #18202a; --map-water: #173650; --map-road: #2a3646; --map-forest: #1b2e25; --map-town: #222b37; --map-main:#a8842a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font-body); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .7em; }
a { color: var(--primary); }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / 3; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 14px; background: var(--primary); color: var(--on-primary); position: sticky; top: 0; z-index: 50; }
.topbar .brand { font-family: var(--font-head); font-weight: 700; letter-spacing: .02em; margin-right: auto; }
.topbar .brand small { color: inherit; opacity: .75; font-weight: 400; margin-left: 6px; }
.topbar label { font-size: .8rem; display: flex; gap: 6px; align-items: center; }
.topbar select, .topbar button { font: inherit; font-size: .85rem; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 10px 0; overflow-y: auto; position: sticky; top: 46px; height: calc(100vh - 46px); }
.side h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 16px 4px; }
.side a { display: block; padding: 5px 16px; color: var(--text); text-decoration: none; font-size: .9rem; }
.side a:hover { background: var(--surface-2); }
.side a.active { background: var(--sel-bg); box-shadow: var(--sel-bar); font-weight: 600; }
main { padding: 18px 24px 60px; min-width: 0; }
.crumbs { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .88rem; }
.crumbs a.back { font-weight: 600; }

/* ---------- Komponenten-Token: Standard für A/B/C (D · Ruhrline setzt eigene in ruhrline.css) */
:root, .th-amt, .th-region, .th-kompakt {
  --btn-bg: var(--surface); --btn-radius: var(--radius); --btn-hover-bg: var(--surface-2); --btn-hover-line: var(--border);
  --btn-primary-bg: var(--primary); --btn-primary-fg: var(--on-primary); --btn-case: none; --btn-weight: 400; --btn-shadow: none;
  --btn-sel-bg: var(--sel-bg); --btn-sel-ring: var(--sel-bar); --tab-active: var(--sel-bar);
  --th-bg: var(--surface-2); --th-fg: var(--text); --th-case: none; --th-weight: 600;
  --badge-bg: transparent; --head-bg: var(--primary); --head-fg: var(--on-primary); --head-line: 0;
}

/* ---------- Komponenten */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); }
.grid { display: grid; gap: calc(var(--gap) * 1.5); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: var(--gap); }
.spacer { flex: 1; }
.btn { font: inherit; font-size: .9rem; border: 1px solid var(--border); background: var(--btn-bg); color: var(--text); padding: 6px 12px; border-radius: var(--btn-radius); transition: transform .14s, border-color .14s, background .14s; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.btn:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-line); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: transparent; text-transform: var(--btn-case); font-weight: var(--btn-weight); box-shadow: var(--btn-shadow); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); text-transform: var(--btn-case); font-weight: var(--btn-weight); }
.th-ruhr .btn.accent { background: var(--btn-primary-bg); border-color: transparent; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.sel, .btn[aria-pressed="true"] { background: var(--btn-sel-bg); box-shadow: var(--btn-sel-ring); font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 3px 8px; font-size: .8rem; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 7px 12px; text-decoration: none; color: var(--text); border: 0; background: none; font: inherit; cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; }
.tabs .active { background: var(--sel-bg); box-shadow: var(--tab-active); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
textarea { width: 100%; min-height: 90px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--font-head); font-weight: var(--th-weight); background: var(--th-bg); color: var(--th-fg); text-transform: var(--th-case); font-size: .82rem; letter-spacing: .02em; }
tr.sel td { background: var(--sel-bg); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.badge { background: var(--badge-bg); display: inline-flex; gap: 4px; align-items: center; font-size: .75rem; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.b-ok { color: var(--ok); } .b-warn { color: var(--warn); } .b-err { color: var(--err); } .b-info { color: var(--info); } .b-muted { color: var(--muted); }
.ev-local { color: var(--ok); } .ev-doc { color: var(--info); } .ev-todo { color: var(--warn); }
.note { border-left: 4px solid var(--info); background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius); font-size: .9rem; }
.note.warn { border-color: var(--warn); } .note.err { border-color: var(--err); } .note.ok { border-color: var(--ok); }
.concept-tag { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.72); color: #fff; font: 600 11px/1 Arial, sans-serif; padding: 5px 7px; border-radius: 3px; letter-spacing: .04em; z-index: 3; }
.state-box { text-align: center; padding: 30px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 999; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 5px solid var(--info); padding: 9px 14px; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 380px; font-size: .9rem; animation: tin .2s; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: var(--warn); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); vertical-align: middle; }
.roleinfo { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.18); }
.hidden { display: none !important; }

/* ---------- Item-/Iconflächen */
.checker { background-color: #fff; background-image: linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%),linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.bg-light { background: #eeece6; } .bg-dark { background: #1f2328; }
.slot { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid #3a4048; background: rgba(20,24,28,.82); border-radius: 4px; position: relative; }
.slot img { width: 32px; height: 32px; image-rendering: auto; }
.slot.active { outline: 2px solid var(--accent); }
.slot .qty { position: absolute; right: 2px; bottom: 0; font: 700 10px/1 Arial; color: #fff; text-shadow: 0 1px 2px #000; }
.slot .key { position: absolute; left: 3px; top: 2px; font: 600 9px/1 Arial; color: #cfd6dd; }
.zoomable { cursor: zoom-in; transition: transform .15s; }
.zoom-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: grid; place-items: center; z-index: 900; cursor: zoom-out; }
.zoom-overlay .zbox { display: flex; gap: 14px; }
.zoom-overlay .zbox > div { width: 300px; height: 300px; display: grid; place-items: center; border-radius: 8px; }
.zoom-overlay img { width: 280px; height: 280px; }

/* ---------- Geräte */
.device-phone { width: 360px; height: 740px; border-radius: 46px; background: #111; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 2px #333; position: relative; flex: none; }
.device-phone .screen { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; position: relative; background: #0d1b2a; color: #fff; font-family: "Segoe UI", system-ui, sans-serif; }
.device-phone .notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 90px; height: 24px; background: #000; border-radius: 14px; z-index: 5; }
.device-phone .side-btn { position: absolute; right: -4px; top: 150px; width: 4px; height: 70px; background: #2a2a2a; border-radius: 2px; }
.device-tablet { width: 1000px; max-width: 100%; aspect-ratio: 1.47; border-radius: 26px; background: #22262b; padding: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 2px #3a3f45; position: relative; }
.device-tablet .screen { width: 100%; height: 100%; border-radius: 8px; overflow: hidden; background: #f3f5f7; color: #15202b; display: grid; grid-template-columns: 200px 1fr; font-family: "Segoe UI", system-ui, sans-serif; font-size: 14px; }
.device-tablet .cam { position: absolute; left: 50%; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #0b0d0f; }

/* ---------- Mockup-Scrollflächen */
.scene-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.scene-wrap svg.scene { display: block; width: 100%; height: auto; }
.hud { position: absolute; inset: 0; pointer-events: none; font-family: "Segoe UI", system-ui, sans-serif; color: #fff; }
.hud > * { pointer-events: auto; }
@keyframes blau { 0%,49% { background: radial-gradient(circle at 15% 40%, rgba(40,90,255,.55), transparent 55%); } 50%,100% { background: radial-gradient(circle at 85% 40%, rgba(255,30,40,.5), transparent 55%); } }
.bluelight { position: absolute; inset: 0; animation: blau .5s steps(1) infinite; mix-blend-mode: screen; pointer-events: none; }
.reduced-flash .bluelight { animation-duration: 2s; opacity: .45; }

@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }
@media print { .side, .topbar { display: none; } }
.icon-missing { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 2px dashed var(--warn); color: var(--warn); background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(178,106,0,.08) 6px 12px); border-radius: 6px; font: 700 11px/1.15 var(--font-body); padding: 3px; overflow: hidden; vertical-align: middle; }
.icon-missing small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); margin-top: 2px; }
.slot .icon-missing { width: 32px !important; height: 32px !important; font-size: 14px; }
