/* ==================================================================
   kramer & crew · TCO-Tool – Stylesheet
   CI: Navy #1B3A6B / Gold #F5B333. Systemschriften (DSGVO-freundlich).
   ================================================================== */

:root {
    --navy:       #1B3A6B;
    --navy-700:   #16315A;
    --navy-900:   #0F2546;
    --gold:       #F5B333;
    --gold-600:   #E0A020;
    --ink:        #1F2733;
    --muted:      #6B7686;
    --line:       #E3E8EF;
    --line-2:     #EEF2F7;
    --bg:         #F4F6FA;
    --card:       #FFFFFF;
    --success:    #0F6E56;
    --success-bg: #E6F6EF;
    --danger:     #C0392B;
    --danger-bg:  #FBEAE8;
    --info-bg:    #EAF1FB;
    --radius:     12px;
    --radius-sm:  8px;
    --shadow:     0 1px 2px rgba(15,37,70,.06), 0 6px 20px rgba(15,37,70,.06);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    background-image: linear-gradient(180deg, #EEF2F8 0%, var(--bg) 320px);
    background-repeat: no-repeat;
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; min-height: 100vh; }
/* width:100% nötig, da der Container als Flex-Item sonst auf Inhaltsbreite
   schrumpft – so haben ALLE Seiten dieselbe Breite wie der Report (1200px). */
.container { flex: 1 0 auto; width: 100%; }

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--navy-900); line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono  { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- Kopfzeile ---------------------------------------------------- */
.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 1px 0 rgba(15,37,70,.04), 0 6px 18px -12px rgba(15,37,70,.25);
}
.app-header .bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-right: 2px; }
.brand-logo { height: 38px; width: auto; display: block; }
.app-nav { display: flex; align-items: center; gap: 2px; margin-left: 4px; overflow-x: auto; scrollbar-width: none; }
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a { white-space: nowrap; }
.app-nav a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-weight: 500;
    font-size: .95rem;
}
.app-nav a:hover { background: var(--line-2); text-decoration: none; }
.app-nav a.active { background: var(--navy); color: #fff; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-user { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.header-user a { color: var(--navy); font-weight: 600; }

/* --- Layout ------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 20px 60px;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    /* Moderner Header im Hero-Stil: weißer Hintergrund mit Gold-Akzent */
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 22px 18px 24px;
    position: relative;
    overflow: hidden;
}
.page-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
.page-head h1 { margin: 0 0 2px; }
.page-head > div > p { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Karten ------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 18px;
}
.card.pad-0 { padding: 0; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.card-head.tight { margin-bottom: 0; }
/* Dezenter Gold-Akzent vor Karten-Überschriften */
.card > .card-head h2,
.card > .card-head h3 { position: relative; padding-left: 12px; }
.card > .card-head h2::before,
.card > .card-head h3::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 1em; border-radius: 2px; background: var(--gold);
}

/* --- Buttons ------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s, transform .02s;
    white-space: nowrap;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-600); }
.btn-danger { background: #fff; border-color: #E6B4AE; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Formulare ---------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--navy-900); }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--ink);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(27,58,107,.12);
}
textarea { resize: vertical; min-height: 68px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.input-suffix { position: relative; }
.input-suffix .suffix { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.input-suffix input { padding-right: 32px; }

/* --- Tabellen ----------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: #FBFCFE; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* --- Badges ------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.badge-navy    { background: var(--navy); color: #fff; }
.badge-gold    { background: var(--gold); color: var(--navy-900); }
.badge-capex   { background: #E7ECF6; color: var(--navy); }
.badge-opex    { background: #FDF0D6; color: #8A5A00; }
.badge-soft    { background: var(--line-2); color: var(--muted); }
.badge-success { background: var(--success-bg); color: var(--success); }

/* --- Flash -------------------------------------------------------- */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); color: var(--success); border-color: #BFE6D6; }
.flash-error   { background: var(--danger-bg); color: var(--danger); border-color: #EFC6C0; }
.flash-info    { background: var(--info-bg); color: var(--navy); border-color: #CBDCF5; }

/* --- Login -------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #F4F6FA 0%, #E8EDF5 100%); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 28px; }
.auth-card .brand { justify-content: center; margin-bottom: 8px; }
.auth-card .brand-logo { height: 40px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: .92rem; }

/* --- Kennzahlen (Stat-Kacheln) ------------------------------------ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    position: relative; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px 18px 16px 20px; box-shadow: var(--shadow);
    overflow: hidden; transition: transform .12s, box-shadow .12s;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy); }
.stat:first-child::before { background: var(--gold); }
.stat:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15,37,70,.08), 0 14px 30px -14px rgba(15,37,70,.28); }
.stat .k { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.stat .v { font-size: 1.5rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .v.gold { color: var(--gold-600); }
.stat .sub { font-size: .82rem; color: var(--muted); margin-top: 3px; }

/* --- Szenario-Block ----------------------------------------------- */
.scenario { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.scenario-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: #FAFBFD; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.scenario-head .title { font-weight: 700; color: var(--navy-900); font-size: 1.05rem; }
.scenario-head .spacer { flex: 1; }
.scenario-body { padding: 4px 0 0; }
.scenario-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); background: #FCFDFE; }

details.inline-form > summary { cursor: pointer; list-style: none; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] > summary .btn { background: var(--line-2); }
.inline-form .form-box { margin-top: 12px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: #FCFDFE; }

/* --- Jahres-Eingabe (Positionen) ---------------------------------- */
.year-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.year-grid .yf label { font-size: .76rem; margin-bottom: 3px; }
.year-tools { display: flex; gap: 8px; margin: 8px 0 2px; flex-wrap: wrap; align-items: center; }
.calc-inline { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.calc-inline input { display: inline-block; }
.calc-box { margin: 6px 0 2px; }
.calc-box > summary { cursor: pointer; list-style: none; }
.calc-box > summary::-webkit-details-marker { display: none; }
.calc-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: #fff; }
.calc-grid .yf label { font-size: .76rem; margin-bottom: 3px; }

/* --- Diagramm (Balken) -------------------------------------------- */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; }
.bar-label { font-weight: 600; font-size: .9rem; }
.bar-track { background: var(--line-2); border-radius: 6px; height: 30px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; display: flex; align-items: center; }
.bar-fill.capex { background: var(--navy); }
.bar-fill.opex  { background: var(--gold); }
.bar-stack { display: flex; height: 100%; width: 100%; }
.bar-seg { height: 100%; }
.bar-seg.capex { background: var(--navy); }
.bar-seg.opex  { background: var(--gold); }
.bar-value { margin-left: 10px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; color: var(--navy-900); white-space: nowrap; }
.legend { display: flex; gap: 16px; margin-top: 4px; font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dot.capex { background: var(--navy); }
.dot.opex  { background: var(--gold); }

.delta-pos { color: var(--danger); font-weight: 700; }   /* teurer als Basis */
.delta-neg { color: var(--success); font-weight: 700; }  /* günstiger als Basis */

/* ==================================================================
   Fall-Bearbeitung (cases/show) – modernes Layout
   ================================================================== */
/* Hero – weißer Hintergrund wie die Karten, mit feinem Gold-Akzent */
.case-hero {
    background: var(--card);
    color: var(--ink); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 22px 24px 22px 26px; margin-bottom: 20px;
    box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.case-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
.case-hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.case-hero .crumb { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.case-hero .crumb a { color: var(--navy); font-weight: 600; }
.case-hero .crumb a:hover { color: var(--navy-900); }
.case-hero h1 { color: var(--navy-900); margin: 0 0 6px; font-size: 1.7rem; line-height: 1.2; }
.case-hero .sub { color: var(--muted); font-size: .95rem; }
.hero-flag { display: inline-block; vertical-align: middle; margin-left: 8px; font-size: .62em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--gold); color: var(--navy-900); border-radius: 999px; padding: 3px 10px; }
.case-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { background: #F3F6FA; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: .82rem; display: inline-flex; gap: 6px; align-items: center; }
.chip .k { color: var(--muted); }
.chip b { font-weight: 700; color: var(--navy-900); }
.chip.chip-gold { background: var(--gold); border-color: var(--gold-600); color: var(--navy-900); }
.chip.chip-gold .k { color: rgba(15,37,70,.6); }
.chip.chip-gold b { color: var(--navy-900); }

.case-grid { display: grid; grid-template-columns: minmax(0,1fr) 336px; gap: 20px; align-items: start; }
.case-main { min-width: 0; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.section-title h2 { margin: 0; }
.scn-add-tools { display: flex; gap: 8px; }

/* Popover (details-basiert) */
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-panel {
    position: absolute; top: 100%; left: 0; margin-top: 6px; z-index: 60;
    width: 440px; max-width: min(92vw, 560px);
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 18px 46px -14px rgba(15,37,70,.4); padding: 16px;
    max-height: 74vh; overflow: auto;
}
.pop.pop-right .pop-panel { left: auto; right: 0; }
.pop-panel.pop-wide { width: 560px; }

/* Szenario-Karte */
.scn-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.scn-card.is-baseline { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.scn-card-head { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.scn-headline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.scn-name { font-weight: 700; font-size: 1.12rem; color: var(--navy-900); }
.chip-type { font-size: .74rem; font-weight: 600; color: var(--navy); background: #E7ECF6; border-radius: 999px; padding: 3px 10px; }
.scn-total { margin-left: auto; text-align: right; }
.scn-total .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.scn-total .v { font-size: 1.15rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.scn-tools { display: flex; gap: 5px; align-items: center; }
.scn-tools form { margin: 0; }

.icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: .95rem; padding: 0; transition: background .12s, color .12s, border-color .12s; }
.icon-btn:hover { background: var(--line-2); color: var(--navy); }
.icon-btn.gold:hover { background: #FDF3DC; color: var(--gold-600); border-color: #F0D79A; }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: #E6B4AE; }
.icon-btn.sm { width: 28px; height: 28px; font-size: .85rem; border-radius: 7px; }

/* Positions-Tabelle */
.items-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.items-table th { font-size: .68rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); font-weight: 700; padding: 10px 7px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.items-table th.num { text-align: right; }
.items-table th .yr { display: block; font-weight: 400; color: var(--muted); font-size: .68rem; }
.items-table td { padding: 8px 7px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.items-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items-table tbody tr:hover { background: #FBFCFE; }
/* Aktionsspalte bleibt beim horizontalen Scrollen sichtbar */
.items-table th.act-col, .items-table td.act-col { position: sticky; right: 0; background: var(--card); box-shadow: -8px 0 8px -8px rgba(15,37,70,.12); }
.items-table tbody tr:hover td.act-col { background: #FBFCFE; }
.items-table .it-label { font-weight: 600; color: var(--navy-900); }
.items-table .it-sub { font-size: .78rem; color: var(--muted); margin-top: 1px; }
.items-table .it-cat { color: var(--navy); font-weight: 600; }
.items-table .it-cmt { color: var(--gold-600); font-weight: 600; }
.items-table .it-sum { font-weight: 700; color: var(--navy-900); }
.items-table .items-empty { padding: 18px 12px; }
.items-table .act-col { width: 1%; white-space: nowrap; }
.row-tools { display: inline-flex; gap: 4px; opacity: .55; transition: opacity .12s; }
.items-table tbody tr:hover .row-tools { opacity: 1; }
.yr-head { font-weight: 400; color: var(--muted); }
.items-table th .yr { color: var(--muted); }
.edit-row td { padding: 0 10px; border-bottom: 1px solid var(--line-2); }
.edit-row details > summary { list-style: none; cursor: pointer; }
.edit-row details > summary::-webkit-details-marker { display: none; }
.edit-toggle { display: inline-block; padding: 7px 0; font-size: .82rem; color: var(--navy); font-weight: 600; }
.edit-toggle:hover { text-decoration: underline; }

.scn-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--line-2); background: #FCFDFE; border-radius: 0 0 var(--radius) var(--radius); }
.scn-foot form { margin: 0; }

/* Sidebar */
.case-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.tool-card h3 { font-size: 1rem; margin: 0 0 10px; color: var(--navy-900); }
.tool-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tool-head h3 { margin: 0; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: .88rem; }
.meta-list dt { color: var(--muted); font-weight: 600; }
.meta-list dd { margin: 0; text-align: right; color: var(--ink); font-weight: 600; }
.snap-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.snap-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #FBFCFE; }
.snap-info { min-width: 0; flex: 1; }
.snap-label { font-weight: 600; font-size: .9rem; }
.snap-act { display: flex; gap: 4px; }
.snap-act form { margin: 0; }
.share-input { width: 100%; font-size: .8rem; padding: 7px 9px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-actions form { margin: 0; }

@media (max-width: 1000px) {
    .case-grid { grid-template-columns: 1fr; }
    .case-side { position: static; }
    .pop-panel { width: min(92vw, 440px); }
}
@media (max-width: 760px) {
    .case-hero { padding: 18px 18px; }
    .case-hero h1 { font-size: 1.4rem; }
    .meta-list dd { text-align: left; }
}

/* --- Bestätigungs-Modal ------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 37, 70, .45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; transition: opacity .14s ease;
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-overlay.show { opacity: 1; }
.modal {
    background: var(--card); border-radius: var(--radius);
    box-shadow: 0 20px 60px -15px rgba(15,37,70,.5);
    width: 100%; max-width: 440px; overflow: hidden;
    transform: translateY(8px) scale(.98); transition: transform .16s ease;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-icon {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
    background: var(--info-bg); color: var(--navy);
}
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--navy-900); }
.modal-body { padding: 10px 22px 4px; color: var(--ink); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
.modal-actions .btn { min-width: 110px; }

/* --- Kommentare --------------------------------------------------- */
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.comment { background: #FBFCFE; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: .82rem; margin-bottom: 3px; }
.comment-body { font-size: .9rem; white-space: pre-wrap; }

/* --- Sensitivitätsanalyse ----------------------------------------- */
.sens-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 22px; }
.sens-ctl { background: #FBFCFE; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 10px; }
.sens-ctl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sens-ctl-head label { font-size: .84rem; font-weight: 700; color: var(--navy-900); }
.sens-val {
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: .82rem;
    min-width: 54px; text-align: center; padding: 2px 8px; border-radius: 999px;
    background: var(--line-2); color: var(--muted);
}
.sens-val.up   { background: var(--danger-bg);  color: var(--danger); }
.sens-val.down { background: var(--success-bg); color: var(--success); }
.sens-scale { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); margin-top: 4px; }

/* Custom-Range mit gefüllter Spur (Füllung bis zum Daumen via --pct) */
.sens-slider { display: flex; align-items: center; }
input[type=range].sens-range {
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
    border-radius: 999px; outline: none; cursor: pointer; margin: 6px 0;
    background: linear-gradient(to right, var(--navy) 0%, var(--navy) var(--pct, 50%), var(--line) var(--pct, 50%), var(--line) 100%);
}
input[type=range].sens-range.is-pos { background: linear-gradient(to right, var(--line) 0%, var(--line) var(--pct), var(--danger) var(--pct), var(--danger) 100%); }
input[type=range].sens-range.is-neg { background: linear-gradient(to right, var(--success) 0%, var(--success) var(--pct), var(--line) var(--pct), var(--line) 100%); }
input[type=range].sens-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 2px solid var(--navy); box-shadow: 0 1px 4px rgba(15,37,70,.25); cursor: grab; margin-top: -1px;
}
input[type=range].sens-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }
input[type=range].sens-range::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--navy);
    box-shadow: 0 1px 4px rgba(15,37,70,.25); cursor: grab;
}
input[type=range].sens-range::-moz-range-track { height: 6px; border-radius: 999px; background: transparent; }

/* --- Torten- & Stapeldiagramme ------------------------------------ */
.pie-row { display: flex; flex-wrap: wrap; gap: 20px; }
.pie-item { text-align: center; }
.pie-title { font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--navy-900); }
.pie { width: 120px; height: 120px; }
.stack-block { margin-bottom: 16px; }
.stack-name { font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.stack-years { display: flex; gap: 10px; align-items: flex-end; height: 150px; }
.stack-col { flex: 1; max-width: 70px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.stack-bar { width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; overflow: hidden; display: flex; flex-direction: column-reverse; background: var(--line-2); min-height: 2px; }
.stack-label { font-size: .72rem; color: var(--muted); margin-top: 4px; }

/* --- Kurvendiagramm (SVG) ----------------------------------------- */
.chart-wrap { width: 100%; overflow-x: auto; }
.be-chart { width: 100%; height: auto; max-width: 820px; display: block; }
.be-chart .ax { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.be-chart .ax-sub { font-size: 10px; }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

.inline-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
hr.sep { border: none; border-top: 1px solid var(--line-2); margin: 16px 0; }

.table-compare th.scn { text-align: right; }
.table-compare td.scn { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-total td { font-weight: 700; border-top: 2px solid var(--line); background: #FAFBFD; }
.row-total td.scn { color: var(--navy-900); }
.cheapest { position: relative; }
.cheapest::after { content: "★"; color: var(--gold-600); margin-left: 6px; }

/* --- App-Footer (als Box abgesetzt, analog zum Header) ------------ */
.app-footer {
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -1px 0 rgba(15,37,70,.04), 0 -6px 18px -12px rgba(15,37,70,.22);
    margin-top: 44px;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto; padding: 18px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.footer-brand { font-weight: 700; color: var(--navy-900); font-size: .95rem; }
.footer-meta { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink); flex-wrap: wrap; }
.footer-meta .dot-sep { color: var(--line); }
@media (max-width: 760px) {
    .footer-inner { padding: 14px 14px; }
}

/* --- Responsive --------------------------------------------------- */
@media (max-width: 760px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; gap: 4px; }
    .app-nav a { padding: 7px 9px; font-size: .9rem; }
    .brand-logo { height: 32px; }
    .app-header .bar { gap: 8px; padding: 0 12px; height: 50px; }
    .header-user span.name-full { display: none; }
    .container { padding: 18px 14px 50px; }
}

/* --- Druck (PDF via Browser) -------------------------------------- */
@media print {
    .app-header, .app-footer, .no-print, .btn, details.inline-form { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
    .container { max-width: none; padding: 0; }
}
