/* =====================================================================
   iQX Design System
   Source: 00_Mockup iQX / 03_Mockup-Framework (Designprinzipien, Variante D
   = Tokens von A "Klar & ruhig") and the shell click dummies.
   - All colours are tokens, defined for light AND dark mode.
   - Touch targets >= 40-44 px, nothing only on hover.
   - RFLP: R yellow/orange, F white/blue, L blue/green, P green/brown (always with letter).
   - AI content: violet with sparkle; staged content: cyan + dashed border.
   ===================================================================== */

/* ---------- Tokens: light ---------- */
:root,
[data-theme="light"] {
    --bg: #f4f6f7;
    --surface: #ffffff;
    --surface-2: #edf1f2;
    --surface-3: #e3e9eb;
    --line: #d8e0e3;
    --line-soft: #e6ecee;
    --fg: #13222a;
    --muted: #5a6a72;
    --faint: #8496a0;
    --accent: #0f6a74;
    --accent-hover: #0b575f;
    --accent-fg: #ffffff;
    --accent-soft: #e1f0f1;
    --ai: #6d47c9;
    --ai-soft: #efe9fb;
    --stg: #0e7490;
    --stg-soft: #e0f4f8;
    --stg-line: #38a3bd;
    --r: #b8520f;
    --f: #2462a6;
    --l: #1f7a45;
    --p: #8a5b16;
    --ok: #1f7a45;
    --ok-soft: #e3f3e9;
    --warn: #9a6700;
    --warn-soft: #fbf1dc;
    --crit: #b42318;
    --crit-soft: #fdecea;
    --info: #2462a6;
    --info-soft: #e6eef8;
    --edge: #9fb0b7;
    --shadow: 0 1px 2px rgba(16, 34, 42, .06), 0 4px 16px rgba(16, 34, 42, .06);
    --shadow-pop: 0 10px 32px rgba(10, 30, 40, .16);
    --font: "IBM Plex Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    --rad: 8px;
    --rad-sm: 6px;
    --top-h: 56px;
    --rail-w: 60px;
    --rail-w-open: 240px;
    --ai-w: 340px;
    color-scheme: light;
}

/* ---------- Tokens: dark ---------- */
[data-theme="dark"] {
    --bg: #0f1719;
    --surface: #152023;
    --surface-2: #1b2a2e;
    --surface-3: #223438;
    --line: #29393e;
    --line-soft: #22313a;
    --fg: #e1eaec;
    --muted: #91a3a9;
    --faint: #6d8088;
    --accent: #4fb8c2;
    --accent-hover: #6cc8d1;
    --accent-fg: #06262a;
    --accent-soft: #16343a;
    --ai: #b39af2;
    --ai-soft: #2a2340;
    --stg: #5fc8dd;
    --stg-soft: #12313a;
    --stg-line: #3c96a8;
    --r: #f0965a;
    --f: #79aef0;
    --l: #6cc992;
    --p: #d6aa63;
    --ok: #6cc992;
    --ok-soft: #173327;
    --warn: #e3b456;
    --warn-soft: #3a2f17;
    --crit: #f27b6f;
    --crit-soft: #3d1e1b;
    --info: #79aef0;
    --info-soft: #1a2a40;
    --edge: #4c6168;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-pop: 0 12px 36px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* ---------- Legacy iVMS token bridge (keeps all migrated views on iQX colours) ---------- */
:root,
[data-theme="light"],
[data-theme="dark"] {
    --vm-bg-primary: var(--bg);
    --vm-bg-secondary: var(--surface);
    --vm-bg-tertiary: var(--surface-2);
    --vm-bg-panel: var(--surface);
    --vm-bg-input: var(--surface);
    --vm-bg-hover: var(--surface-2);
    --vm-bg-active: var(--accent-soft);
    --vm-bg-selected: var(--accent-soft);
    --vm-bg-header: var(--surface);
    --vm-bg: var(--bg);
    --vm-bg-alt: var(--surface-2);
    --vm-border: var(--line);
    --vm-border-light: var(--line-soft);
    --vm-border-focus: var(--accent);
    --vm-border-strong: var(--edge);
    --vm-text-primary: var(--fg);
    --vm-text-secondary: var(--muted);
    --vm-text-muted: var(--faint);
    --vm-text-accent: var(--accent);
    --vm-text-bright: var(--fg);
    --vm-text-disabled: var(--faint);
    --vm-accent: var(--accent);
    --vm-accent-hover: var(--accent-hover);
    --vm-success: var(--ok);
    --vm-warning: var(--warn);
    --vm-danger: var(--crit);
    --vm-info: var(--info);
    /* Variance marking (Designprinzipien): standard = neutral, variant = blue, option = green */
    --vm-variant-color: var(--f);
    --vm-option-color: var(--l);
    --vm-exclude-color: var(--crit);
    --vm-mandatory-color: var(--accent);
    --vm-ifthen-color: var(--warn);
    --vm-eliminate-color: var(--crit);
    --vm-default-color: var(--muted);
    --vm-header-height: var(--top-h);
    --vm-font-ui: var(--font);
    --vm-font-mono: var(--mono);
    --vm-font-size: 13px;
    --vm-row-height: 34px;
    --vm-shadow-color: rgba(16, 34, 42, .12);
    --vm-overlay-subtle: color-mix(in srgb, var(--fg) 3%, transparent);
    --vm-overlay-light: color-mix(in srgb, var(--fg) 5%, transparent);
    --vm-overlay-medium: color-mix(in srgb, var(--fg) 7%, transparent);
    --vm-scrollbar-thumb: color-mix(in srgb, var(--fg) 16%, transparent);
    --vm-scrollbar-thumb-hover: color-mix(in srgb, var(--fg) 28%, transparent);
    --vm-matrix-mandatory: var(--accent-soft);
    --vm-matrix-exclude: var(--crit-soft);
    --vm-matrix-ifthen: var(--warn-soft);
    --vm-matrix-eliminate: color-mix(in srgb, var(--crit) 18%, var(--surface));
    --vm-matrix-highlight: var(--surface-2);
    --vm-row-hover: color-mix(in srgb, var(--accent) 5%, var(--surface));
    /* Modularization workbench */
    --mwb-line: var(--line);
    --mwb-muted: var(--muted);
    --mwb-brand: var(--accent);
    --mwb-brand2: var(--accent-hover);
    --mwb-ok: var(--ok);
    --mwb-text: var(--fg);
    --mwb-bg: var(--bg);
    --mwb-card: var(--surface);
    --mwb-warn: var(--warn);
    --mwb-err: var(--crit);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .vm-mono { font-family: var(--mono); }
.tn { font-variant-numeric: tabular-nums; }
.iqx-muted { color: var(--muted); }
.iqx-lbl { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* icons */
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: none; }
.ic svg { width: 100%; height: 100%; display: block; }
.ic.ic-sm { width: 15px; height: 15px; }
.ic.ic-xs { width: 13px; height: 13px; }
.ic.ic-lg { width: 22px; height: 22px; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--vm-scrollbar-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--vm-scrollbar-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--vm-scrollbar-thumb-hover); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
   Shell
   ===================================================================== */
.iqx-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    overflow: hidden;
}

/* ---------- Top bar ---------- */
.iqx-top {
    height: var(--top-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 30;
}
.iqx-brand { display: flex; align-items: center; text-decoration: none; }
.iqx-logo { font-weight: 600; font-size: 19px; letter-spacing: -.02em; color: var(--accent); }
.iqx-tenant {
    font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px;
    padding: 1px 6px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.iqx-projsw { position: relative; }
.iqx-projsw-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px;
    border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--rad-sm);
    cursor: pointer; max-width: 300px; color: var(--fg);
}
.iqx-projsw-btn:hover { border-color: var(--edge); }
.iqx-projsw-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.iqx-path { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; }
.iqx-path a { color: var(--muted); text-decoration: none; padding: 4px 2px; border-radius: 4px; }
.iqx-path a:hover { color: var(--fg); text-decoration: underline; }
.iqx-path b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.iqx-path-sep { color: var(--faint); }
.iqx-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.iqx-iconbtn {
    width: 40px; height: 40px; border: 0; background: transparent; border-radius: 8px;
    display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; flex: none;
}
.iqx-iconbtn:hover { background: var(--surface-2); color: var(--fg); }
.iqx-iconbtn.sm { width: 32px; height: 32px; }
.iqx-iconbtn.on, .iqx-iconbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.iqx-iconbtn.on-ai { background: var(--ai-soft); color: var(--ai); }
.iqx-iconbtn:disabled { opacity: .5; cursor: default; }
.iqx-iconbtn.is-loading .ic { animation: iqx-spin 1s linear infinite; }

.iqx-lang { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.iqx-lang button {
    border: 0; background: transparent; min-width: 34px; height: 32px; border-radius: 6px;
    color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; letter-spacing: .02em;
}
.iqx-lang button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.iqx-user { position: relative; }
.iqx-avatar {
    width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center;
    font-weight: 600; font-size: 12px; flex: none;
}
.iqx-avatar.lg { width: 40px; height: 40px; font-size: 14px; cursor: default; }

/* menus / popovers */
.iqx-backdrop { position: fixed; inset: 0; z-index: 40; }
.iqx-menu {
    position: absolute; top: calc(100% + 6px); z-index: 41; min-width: 260px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.iqx-projsw-menu { left: 0; width: 340px; max-height: 70vh; overflow: auto; }
.iqx-user-menu { right: 0; width: 300px; padding: 10px; gap: 6px; }
.iqx-menu-item {
    display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 6px;
    color: var(--fg); text-decoration: none; border: 0; background: transparent; cursor: pointer; text-align: left; width: 100%;
}
.iqx-menu-item:hover { background: var(--surface-2); }
.iqx-menu-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.iqx-menu-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iqx-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.iqx-menu-lbl { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 6px 2px 0; }
.iqx-menu-empty { padding: 12px 10px; color: var(--muted); }
.iqx-menu-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 40px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); margin-bottom: 4px; }
.iqx-menu-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--fg); }
.iqx-proj-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); flex: none; opacity: .6; }
.iqx-user-head { display: flex; gap: 10px; align-items: center; padding: 4px 2px; }
.iqx-user-head b { display: block; }
.iqx-user-head small { color: var(--muted); }

/* ---------- Body / rail ---------- */
.iqx-body { flex: 1; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 0; position: relative; }
.iqx-shell.ai-open .iqx-body { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--ai-w); }
.iqx-railcell { position: relative; z-index: 20; }
.iqx-rail {
    position: absolute; inset: 0 auto 0 0; width: var(--rail-w);
    background: var(--surface); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 4px; padding: 8px; overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) { .iqx-rail { transition: width .18s ease, box-shadow .18s ease; } }
.iqx-shell.rail-open .iqx-rail { width: var(--rail-w-open); box-shadow: 8px 0 24px rgba(10, 30, 40, .12); }
.iqx-rail-item {
    display: flex; align-items: center; gap: 12px; min-height: 44px; border: 0; background: transparent;
    border-radius: 8px; padding: 0 12px; color: var(--muted); white-space: nowrap; text-align: left;
    text-decoration: none; cursor: pointer; flex: none; width: 100%;
}
.iqx-rail-item:hover { background: var(--surface-2); color: var(--fg); }
.iqx-rail-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.iqx-rail-item.on-ai { background: var(--ai-soft); color: var(--ai); }
.iqx-rail .lab { opacity: 0; transition: opacity .12s; overflow: hidden; text-overflow: ellipsis; }
.iqx-shell.rail-open .iqx-rail .lab { opacity: 1; }
.iqx-rail-sep { height: 1px; background: var(--line); margin: 6px 4px; flex: none; }
.iqx-rail-grp { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px; height: 16px; white-space: nowrap; opacity: 0; flex: none; }
.iqx-shell.rail-open .iqx-rail-grp { opacity: 1; }
.iqx-rail-fill { flex: 1; }

/* ---------- Main ---------- */
.iqx-main { min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.iqx-main.flush { overflow: hidden; }
.iqx-page { padding: 22px 24px 32px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.iqx-page.narrow { max-width: 1280px; width: 100%; }

/* ---------- AI panel ---------- */
.iqx-ai { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.iqx-ai-hd { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); font-weight: 600; flex: none; }
.iqx-ai-hd > .ic { color: var(--ai); }
.iqx-ai-hd .iqx-iconbtn { margin-left: auto; }
.iqx-ai-thread { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.iqx-ai-ctx { display: flex; flex-direction: column; gap: 6px; }
.iqx-ai-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.iqx-msg { display: flex; gap: 10px; align-items: flex-start; }
.iqx-msg-ava { width: 28px; height: 28px; border-radius: 8px; background: var(--ai-soft); color: var(--ai); display: grid; place-items: center; flex: none; }
.iqx-msg-ava .ic { width: 15px; height: 15px; }
.iqx-msg-bub { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.iqx-msg-bub p { margin: 0; }
.iqx-ai-compose { flex: none; border-top: 1px solid var(--line); padding: 12px; }
.iqx-ai-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px 0 12px; min-height: 46px; color: var(--muted); }
.iqx-ai-input.is-disabled { background: var(--surface-2); }
.iqx-ai-send { margin-left: auto; width: 36px; height: 36px; border-radius: 6px; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; }
.iqx-ai-send:disabled { opacity: .4; }

/* =====================================================================
   Building blocks
   ===================================================================== */
.iqx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 0 14px; border-radius: var(--rad-sm); border: 1px solid var(--line);
    background: var(--surface); color: var(--fg); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 500;
}
.iqx-btn:hover { border-color: var(--edge); background: var(--surface-2); }
.iqx-btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; min-height: 44px; padding: 0 18px; }
.iqx-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.iqx-btn.ai { border: 1px dashed var(--ai); background: var(--ai-soft); color: var(--ai); font-weight: 600; }
.iqx-btn.sm { min-height: 34px; padding: 0 10px; font-size: 12.5px; }
.iqx-btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.iqx-btn.quiet:hover { background: var(--surface-2); color: var(--fg); }
.iqx-btn:disabled { opacity: .5; cursor: default; }

.iqx-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.iqx-card-hd { display: flex; align-items: center; gap: 10px; margin: -14px -16px 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.iqx-card-hd h3 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.iqx-card-hd h3 .ic { color: var(--accent); }
.iqx-card-hd .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.iqx-card-hd .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.iqx-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.iqx-head h1, .iqx-head h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.iqx-head h1 .ic { color: var(--accent); width: 22px; height: 22px; }
.iqx-head .sub { margin: 2px 0 0; color: var(--muted); max-width: 90ch; }
.iqx-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.iqx-seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.iqx-seg button, .iqx-seg a {
    border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 6px; color: var(--muted);
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
.iqx-seg button[aria-pressed="true"], .iqx-seg a.on, .iqx-seg button.on {
    background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.iqx-seg .cnt { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.iqx-seg-full { display: flex; width: 100%; }
.iqx-seg-full > * { flex: 1; justify-content: center; }

.iqx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.iqx-tabs > a, .iqx-tabs > button {
    border: 0; background: transparent; min-height: 42px; padding: 0 14px; color: var(--muted);
    border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
    cursor: pointer; white-space: nowrap; font-weight: 500;
}
.iqx-tabs > a:hover, .iqx-tabs > button:hover { color: var(--fg); }
.iqx-tabs > .on, .iqx-tabs > [aria-pressed="true"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.iqx-tabs .badge { font-family: var(--mono); font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0 7px; }

.iqx-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px 2px 7px; white-space: nowrap; }
.iqx-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.iqx-pill.ok { color: var(--ok); background: var(--ok-soft); }
.iqx-pill.warn { color: var(--warn); background: var(--warn-soft); }
.iqx-pill.crit { color: var(--crit); background: var(--crit-soft); }
.iqx-pill.info { color: var(--info); background: var(--info-soft); }
.iqx-pill.ai { color: var(--ai); background: var(--ai-soft); }
.iqx-pill.muted { color: var(--muted); background: var(--surface-2); }
.iqx-pill.planned { color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.iqx-pill.planned::before { background: var(--faint); }

.iqx-src {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--surface);
}
.iqx-src b { color: var(--fg); font-weight: 600; }
.iqx-code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.iqx-aibadge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--ai); background: var(--ai-soft); border-radius: 999px; padding: 2px 8px 2px 6px; }
.iqx-staged { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600; color: var(--stg); border: 1.5px dashed var(--stg-line); background: var(--stg-soft); border-radius: 4px; padding: 0 5px; }
.iqx-chip { display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10.5px; font-weight: 600; min-width: 20px; height: 18px; padding: 0 4px; border-radius: 4px; color: var(--surface); }
.iqx-chip.R { background: var(--r); } .iqx-chip.F { background: var(--f); } .iqx-chip.L { background: var(--l); } .iqx-chip.P { background: var(--p); }

.iqx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.iqx-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.iqx-kpi b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.iqx-kpi span { color: var(--muted); font-size: 12px; }
.iqx-kpi.ok b { color: var(--ok); } .iqx-kpi.crit b { color: var(--crit); } .iqx-kpi.info b { color: var(--info); } .iqx-kpi.warn b { color: var(--warn); }

.iqx-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--rad); background: var(--surface-2); color: var(--fg); }
.iqx-banner .ic { color: var(--accent); }
.iqx-banner.crit { background: var(--crit-soft); } .iqx-banner.crit .ic { color: var(--crit); }
.iqx-banner pre { margin: 0; white-space: pre-wrap; font-size: 12px; }

.iqx-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--rad-sm); color: var(--muted); background: var(--surface); min-width: 220px; }
.iqx-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--fg); }
.iqx-select { height: 40px; border: 1px solid var(--line); border-radius: var(--rad-sm); background: var(--surface); color: var(--fg); padding: 0 32px 0 12px; cursor: pointer; }

.iqx-empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.iqx-empty h3 { margin: 0; color: var(--fg); font-size: 15px; }
.iqx-empty .ic { width: 32px; height: 32px; color: var(--faint); }

.iqx-skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: iqx-shimmer 1.4s ease infinite; border-radius: var(--rad); }
@keyframes iqx-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes iqx-spin { to { transform: rotate(360deg); } }
.iqx-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: iqx-spin .8s linear infinite; display: inline-block; }

.iqx-prog { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.iqx-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* dialog */
.iqx-dialog-back { position: fixed; inset: 0; background: rgba(10, 24, 30, .42); z-index: 60; display: grid; place-items: center; padding: 16px; }
.iqx-dialog { width: min(720px, 100%); max-height: calc(100vh - 32px); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.iqx-dialog-hd { padding: 20px 24px 12px; }
.iqx-dialog-hd h2 { margin: 0; font-size: 19px; font-weight: 600; }
.iqx-dialog-hd p { margin: 4px 0 0; color: var(--muted); }
.iqx-dialog-body { padding: 4px 24px 16px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.iqx-dialog-ft { border-top: 1px solid var(--line); padding: 14px 24px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.iqx-option {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--rad);
    cursor: pointer; background: var(--surface); text-align: left; width: 100%;
}
.iqx-option:hover { border-color: var(--edge); }
.iqx-option.on { border-color: var(--accent); background: var(--accent-soft); }
.iqx-option .radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--edge); flex: none; display: grid; place-items: center; }
.iqx-option.on .radio { border-color: var(--accent); }
.iqx-option.on .radio::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.iqx-option b { display: block; font-weight: 600; }
.iqx-option small { color: var(--muted); }

/* =====================================================================
   Home (E2)
   ===================================================================== */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.home-continue .ctx { color: var(--muted); font-size: 12.5px; }
.home-continue .what { font-weight: 600; font-size: 15px; }
.home-continue .iqx-btn.primary { width: 100%; }

.app-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.app-tile {
    position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad);
    padding: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
    text-decoration: none; color: var(--fg); min-height: 128px;
}
.app-tile:hover { border-color: var(--edge); box-shadow: var(--shadow); }
.app-tile .ico { width: 44px; height: 44px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.app-tile .ico .ic { width: 21px; height: 21px; }
.app-tile .nm { font-weight: 600; font-size: 14px; line-height: 1.3; }
.app-tile .uc { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.app-tile .ds { color: var(--muted); font-size: 12.5px; }
.app-tile .tr { position: absolute; top: 12px; right: 12px; }
.app-tile.planned { background: var(--surface); border-style: dashed; }
.app-tile.planned .ico { background: var(--surface-2); color: var(--muted); }
.app-tile.planned .nm { color: var(--muted); }
.app-tile.wide { grid-column: span 2; }
@media (max-width: 700px) { .app-tile.wide { grid-column: span 1; } }
.app-tile .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: 12.5px; }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.proj-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); padding: 14px 16px;
    display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg); min-height: 168px; min-width: 0;
}
.proj-card:hover { border-color: var(--edge); box-shadow: var(--shadow); }
.proj-card .top { display: flex; align-items: flex-start; gap: 10px; }
.proj-card .ico { width: 40px; height: 40px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.proj-card h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.proj-card .top .iqx-pill { margin-left: auto; }
.proj-card .desc { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-card .meta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.proj-card .prog-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.proj-card .prog-row .iqx-prog { flex: 1; }
.proj-group { margin: 6px 0 -4px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

.proj-list { display: flex; flex-direction: column; }
.proj-row {
    display: grid; grid-template-columns: 40px minmax(0, 2.2fr) minmax(0, 1fr) 120px 140px 90px; gap: 14px; align-items: center;
    padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--fg); min-height: 56px;
}
.proj-row:hover { background: var(--surface-2); }
.proj-row .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.proj-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-row .ds { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-row .muted { color: var(--muted); font-size: 12px; }
.proj-list-hd { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); min-height: 34px; }
.proj-list-hd:hover { background: transparent; }
@media (max-width: 900px) { .proj-row { grid-template-columns: 40px minmax(0, 1fr) 90px; } .proj-row > :nth-child(3), .proj-row > :nth-child(4), .proj-row > :nth-child(5) { display: none; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }

/* =====================================================================
   Project home (E3)
   ===================================================================== */
.ph-hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ph-hero .ico { width: 52px; height: 52px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.ph-hero .ico .ic { width: 26px; height: 26px; }
.ph-facts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; }
.ph-section { display: flex; flex-direction: column; gap: 10px; }
.ph-section-hd { display: flex; align-items: baseline; gap: 10px; }
.ph-section-hd h2 { margin: 0; font-size: 14px; font-weight: 600; }
.ph-section-hd .iqx-muted { font-size: 12px; }

/* =====================================================================
   App header + process / view bar (Prinzip 18: horizontal bar on top)
   ===================================================================== */
.app-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.app-head .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.app-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 10px; }
.app-head h1 .iqx-code { font-weight: 400; }
.app-head .sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.app-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-bar { display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 52px; flex: none; flex-wrap: wrap; }
.app-bar .iqx-tabs { border-bottom: 0; align-self: stretch; }
.app-bar .iqx-tabs > * { min-height: 50px; }
.app-bar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* placeholder app */
.planned-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .planned-hero { grid-template-columns: minmax(0, 1fr); } }
.planned-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; counter-reset: st; }
.planned-steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.planned-steps li::before { counter-increment: st; content: counter(st); width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; color: var(--muted); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* =====================================================================
   Login (E1)
   ===================================================================== */
.lg-page { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; background: var(--bg); }
.lg-wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px); align-items: stretch; max-width: 1120px; width: 100%; margin: auto; padding: 32px 16px; gap: 0; }
.lg-hero { background: var(--accent); color: #fff; border-radius: 14px 0 0 14px; padding: 48px 44px; display: flex; flex-direction: column; gap: 18px; position: relative; overflow: hidden; }
[data-theme="dark"] .lg-hero { background: #0b3d43; }
.lg-hero .logo { font-size: 34px; font-weight: 600; letter-spacing: -.02em; }
.lg-hero h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; max-width: 20ch; }
.lg-hero p { margin: 0; opacity: .88; max-width: 46ch; font-size: 14px; }
.lg-usps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lg-usps li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.lg-usps .dot { width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex: none; }
.lg-hero .note { margin-top: auto; font-size: 12px; opacity: .75; }
.lg-hero .grid-deco { position: absolute; right: -40px; bottom: -40px; width: 260px; height: 260px; opacity: .12; background-image: radial-gradient(#fff 1.4px, transparent 1.4px); background-size: 16px 16px; }
.lg-card { background: var(--surface); border: 1px solid var(--line); border-left: 0; border-radius: 0 14px 14px 0; padding: 44px 40px; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.lg-card h2 { margin: 0; font-size: 22px; font-weight: 600; }
.lg-card .sub { margin: -10px 0 4px; color: var(--muted); }
.lg-field { display: flex; flex-direction: column; gap: 6px; }
.lg-field label { font-weight: 500; font-size: 12.5px; }
.lg-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--rad-sm); background: var(--surface); min-height: 44px; padding: 0 4px 0 12px; }
.lg-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lg-input input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 42px; }
.lg-input .iqx-iconbtn { width: 36px; height: 36px; }
.lg-card .iqx-btn.primary { width: 100%; margin-top: 4px; }
.lg-status { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.lg-foot { display: flex; align-items: center; gap: 16px; padding: 12px 24px; color: var(--muted); font-size: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); background: var(--surface); }
.lg-foot .links { margin-left: auto; display: flex; gap: 14px; }
.lg-foot a { color: var(--muted); text-decoration: none; }
.lg-foot a:hover { color: var(--fg); }
@media (max-width: 860px) {
    .lg-wrap { grid-template-columns: minmax(0, 1fr); }
    .lg-hero { border-radius: 14px 14px 0 0; padding: 28px 24px; }
    .lg-card { border-left: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; padding: 28px 24px; }
}

/* error boundary */
.iqx-error { min-height: 60vh; display: grid; place-items: center; padding: 24px; }
.iqx-error .box { max-width: 560px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.iqx-error pre { max-height: 200px; overflow: auto; text-align: left; font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 10px; border-radius: 6px; width: 100%; }
.ic.spin { animation: iqx-spin 1s linear infinite; }
