/* SecondBrain design system: tokens, base, Bootstrap bridge, app shell, components.
   Page-specific styles live in pages.css. Tokens follow docs/design/gen2.py. */

/* ---------- Fonts (self-hosted, SIL OFL 1.1, see fonts/OFL-*.txt) ---------- */
@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/geist-latin-wght-normal.woff2') format('woff2-variations'), url('fonts/geist-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations'), url('fonts/geist-latin-ext-wght-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Geist Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/geist-mono-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Geist Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/geist-mono-latin-ext-400-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Geist Mono';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('fonts/geist-mono-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Geist Mono';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('fonts/geist-mono-latin-ext-500-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root, [data-bs-theme=dark] {
    --bg: #0A0B0D;
    --side: #0D0F12;
    --s1: #121418;
    --s2: #181B20;
    --line: #23272E;
    --line2: #2E333B;
    --line3: #3A4048;
    --text: #ECEEF1;
    --body-text: #D5D9DF;
    --muted: #8C929D;
    --dim: #5C626C;
    --accent: #C8F169;
    --accent-hover: #E1FF9E;
    --on-accent: #0A0B0D;
    --ok: #7EE2A8;
    --info: #7AA2FF;
    --busy: #F2C94C;
    --fail: #FF7A7A;
    --t-kunde: #7AA2FF;
    --t-projekt: #C8F169;
    --t-person: #FF9F6E;
    --t-entscheidung: #F2C94C;
    --t-thema: #B18CFF;
    --t-quelle: #6B7280;
    --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --focus-ring: 0 0 0 3px rgba(200, 241, 105, 0.12);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    /* Bootstrap bridge: pages that still use Bootstrap classes pick up the dark design. */
    color-scheme: dark;
    --bs-body-bg: var(--bg);
    --bs-body-bg-rgb: 10, 11, 13;
    --bs-body-color: var(--text);
    --bs-body-color-rgb: 236, 238, 241;
    --bs-body-font-family: var(--sans);
    --bs-font-sans-serif: var(--sans);
    --bs-font-monospace: var(--mono);
    --bs-body-font-size: 0.875rem;
    --bs-emphasis-color: var(--text);
    --bs-emphasis-color-rgb: 236, 238, 241;
    --bs-secondary-color: var(--muted);
    --bs-secondary-color-rgb: 140, 146, 157;
    --bs-tertiary-color: var(--dim);
    --bs-secondary-bg: var(--s1);
    --bs-secondary-bg-rgb: 18, 20, 24;
    --bs-tertiary-bg: var(--s2);
    --bs-tertiary-bg-rgb: 24, 27, 32;
    --bs-border-color: var(--line2);
    --bs-border-color-translucent: rgba(255, 255, 255, 0.08);
    --bs-border-radius: 8px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 12px;
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 200, 241, 105;
    --bs-link-hover-color: var(--accent-hover);
    --bs-link-hover-color-rgb: 225, 255, 158;
    --bs-code-color: var(--accent);
    --bs-heading-color: var(--text);
    --bs-primary: #C8F169;
    --bs-primary-rgb: 200, 241, 105;
    --bs-success: #7EE2A8;
    --bs-success-rgb: 126, 226, 168;
    --bs-info: #7AA2FF;
    --bs-info-rgb: 122, 162, 255;
    --bs-warning: #F2C94C;
    --bs-warning-rgb: 242, 201, 76;
    --bs-danger: #FF7A7A;
    --bs-danger-rgb: 255, 122, 122;
    --bs-secondary: #8C929D;
    --bs-secondary-rgb: 140, 146, 157;
    --bs-light-rgb: 24, 27, 32;
    --bs-dark-rgb: 10, 11, 13;
    --bs-focus-ring-color: rgba(200, 241, 105, 0.2);
    --bs-form-valid-color: var(--ok);
    --bs-form-valid-border-color: var(--ok);
    --bs-form-invalid-color: var(--fail);
    --bs-form-invalid-border-color: var(--fail);
}

/* ---------- Base ---------- */
html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-size: 14px;
    line-height: 1.5;
    min-height: 100dvh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

h1:focus {
    outline: none;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
}

::selection {
    background: rgba(200, 241, 105, 0.25);
}

:focus-visible {
    outline: 2px solid rgba(200, 241, 105, 0.6);
    outline-offset: 2px;
}

kbd {
    display: inline-flex;
    align-items: center;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 5px;
    border: 1px solid var(--line2);
    color: var(--muted);
    background: var(--s2);
    box-shadow: none;
}

code {
    font-family: var(--mono);
    color: var(--accent);
}

* {
    scrollbar-color: var(--line2) transparent;
    scrollbar-width: thin;
}

.icon {
    flex-shrink: 0;
    display: block;
}

.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-break { overflow-wrap: anywhere; }
.grow { flex: 1 1 auto; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.micro-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
}

.visually-hidden-focusable:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- App shell ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100dvh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 18px 12px;
    background: var(--side);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.logo-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--accent);
    color: var(--on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.brand-tag {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--dim);
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.global-search {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 9px;
    background: var(--s1);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.global-search:focus-within {
    border-color: var(--line3);
    box-shadow: var(--focus-ring);
}

.global-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: var(--text);
}

.global-search input::-webkit-search-cancel-button {
    display: none;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section {
    padding: 0 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 450;
    color: var(--muted);
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--text);
    font-weight: 600;
    background: var(--s2);
    box-shadow: inset 0 0 0 1px var(--line2);
}

.nav-item.active .icon {
    color: var(--accent);
}

.nav-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent);
    color: #0A0B0D;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

/* Live nav: synapse storm around "Jobs" (JobStorm.razor + js/nav-storm.js), popping inbox count. */
.nav-item {
    position: relative;
}

.nav-item > .icon,
.nav-item > .nav-label {
    position: relative;
    z-index: 1;
}

.nav-storm {
    position: absolute;
    left: -12px;
    top: -12px;
    width: calc(100% + 24px);
    height: calc(100% + 24px);
    pointer-events: none;
    z-index: 0;
}

.nav-item.storming {
    color: var(--text);
}

.nav-item.storming > .icon {
    color: var(--accent);
    animation: sb-storm-icon 1.1s ease-in-out infinite;
}

.nav-item.storming.storm-calm > .icon {
    color: var(--info);
    animation-duration: 2.6s;
}

@keyframes sb-storm-icon {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(200, 241, 105, 0.35)); }
    50% { filter: drop-shadow(0 0 6px rgba(200, 241, 105, 0.8)); }
}

.nav-item.storm-calm > .icon {
    animation-name: sb-storm-icon-calm;
}

@keyframes sb-storm-icon-calm {
    0%, 100% { filter: drop-shadow(0 0 1px rgba(122, 162, 255, 0.3)); }
    50% { filter: drop-shadow(0 0 5px rgba(122, 162, 255, 0.7)); }
}

/* What the storm means, revealed on hover: inline on the sidebar, a tooltip next to the rail. */
.storm-tip {
    position: relative;
    z-index: 1;
    margin-left: auto;
    display: inline-flex;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.nav-item:hover .storm-tip,
.nav-item:focus-visible .storm-tip {
    opacity: 1;
    transform: none;
}

.storm-tip-run { color: var(--accent); }
.storm-tip-wait { color: var(--info); }

.nav-count.pop {
    position: relative;
    z-index: 1;
    animation: sb-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes sb-pop {
    0% { transform: scale(0.4); box-shadow: 0 0 0 0 rgba(200, 241, 105, 0.6); }
    60% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(200, 241, 105, 0); }
    100% { transform: scale(1); }
}

.meter-row .tick {
    animation: sb-tick 0.9s ease-out;
}

@keyframes sb-tick {
    0% { color: var(--accent); text-shadow: 0 0 8px rgba(200, 241, 105, 0.7); }
    100% { color: inherit; text-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-item.storming > .icon,
    .nav-count.pop,
    .meter-row .tick {
        animation: none;
    }
}

.side-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--s1);
    border: 1px solid var(--line);
}

.meter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.meter {
    height: 4px;
    border-radius: 999px;
    background: var(--s2);
    overflow: hidden;
}

.meter span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.user-row form {
    margin: 0;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--s2);
    box-shadow: inset 0 0 0 1px var(--line2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    cursor: pointer;
    list-style: none;
}

.avatar::-webkit-details-marker {
    display: none;
}

.avatar:hover {
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line3);
}

.user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 11px;
    color: var(--muted);
}

.link-button {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

.link-button:hover {
    color: var(--text);
}

.rail-only {
    display: none !important;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mobile-bar, .tabbar, .fab {
    display: none;
}

/* Account menu (rail + phone) */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
}

.menu-pop {
    position: absolute;
    z-index: 50;
    min-width: 220px;
    padding: 6px;
    border-radius: 12px;
    background: var(--s1);
    border: 1px solid var(--line2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar .menu-pop {
    left: calc(100% + 12px);
    bottom: 0;
}

.mobile-bar .menu-pop {
    right: 0;
    top: calc(100% + 8px);
}

.menu-head {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}

.menu-pop a, .menu-pop button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    width: 100%;
    font: inherit;
    font-size: 14px;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
}

.menu-pop a:hover, .menu-pop button:hover {
    color: var(--text);
    background: var(--s2);
}

.menu-pop form {
    margin: 4px 0 0;
    border-top: 1px solid var(--line);
    padding-top: 4px;
}

/* ---------- Page scaffold ---------- */
.page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 36px 36px;
    flex: 1 1 auto;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: flex-end;
    gap: 12px 16px;
    flex-wrap: wrap;
    padding-top: 26px;
    margin-bottom: 6px;
}

.ph-text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 320px;
    min-width: 0;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--dim);
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.05;
    font-weight: 650;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.ph-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn-ui {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 9px;
    border: 1px solid var(--line2);
    background: var(--s1);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn-ui:hover {
    color: var(--text);
    border-color: var(--line3);
    background: #16191e;
}

.btn-ui.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    font-weight: 650;
}

.btn-ui.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--on-accent);
}

.btn-ui.primary kbd {
    background: rgba(10, 11, 13, 0.1);
    border-color: rgba(10, 11, 13, 0.2);
    color: var(--on-accent);
}

.btn-ui.sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-ui.xs {
    height: 26px;
    padding: 0 9px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-ui.danger {
    color: #FF9C9C;
}

.btn-ui.danger:hover {
    border-color: rgba(255, 122, 122, 0.5);
    color: var(--fail);
}

.btn-ui.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-ui.ghost:hover {
    color: var(--text);
    background: var(--s2);
}

.btn-ui.block {
    width: 100%;
}

.btn-ui:disabled, .btn-ui[aria-disabled=true] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.icon-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 9px;
    border: 1px solid var(--line2);
    background: var(--s1);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--line3);
}

.icon-btn.lg {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.icon-btn.accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: sb-spin 0.7s linear infinite;
    vertical-align: -2px;
}

@keyframes sb-spin {
    to { transform: rotate(360deg); }
}

/* Thinking.razor: impulse from left to right through a small net, 1.6 s per round. */
.thinking {
    display: inline-flex;
    vertical-align: middle;
}

.thinking svg {
    overflow: visible;
}

.thinking line {
    stroke-width: 1.2;
    stroke-linecap: round;
}

.thinking .axon line {
    stroke: var(--line3);
}

.thinking .impulse line {
    stroke: var(--accent);
    stroke-width: 1.8;
    stroke-dasharray: 0.35 2;
    stroke-dashoffset: 0.35;
    animation: sb-impulse 1.6s linear infinite;
}

.thinking .soma circle {
    fill: var(--dim);
    transform-box: fill-box;
    transform-origin: center;
    animation: sb-soma 1.6s ease-out infinite;
}

.thinking .d1 { animation-delay: 0.4s; }
.thinking .d2 { animation-delay: 0.8s; }
.thinking .d3 { animation-delay: 1.2s; }

@keyframes sb-impulse {
    0% { stroke-dashoffset: 0.35; }
    25%, 100% { stroke-dashoffset: -1; }
}

@keyframes sb-soma {
    0%, 100% { fill: var(--dim); transform: scale(1); }
    6% { fill: var(--accent); transform: scale(1.45); filter: drop-shadow(0 0 3px var(--accent)); }
    30% { fill: var(--dim); transform: scale(1); filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    .thinking .impulse line,
    .thinking .soma circle {
        animation: none;
    }

    .thinking .soma circle {
        fill: var(--accent);
    }
}

/* ---------- Panels ---------- */
.panel {
    background: var(--s1);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    flex-wrap: wrap;
}

.panel-head h2, .panel-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-head .meta {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--dim);
}

.spacer {
    flex: 1 1 auto;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 550;
    color: var(--muted);
}

.panel-link:hover {
    color: var(--text);
}

.panel-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-body.sep, .sep {
    border-top: 1px solid var(--line);
}

.panel > .table-responsive, .panel > .table {
    border-top: 1px solid var(--line);
}

.empty {
    padding: 28px 20px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--line);
}

.list-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    border-top: 1px solid var(--line);
    color: var(--text);
    min-width: 0;
}

a.list-row:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.015);
}

/* ---------- Pills, chips, tags ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--s2);
    box-shadow: inset 0 0 0 1px var(--line2);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    --tone: var(--muted);
}

.pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tone);
    box-shadow: 0 0 8px var(--tone);
    flex-shrink: 0;
}

.pill-ok { --tone: var(--ok); }
.pill-info { --tone: var(--info); }
.pill-busy { --tone: var(--busy); }
.pill-fail { --tone: var(--fail); }
.pill-muted { --tone: var(--muted); }
.pill-accent { --tone: var(--accent); }

.t-kunde { --tc: var(--t-kunde); }
.t-projekt { --tc: var(--t-projekt); }
.t-person { --tc: var(--t-person); }
.t-entscheidung { --tc: var(--t-entscheidung); }
.t-thema { --tc: var(--t-thema); }
.t-quelle { --tc: var(--t-quelle); }
.t-other { --tc: var(--muted); }

.type-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--s2);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--tc);
    white-space: nowrap;
}

.type-chip .sq {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--tc);
}

.type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc);
    flex-shrink: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--s2);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.class-chip {
    font-size: 13px;
    color: var(--muted);
}

.class-chip.vertraulich {
    color: var(--fail);
}

.class-chip.kunde {
    color: var(--busy);
}

.src-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--s2);
    box-shadow: inset 0 0 0 1px var(--line2);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line2);
    background: var(--s1);
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}

.chip-btn:hover {
    color: var(--text);
}

.chip-btn.on {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.chip-btn.off {
    opacity: 0.45;
}

.chip-btn .count {
    font-family: var(--mono);
    font-size: 11px;
    opacity: 0.75;
}

/* ---------- Forms ---------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    min-width: 0;
}

.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .field textarea {
    height: 38px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--line2);
    background: var(--bg);
    font: inherit;
    font-size: 14px;
    color: var(--text);
}

.field textarea, textarea.input {
    height: auto;
    padding: 10px 12px;
    line-height: 1.5;
    resize: vertical;
}

.field select, select.input {
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C929D' 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 10px center;
    background-size: 14px;
}

.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: rgba(200, 241, 105, 0.5);
    box-shadow: var(--focus-ring);
}

.input.mono, .field .mono {
    font-family: var(--mono);
    font-size: 13px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--line2);
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.search-field:focus-within {
    border-color: rgba(200, 241, 105, 0.5);
    box-shadow: var(--focus-ring);
}

.search-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: var(--text);
}

.search-field.lg {
    height: 46px;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
}

.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    align-self: flex-start;
    flex-wrap: wrap;
}

.seg button {
    height: 32px;
    padding: 0 14px;
    border-radius: 7px;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
}

.seg button:hover {
    color: var(--text);
}

.seg button.on {
    background: var(--s2);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line2);
}

.seg.sm button {
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}

input[type=checkbox], input[type=radio], input[type=range] {
    accent-color: var(--accent);
}

.check input[type=checkbox] {
    width: 15px;
    height: 15px;
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.notice {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 11px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.notice .icon {
    color: var(--busy);
}

.callout-warn {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(242, 201, 76, 0.07);
    border: 1px solid rgba(242, 201, 76, 0.28);
    font-size: 14px;
    line-height: 1.5;
}

.callout-warn > .icon {
    color: var(--busy);
    margin-top: 3px;
}

.callout-title {
    font-weight: 600;
    color: var(--busy);
}

/* ---------- Grid tables ---------- */
.gt-row {
    display: grid;
    grid-template-columns: var(--cols);
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    border-top: 1px solid var(--line);
    min-width: 0;
}

.gt-head {
    padding-top: 8px;
    padding-bottom: 8px;
}

.gt-row:not(.gt-head):hover {
    background: rgba(255, 255, 255, 0.015);
}

.cell-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cell-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cell-title a, .cell-title .title {
    font-size: 14px;
    font-weight: 550;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-title a:hover {
    color: var(--accent);
}

.cell-sub {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-mono {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

/* ---------- Bootstrap components in the dark design ---------- */
.card {
    --bs-card-bg: var(--s1);
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: 14px;
    --bs-card-inner-border-radius: 13px;
    --bs-card-cap-bg: transparent;
    --bs-card-color: var(--text);
    --bs-card-spacer-y: 1.1rem;
    --bs-card-spacer-x: 1.25rem;
}

.card-title, .card h2, .card h3 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.015);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-color: var(--text);
    --bs-table-active-bg: rgba(200, 241, 105, 0.06);
    --bs-table-active-color: var(--text);
    margin-bottom: 0;
    font-size: 13px;
}

.table > :not(caption) > * > * {
    padding: 0.65rem 0.9rem;
    border-bottom-color: var(--line);
}

.table > thead th {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    white-space: nowrap;
}

.table > tbody > tr:last-child > * {
    border-bottom: none;
}

.table-warning {
    --bs-table-bg: rgba(242, 201, 76, 0.06);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
}

.form-control, .form-select {
    background-color: var(--bg);
    border-color: var(--line2);
    color: var(--text);
    border-radius: 8px;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg);
    border-color: rgba(200, 241, 105, 0.5);
    color: var(--text);
    box-shadow: var(--focus-ring);
}

.form-control::placeholder {
    color: var(--dim);
}

.form-control:disabled, .form-select:disabled {
    background-color: var(--s1);
    color: var(--muted);
}

.form-label, .col-form-label {
    color: var(--muted);
    font-size: 12px;
}

.form-check-input {
    background-color: var(--bg);
    border-color: var(--line3);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
    --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230A0B0D' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: rgba(200, 241, 105, 0.5);
    box-shadow: var(--focus-ring);
}

.form-floating > label {
    color: var(--muted);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--dim);
}

.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-control:disabled ~ label::after {
    background-color: transparent;
}

.form-floating > .form-control::placeholder {
    color: transparent;
}

.btn {
    --bs-btn-font-weight: 550;
    --bs-btn-border-radius: 9px;
    --bs-btn-font-size: 13px;
    --bs-btn-focus-box-shadow: var(--focus-ring);
}

.btn-sm {
    --bs-btn-border-radius: 8px;
    --bs-btn-font-size: 12px;
}

.btn-lg {
    --bs-btn-border-radius: 10px;
    --bs-btn-font-size: 15px;
    --bs-btn-padding-y: 0.6rem;
}

.btn-primary {
    --bs-btn-color: var(--on-accent);
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: var(--on-accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-color: var(--on-accent);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-color: var(--on-accent);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    font-weight: 650;
}

.btn-secondary, .btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-outline-light, .btn-outline-dark {
    --bs-btn-color: var(--text);
    --bs-btn-bg: var(--s1);
    --bs-btn-border-color: var(--line2);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: #16191e;
    --bs-btn-hover-border-color: var(--line3);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--s2);
    --bs-btn-active-border-color: var(--line3);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--s1);
    --bs-btn-disabled-border-color: var(--line2);
}

.btn-success {
    --bs-btn-color: #0A0B0D;
    --bs-btn-bg: var(--ok);
    --bs-btn-border-color: var(--ok);
    --bs-btn-hover-color: #0A0B0D;
    --bs-btn-hover-bg: #A3F0C4;
    --bs-btn-hover-border-color: #A3F0C4;
    --bs-btn-disabled-bg: var(--ok);
    --bs-btn-disabled-border-color: var(--ok);
}

.btn-danger, .btn-outline-danger, .btn-outline-warning {
    --bs-btn-color: #FF9C9C;
    --bs-btn-bg: var(--s1);
    --bs-btn-border-color: rgba(255, 122, 122, 0.35);
    --bs-btn-hover-color: #0A0B0D;
    --bs-btn-hover-bg: var(--fail);
    --bs-btn-hover-border-color: var(--fail);
    --bs-btn-active-color: #0A0B0D;
    --bs-btn-active-bg: var(--fail);
    --bs-btn-disabled-color: #FF9C9C;
    --bs-btn-disabled-bg: var(--s1);
    --bs-btn-disabled-border-color: rgba(255, 122, 122, 0.25);
}

.btn-link {
    --bs-btn-color: var(--accent);
    --bs-btn-hover-color: var(--accent-hover);
    text-decoration: none;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.alert {
    --bs-alert-border-radius: 12px;
    --bs-alert-padding-y: 0.7rem;
    --bs-alert-padding-x: 0.9rem;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 0;
}

.alert + .alert {
    margin-top: 8px;
}

.alert-danger {
    --bs-alert-bg: rgba(255, 122, 122, 0.08);
    --bs-alert-border-color: rgba(255, 122, 122, 0.3);
    --bs-alert-color: #FFB4B4;
    --bs-alert-link-color: #FFD0D0;
}

.alert-success {
    --bs-alert-bg: rgba(126, 226, 168, 0.07);
    --bs-alert-border-color: rgba(126, 226, 168, 0.28);
    --bs-alert-color: #B5F0CD;
    --bs-alert-link-color: #D5F8E3;
}

.alert-warning {
    --bs-alert-bg: rgba(242, 201, 76, 0.07);
    --bs-alert-border-color: rgba(242, 201, 76, 0.28);
    --bs-alert-color: #F6DC8C;
    --bs-alert-link-color: var(--accent);
}

.alert-info {
    --bs-alert-bg: rgba(122, 162, 255, 0.07);
    --bs-alert-border-color: rgba(122, 162, 255, 0.28);
    --bs-alert-color: #BFD1FF;
    --bs-alert-link-color: var(--accent);
}

.alert a, .alert .alert-link {
    color: var(--bs-alert-link-color);
    font-weight: 550;
}

.badge {
    font-family: var(--mono);
    font-weight: 500;
    font-size: 11px;
    border-radius: 6px;
    padding: 0.35em 0.6em;
}

.text-bg-success { color: #0A0B0D !important; }
.text-bg-warning { color: #0A0B0D !important; }
.text-bg-danger { color: #0A0B0D !important; }
.text-bg-primary { color: #0A0B0D !important; }
.text-bg-info { color: #0A0B0D !important; }

.text-bg-secondary {
    color: var(--text) !important;
    background-color: var(--s2) !important;
}

.text-bg-light {
    color: var(--muted) !important;
    background-color: var(--s2) !important;
}

.text-muted, .text-body-secondary {
    color: var(--muted) !important;
}

.list-group {
    --bs-list-group-bg: var(--s1);
    --bs-list-group-color: var(--text);
    --bs-list-group-border-color: var(--line);
    --bs-list-group-border-radius: 12px;
    --bs-list-group-action-hover-bg: var(--s2);
    --bs-list-group-action-hover-color: var(--text);
    --bs-list-group-action-color: var(--text);
}

.nav-tabs {
    --bs-nav-tabs-border-color: var(--line);
    --bs-nav-tabs-link-active-bg: var(--s1);
    --bs-nav-tabs-link-active-color: var(--text);
    --bs-nav-tabs-link-active-border-color: var(--line) var(--line) var(--s1);
    --bs-nav-link-color: var(--muted);
    --bs-nav-link-hover-color: var(--text);
}

.progress {
    --bs-progress-bg: var(--s2);
    --bs-progress-bar-bg: var(--accent);
    --bs-progress-height: 6px;
    --bs-progress-border-radius: 999px;
}

.modal {
    --bs-modal-bg: var(--s1);
    --bs-modal-border-color: var(--line2);
    --bs-modal-border-radius: 14px;
}

hr {
    border-color: var(--line);
    opacity: 1;
}

mark, .mark {
    background: rgba(200, 241, 105, 0.18);
    color: var(--text);
    padding: 0 2px;
    border-radius: 3px;
}

/* Bootstrap pages wrapped in the scaffold get consistent spacing. */
.page > h1, .page > .h3:first-child {
    font-size: 34px;
    line-height: 1.05;
    font-weight: 650;
    letter-spacing: -0.035em;
    margin: 26px 0 6px;
}

/* ---------- Blazor bits ---------- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid rgba(126, 226, 168, 0.6);
}

.invalid {
    outline: 1px solid var(--fail);
}

.validation-message, .validation-errors, .text-danger {
    color: var(--fail) !important;
    font-size: 12px;
}

.validation-errors {
    padding-left: 18px;
    margin: 0;
}

#blazor-error-ui {
    background: var(--s1);
    color: var(--text);
    border-top: 1px solid rgba(255, 122, 122, 0.4);
    bottom: 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem calc(0.8rem + var(--safe-bottom));
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 13px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.7rem;
}

.blazor-error-boundary {
    background: rgba(255, 122, 122, 0.08);
    border: 1px solid rgba(255, 122, 122, 0.3);
    border-radius: 12px;
    padding: 1rem;
    color: #FFB4B4;
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten.";
}

/* ---------- Auth pages ---------- */
.auth-shell {
    min-height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
    background: radial-gradient(circle at 50% 30%, #13161B 0%, var(--bg) 70%);
    position: relative;
    isolation: isolate;
}

/* Firing neural net behind the card (js/synapses.js). */
.synapse-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    padding: 28px;
    border-radius: 16px;
    background: var(--s1);
    border: 1px solid var(--line);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-brand {
    padding: 0;
}

.auth-brand .logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

.auth-card h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 650;
    letter-spacing: -0.035em;
}

.auth-card .lead-text {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-card .form-floating {
    margin: 0;
}

.auth-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.auth-foot {
    font-size: 11px;
    color: var(--dim);
    margin: 0;
    text-align: center;
}

/* ---------- Responsive shell ---------- */

/* Tablet: icon rail. */
@media (max-width: 1199.98px) {
    .app-shell {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .sidebar {
        padding: 24px 14px;
        align-items: center;
        gap: 6px;
        overflow: visible;
    }

    .sidebar .brand {
        padding: 0;
        margin-bottom: 18px;
    }

    .sidebar .logo-mark {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .brand-name, .brand-tag, .global-search, .nav-label, .nav-section, .side-foot {
        display: none;
    }

    .rail-only {
        display: flex !important;
    }

    .nav-group {
        align-items: center;
        gap: 6px;
    }

    .nav-group + .nav-group {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--line);
    }

    .nav-item {
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
    }

    .nav-item .icon {
        width: 22px;
        height: 22px;
    }

    .nav-item {
        position: relative;
    }

    .storm-tip {
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        margin: 0;
        padding: 5px 8px;
        border-radius: 8px;
        background: var(--s2);
        box-shadow: inset 0 0 0 1px var(--line2), 0 6px 18px rgba(0, 0, 0, 0.4);
        white-space: nowrap;
        transform: translate(-4px, -50%);
        z-index: 30;
    }

    .nav-item:hover .storm-tip,
    .nav-item:focus-visible .storm-tip {
        transform: translate(0, -50%);
    }

    .nav-item .nav-count {
        position: absolute;
        top: 4px;
        right: 2px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        line-height: 16px;
        font-size: 10px;
    }

    .sidebar .account-menu {
        margin-top: auto;
    }

    .sidebar .account-menu .avatar {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .page {
        padding: 0 24px 24px;
    }
}

/* Phone: header + bottom tab bar. */
@media (max-width: 767.98px) {
    body {
        font-size: 15px;
    }

    .app-shell {
        display: block;
        padding-bottom: calc(76px + var(--safe-bottom));
    }

    .sidebar {
        display: none;
    }

    .mobile-bar {
        display: flex;
        align-items: center;
        gap: 4px;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: calc(6px + var(--safe-top)) 12px 6px 16px;
        background: rgba(10, 11, 13, 0.88);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line);
    }

    .mobile-bar .brand {
        padding: 0;
        flex: 1;
    }

    .mobile-bar .icon-btn {
        width: 44px;
        height: 44px;
        border: none;
        background: transparent;
    }

    .mobile-bar .avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
        margin: 4px;
    }

    .tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        padding: 0 8px var(--safe-bottom);
        background: rgba(13, 15, 18, 0.94);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border-top: 1px solid var(--line);
    }

    .tabbar a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-height: 60px;
        padding: 8px 0 6px;
        font-size: 10px;
        font-weight: 550;
        color: var(--dim);
    }

    .tabbar a.active {
        color: var(--text);
    }

    .tabbar a.active .icon {
        color: var(--accent);
    }

    .fab {
        display: flex;
        position: fixed;
        right: 20px;
        bottom: calc(92px + var(--safe-bottom));
        width: 56px;
        height: 56px;
        border-radius: 18px;
        background: var(--accent);
        color: var(--on-accent);
        align-items: center;
        justify-content: center;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
        z-index: 25;
    }

    .fab:hover {
        color: var(--on-accent);
        background: var(--accent-hover);
    }

    .page {
        padding: 0 16px 20px;
        gap: 14px;
    }

    .page-header {
        padding-top: 18px;
        margin-bottom: 2px;
    }

    .page-header h1, .page > h1 {
        font-size: 30px;
    }

    .crumbs {
        display: none;
    }

    .ph-actions .btn-ui {
        height: 44px;
    }

    .ph-actions > a[href="fragen"], .ph-actions > a[href="quellen#upload"] {
        display: none;
    }

    .btn-ui, .btn-ui.sm {
        min-height: 44px;
    }

    .btn-ui.xs {
        min-height: 36px;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .chip-btn {
        height: 36px;
    }

    .seg button {
        height: 38px;
    }

    .input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .form-control, .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel-head, .list-row, .gt-row, .panel-body, .pager {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hide-sm {
        display: none !important;
    }

    .auth-card {
        padding: 22px 18px;
    }
}

@media (hover: none) {
    .check {
        min-height: 44px;
    }
}
