:root {
    --bg: #eef2f7;
    --bg-accent-1: rgba(59, 130, 246, 0.12);
    --bg-accent-2: rgba(16, 185, 129, 0.10);

    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #f1f5f9;

    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.22);
    --border-strong: rgba(148, 163, 184, 0.35);

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.10);

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;

    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.05);

    --radius-shell: 34px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 12px;

    --shell-width: 460px;
    --shell-desktop-width: 1200px;
    --shell-desktop-content: 900px;

    --nav-height: 82px;
}

html.theme-dark {
    --bg: #08111f;
    --bg-accent-1: rgba(59, 130, 246, 0.14);
    --bg-accent-2: rgba(16, 185, 129, 0.10);

    --surface: rgba(15, 23, 42, 0.72);
    --surface-solid: #0f172a;
    --surface-soft: #111c31;
    --surface-strong: #16233b;

    --text: #e5edf8;
    --text-soft: #cbd5e1;
    --text-muted: #94a3b8;

    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.26);

    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-soft: rgba(96, 165, 250, 0.12);

    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;

    --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.45);
    --shadow-md: 0 12px 30px rgba(2, 6, 23, 0.32);
    --shadow-sm: 0 8px 20px rgba(2, 6, 23, 0.22);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    color-scheme: light;
}

html.theme-dark {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, var(--bg-accent-1) 0%, transparent 28%),
        radial-gradient(circle at bottom right, var(--bg-accent-2) 0%, transparent 30%),
        var(--bg);
    transition: background .2s ease, color .2s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    display: block;
}

.app-page {
    min-height: 100vh;
    padding: 20px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-shell {
    width: 100%;
    max-width: var(--shell-width);
    min-height: calc(100vh - 40px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-shell);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-shell-inner {
    width: 100%;
    min-width: 0;
    padding: 14px 14px calc(var(--nav-height) + 18px);
}

.app-statusbar {
    display: flex;
    justify-content: center;
    padding-top: 10px;
}

.app-statusbar::before {
    content: "";
    width: 120px;
    height: 5px;
    border-radius: 999px;
    background: var(--border-strong);
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 6px 18px;
}

.app-topbar-title {
    min-width: 0;
}

.app-eyebrow {
    font-size: 0.78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.app-heading {
    font-size: 1.18rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.15;
}

.app-subheading {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.93rem;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.app-icon-btn,
.theme-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: .2s ease;
    flex-shrink: 0;
}

.app-icon-btn:hover,
.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.app-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.app-main {
    display: block;
    width: 100%;
    min-width: 0;
}

.app-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}

.app-card.soft {
    width: 100%;
    background: var(--surface-soft);
}

.app-card.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-color: transparent;
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.22);
}

html.theme-dark .app-card.hero {
    box-shadow: 0 18px 40px rgba(59, 130, 246, 0.18);
}

.app-card.hero .app-text,
.app-card.hero .app-meta {
    color: rgba(255,255,255,0.86);
}

.app-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 800;
}

.app-text {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.app-meta {
    margin: 0;
    color: var(--text-soft);
    font-size: .92rem;
}

.app-section-title {
    font-size: .80rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 16px 4px 10px;
    font-weight: 800;
}

.app-grid {
    display: grid;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.app-grid.two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.app-grid.three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.app-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-stat-label {
    font-size: .84rem;
    color: var(--text-muted);
    font-weight: 700;
}

.app-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
}

.app-btn {
    appearance: none;
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    min-height: 48px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
}

.app-btn:hover {
    background: var(--primary-hover);
}

.app-btn.full {
    width: 100%;
}

.app-btn.secondary {
    background: var(--primary-soft);
    color: var(--primary);
}

.app-btn.secondary:hover {
    filter: brightness(0.98);
}

.app-btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 14px;
    width: 100%;
    min-width: 0;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-soft);
}

.form-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 50px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
    padding: 12px 14px;
    outline: none;
    transition: .2s ease;
    box-sizing: border-box;
}

textarea.form-input {
    min-height: 110px;
    resize: vertical;
}

select.form-input {
    appearance: auto;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-help,
.form-error {
    font-size: .84rem;
    margin-top: 6px;
}

.form-help {
    color: var(--text-muted);
}

.form-error {
    color: var(--danger);
}

.auth-links {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    font-size: .92rem;
    color: var(--text-muted);
}

.app-list {
    display: grid;
    gap: 10px;
}

.app-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.app-list-item strong {
    display: block;
    font-size: .95rem;
}

.app-list-item span {
    display: block;
    margin-top: 3px;
    font-size: .85rem;
    color: var(--text-muted);
}

.app-badge {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: .75rem;
    white-space: nowrap;
}

.app-nav {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    min-height: 64px;
    border-radius: 24px;
    padding: 8px;
    background: rgba(255,255,255,0.76);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

html.theme-dark .app-nav {
    background: rgba(15, 23, 42, 0.84);
}

.app-nav-link {
    min-height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: .80rem;
    min-width: 0;
}

.app-nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.desktop-panel {
    display: none;
}

.app-stack {
    display: grid;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.app-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.app-actions .app-btn {
    flex: 1 1 auto;
}

.app-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.app-switch {
    position: relative;
    width: 54px;
    height: 32px;
    display: inline-block;
    flex-shrink: 0;
}

.app-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.app-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    transition: .2s ease;
    cursor: pointer;
}

.app-switch-slider::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
    transition: .2s ease;
}

.app-switch input:checked + .app-switch-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.app-switch input:checked + .app-switch-slider::before {
    transform: translateX(22px);
}

.app-kv {
    display: grid;
    gap: 12px;
}

.app-kv-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.app-kv-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.app-kv-row strong {
    font-size: .95rem;
}

.app-kv-row span {
    color: var(--text-muted);
    text-align: right;
    font-size: .92rem;
}

.app-empty {
    padding: 20px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px dashed var(--border-strong);
    text-align: center;
}

.app-empty h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.app-empty p {
    margin: 0;
    color: var(--text-muted);
}

.app-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.app-quick-action {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 14px 10px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    text-align: center;
    font-weight: 700;
    color: var(--text);
    min-width: 0;
}

.app-quick-action small {
    color: var(--text-muted);
    font-weight: 600;
    font-size: .76rem;
}

.app-module-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.app-pill-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.app-pill-tab {
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-weight: 700;
    font-size: .86rem;
}

.app-pill-tab.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}

.app-message {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.app-message-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.app-message-head strong {
    display: block;
    font-size: .95rem;
}

.app-message-head span {
    font-size: .82rem;
    color: var(--text-muted);
}

.app-message p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.5;
}

.app-project-card {
    display: grid;
    gap: 14px;
}

.app-progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--surface-strong);
    overflow: hidden;
}

.app-progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

.app-task-list {
    display: grid;
    gap: 10px;
}

.app-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.app-task input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.app-task-body {
    flex: 1;
    min-width: 0;
}

.app-task-body strong {
    display: block;
    font-size: .94rem;
}

.app-task-body span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: .84rem;
}

.app-chart-bars {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    min-height: 180px;
    padding-top: 12px;
}

.app-chart-bar-wrap {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.app-chart-bar {
    width: 100%;
    max-width: 34px;
    border-radius: 14px 14px 8px 8px;
    background: linear-gradient(180deg, var(--primary), var(--primary-hover));
    min-height: 20px;
}

.app-chart-label {
    font-size: .76rem;
    color: var(--text-muted);
    font-weight: 700;
}

.app-split {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}

.app-tabs {
    display: grid;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.app-tab-nav {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    width: 100%;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.app-tab-btn {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-soft);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: .2s ease;
    flex: 0 0 auto;
}

.app-tab-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}

.app-tab-panel {
    display: none;
    width: 100%;
    min-width: 0;
}

.app-tab-panel.active {
    display: block;
}

.app-tab-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.app-tab-actions .app-btn {
    width: auto;
    min-width: 140px;
}

.app-sticky-tabs {
    position: sticky;
    top: 10px;
    z-index: 10;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    margin-bottom: 14px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

@media (min-width: 900px) {
    .app-page {
        padding: 28px;
    }

    .app-shell {
        max-width: var(--shell-desktop-width);
        min-height: min(860px, calc(100vh - 56px));
        display: grid;
        grid-template-columns: 320px minmax(0, 1fr);
    }

    .desktop-panel {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 28px;
        background: linear-gradient(180deg, var(--surface-soft), transparent);
        border-right: 1px solid var(--border);
        min-width: 0;
    }

    .desktop-panel .brand h2 {
        margin: 0 0 8px;
        font-size: 1.6rem;
        line-height: 1.1;
    }

    .desktop-panel .brand p {
        margin: 0;
        color: var(--text-muted);
        line-height: 1.6;
    }

    .desktop-panel .preview-card {
        border-radius: 28px;
        padding: 22px;
        background: linear-gradient(135deg, var(--primary), var(--primary-hover));
        color: white;
        box-shadow: 0 18px 40px rgba(37, 99, 235, 0.20);
    }

    .desktop-panel .preview-card p {
        color: rgba(255,255,255,0.88);
    }

    .app-shell-mobile {
        position: relative;
        min-width: 0;
        width: 100%;
    }

    .app-statusbar {
        display: none;
    }

    .app-shell-inner {
        padding: 24px 24px calc(var(--nav-height) + 18px);
        max-width: var(--shell-desktop-content);
    }

    .app-topbar {
        padding-top: 2px;
    }

    .app-nav {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: min(520px, calc(100% - 48px));
    }
}

@media (max-width: 900px) {
    .app-quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-module-grid,
    .app-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .app-grid.two,
    .app-grid.three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-shell {
        border-radius: 28px;
    }

    .app-shell-inner {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-card {
        padding: 16px;
    }

    .app-inline,
    .app-kv-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-kv-row span {
        text-align: left;
    }

    .app-chart-bars {
        gap: 8px;
    }

    .app-chart-bar {
        max-width: 28px;
    }

    .app-tab-actions {
        flex-direction: column;
    }

    .app-tab-actions .app-btn {
        width: 100%;
    }
}

[data-show-for] {
    display: none;
}

.app-range-group {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.app-range-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-range-value {
    font-size: .84rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

input[type="range"].form-range {
    width: 100%;
    accent-color: var(--primary);
}

.app-zeugen-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}