/* ==========================================================================
   4bowl Deploy – Dark UI
   ========================================================================== */
:root {
    color-scheme: dark;
    --bg: #0c0e12;
    --bg-elev: #101318;
    --surface: #13161c;
    --surface-2: #181c24;
    --surface-3: #1e232c;
    --border: #22272f;
    --border-strong: #2e3540;
    --text: #f2f4f7;
    --text-2: #cfd4dc;
    --muted: #8a919e;
    --muted-2: #626a78;

    --accent: #9e77ed;
    --accent-strong: #7f56d9;
    --accent-soft: rgba(158, 119, 237, 0.14);
    --accent-ring: rgba(158, 119, 237, 0.35);

    --blue: #3987e5;
    --good: #0ca30c;
    --good-text: #4ade80;
    --warning: #fab219;
    --serious: #ec835a;
    --critical: #d03b3b;
    --critical-text: #f87171;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
    --sidebar-w: 264px;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.link { color: var(--text-2); border-bottom: 1px dotted var(--border-strong); }
a.link:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--text-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: .85em; background: var(--surface-3); padding: .1em .4em; border-radius: 4px; color: var(--text-2); }
kbd { font-size: .75em; background: var(--surface-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; padding: 0 .4em; border-radius: 4px; color: var(--text-2); }
small { font-size: .85em; }
.muted { color: var(--muted); }
.text-danger { color: var(--critical-text); }
.accent { color: var(--accent); font-style: normal; font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { display: block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow { color: var(--muted-2); padding: 0 .25em; }
.divider { height: 1px; background: var(--border); margin: .25rem 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-gap { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.row-gap.wrap { display: flex; }
.inline { display: inline; }
[hidden] { display: none !important; }

/* Fortschrittsbalken (Seitenwechsel) ------------------------------------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 100; background: transparent; }
.progress span { display: block; height: 100%; width: 30%; background: var(--accent); animation: progress 1.2s ease-in-out infinite; }
@keyframes progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* Layout ----------------------------------------------------------------- */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--bg-elev); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1rem .875rem; z-index: 40;
    transition: transform .2s ease;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .9rem; }
.brand-mark {
    display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: -.02em;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 4px 12px var(--accent-ring);
}
.brand-name { font-weight: 600; font-size: 1.02rem; }
.brand-lg .brand-mark { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 12px; }
.brand-lg .brand-name { font-size: 1.2rem; }
.sidebar .sidebar-close { margin-left: auto; display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 1rem .6rem .4rem; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: .95rem; transition: background .12s, color .12s;
}
.nav-item svg, .btn-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-item.active svg { color: var(--accent); }
.nav-badge { margin-left: auto; font-style: normal; font-size: .72rem; background: var(--surface-3); border: 1px solid var(--border-strong); padding: 0 .45em; border-radius: 999px; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: .8rem; display: flex; align-items: center; gap: .3rem; }
.user-card { display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 0; padding: .35rem .4rem; border-radius: var(--radius-sm); color: inherit; }
.user-card:hover { background: var(--surface-2); text-decoration: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-guest .main { margin-left: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
    padding: .8rem 2rem; background: rgba(12,14,18,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-menu { display: none; }
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--muted); flex: 1; min-width: 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb .sep { color: var(--muted-2); }
.topbar-actions { display: flex; align-items: center; gap: .8rem; }
.topbar-avatar { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--border-strong); }

.page { padding: 1.75rem 2rem 6rem; display: flex; flex-direction: column; gap: 1.25rem; max-width: 1600px; width: 100%; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.65rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-subtitle { color: var(--muted); margin-top: .25rem; max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Avatar ------------------------------------------------------------------ */
.avatar {
    --avatar: var(--accent-strong);
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: color-mix(in srgb, var(--avatar) 28%, var(--surface-3));
    color: #fff; font-size: .76rem; font-weight: 700; letter-spacing: .02em;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--avatar) 60%, transparent);
}
.avatar-lg { width: 44px; height: 44px; font-size: .95rem; }

/* Pills ------------------------------------------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: .4em; padding: .12em .6em .12em .5em; border-radius: 999px;
    font-size: .78rem; font-weight: 500; line-height: 1.6; white-space: nowrap;
    background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2);
}
a.pill:hover { text-decoration: none; border-color: var(--muted); color: var(--text); }
.pill .dot, .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.op-create .dot, .dot-create { background: var(--good); }
.pill.op-overwrite .dot, .dot-overwrite { background: var(--warning); }
.pill.op-delete .dot, .dot-delete { background: var(--critical); }
.pill.op-create { background: rgba(12,163,12,.10); border-color: rgba(12,163,12,.35); }
.pill.op-overwrite { background: rgba(250,178,25,.10); border-color: rgba(250,178,25,.35); }
.pill.op-delete { background: rgba(208,59,59,.12); border-color: rgba(208,59,59,.4); }
.pill.env-edge .dot { background: var(--accent); }
.pill.env-edge { background: var(--accent-soft); border-color: rgba(158,119,237,.4); }
.pill.env-live .dot { background: var(--blue); }
.pill.env-live { background: rgba(57,135,229,.12); border-color: rgba(57,135,229,.4); }
.pill.type-restore .dot { background: var(--serious); }
.pill.type-restore { background: rgba(236,131,90,.12); border-color: rgba(236,131,90,.4); }
.pill.type-deploy .dot { background: var(--accent); }
.pill.state-ok .dot { background: var(--good); }
.pill.state-warn .dot { background: var(--warning); }
.pill.state-error .dot { background: var(--critical); }
.pill.state-error { border-color: rgba(208,59,59,.45); }
.pill.muted-pill { color: var(--muted); }
.newer { color: var(--good-text); }
.older { color: var(--critical-text); }
.same { color: var(--text-2); }

/* Buttons ----------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: .9rem;
    border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
    white-space: nowrap; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible, .input:focus-visible, select:focus-visible, input:focus-visible, .btn-icon:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-strong); color: #fff; border-color: rgba(255,255,255,.08); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.btn-primary:hover:not(:disabled) { background: #6f47c9; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--muted-2); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b83232; }
.btn-sm { padding: .38rem .75rem; font-size: .83rem; }
.btn-xs { padding: .22rem .5rem; font-size: .76rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-icon {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 1.2rem; line-height: 1;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }

/* Segmented control ------------------------------------------------------- */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button {
    font: inherit; font-size: .83rem; font-weight: 500; color: var(--muted); background: transparent; border: 0;
    padding: .35rem .8rem; border-radius: 6px; cursor: pointer; transition: background .12s, color .12s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* Forms -------------------------------------------------------------------- */
.input, select, input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], textarea {
    font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: .55rem .8rem; min-height: 40px; transition: border-color .12s, box-shadow .12s;
    width: 100%;
}
.input::placeholder, input::placeholder { color: var(--muted-2); }
.input:hover, select:hover, input:hover { border-color: var(--muted-2); }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a919e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center; }
select optgroup { background: var(--surface-2); color: var(--muted); }
select option { background: var(--surface-2); color: var(--text); }
input[type=color] { width: 48px; height: 40px; padding: 3px; border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent-strong); cursor: pointer; margin: 0; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 500; color: var(--text-2); }
.field .help { color: var(--muted); font-size: .8rem; }
.field-inline { flex-direction: row; align-items: center; gap: .8rem; flex-wrap: wrap; }
.field-inline > span:first-child { flex-basis: 100%; }
.field-wide { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.25rem; }
.checkbox { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.toolbar .input { width: 240px; }
.note { font-size: .88rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; line-height: 1.55; }

/* Alerts ------------------------------------------------------------------- */
.alert { position: relative; display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 2.6rem .8rem 1rem; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.alert strong { font-size: .9rem; white-space: nowrap; }
.alert ul { margin: 0; padding-left: 1.1rem; color: var(--text-2); font-size: .92rem; }
.alert li + li { margin-top: .15rem; }
.alert-success { border-color: rgba(12,163,12,.45); background: rgba(12,163,12,.08); }
.alert-success strong { color: var(--good-text); }
.alert-error { border-color: rgba(208,59,59,.5); background: rgba(208,59,59,.1); }
.alert-error strong { color: var(--critical-text); }
.alert-warning { border-color: rgba(250,178,25,.45); background: rgba(250,178,25,.08); }
.alert-warning strong { color: var(--warning); }
.alert-info { border-color: rgba(57,135,229,.45); background: rgba(57,135,229,.08); }
.alert-info strong { color: #7ab4f5; }
.alert-close { position: absolute; top: .45rem; right: .5rem; background: none; border: 0; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: .2rem .4rem; border-radius: 6px; }
.alert-close:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* Cards -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.3); overflow: hidden; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-subtitle { color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.card-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card-body { padding: 1.25rem; }
.card-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; align-items: center; gap: .6rem; }
.card-success { border-color: rgba(12,163,12,.4); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.25rem; }
.grid-2.align-start { align-items: start; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.meta-grid > div { display: flex; flex-direction: column; gap: .3rem; }
.meta-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 600; }

/* Stat tiles --------------------------------------------------------------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stats-grid-5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat {
    display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: inherit; text-align: left; font: inherit; cursor: default; transition: border-color .12s, background .12s;
}
a.stat:hover, .stat-btn:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.stat-btn { cursor: pointer; }
.stat-btn.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-warn { border-color: rgba(250,178,25,.4); }
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.stat-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat-value-sm { font-size: 1.3rem; }
.stat-foot { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .8rem; min-height: 1.2em; }
.stat-delta { font-style: normal; font-weight: 600; padding: .05em .45em; border-radius: 999px; font-size: .78rem; }
.stat-delta.up { color: var(--good-text); background: rgba(12,163,12,.12); }
.stat-delta.down { color: var(--critical-text); background: rgba(208,59,59,.14); }

/* Tables ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table th small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: .3rem; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255,255,255,.02); }
.table .num { text-align: right; }
.table td.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.table-sm th, .table-sm td { padding: .45rem .8rem; font-size: .85rem; }
.col-check { width: 2.5rem; }
.cell-user { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.cell-user strong { display: block; font-weight: 600; line-height: 1.2; }
.cell-user small { color: var(--muted); display: block; }
.cell-file strong { display: block; font-family: var(--mono); font-size: .86rem; font-weight: 500; word-break: break-all; }
.cell-file small { color: var(--muted); font-family: var(--mono); font-size: .75rem; }
.cell-meta > span:not(.pill) { display: block; font-size: .86rem; }
.cell-meta > .pill { margin-bottom: .2rem; }
.cell-meta small { display: block; color: var(--muted); }
.cell-reason { max-width: 36ch; }
.cell-reason span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { white-space: nowrap; }
.cell-stack { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.cell-wrap { white-space: normal; }
.cell-wrap .pill { margin: .1rem 0; }
.cell-actions .btn + .btn { margin-left: .2rem; }
.file-table .group-row td { background: var(--bg-elev); color: var(--muted); font-family: var(--mono); font-size: .78rem; padding: .4rem 1rem; border-top: 1px solid var(--border); }
.file-table .group-row:first-child td { border-top: 0; }
.row-disabled td { opacity: .55; }
.row-disabled td:hover { opacity: .8; }

/* Selector (Quelle → Ziel) -------------------------------------------------- */
.selector { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 1rem; align-items: end; padding: 1.25rem; }
.selector-side { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.selector-swap { align-self: center; margin-top: 1.2rem; border-color: var(--border-strong); }
.selector .btn-primary { min-height: 40px; }

/* Sticky action bar --------------------------------------------------------- */
.sticky-bar {
    position: sticky; bottom: 1rem; z-index: 20; display: flex; align-items: center; gap: 1rem;
    padding: .8rem 1rem; background: rgba(24,28,36,.92); backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sticky-info { white-space: nowrap; font-size: .92rem; }
.sticky-info strong { font-size: 1.1rem; }
.sticky-bar .input { flex: 1; }

/* Empty state --------------------------------------------------------------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.empty-state h2 { color: var(--text); font-size: 1.15rem; }
.empty-state p { max-width: 50ch; }
.empty-state .btn { margin-top: .5rem; }

/* Login --------------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: radial-gradient(1200px 600px at 50% -10%, rgba(127,86,217,.18), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; }
.login-card .brand { padding: 0 0 1rem; }
.login-card h1 { font-size: 1.35rem; }
.login-card form { margin-top: 1.25rem; }
.login .alert { max-width: 400px; margin-bottom: 1rem; }

/* Chart --------------------------------------------------------------------- */
.chart-wrap { position: relative; padding-bottom: .75rem; }
.chart { position: relative; height: 300px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .grid-col { stroke: rgba(255,255,255,.035); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .area { fill: url(#chart-fill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .crosshair { stroke: var(--muted-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .marker { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; r: 5; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .empty-note { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.chart-tooltip {
    position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s; transform: translate(-50%, calc(-100% - 14px));
    background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: .45rem .65rem; font-size: .8rem; white-space: nowrap; box-shadow: var(--shadow); z-index: 5;
}
.chart-tooltip strong { display: block; font-size: .95rem; }
.chart-tooltip small { color: var(--muted); }
.chart-table { margin: .5rem 1.25rem 0; font-size: .85rem; }
.chart-table summary { color: var(--muted); cursor: pointer; }
.chart-table .table-wrap { margin-top: .5rem; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Modal / Viewer -------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5,6,8,.72); backdrop-filter: blur(4px); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal { width: min(1500px, 100%); max-height: min(92vh, 1000px); min-height: 260px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.modal-heading { min-width: 0; flex: 1; }
.modal-heading h2 { font-size: 1rem; font-family: var(--mono); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-heading p { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-stats { display: flex; gap: .5rem; align-items: center; font-family: var(--mono); font-size: .82rem; }
.modal-stats .add { color: var(--good-text); }
.modal-stats .del { color: var(--critical-text); }
.modal-toolbar { display: flex; align-items: center; gap: 1rem; padding: .55rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; font-size: .85rem; min-height: 46px; }
.modal-toolbar:empty { display: none; }
.modal-toolbar .legend { display: inline-flex; gap: .6rem; align-items: center; color: var(--muted); }
.modal-toolbar .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.modal-toolbar .legend .la { background: rgba(12,163,12,.45); }
.modal-toolbar .legend .ld { background: rgba(208,59,59,.5); }
.modal-toolbar .spacer { flex: 1; }
.modal-body { flex: 1; overflow: auto; background: var(--bg-elev); position: relative; }
.modal-msg { padding: 2.5rem; text-align: center; color: var(--muted); }
.modal-msg strong { color: var(--text); display: block; margin-bottom: .3rem; }
.loading { padding: 2.5rem; text-align: center; color: var(--muted); }

.code-view { margin: 0; padding: 0; background: transparent !important; font-size: 12.5px; line-height: 1.55; }
.code-table, .diff-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.code-table td, .diff-table td { padding: 0 .75rem; vertical-align: top; white-space: pre-wrap; word-break: break-word; border: 0; }
.code-table .ln, .diff-table .ln { width: 1%; min-width: 3.2em; text-align: right; color: var(--muted-2); user-select: none; padding-right: .5rem; border-right: 1px solid var(--border); background: var(--surface); position: sticky; left: 0; }
.diff-table .ln + .ln { left: auto; position: static; }
.diff-table .sign { width: 1%; text-align: center; user-select: none; color: var(--muted-2); padding: 0 .35rem; }
.diff-table tr.add td { background: rgba(12,163,12,.11); }
.diff-table tr.add .sign { color: var(--good-text); }
.diff-table tr.del td { background: rgba(208,59,59,.12); }
.diff-table tr.del .sign { color: var(--critical-text); }
.diff-table tr.add .ln, .diff-table tr.del .ln { background: inherit; }
.diff-table mark { background: rgba(12,163,12,.38); color: inherit; border-radius: 2px; }
.diff-table tr.del mark { background: rgba(208,59,59,.42); }
.diff-table tr.skip td { background: var(--surface-2); color: var(--muted); text-align: center; padding: .25rem; font-size: .78rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.diff-table tr.skip button { font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }
.diff-table tr.skip button:hover { text-decoration: underline; }
.diff-table.split td.code { width: 50%; }
.diff-table.split td.empty-side { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.025) 6px 12px); }
.diff-table .code .token { background: transparent !important; }
/* Prism-Theme-Reste im eigenen Viewer neutralisieren */
.modal pre[class*="language-"], .modal code[class*="language-"] { background: transparent; text-shadow: none; margin: 0; padding: 0; font-size: inherit; line-height: inherit; }

/* Responsive ------------------------------------------------------------------ */
@media (max-width: 1100px) {
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: none; box-shadow: var(--shadow); }
    .sidebar.open ~ .sidebar-backdrop { display: block; }
    .sidebar-close { display: inline-grid; }
    .main { margin-left: 0; }
    .topbar { padding: .7rem 1rem; }
    .topbar-menu { display: inline-grid; }
    .topbar-cta { display: none; }
    .page { padding: 1.25rem 1rem 6rem; }
    .selector { grid-template-columns: 1fr; }
    .selector-swap { justify-self: center; margin: 0; transform: rotate(90deg); }
    .sticky-bar { flex-wrap: wrap; bottom: .5rem; }
    .sticky-bar .input { flex-basis: 100%; }
    .modal-backdrop { padding: 0; }
    .modal { height: 100vh; border-radius: 0; }
    .toolbar .input { width: 100%; }
}
