:root,
html[data-theme="default"] {
    --color-primary: #172554;
    --color-primary-hover: #0f172a;
    --color-primary-soft: #dbeafe;
    --color-secondary: #64748b;
    --color-accent: #2563eb;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #0369a1;

    --bg-main: #f4f7fb;
    --bg-main-strong: #e8eef7;
    --bg-surface: rgba(255, 255, 255, 0.82);
    --bg-surface-solid: #ffffff;
    --bg-surface-muted: #f8fafc;
    --bg-navigation: rgba(248, 250, 252, 0.78);

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverted: #ffffff;

    --border-soft: rgba(148, 163, 184, 0.35);
    --border-strong: rgba(15, 23, 42, 0.18);

    --card-radius: 22px;
    --hero-radius: 30px;
    --control-radius: 14px;
    --button-radius: 999px;

    --card-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --panel-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --hero-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
    --button-shadow: 0 14px 32px rgba(29, 78, 216, 0.24);

    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
    --topbar-height: 74px;
    --transition-fast: 140ms ease;
    --transition-normal: 220ms ease;

    --hover-bg: rgba(37, 99, 235, 0.08);
    --hover-bg-strong: rgba(37, 99, 235, 0.14);
    --hover-border: rgba(37, 99, 235, 0.24);
    --hover-text: #172554;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 650;
    --font-weight-bold: 750;

    /* Legacy aliases kept for all existing components. */
    --color-bg: var(--bg-main);
    --color-bg-strong: var(--bg-main-strong);
    --color-surface: var(--bg-surface);
    --color-surface-solid: var(--bg-surface-solid);
    --color-text: var(--text-main);
    --color-muted: var(--text-muted);
    --color-border: var(--border-soft);
    --shadow-soft: var(--hero-shadow);
    --shadow-card: var(--card-shadow);
    --radius-xl: var(--hero-radius);
    --radius-lg: var(--card-radius);
    --radius-md: var(--control-radius);
}

html[data-theme="business-navy"] {
    --color-primary: #25365d;
    --color-primary-hover: #1d2b4a;
    --color-primary-soft: rgba(37, 54, 93, 0.07);
    --color-secondary: #5f6f89;
    --color-accent: #25365d;
    --color-success: #236b47;
    --color-warning: #9a6a18;
    --color-danger: #9f2d2d;
    --color-info: #285f84;

    --bg-main: #f4f6f9;
    --bg-main-strong: #e9edf4;
    --bg-surface: #ffffff;
    --bg-surface-solid: #ffffff;
    --bg-surface-muted: #f8f9fa;
    --bg-navigation: #25365d;

    --text-main: #182033;
    --text-muted: #68758c;
    --text-inverted: #ffffff;

    --border-soft: rgba(37, 54, 93, 0.10);
    --border-strong: rgba(37, 54, 93, 0.18);

    --card-radius: 6px;
    --hero-radius: 6px;
    --control-radius: 4px;
    --button-radius: 4px;

    --card-shadow: 0 2px 4px rgba(37, 54, 93, 0.05);
    --panel-shadow: 0 2px 6px rgba(37, 54, 93, 0.06);
    --hero-shadow: 0 2px 4px rgba(37, 54, 93, 0.05);
    --button-shadow: 0 2px 4px rgba(37, 54, 93, 0.12);

    --focus-ring: 0 0 0 3px rgba(37, 54, 93, 0.16);
    --transition-fast: 120ms ease;
    --transition-normal: 180ms ease;

    --hover-bg: rgba(37, 54, 93, 0.075);
    --hover-bg-strong: rgba(37, 54, 93, 0.12);
    --hover-border: rgba(37, 54, 93, 0.22);
    --hover-text: #1d2b4a;

    --font-weight-normal: 350;
    --font-weight-medium: 450;
    --font-weight-semibold: 520;
    --font-weight-bold: 600;

    --color-bg: var(--bg-main);
    --color-bg-strong: var(--bg-main-strong);
    --color-surface: var(--bg-surface);
    --color-surface-solid: var(--bg-surface-solid);
    --color-text: var(--text-main);
    --color-muted: var(--text-muted);
    --color-border: var(--border-soft);
    --shadow-soft: var(--hero-shadow);
    --shadow-card: var(--card-shadow);
    --radius-xl: var(--hero-radius);
    --radius-lg: var(--card-radius);
    --radius-md: var(--control-radius);
}

html[data-theme="nord"] {
    --color-primary: #5e81ac;
    --color-primary-hover: #4c6f96;
    --color-primary-soft: rgba(94, 129, 172, 0.12);
    --color-secondary: #81a1c1;
    --color-accent: #88c0d0;
    --color-success: #a3be8c;
    --color-warning: #ebcb8b;
    --color-danger: #bf616a;
    --color-info: #5e81ac;

    --bg-main: #eceff4;
    --bg-main-strong: #e5e9f0;
    --bg-surface: #ffffff;
    --bg-surface-solid: #ffffff;
    --bg-surface-muted: #e5e9f0;
    --bg-navigation: #3b4252;

    --text-main: #2e3440;
    --text-muted: #4c566a;
    --text-inverted: #eceff4;

    --border-soft: rgba(76, 86, 106, 0.16);
    --border-strong: rgba(76, 86, 106, 0.28);

    --card-radius: 6px;
    --hero-radius: 6px;
    --control-radius: 5px;
    --button-radius: 5px;

    --card-shadow: 0 2px 6px rgba(46, 52, 64, 0.06);
    --panel-shadow: 0 3px 8px rgba(46, 52, 64, 0.07);
    --hero-shadow: 0 3px 8px rgba(46, 52, 64, 0.07);
    --button-shadow: 0 2px 5px rgba(46, 52, 64, 0.12);

    --focus-ring: 0 0 0 3px rgba(94, 129, 172, 0.22);
    --transition-fast: 120ms ease;
    --transition-normal: 180ms ease;

    --hover-bg: rgba(94, 129, 172, 0.11);
    --hover-bg-strong: rgba(94, 129, 172, 0.17);
    --hover-border: rgba(94, 129, 172, 0.34);
    --hover-text: #2e3440;

    --font-weight-normal: 350;
    --font-weight-medium: 450;
    --font-weight-semibold: 540;
    --font-weight-bold: 620;

    --color-bg: var(--bg-main);
    --color-bg-strong: var(--bg-main-strong);
    --color-surface: var(--bg-surface);
    --color-surface-solid: var(--bg-surface-solid);
    --color-text: var(--text-main);
    --color-muted: var(--text-muted);
    --color-border: var(--border-soft);
    --shadow-soft: var(--hero-shadow);
    --shadow-card: var(--card-shadow);
    --radius-xl: var(--hero-radius);
    --radius-lg: var(--card-radius);
    --radius-md: var(--control-radius);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--color-bg); }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.14), transparent 35rem),
        linear-gradient(135deg, #f8fafc 0%, #edf3fb 52%, #f8fafc 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::selection { background: var(--color-primary); color: #ffffff; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.ambient {
    position: fixed;
    z-index: -1;
    width: 26rem;
    height: 26rem;
    border-radius: 999px;
    filter: blur(38px);
    opacity: 0.32;
    pointer-events: none;
}

.ambient-one { top: 7rem; left: 4vw; background: #bfdbfe; }
.ambient-two { right: 4vw; bottom: 3rem; background: #c7d2fe; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem clamp(1rem, 3vw, 3rem);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(248, 250, 252, 0.78);
    backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 0.85rem; }

.brand-mark {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: 1rem;
    color: #ffffff;
    background: linear-gradient(145deg, #0f172a, #1d4ed8);
    box-shadow: 0 12px 30px rgba(29, 78, 216, 0.26);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 0.98rem; letter-spacing: -0.02em; }
.brand small { color: var(--color-muted); font-size: 0.75rem; }

.topbar-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.45rem; }

.topbar-nav a {
    padding: 0.62rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--color-muted);
    font-size: 0.9rem;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.topbar-nav a:hover,
.topbar-nav a:focus-visible {
    border-color: rgba(37, 99, 235, 0.16);
    color: var(--color-primary);
    background: rgba(219, 234, 254, 0.72);
    outline: none;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 4.5rem) 0 3rem;
}

.hero-card, .panel, .info-card, .error-card {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(24px);
}

.hero-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: center;
    padding: clamp(2rem, 5vw, 4.5rem);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -4rem -8rem auto;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.16), transparent 68%);
}

.hero-content { position: relative; z-index: 1; max-width: 760px; }

.eyebrow, .info-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 1rem;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    line-height: 0.95;
    letter-spacing: -0.075em;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.45rem, 3vw, 2rem);
    letter-spacing: -0.04em;
}

p { color: var(--color-muted); font-size: 1rem; }
.hero-content p { max-width: 680px; font-size: clamp(1.02rem, 2vw, 1.2rem); }

.hero-actions, .error-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.6rem; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    padding: 0.8rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover, .button:focus-visible { transform: translateY(-1px); outline: none; }
.button-primary { color: #ffffff; background: linear-gradient(135deg, #0f172a, #1d4ed8); box-shadow: 0 14px 32px rgba(29, 78, 216, 0.24); }
.button-secondary { color: var(--color-primary); background: rgba(255, 255, 255, 0.72); border-color: rgba(37, 99, 235, 0.18); }

.status-orb {
    position: relative;
    z-index: 1;
    display: grid;
    width: clamp(8rem, 16vw, 13rem);
    height: clamp(8rem, 16vw, 13rem);
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.72), transparent 0.9rem),
        linear-gradient(145deg, #16a34a, #0f766e 48%, #172554);
    box-shadow: 0 35px 70px rgba(15, 118, 110, 0.28);
}

.status-orb span { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; letter-spacing: -0.08em; }
.grid { display: grid; gap: 1rem; }
.cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 1.3rem; }

.info-card { min-height: 11rem; padding: 1.25rem; border-radius: var(--radius-lg); }
.info-card strong { display: block; margin-top: 0.75rem; font-size: 1.45rem; letter-spacing: -0.04em; }
.info-card small { display: block; margin-top: 0.55rem; color: var(--color-muted); }

.panel { margin-top: 1.3rem; padding: clamp(1.4rem, 3vw, 2.2rem); border-radius: var(--radius-lg); }
.two-column-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr); gap: 1.5rem; align-items: center; }
.mini-roadmap { display: grid; gap: 0.65rem; }

.roadmap-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    color: var(--color-muted);
    background: rgba(255, 255, 255, 0.58);
}

.roadmap-row span { width: 0.68rem; height: 0.68rem; border-radius: 50%; background: #cbd5e1; }
.roadmap-row.done { color: #166534; }
.roadmap-row.done span { background: var(--color-success); }
.roadmap-row.next { color: var(--color-primary); font-weight: 800; }
.roadmap-row.next span { background: var(--color-accent); box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12); }

.code-panel code, .request-id code, .error-meta code {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.55rem;
    background: rgba(15, 23, 42, 0.04);
}

.footer {
    width: min(1180px, calc(100% - 2rem));
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 auto;
    padding: 0 0 2rem;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.error-page { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.error-shell { width: min(1080px, 100%); }
.error-card { padding: clamp(1.4rem, 4vw, 2.8rem); border-radius: var(--radius-xl); }
.compact-error-card { max-width: 680px; margin: 0 auto; text-align: center; }
.error-header { display: flex; gap: 1rem; align-items: flex-start; }

.error-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.3rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626, #7f1d1d);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.error-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin: 1.4rem 0; }
.error-meta div { padding: 0.9rem; border: 1px solid rgba(148, 163, 184, 0.24); border-radius: 1rem; background: rgba(255, 255, 255, 0.54); }
.error-meta dt { margin-bottom: 0.28rem; color: var(--color-muted); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.error-meta dd { margin: 0; overflow-wrap: anywhere; }

.trace {
    overflow: auto;
    max-height: 45vh;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.82rem;
    line-height: 1.6;
}

@media (max-width: 920px) {
    .hero-card, .two-column-panel { grid-template-columns: 1fr; }
    .status-orb { justify-self: start; }
    .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-nav { justify-content: flex-start; }
    .cards-grid, .error-meta { grid-template-columns: 1fr; }
    h1 { font-size: clamp(2.15rem, 14vw, 3.4rem); }
    .footer { flex-direction: column; }
}

.install-hero .status-orb {
    grid-template-rows: 1fr auto;
    gap: 0.2rem;
    padding: 1.6rem;
    text-align: center;
}

.install-hero .status-orb small {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-orb-warning {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,0.72), transparent 0.9rem),
        linear-gradient(145deg, #d97706, #b45309 46%, #172554);
}

.install-summary-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.4rem;
}

.summary-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.15rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.68);
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 900;
}

.pill-ok { color: #166534; background: rgba(220, 252, 231, 0.78); border-color: rgba(22, 163, 74, 0.22); }
.pill-warning { color: #92400e; background: rgba(254, 243, 199, 0.78); border-color: rgba(217, 119, 6, 0.25); }
.pill-error { color: #991b1b; background: rgba(254, 226, 226, 0.78); border-color: rgba(220, 38, 38, 0.24); }

.install-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.3rem;
}

.install-check-card {
    margin-top: 0;
}

.check-list {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
}

.check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.58);
}

.check-row strong,
.check-row small {
    display: block;
}

.check-row small {
    margin-top: 0.22rem;
    color: var(--color-muted);
}

.check-row > span {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.32rem 0.58rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.check-ok > span { color: #166534; background: rgba(220, 252, 231, 0.84); }
.check-warning > span { color: #92400e; background: rgba(254, 243, 199, 0.88); }
.check-error > span { color: #991b1b; background: rgba(254, 226, 226, 0.88); }

.inline-form {
    display: inline-flex;
    margin: 0;
}

.inline-form button {
    font: inherit;
    cursor: pointer;
}

.result-panel {
    border-width: 1px;
}

.result-ok { border-color: rgba(22, 163, 74, 0.24); }
.result-error { border-color: rgba(220, 38, 38, 0.28); }

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.result-grid div {
    padding: 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.result-grid strong,
.result-grid small {
    display: block;
}

.result-grid strong {
    font-size: 2rem;
    letter-spacing: -0.06em;
}

.result-grid small {
    color: var(--color-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.migration-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
}

.migration-table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.62);
}

.migration-table th,
.migration-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
    vertical-align: top;
}

.migration-table th {
    color: var(--color-primary);
    background: rgba(219, 234, 254, 0.55);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.migration-table tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 860px) {
    .install-summary-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .summary-pills {
        justify-content: flex-start;
    }

    .install-grid {
        grid-template-columns: 1fr;
    }

    .check-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Patch 4: View helpers, reusable UI partials and roadmap widget */
.layout-install .brand-mark {
    border-radius: 1.15rem;
    background: linear-gradient(145deg, #172554, #0f766e);
}

.layout-admin .brand-mark {
    background: linear-gradient(145deg, #111827, #7c3aed);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.85rem;
    padding: 0.28rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-success { color: #166534; background: rgba(220, 252, 231, 0.82); border-color: rgba(22, 163, 74, 0.22); }
.badge-warning { color: #92400e; background: rgba(254, 243, 199, 0.82); border-color: rgba(217, 119, 6, 0.22); }
.badge-danger { color: #991b1b; background: rgba(254, 226, 226, 0.82); border-color: rgba(220, 38, 38, 0.22); }
.badge-accent { color: #1e3a8a; background: rgba(219, 234, 254, 0.82); border-color: rgba(37, 99, 235, 0.22); }
.badge-neutral { color: #334155; background: rgba(241, 245, 249, 0.82); }
.badge-size-small { min-height: 1.45rem; padding: 0.18rem 0.52rem; font-size: 0.7rem; }

.alert {
    margin: 1rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.72);
}
.alert strong { display: block; margin-bottom: 0.25rem; }
.alert p { margin: 0; }
.alert-warning { border-color: rgba(217, 119, 6, 0.22); background: rgba(254, 243, 199, 0.58); }
.alert-error { border-color: rgba(220, 38, 38, 0.22); background: rgba(254, 226, 226, 0.58); }
.alert-success { border-color: rgba(22, 163, 74, 0.22); background: rgba(220, 252, 231, 0.58); }

.roadmap-widget {
    overflow: hidden;
}

.roadmap-widget-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
}

.roadmap-progress {
    --progress: 0%;
    position: relative;
    display: grid;
    width: 8.75rem;
    height: 8.75rem;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(255,255,255,0.95) 0 58%, transparent 59%),
        conic-gradient(#2563eb var(--progress), rgba(203, 213, 225, 0.85) 0);
    box-shadow: 0 22px 45px rgba(37, 99, 235, 0.16);
}

.roadmap-progress strong,
.roadmap-progress small {
    grid-area: 1 / 1;
    text-align: center;
}

.roadmap-progress strong {
    margin-top: -0.9rem;
    font-size: 1.8rem;
    letter-spacing: -0.05em;
}

.roadmap-progress small {
    margin-top: 2.2rem;
    width: 6rem;
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.roadmap-current-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.2rem;
    border: 1px solid rgba(37, 99, 235, 0.16);
    border-radius: 1.25rem;
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.72), rgba(255, 255, 255, 0.58));
}

.roadmap-current-card h3,
.roadmap-column h3 {
    margin: 0 0 0.45rem;
    letter-spacing: -0.03em;
}

.roadmap-current-card p { margin-bottom: 0; }
.roadmap-kicker { color: var(--color-accent); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }

.roadmap-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.roadmap-column {
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.15rem;
    background: rgba(255, 255, 255, 0.48);
}

.timeline-list,
.planned-list {
    display: grid;
    gap: 0.65rem;
}

.timeline-row,
.planned-row,
.feature-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.72rem 0.78rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.62);
}

.timeline-row strong,
.timeline-row small,
.planned-row strong,
.planned-row span {
    display: block;
}

.timeline-row small,
.planned-row span,
.muted-text {
    color: var(--color-muted);
}

.timeline-dot,
.feature-row span {
    flex: 0 0 auto;
    width: 0.72rem;
    height: 0.72rem;
    margin-top: 0.25rem;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.11);
}

.next-card {
    padding: 0.85rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 1rem;
    background: rgba(219, 234, 254, 0.42);
}

.next-card strong { display: block; margin-bottom: 0.55rem; }
.next-card ul { margin: 0; padding-left: 1.1rem; color: var(--color-muted); }
.next-card li + li { margin-top: 0.3rem; }

.roadmap-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.roadmap-meta span {
    padding: 0.38rem 0.62rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    color: var(--color-muted);
    background: rgba(255, 255, 255, 0.48);
    font-size: 0.8rem;
    font-weight: 700;
}

.feature-list {
    display: grid;
    gap: 0.65rem;
}

.feature-row {
    align-items: center;
    color: var(--color-primary);
    font-weight: 800;
}

.feature-row span {
    margin-top: 0;
    background: var(--color-accent);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.11);
}

@media (max-width: 920px) {
    .roadmap-widget-head,
    .roadmap-columns {
        grid-template-columns: 1fr;
    }

    .roadmap-progress {
        width: 7.5rem;
        height: 7.5rem;
    }
}

@media (max-width: 640px) {
    .roadmap-current-card {
        flex-direction: column;
    }
}

/* Patch 5: Auth, Admin und CSRF */
.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding-left: 0.4rem;
}

.logout-form { margin: 0; }

.logout-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(220, 38, 38, 0.18);
    border-radius: 999px;
    color: #991b1b;
    background: rgba(254, 242, 242, 0.8);
    font-weight: 800;
    cursor: pointer;
}

.auth-shell {
    min-height: calc(100vh - 210px);
    display: grid;
    place-items: center;
}

.auth-card, .auth-panel {
    width: min(620px, 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(24px);
}

.auth-card { padding: clamp(1.5rem, 4vw, 2.6rem); }
.auth-header { margin-bottom: 1.4rem; }
.auth-header h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
.auth-panel { width: 100%; padding: clamp(1.4rem, 3vw, 2.2rem); }

.form-stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.form-grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.form-field { display: grid; gap: 0.45rem; color: var(--color-text); font-weight: 800; }
.form-field span { font-size: 0.9rem; }

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: 3rem;
    padding: 0.75rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 1rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-field input:disabled,
.form-field textarea:disabled,
.form-field select:disabled,
.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-wide { width: 100%; }
.form-error { color: var(--color-danger); font-weight: 800; font-size: 0.9rem; }

.user-avatar {
    --avatar-color: #0f172a;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    color: #ffffff;
    background: var(--avatar-color);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    font-weight: 900;
    letter-spacing: -0.05em;
    object-fit: cover;
}

.user-avatar-sm { width: 2.25rem; height: 2.25rem; font-size: 0.82rem; }
.user-avatar-md { width: 3rem; height: 3rem; font-size: 1rem; }
.user-avatar-lg { width: 4rem; height: 4rem; font-size: 1.35rem; }

.admin-hero .status-orb span { font-size: clamp(1.4rem, 3vw, 2.5rem); }
.admin-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.alert-danger, .alert-error { border-color: rgba(220, 38, 38, 0.25); background: rgba(254, 242, 242, 0.86); }
.alert-danger strong, .alert-error strong { color: #991b1b; }
.alert-success { border-color: rgba(22, 163, 74, 0.25); background: rgba(240, 253, 244, 0.86); }
.alert-success strong { color: #166534; }
.alert-warning { border-color: rgba(217, 119, 6, 0.25); background: rgba(255, 251, 235, 0.9); }
.alert-warning strong { color: #92400e; }

@media (max-width: 820px) {
    .topbar { align-items: flex-start; }
    .topbar-right { width: 100%; justify-content: flex-start; }
    .form-grid-two, .admin-status-grid { grid-template-columns: 1fr; }
}

/* Patch 6: Admin-Systembereich, Settings, Logs und technische Übersichten */
.system-hero code,
.settings-table code,
.log-viewer code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.status-orb-error {
    background: radial-gradient(circle at 35% 25%, #fecaca 0, #dc2626 42%, #7f1d1d 100%);
    box-shadow: 0 24px 60px rgba(220, 38, 38, 0.28);
}

.button-danger {
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    box-shadow: 0 18px 34px rgba(220, 38, 38, 0.22);
}

.system-action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.15rem 0;
}

.system-action-card {
    display: grid;
    gap: 0.45rem;
    min-height: 11rem;
    padding: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.35rem;
    color: var(--color-text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.system-action-card:hover,
.system-action-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.12);
    outline: none;
}

.system-action-card span {
    display: inline-grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.system-action-card strong {
    font-size: 1.1rem;
}

.system-action-card small {
    color: var(--color-muted);
    line-height: 1.55;
}

.check-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.check-section {
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.1rem;
    background: rgba(248, 250, 252, 0.72);
}

.check-section h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.settings-form {
    max-width: 980px;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--color-text);
    font-weight: 800;
}

.checkbox-line input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--color-accent);
}

.settings-group-panel small {
    display: block;
    margin-top: 0.28rem;
    color: var(--color-muted);
    font-weight: 600;
}

.settings-table td {
    vertical-align: top;
}

.pill-neutral {
    border-color: rgba(100, 116, 139, 0.22);
    color: #334155;
    background: rgba(241, 245, 249, 0.9);
}

.panel-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.compact-form {
    align-items: end;
}

.compact-field {
    min-width: 8rem;
}

.compact-field input {
    min-height: 2.5rem;
    padding: 0.5rem 0.7rem;
}

.log-viewer {
    max-height: 34rem;
    overflow: auto;
    margin: 0;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 1rem;
    color: #dbeafe;
    background: #0f172a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.muted {
    color: var(--color-muted);
}

@media (max-width: 1080px) {
    .system-action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .check-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .system-action-grid {
        grid-template-columns: 1fr;
    }

    .panel-head-row {
        display: grid;
    }
}

/* Patch 7 · Admin data management */
.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.danger-zone {
    border-color: rgba(220, 38, 38, 0.24);
    background: linear-gradient(180deg, rgba(255, 247, 247, 0.92), rgba(255, 255, 255, 0.96));
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.card-heading h2 {
    margin: 0.1rem 0 0;
}

.danger-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.confirmation-input {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
    letter-spacing: 0.015em;
}

.form-help code,
.muted code {
    padding: 0.14rem 0.38rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 0.45rem;
    background: rgba(241, 245, 249, 0.92);
    color: #0f172a;
}

.button-danger {
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border-color: rgba(185, 28, 28, 0.3);
    box-shadow: 0 14px 28px rgba(185, 28, 28, 0.18);
}

.button-warning {
    color: #451a03;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: rgba(180, 83, 9, 0.3);
}

.compact-table-wrap {
    margin: 1rem 0;
}

.compact-table th,
.compact-table td {
    padding: 0.58rem 0.7rem;
}

.tight-list {
    display: grid;
    gap: 0.45rem;
    margin: 1rem 0;
    padding-left: 1.1rem;
}

.result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: -0.4rem 0 1.2rem;
}

.result-list > span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.72rem;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.92);
    color: var(--color-text);
    font-size: 0.86rem;
    font-weight: 800;
}

.activity-table td {
    vertical-align: top;
}

.context-details summary {
    cursor: pointer;
    color: var(--color-accent);
    font-weight: 800;
}

.context-details pre {
    max-width: 34rem;
    max-height: 18rem;
    overflow: auto;
    margin: 0.6rem 0 0;
    padding: 0.8rem;
    border-radius: 0.75rem;
    color: #dbeafe;
    background: #0f172a;
    font-size: 0.78rem;
    line-height: 1.5;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.small-select {
    min-height: 2.5rem;
    padding: 0.45rem 0.65rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1080px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .card-heading,
    .inline-form {
        display: grid;
    }
}

/* Patch 8 · CRUD-Basis */
.page-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header-row h1 {
    margin: 0.15rem 0 0.25rem;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-panel > h2 {
    padding: 1.2rem 1.35rem 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    vertical-align: middle;
    text-align: left;
}

.data-table th {
    color: var(--color-muted);
    background: rgba(248, 250, 252, 0.88);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.data-table td small,
.entity-title-cell small {
    display: block;
    margin-top: 0.18rem;
    color: var(--color-muted);
    font-size: 0.82rem;
}

.entity-title-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 14rem;
}

.entity-avatar {
    --entity-color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    flex: 0 0 2.65rem;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--entity-color), color-mix(in srgb, var(--entity-color) 72%, #0f172a));
    font-weight: 900;
    letter-spacing: 0.03em;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.entity-avatar-project {
    border-radius: 0.85rem;
}

.entity-avatar-customer {
    background: #fff;
    color: var(--entity-color);
    border: 2px solid var(--entity-color);
}

.task-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.2rem;
    height: 4.2rem;
    border-radius: 1.35rem;
    color: #fff;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    font-size: 2rem;
    font-weight: 900;
}

.actions-cell {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.actions-cell form {
    margin: 0;
}

.actions-cell a,
.link-danger {
    border: 0;
    padding: 0;
    color: var(--color-accent);
    background: transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.link-danger {
    color: #be123c;
}

.empty-cell {
    color: var(--color-muted);
    text-align: center;
}

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

.form-grid label {
    display: grid;
    gap: 0.4rem;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 0.85rem;
    padding: 0.78rem 0.85rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.92);
    font: inherit;
    font-weight: 600;
}

.form-grid input[type="color"] {
    min-height: 3rem;
    padding: 0.25rem;
}

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

.form-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
}

.checkbox-line {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.6rem !important;
}

.checkbox-line input {
    width: auto;
}

.form-error {
    color: #be123c;
    font-size: 0.82rem;
    font-weight: 800;
}

.detail-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.2rem;
}

.detail-hero .entity-avatar {
    width: 4.2rem;
    height: 4.2rem;
    flex-basis: 4.2rem;
    font-size: 1.35rem;
}

.detail-hero h1 {
    margin: 0.15rem 0 0.35rem;
}

.detail-actions {
    margin-left: auto;
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.status-badge,
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.62rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

.status-badge-active,
.status-badge-in-progress,
.status-badge-open {
    color: #075985;
    background: #e0f2fe;
}

.status-badge-planned,
.status-badge-waiting {
    color: #854d0e;
    background: #fef3c7;
}

.status-badge-on-hold {
    color: #6d28d9;
    background: #ede9fe;
}

.status-badge-completed,
.status-badge-done {
    color: #166534;
    background: #dcfce7;
}

.status-badge-cancelled {
    color: #9f1239;
    background: #ffe4e6;
}

.priority-badge-low {
    color: #475569;
    background: #f1f5f9;
}

.priority-badge-normal {
    color: #075985;
    background: #e0f2fe;
}

.priority-badge-high {
    color: #9a3412;
    background: #ffedd5;
}

.priority-badge-urgent {
    color: #9f1239;
    background: #ffe4e6;
}

.is-soft-hidden {
    display: none !important;
}

@media (max-width: 860px) {
    .page-header-row,
    .detail-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-actions {
        margin-left: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading-row h2 {
    margin: 0.1rem 0 0;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.42rem 0.72rem;
    color: #0f172a;
    background: rgba(226, 232, 240, 0.88);
    font-size: 0.8rem;
    font-weight: 900;
    white-space: nowrap;
}

.chat-panel {
    margin-top: 1.2rem;
}

.chat-thread {
    display: grid;
    gap: 0.95rem;
    margin: 1.1rem 0 1.25rem;
}

.chat-message {
    display: grid;
    grid-template-columns: 2.65rem minmax(0, 1fr);
    gap: 0.8rem;
    align-items: flex-start;
}

.chat-avatar {
    width: 2.65rem;
    height: 2.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #fff;
    background: var(--avatar-color, #0f172a);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.16);
    font-size: 0.84rem;
    font-weight: 950;
}

.chat-message-system .chat-avatar {
    background: linear-gradient(135deg, #64748b, #0f172a);
}

.chat-bubble {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1.1rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}

.chat-message-system .chat-bubble {
    background: rgba(248, 250, 252, 0.96);
    border-style: dashed;
}

.chat-message-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    margin-bottom: 0.45rem;
    color: var(--color-muted);
    font-size: 0.78rem;
}

.chat-message-header strong {
    color: var(--color-text);
    font-size: 0.9rem;
}

.chat-message-header em {
    border-radius: 999px;
    padding: 0.16rem 0.42rem;
    color: #334155;
    background: #f1f5f9;
    font-style: normal;
    font-weight: 850;
}

.chat-message-body {
    color: var(--color-text);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.message-form {
    display: grid;
    gap: 0.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    padding-top: 1rem;
}

.message-form-label {
    color: var(--color-text);
    font-weight: 900;
}

.message-form textarea {
    width: 100%;
    min-height: 8rem;
    resize: vertical;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.94);
    font: inherit;
    font-weight: 600;
    line-height: 1.55;
}

.message-form textarea:focus {
    outline: 3px solid rgba(37, 99, 235, 0.16);
    border-color: rgba(37, 99, 235, 0.48);
}

.message-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.message-form-hint {
    color: var(--color-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.compact-empty {
    border-radius: 1rem;
    padding: 1.2rem;
}

@media (max-width: 640px) {
    .section-heading-row,
    .message-form-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-message {
        grid-template-columns: 2.2rem minmax(0, 1fr);
        gap: 0.62rem;
    }

    .chat-avatar {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.72rem;
    }
}

/* Patch 10 · Kanban Board */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.kanban-shell {
    padding: 1rem;
    overflow: hidden;
}

.kanban-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.1rem;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.82));
}

.kanban-toolbar strong {
    display: block;
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 950;
}

.kanban-toolbar span {
    display: block;
    margin-top: 0.15rem;
    color: var(--color-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.kanban-feedback {
    min-height: 2.15rem;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.48rem 0.76rem;
    color: #334155;
    background: rgba(241, 245, 249, 0.92);
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
}

.kanban-feedback:empty {
    display: none;
}

.kanban-feedback[data-type="success"] {
    color: #166534;
    background: #dcfce7;
}

.kanban-feedback[data-type="danger"] {
    color: #9f1239;
    background: #ffe4e6;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(17rem, 1fr));
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.45rem;
}

.kanban-column {
    min-width: 17rem;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1.25rem;
    background: rgba(248, 250, 252, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.kanban-column.is-drag-over {
    border-color: rgba(37, 99, 235, 0.52);
    background: rgba(239, 246, 255, 0.96);
    transform: translateY(-2px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.9rem 0.95rem 0.75rem;
}

.kanban-column-header > div {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.kanban-column-header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 0.96rem;
    font-weight: 950;
    white-space: nowrap;
}

.kanban-status-dot {
    width: 0.72rem;
    height: 0.72rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18);
}

.kanban-column-open .kanban-status-dot { background: #0284c7; box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18); }
.kanban-column-in-progress .kanban-status-dot { background: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }
.kanban-column-waiting .kanban-status-dot { background: #d97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18); }
.kanban-column-done .kanban-status-dot { background: #16a34a; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18); }
.kanban-column-cancelled .kanban-status-dot { background: #e11d48; box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.18); }

.kanban-dropzone {
    min-height: 12rem;
    display: grid;
    align-content: start;
    gap: 0.85rem;
    padding: 0 0.85rem 0.95rem;
}

.kanban-empty {
    border: 1px dashed rgba(148, 163, 184, 0.42);
    border-radius: 1rem;
    padding: 1rem;
    color: var(--color-muted);
    background: rgba(255, 255, 255, 0.58);
    font-size: 0.86rem;
    font-weight: 800;
    text-align: center;
}

.task-card {
    position: relative;
    display: grid;
    gap: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-left: 0.34rem solid #94a3b8;
    border-radius: 1.05rem;
    padding: 0.9rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
    cursor: grab;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease, border-color 160ms ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.12);
}

.task-card.is-dragging {
    opacity: 0.52;
    transform: rotate(1deg) scale(0.985);
}

.task-card.is-saving {
    opacity: 0.72;
    pointer-events: none;
}

.task-card-open { border-left-color: #0284c7; }
.task-card-in-progress { border-left-color: #2563eb; }
.task-card-waiting { border-left-color: #d97706; }
.task-card-done { border-left-color: #16a34a; }
.task-card-cancelled { border-left-color: #e11d48; }

.task-card.is-overdue {
    background: linear-gradient(135deg, rgba(255, 241, 242, 0.96), rgba(255, 255, 255, 0.96));
}

.task-card.is-due-today {
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.96));
}

.task-card-kicker {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
}

.task-card h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.24;
}

.task-card h3 a {
    color: var(--color-text);
    text-decoration: none;
}

.task-card h3 a:hover,
.task-card h3 a:focus-visible {
    color: var(--color-primary);
    text-decoration: underline;
}

.task-card p {
    margin: 0.48rem 0 0;
    color: var(--color-muted);
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.48;
}

.task-card-flag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.48rem;
    font-size: 0.72rem;
    font-weight: 950;
}

.flag-danger {
    color: #9f1239;
    background: #ffe4e6;
}

.flag-warning {
    color: #854d0e;
    background: #fef3c7;
}

.task-card-meta {
    display: grid;
    gap: 0.42rem;
    margin: 0;
}

.task-card-meta div {
    display: grid;
    grid-template-columns: 4.8rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: baseline;
}

.task-card-meta dt {
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.task-card-meta dd {
    min-width: 0;
    margin: 0;
    color: var(--color-text);
    font-size: 0.82rem;
    font-weight: 760;
    overflow-wrap: anywhere;
}

.kanban-status-form {
    display: grid;
    gap: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 0.72rem;
}

.kanban-dnd-ready .kanban-status-form {
    display: none;
}

.kanban-status-form label {
    display: grid;
    gap: 0.32rem;
}

.kanban-status-form span {
    color: var(--color-muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.kanban-status-form select,
.kanban-status-form button {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 0.8rem;
    padding: 0.58rem 0.66rem;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
}

.kanban-status-form button {
    color: #fff;
    background: #0f172a;
    cursor: pointer;
}

@media (max-width: 1180px) {
    .kanban-board {
        grid-template-columns: repeat(5, minmax(16rem, 18rem));
    }
}

@media (max-width: 760px) {
    .header-actions,
    .kanban-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .header-actions .button,
    .kanban-feedback {
        justify-content: center;
        width: 100%;
    }

    .kanban-shell {
        padding: 0.75rem;
    }

    .kanban-board {
        grid-template-columns: repeat(5, minmax(15.5rem, 84vw));
    }
}

/* Patch 11 · Aufgaben-Kalender */
.view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.view-switcher-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.125rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.view-switcher-link:hover,
.view-switcher-link.is-active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.calendar-shell {
    overflow: hidden;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.calendar-toolbar strong {
    display: block;
    color: #0f172a;
    font-size: 1.125rem;
}

.calendar-toolbar span {
    display: block;
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.calendar-feedback {
    min-width: 13rem;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: right;
}

.calendar-feedback.is-success { color: #047857; }
.calendar-feedback.is-danger { color: #b91c1c; }
.calendar-feedback.is-neutral { color: #475569; }

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(10rem, 1fr));
    min-width: 72rem;
}

.calendar-weekdays {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-bottom: 0;
    border-radius: 1rem 1rem 0 0;
    overflow: hidden;
    background: #f8fafc;
}

.calendar-weekdays span {
    padding: 0.7rem 0.85rem;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.calendar-weekdays span:last-child {
    border-right: 0;
}

.calendar-grid {
    border-left: 1px solid rgba(148, 163, 184, 0.22);
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0 0 1rem 1rem;
    overflow: hidden;
}

.calendar-day {
    min-height: 10.5rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.9);
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.calendar-day.is-muted {
    background: rgba(248, 250, 252, 0.72);
}

.calendar-day.is-today {
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.8), rgba(255, 255, 255, 0.92));
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.24);
}

.calendar-day.is-drop-target {
    background: rgba(219, 234, 254, 0.95);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.42), 0 14px 30px rgba(37, 99, 235, 0.12);
}

.calendar-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    color: #0f172a;
    font-weight: 900;
}

.calendar-day.is-muted .calendar-day-number {
    color: #94a3b8;
}

.calendar-day.is-today .calendar-day-number {
    color: #ffffff;
    background: #2563eb;
}

.calendar-today-badge {
    color: #1d4ed8;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.calendar-day-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.calendar-empty-hint {
    display: block;
    padding: 0.55rem 0;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 700;
}

.calendar-task {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.4rem;
    padding: 0.52rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-left-width: 4px;
    border-radius: 0.8rem;
    background: #ffffff;
    color: #0f172a;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
    cursor: grab;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.calendar-task:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.11);
}

.calendar-task.is-dragging,
.calendar-task.is-saving {
    opacity: 0.55;
}

.calendar-task-time {
    color: #475569;
    font-size: 0.74rem;
    font-weight: 900;
    grid-row: span 2;
    padding-top: 0.08rem;
}

.calendar-task-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 900;
}

.calendar-task-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
}

.calendar-task.priority-low { border-left-color: #94a3b8; }
.calendar-task.priority-normal { border-left-color: #2563eb; }
.calendar-task.priority-high { border-left-color: #f59e0b; }
.calendar-task.priority-urgent { border-left-color: #dc2626; }
.calendar-task.is-closed { opacity: 0.64; }

@media (max-width: 980px) {
    .calendar-shell {
        overflow-x: auto;
    }

    .calendar-toolbar {
        align-items: flex-start;
    }

    .calendar-feedback {
        width: 100%;
        text-align: left;
    }
}

/* Patch 12: task filters */
.task-filter-panel {
    margin-bottom: 1rem;
}

.task-filter-bar {
    display: grid;
    grid-template-columns: minmax(16rem, 2fr) repeat(5, minmax(10rem, 1fr)) auto;
    gap: 0.85rem;
    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}

.filter-field span {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filter-field input,
.filter-field select {
    width: 100%;
    min-height: 2.7rem;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 0.9rem;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    padding: 0.65rem 0.8rem;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: rgba(37, 99, 235, 0.72);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.active-filters > span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.62rem;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 999px;
    background: rgba(239, 246, 255, 0.9);
    color: #1e3a8a;
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.filter-chip:hover {
    background: #1d4ed8;
    color: #ffffff;
    transform: translateY(-1px);
}

.filter-chip span {
    font-weight: 800;
    opacity: 0.78;
}

.filter-chip strong {
    font-weight: 900;
}

.filter-chip em {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.52);
    font-style: normal;
    font-weight: 900;
}

.filter-chip-reset {
    border-color: rgba(148, 163, 184, 0.32);
    background: #f8fafc;
    color: #475569;
    font-weight: 900;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 16rem;
    padding: 2.5rem 1.25rem;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.42);
    border-radius: 1.2rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.98));
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.85rem;
    border-radius: 1rem;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 1.65rem;
    font-weight: 900;
}

.empty-state h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.2rem;
}

.empty-state p {
    max-width: 34rem;
    margin: 0.45rem 0 1rem;
    color: #64748b;
}

.panel-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.panel-title-row h2 {
    margin: 0;
    color: #0f172a;
}

.panel-title-row p {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

@media (max-width: 1280px) {
    .task-filter-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-field-wide,
    .filter-actions {
        grid-column: span 3;
    }

    .filter-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .task-filter-bar {
        grid-template-columns: 1fr;
    }

    .filter-field-wide,
    .filter-actions {
        grid-column: auto;
    }

    .filter-actions .button {
        width: 100%;
        justify-content: center;
    }
}

.message-form-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.editor-toggle {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: #f8fafc;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.editor-toggle-button {
    border: 0;
    border-radius: 999px;
    padding: 0.42rem 0.78rem;
    background: transparent;
    color: #475569;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 850;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.editor-toggle-button:hover,
.editor-toggle-button:focus-visible {
    color: #0f172a;
    transform: translateY(-1px);
}

.editor-toggle-button.is-active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.message-form-hint.is-warning {
    color: #b45309;
}

.message-form-hint.is-success {
    color: #047857;
}

.rich-content {
    color: #0f172a;
    line-height: 1.6;
}

.rich-content p {
    margin: 0 0 0.65rem;
}

.rich-content p:last-child,
.rich-content ul:last-child,
.rich-content ol:last-child,
.rich-content blockquote:last-child {
    margin-bottom: 0;
}

.rich-content ul,
.rich-content ol {
    margin: 0.35rem 0 0.75rem 1.2rem;
    padding: 0;
}

.rich-content li + li {
    margin-top: 0.2rem;
}

.rich-content blockquote {
    margin: 0.75rem 0;
    padding: 0.55rem 0.85rem;
    border-left: 3px solid #94a3b8;
    border-radius: 0.55rem;
    background: rgba(248, 250, 252, 0.9);
    color: #334155;
}

.rich-content a {
    color: #0369a1;
    font-weight: 800;
    text-decoration: none;
}

.rich-content a:hover,
.rich-content a:focus-visible {
    text-decoration: underline;
}

.chat-message-rich .chat-bubble {
    border-color: rgba(14, 165, 233, 0.22);
}

@media (max-width: 760px) {
    .message-form-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .editor-toggle {
        width: 100%;
    }

    .editor-toggle-button {
        flex: 1;
    }
}

/* Patch 14 · Mail-Queue */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
}
.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.mail-table td {
    vertical-align: top;
}
.badge-queued,
.badge-processing,
.badge-sent,
.badge-failed,
.badge-cancelled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: .25rem .65rem;
    font-size: .78rem;
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, .08);
}
.badge-queued { background: #eff6ff; color: #1d4ed8; }
.badge-processing { background: #fef3c7; color: #92400e; }
.badge-sent { background: #dcfce7; color: #166534; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #475569; }
.mail-preview-frame {
    width: 100%;
    min-height: 360px;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 18px;
    background: #fff;
}
.checkbox-line {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
}
.checkbox-line input {
    width: auto;
}
@media (max-width: 760px) {
    .panel-heading-row {
        display: block;
    }
    .inline-form {
        width: 100%;
    }
}

/* Patch 15 · Benachrichtigungen */
.notification-settings-panel .muted {
    color: #64748b;
    margin-top: -.35rem;
}
.notification-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin: 1.25rem 0;
}
.setting-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
}
.setting-toggle-card strong {
    display: block;
    color: #0f172a;
    margin-bottom: .25rem;
}
.setting-toggle-card small {
    display: block;
    color: #64748b;
    line-height: 1.45;
}
.setting-toggle-card input[type="checkbox"] {
    width: 1.35rem;
    height: 1.35rem;
    flex: 0 0 auto;
    accent-color: #1d4ed8;
}
.setting-toggle-card input[type="text"] {
    min-width: 160px;
    max-width: 220px;
}
.compact-feature-list {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.compact-feature-list > div {
    padding: 1rem;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .24);
}
.compact-feature-list strong,
.compact-feature-list small {
    display: block;
}
.compact-feature-list small {
    color: #64748b;
    margin-top: .25rem;
    line-height: 1.45;
}
@media (max-width: 760px) {
    .setting-toggle-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .setting-toggle-card input[type="text"] {
        max-width: none;
        width: 100%;
    }
}

/* Patch 16: Benutzerverwaltung */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    padding: .25rem .65rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .01em;
    border: 1px solid rgba(15, 23, 42, .08);
}

.role-badge-admin {
    background: rgba(29, 78, 216, .12);
    color: #1d4ed8;
}

.role-badge-user {
    background: rgba(15, 118, 110, .12);
    color: #0f766e;
}

.user-avatar-wrap {
    display: inline-flex;
    position: relative;
    flex: 0 0 auto;
}

.user-avatar-wrap.is-inactive {
    opacity: .65;
    filter: grayscale(.25);
}

.user-avatar-status {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: .62rem;
    height: .62rem;
    border-radius: 999px;
    background: #16a34a;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .16);
}

.user-avatar-wrap.is-inactive .user-avatar-status {
    background: #94a3b8;
}

.user-avatar-lg {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 1.35rem;
}

.user-avatar-wrap-lg .user-avatar-status {
    width: .9rem;
    height: .9rem;
}

.user-profile-panel {
    display: grid;
    gap: 1.5rem;
}

.user-profile-head {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-profile-head h2 {
    margin: 0;
}

.user-profile-head p {
    margin: .2rem 0 .55rem;
    color: #64748b;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}

.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
    margin: 0;
}

.details-list div {
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 1rem;
    padding: .85rem .95rem;
    background: rgba(248, 250, 252, .78);
}

.details-list dt {
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    margin: 0 0 .35rem;
}

.details-list dd {
    margin: 0;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.form-context-user {
    padding: .9rem 1rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 1rem;
    background: rgba(248, 250, 252, .78);
}

.button-danger {
    background: #be123c;
    color: #fff;
    border-color: #be123c;
}

.button-danger:hover {
    background: #9f1239;
    border-color: #9f1239;
}

/* Patch 17 · Kundenbenutzer-Zugriff */
.user-page .page { max-width: 1320px; }
.user-hero { border-color: rgba(37, 99, 235, .18); }
.user-assignment-form { align-items: end; }
.checkbox-label { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--muted); }
.inline-permissions-form { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .8rem; }
.inline-permissions-form label { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; color: var(--muted); white-space: nowrap; }
.button-small { padding: .45rem .7rem; font-size: .82rem; }
.user-inline { display: flex; align-items: center; gap: .7rem; }
.user-inline small { display: block; color: var(--muted); margin-top: .12rem; }
.section-heading-row { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.project-card-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.entity-card { display: flex; gap: 1rem; align-items: flex-start; }
.entity-card h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.entity-card p { margin: 0 0 .75rem; color: var(--muted); }
.entity-avatar-task { background: linear-gradient(135deg, #334155, #0f172a); color: #fff; }
.compact-table .button { margin: .1rem 0; }
@media (max-width: 820px) {
  .section-heading-row, .inline-permissions-form { flex-direction: column; align-items: stretch; }
  .inline-permissions-form label { white-space: normal; }
}

/* Patch 18 · User-Profil und Kundenbenutzer-UX */
.user-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
    margin: 0 0 1.2rem;
    padding: .55rem;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
    backdrop-filter: blur(12px);
}
.user-navigation-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: .5rem .9rem;
    border-radius: 999px;
    color: #475569;
    font-weight: 800;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.user-navigation-link:hover,
.user-navigation-link.is-active {
    background: #0f172a;
    color: #fff;
    transform: translateY(-1px);
}
.user-navigation-link-admin {
    margin-left: auto;
    background: rgba(29, 78, 216, .1);
    color: #1d4ed8;
}
.topbar-profile-link {
    display: inline-flex;
    text-decoration: none;
}
.user-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.user-dashboard-card {
    position: relative;
    overflow: hidden;
    min-height: 8.4rem;
    padding: 1.15rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 1.25rem;
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
    box-shadow: 0 16px 36px rgba(15, 23, 42, .07);
}
.user-dashboard-card::after {
    content: '';
    position: absolute;
    right: -2.4rem;
    top: -2.4rem;
    width: 7rem;
    height: 7rem;
    border-radius: 999px;
    background: rgba(29, 78, 216, .08);
}
.user-dashboard-card span,
.user-dashboard-card small,
.user-dashboard-card strong {
    display: block;
    position: relative;
    z-index: 1;
}
.user-dashboard-card span {
    color: #64748b;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.user-dashboard-card strong {
    margin-top: .6rem;
    font-size: 2rem;
    color: #0f172a;
}
.user-dashboard-card small {
    margin-top: .3rem;
    color: #64748b;
}
.user-dashboard-card > a {
    position: absolute;
    inset: 0;
    z-index: 2;
}
.user-project-card,
.user-task-card {
    display: grid;
    gap: .9rem;
    padding: 1.1rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .07);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.user-project-card:hover,
.user-task-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, .24);
    box-shadow: 0 22px 44px rgba(15, 23, 42, .1);
}
.user-project-card-head,
.user-task-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .9rem;
}
.user-project-card-head {
    justify-content: flex-start;
}
.user-project-card h2,
.user-task-card h2 {
    margin: 0 0 .25rem;
    font-size: 1.05rem;
    line-height: 1.25;
}
.user-project-card h2 a,
.user-task-card h2 a {
    color: #0f172a;
    text-decoration: none;
}
.user-project-card h2 a:hover,
.user-task-card h2 a:hover {
    color: #1d4ed8;
}
.user-project-card p,
.user-task-card p {
    margin: 0;
    color: #64748b;
}
.user-card-description {
    font-size: .9rem;
    line-height: 1.55;
}
.user-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(148, 163, 184, .18);
    color: #64748b;
    font-size: .86rem;
}
.user-task-card.priority-urgent { border-left: 4px solid #be123c; }
.user-task-card.priority-high { border-left: 4px solid #ea580c; }
.user-task-card.priority-normal { border-left: 4px solid #2563eb; }
.user-task-card.priority-low { border-left: 4px solid #64748b; }
.date-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .25rem .55rem;
    background: rgba(15, 23, 42, .05);
    color: #475569;
    font-size: .78rem;
    font-weight: 700;
}
.user-section-heading {
    margin-top: 1.5rem;
}
.profile-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .82fr);
    align-items: start;
}
.profile-form {
    display: grid;
    gap: 1rem;
}
.profile-security-note {
    display: grid;
    gap: .2rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 1rem;
    background: rgba(37, 99, 235, .06);
    color: #1e3a8a;
}
.profile-security-note span {
    color: #475569;
    font-size: .9rem;
}
.password-panel {
    max-width: 760px;
}
.customer-chip-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .85rem;
}
.customer-chip {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .9rem;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 1rem;
    background: rgba(248, 250, 252, .78);
}
.customer-chip strong,
.customer-chip small {
    display: block;
}
.customer-chip small {
    margin-top: .18rem;
    color: #64748b;
}
@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .user-navigation {
        border-radius: 1.25rem;
    }
    .user-navigation-link-admin {
        margin-left: 0;
    }
}

/* Patch 19: Uploads & visual identifiers */
.upload-grid {
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.78);
}

.upload-field {
    display: grid;
    gap: 0.45rem;
}

.upload-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.upload-field input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px dashed rgba(37, 99, 235, 0.35);
    border-radius: 0.8rem;
    background: #fff;
}

.upload-remove {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b91c1c;
}

.field-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.image-preview {
    display: block;
    width: 6rem;
    height: 6rem;
    object-fit: cover;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.12);
}

.entity-avatar-image {
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.26);
}

.entity-avatar-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.user-avatar-wrap-lg .user-avatar,
.user-avatar-lg {
    width: 4.75rem;
    height: 4.75rem;
    font-size: 1.25rem;
}

@media (max-width: 760px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }

    .upload-field-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Patch 20: Nachrichten-Anhänge */
.message-attachment-field {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed rgba(100, 116, 139, 0.45);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.72);
}

.message-attachment-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: #0f172a;
}

.message-attachment-field input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.45);
}

.attachment-preview-list {
    display: grid;
    gap: 0.35rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
    color: #334155;
    font-size: 0.88rem;
}

.attachment-preview-list li {
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: rgba(226, 232, 240, 0.65);
}

.attachment-preview-warning {
    color: #b45309;
    background: rgba(254, 243, 199, 0.9) !important;
}

.message-attachments {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.attachment-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
}

.attachment-icon {
    min-width: 3.1rem;
    height: 2.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #1e3a8a;
    background: #dbeafe;
}

.attachment-thumb {
    width: 4.5rem;
    height: 3.2rem;
    overflow: hidden;
    border-radius: 12px;
    background: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.attachment-meta {
    min-width: 0;
}

.attachment-meta strong,
.attachment-meta span {
    display: block;
}

.attachment-meta strong {
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-meta span {
    color: #64748b;
    font-size: 0.84rem;
    margin-top: 0.12rem;
}

.attachment-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 720px) {
    .attachment-item {
        grid-template-columns: auto 1fr;
    }

    .attachment-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

/* Patch 21 · Upload-Komfort & Datei-Cleanup */
.upload-dropzone {
    border: 1px dashed rgba(71, 85, 105, 0.35);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.72);
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.upload-dropzone-active {
    border-color: rgba(37, 99, 235, 0.75);
    background: rgba(219, 234, 254, 0.72);
    transform: translateY(-1px);
}

.upload-dropzone-inner {
    display: grid;
    gap: .35rem;
    place-items: center;
    padding: 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, .72);
    text-align: center;
}

.upload-dropzone-inner strong {
    color: var(--color-navy, #0f172a);
    font-size: .98rem;
}

.upload-dropzone-inner span,
.upload-preview-item small {
    color: var(--color-muted, #64748b);
    font-size: .82rem;
}

.upload-dropzone-inner input[type="file"] {
    margin-top: .45rem;
    max-width: 100%;
}

.attachment-preview-list[hidden] {
    display: none;
}

.attachment-preview-list,
.upload-preview-list {
    list-style: none;
    margin: .85rem 0 0;
    padding: 0;
    display: grid;
    gap: .5rem;
}

.upload-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 12px;
    background: rgba(255, 255, 255, .84);
}

.upload-preview-item span {
    min-width: 0;
    display: grid;
    gap: .15rem;
}

.upload-preview-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-preview-item-warning {
    border-color: rgba(245, 158, 11, .5);
    background: rgba(255, 251, 235, .88);
}

.file-stats-grid .info-card strong {
    font-variant-numeric: tabular-nums;
}

.file-filter-panel .task-filter-form {
    align-items: end;
}

.file-table td strong,
.file-table td small {
    display: block;
}

.file-table td small {
    color: var(--color-muted, #64748b);
    margin-top: .15rem;
    word-break: break-word;
}

.file-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.25rem;
    padding: .3rem .5rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    color: #0f172a;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.file-type-image {
    background: rgba(20, 184, 166, .14);
    color: #0f766e;
}

.danger-zone-panel {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.25rem;
    border-color: rgba(245, 158, 11, .28);
    background: linear-gradient(135deg, rgba(255, 251, 235, .78), rgba(255,255,255,.88));
}

.danger-inline-form {
    display: flex;
    align-items: end;
    gap: .75rem;
    flex-wrap: wrap;
}

.danger-inline-form label {
    display: grid;
    gap: .35rem;
    min-width: 260px;
}

.pagination-bar {
    margin-top: 1rem;
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
}

.largest-file-list {
    display: grid;
    gap: .5rem;
    margin-top: 1rem;
}

.largest-file-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem .9rem;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 12px;
    background: rgba(248, 250, 252, .8);
    color: inherit;
    text-decoration: none;
}

.definition-list {
    display: grid;
    grid-template-columns: minmax(130px, .32fr) 1fr;
    gap: .65rem 1rem;
    margin: 1rem 0 0;
}

.definition-list dt {
    color: var(--color-muted, #64748b);
    font-weight: 700;
}

.definition-list dd {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

.definition-list code {
    white-space: normal;
    word-break: break-all;
}

.file-preview-box {
    margin-top: 1rem;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .04);
}

.file-preview-box img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
}

@media (max-width: 860px) {
    .danger-zone-panel,
    .danger-inline-form,
    .upload-preview-item,
    .largest-file-list a {
        align-items: stretch;
        flex-direction: column;
    }

    .definition-list {
        grid-template-columns: 1fr;
    }
}

/* Patch 22: task quick actions */
.task-inline-form,
.task-quick-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.task-inline-form {
    margin: 0;
}

.task-inline-form select,
.task-inline-form input[type="date"] {
    min-height: 2.25rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .35);
    background: rgba(255, 255, 255, .92);
    padding: .4rem .55rem;
    font-size: .86rem;
}

.task-inline-form button {
    min-height: 2.25rem;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 10px;
    background: rgba(15, 23, 42, .05);
    color: var(--color-navy, #0f172a);
    font-weight: 800;
    cursor: pointer;
    padding: .35rem .65rem;
}

.task-inline-form button:hover,
.task-inline-form select:hover,
.task-inline-form input[type="date"]:hover {
    border-color: rgba(37, 99, 235, .4);
}

.task-inline-form.is-submitting {
    opacity: .68;
    pointer-events: none;
}

.task-inline-due-wrap {
    display: grid;
    gap: .35rem;
    min-width: 210px;
}

.task-current-due {
    color: var(--color-muted, #64748b);
    font-size: .82rem;
}

.task-quick-actions {
    padding: .75rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(248, 250, 252, .92), rgba(255, 255, 255, .86));
}

.task-quick-actions-compact {
    display: grid;
    gap: .5rem;
    padding: .65rem;
    margin-top: .75rem;
}

.task-quick-actions-compact .task-inline-form,
.task-quick-actions-compact .task-inline-form label,
.task-quick-actions-compact .task-inline-form select,
.task-quick-actions-compact .task-inline-form button {
    width: 100%;
}

.task-detail-action-panel {
    margin-bottom: 1rem;
}

.actions-cell .task-inline-form {
    display: inline-flex;
}

.actions-cell form.task-duplicate-form {
    display: inline-flex;
}

@media (max-width: 900px) {
    .task-inline-form,
    .task-quick-actions {
        align-items: stretch;
    }

    .task-inline-form select,
    .task-inline-form input[type="date"],
    .task-inline-form button {
        width: 100%;
    }

    .task-inline-due-wrap {
        min-width: 100%;
    }
}


/* Patch 23: CSS Custom Properties Theme Refinement */
html[data-theme] body {
    background: var(--bg-main);
    color: var(--text-main);
}

html[data-theme="default"] body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.14), transparent 35rem),
        linear-gradient(135deg, #f8fafc 0%, #edf3fb 52%, #f8fafc 100%);
}

html[data-theme="business-navy"] body {
    background: linear-gradient(180deg, var(--bg-surface-muted) 0%, var(--bg-main) 100%);
}

html[data-theme="business-navy"] .ambient {
    display: none;
}

html[data-theme] .topbar {
    border-bottom-color: var(--border-soft);
    background: var(--bg-navigation);
}

html[data-theme="default"] .topbar {
    background: rgba(248, 250, 252, 0.78);
}

html[data-theme="business-navy"] .topbar {
    color: var(--text-inverted);
    box-shadow: var(--panel-shadow);
    backdrop-filter: none;
}

html[data-theme="business-navy"] .brand small,
html[data-theme="business-navy"] .topbar-nav a {
    color: rgba(255, 255, 255, 0.78);
}

html[data-theme="business-navy"] .topbar-nav a:hover,
html[data-theme="business-navy"] .topbar-nav a:focus-visible {
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

html[data-theme="business-navy"] .brand-mark,
html[data-theme="business-navy"] .button-primary {
    background: var(--color-primary);
    box-shadow: var(--button-shadow);
}

html[data-theme] .hero-card,
html[data-theme] .panel,
html[data-theme] .info-card,
html[data-theme] .error-card,
html[data-theme] .task-card,
html[data-theme] .calendar-day,
html[data-theme] .kanban-column,
html[data-theme] .upload-dropzone,
html[data-theme] .attachment-card,
html[data-theme] .user-dashboard-card,
html[data-theme] .user-project-card,
html[data-theme] .user-task-card,
html[data-theme] .stat-card {
    border-color: var(--border-soft);
    background: var(--bg-surface);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

html[data-theme="business-navy"] .hero-card,
html[data-theme="business-navy"] .panel,
html[data-theme="business-navy"] .info-card,
html[data-theme="business-navy"] .error-card,
html[data-theme="business-navy"] .task-card,
html[data-theme="business-navy"] .calendar-day,
html[data-theme="business-navy"] .kanban-column,
html[data-theme="business-navy"] .upload-dropzone,
html[data-theme="business-navy"] .attachment-card,
html[data-theme="business-navy"] .user-dashboard-card,
html[data-theme="business-navy"] .user-project-card,
html[data-theme="business-navy"] .user-task-card,
html[data-theme="business-navy"] .stat-card {
    backdrop-filter: none;
}

html[data-theme] .hero-card {
    border-radius: var(--hero-radius);
    box-shadow: var(--hero-shadow);
}

html[data-theme="business-navy"] .hero-card::after {
    opacity: 0.36;
    background: radial-gradient(circle, rgba(37, 54, 93, 0.08), transparent 68%);
}

html[data-theme] .button,
html[data-theme] button,
html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea,
html[data-theme] .summary-pill,
html[data-theme] .badge,
html[data-theme] .filter-chip,
html[data-theme] .theme-preview-chip {
    border-radius: var(--control-radius);
}

html[data-theme] .button,
html[data-theme] .button-primary {
    border-radius: var(--button-radius);
}

html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea,
html[data-theme] .task-inline-form select,
html[data-theme] .task-inline-form input[type="date"] {
    border-color: var(--border-soft);
    background: var(--bg-surface-solid);
    color: var(--text-main);
}

html[data-theme] input:focus,
html[data-theme] select:focus,
html[data-theme] textarea:focus {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
    outline: none;
}

html[data-theme] .button-secondary,
html[data-theme] .task-inline-form button,
html[data-theme] .task-quick-actions {
    border-color: var(--border-soft);
    background: var(--bg-surface-muted);
    color: var(--color-primary);
}

html[data-theme="business-navy"] .button-secondary {
    background: #ffffff;
}

html[data-theme] .eyebrow,
html[data-theme] .info-label,
html[data-theme] a:hover {
    color: var(--color-accent);
}

.theme-settings-panel .theme-form {
    margin-top: 1rem;
}

.theme-preview-list {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .65rem;
    padding-top: 1.65rem;
}

.theme-preview-chip {
    display: inline-flex;
    min-height: 2.4rem;
    align-items: center;
    border: 1px solid var(--border-soft);
    padding: .55rem .8rem;
    font-weight: 800;
    font-size: .85rem;
}

.theme-preview-default {
    color: #172554;
    background: linear-gradient(135deg, #ffffff, #dbeafe);
    box-shadow: 0 8px 20px rgba(37, 99, 235, .12);
}

.theme-preview-business {
    color: #ffffff;
    border-color: rgba(37, 54, 93, .18);
    background: #25365d;
    box-shadow: 0 2px 4px rgba(37, 54, 93, .12);
}

.theme-token-note {
    border: 1px solid var(--border-soft);
    border-radius: var(--card-radius);
    background: var(--bg-surface-muted);
    padding: .85rem 1rem;
    color: var(--text-muted);
}


/* Patch 24: Theme typography and hover contrast refinement */
html[data-theme] body {
    font-weight: var(--font-weight-normal);
}

html[data-theme] strong,
html[data-theme] b,
html[data-theme] .brand strong,
html[data-theme] .eyebrow,
html[data-theme] .info-label,
html[data-theme] .migration-table th,
html[data-theme] .data-table th,
html[data-theme] .compact-table th,
html[data-theme] .calendar-weekdays span,
html[data-theme] .kanban-column-header h2,
html[data-theme] .task-card-kicker,
html[data-theme] .form-field,
html[data-theme] .summary-pill,
html[data-theme] .badge,
html[data-theme] .theme-preview-chip,
html[data-theme] .filter-chip,
html[data-theme] .file-type-badge {
    font-weight: var(--font-weight-semibold);
}

html[data-theme] h1,
html[data-theme] h2,
html[data-theme] h3,
html[data-theme] .status-orb span,
html[data-theme] .stat-value,
html[data-theme] .feature-row strong,
html[data-theme] .user-dashboard-card strong {
    font-weight: var(--font-weight-bold);
}

html[data-theme] .button,
html[data-theme] button,
html[data-theme] .topbar-nav a,
html[data-theme] .user-navigation-link,
html[data-theme] .editor-toggle-button,
html[data-theme] .task-inline-form select,
html[data-theme] .task-inline-form button {
    font-weight: var(--font-weight-medium);
}

html[data-theme="business-navy"] h1,
html[data-theme="business-navy"] h2,
html[data-theme="business-navy"] h3,
html[data-theme="nord"] h1,
html[data-theme="nord"] h2,
html[data-theme="nord"] h3 {
    letter-spacing: -0.032em;
}

html[data-theme="business-navy"] .eyebrow,
html[data-theme="business-navy"] .info-label,
html[data-theme="nord"] .eyebrow,
html[data-theme="nord"] .info-label {
    letter-spacing: 0.09em;
}

html[data-theme] .button:hover,
html[data-theme] .button:focus-visible,
html[data-theme] .button-secondary:hover,
html[data-theme] .button-secondary:focus-visible,
html[data-theme] .task-inline-form button:hover,
html[data-theme] .task-inline-form button:focus-visible,
html[data-theme] .editor-toggle-button:hover,
html[data-theme] .editor-toggle-button:focus-visible,
html[data-theme] .filter-chip:hover,
html[data-theme] .filter-chip:focus-visible {
    border-color: var(--hover-border);
    background: var(--hover-bg-strong);
    color: var(--hover-text);
}

html[data-theme] .topbar-nav a:hover,
html[data-theme] .topbar-nav a:focus-visible,
html[data-theme] .user-navigation-link:hover,
html[data-theme] .user-navigation-link:focus-visible,
html[data-theme] .user-navigation-link.is-active {
    border-color: var(--hover-border);
    background: var(--hover-bg-strong);
    color: var(--hover-text);
}

html[data-theme] .migration-table tbody tr:hover,
html[data-theme] .settings-table tbody tr:hover,
html[data-theme] .compact-table tbody tr:hover,
html[data-theme] .data-table tbody tr:hover,
html[data-theme] .activity-table tbody tr:hover,
html[data-theme] .mail-table tbody tr:hover,
html[data-theme] .file-table tbody tr:hover {
    background: var(--hover-bg);
}

html[data-theme] .task-card:hover,
html[data-theme] .calendar-task:hover,
html[data-theme] .user-project-card:hover,
html[data-theme] .user-task-card:hover,
html[data-theme] .system-action-card:hover,
html[data-theme] .attachment-card:hover,
html[data-theme] .upload-dropzone:hover {
    border-color: var(--hover-border);
    background: color-mix(in srgb, var(--bg-surface) 88%, var(--hover-bg-strong));
}

html[data-theme] .kanban-column.is-drag-over,
html[data-theme] .calendar-day.is-drop-target,
html[data-theme] .upload-dropzone.is-drag-over {
    border-color: var(--hover-border);
    background: var(--hover-bg-strong);
}

html[data-theme="business-navy"] .topbar-nav a:hover,
html[data-theme="business-navy"] .topbar-nav a:focus-visible,
html[data-theme="nord"] .topbar-nav a:hover,
html[data-theme="nord"] .topbar-nav a:focus-visible {
    border-color: rgba(255, 255, 255, 0.34);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
}

html[data-theme="business-navy"] .button-primary:hover,
html[data-theme="business-navy"] .button-primary:focus-visible,
html[data-theme="nord"] .button-primary:hover,
html[data-theme="nord"] .button-primary:focus-visible {
    background: var(--color-primary-hover);
    color: var(--text-inverted);
}

html[data-theme="business-navy"] .button-secondary:hover,
html[data-theme="business-navy"] .button-secondary:focus-visible,
html[data-theme="nord"] .button-secondary:hover,
html[data-theme="nord"] .button-secondary:focus-visible {
    background: var(--hover-bg-strong);
    border-color: var(--hover-border);
    color: var(--hover-text);
}

html[data-theme="business-navy"] .brand-mark {
    font-weight: var(--font-weight-bold);
}

html[data-theme="nord"] body {
    background: linear-gradient(180deg, #f8fafc 0%, var(--bg-main) 42%, #e5e9f0 100%);
}

html[data-theme="nord"] .ambient {
    display: none;
}

html[data-theme="nord"] .topbar {
    color: var(--text-inverted);
    background: var(--bg-navigation);
    box-shadow: var(--panel-shadow);
    backdrop-filter: none;
}

html[data-theme="nord"] .brand small,
html[data-theme="nord"] .topbar-nav a {
    color: rgba(236, 239, 244, 0.82);
}

html[data-theme="nord"] .brand-mark,
html[data-theme="nord"] .button-primary {
    background: var(--color-primary);
    box-shadow: var(--button-shadow);
}

html[data-theme="nord"] .hero-card::after {
    opacity: 0.3;
    background: radial-gradient(circle, rgba(136, 192, 208, 0.18), transparent 68%);
}

html[data-theme="nord"] .theme-preview-nord {
    color: #2e3440;
    border-color: rgba(76, 86, 106, 0.2);
    background: linear-gradient(135deg, #eceff4, #d8dee9 55%, #88c0d0);
    box-shadow: 0 2px 6px rgba(46, 52, 64, 0.1);
}

.theme-preview-nord {
    color: #2e3440;
    border-color: rgba(76, 86, 106, 0.2);
    background: linear-gradient(135deg, #eceff4, #d8dee9 55%, #88c0d0);
    box-shadow: 0 2px 6px rgba(46, 52, 64, 0.1);
}
