:root {
    --navy: #0b1929;
    --navy-soft: #122136;
    --navy-ink: #1a2b3c;
    --gold: #c9a440;
    --gold-light: #e8c75a;
    --gold-dim: rgba(201, 164, 64, 0.16);
    --white: #ffffff;
    --off-white: #f8f9fb;
    --tint: #eef3f7;
    --line: rgba(11, 25, 41, 0.12);
    --text: #1a2b3c;
    --muted: #5c7a96;
    --success: #0f766e;
    --danger: #b42318;
    --info: #174ea6;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 16px 40px rgba(11, 25, 41, 0.12);
    --font-sans: "Inter", "Segoe UI", sans-serif;
    --font-serif: "Georgia", serif;
    --body-font-size: 16px;
    --nav-font-size: 16px;
    --button-font-size: 16px;
    --button-padding-y: 12px;
    --button-padding-x: 18px;
    --button-compact-font-size: 13px;
    --button-compact-padding-y: 6px;
    --button-compact-padding-x: 10px;
    --brand-title-size: 22px;
    --brand-subtitle-size: 13px;
    --h1-size: 34px;
    --h2-size: 28px;
    --h3-size: 22px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--body-font-size);
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(201, 164, 64, 0.12), transparent 28%),
        linear-gradient(180deg, #f7f8fb 0%, #edf2f6 100%);
    min-height: 100vh;
}

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

a:hover {
    color: var(--gold-light);
}

.shell {
    min-height: 100vh;
}

.topbar {
    background: rgba(11, 25, 41, 0.96);
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.topbar-inner,
.content,
.auth-card,
.setup-card {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar-inner {
    display: grid;
    gap: 18px;
    padding: 18px 0;
}

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.topbar-nav-row {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--white);
}

.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;
}

.brand-title {
    font-family: var(--font-serif);
    font-size: var(--brand-title-size);
    letter-spacing: 0.03em;
    color: var(--white);
}

.brand-subtitle {
    display: block;
    margin-top: 4px;
    font-size: var(--brand-subtitle-size);
    color: rgba(255, 255, 255, 0.72);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.nav a {
    padding: 10px 14px;
    border-radius: 999px;
    font-size: var(--nav-font-size);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav a.is-active,
.nav a:hover {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}

.nav-group {
    display: grid;
    gap: 8px;
    padding: 8px 12px 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.nav-group-title {
    padding-left: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

.nav-group-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-submenu {
    position: relative;
}

.nav-submenu-trigger {
    list-style: none;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: var(--nav-font-size);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

.nav-submenu-trigger::-webkit-details-marker {
    display: none;
}

.nav-submenu[open] .nav-submenu-trigger,
.nav-submenu-trigger:hover {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}

.nav-submenu-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    display: grid;
    gap: 10px;
    min-width: 220px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(11, 25, 41, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 42px rgba(11, 25, 41, 0.28);
}

.nav-submenu-links a {
    white-space: nowrap;
}

.account-menu {
    position: relative;
}

.account-trigger {
    list-style: none;
    cursor: pointer;
    padding: 12px 18px;
    min-width: 260px;
    border-radius: 999px;
    border: 2px solid rgba(201, 164, 64, 0.7);
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    font-weight: 700;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.account-trigger::-webkit-details-marker {
    display: none;
}

.account-trigger:hover,
.account-menu[open] .account-trigger {
    background: rgba(255, 255, 255, 0.14);
}

.account-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(241, 245, 249, 0.98);
    border: 2px solid rgba(201, 164, 64, 0.32);
    box-shadow: 0 18px 42px rgba(11, 25, 41, 0.22);
}

.account-popover a {
    display: block;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--white);
    border: 2px solid rgba(201, 164, 64, 0.3);
    color: var(--navy);
    font-weight: 700;
}

.account-popover a:hover,
.account-popover a.is-active {
    background: rgba(201, 164, 64, 0.14);
    border-color: rgba(201, 164, 64, 0.7);
    color: var(--navy);
}

.content {
    padding: 32px 0 48px;
}

.card,
.auth-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 28px;
    margin-bottom: 20px;
}

.subcard {
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--off-white);
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(11, 25, 41, 0.98), rgba(18, 33, 54, 0.94)),
        linear-gradient(90deg, rgba(201, 164, 64, 0.2), transparent);
    color: var(--white);
    overflow: hidden;
}

.hero-card h1,
.hero-card h2,
.hero-card h3 {
    margin-top: 0;
    font-family: var(--font-serif);
}

.hero-card p {
    color: rgba(255, 255, 255, 0.82);
}

.kpi-grid,
.split-grid {
    display: grid;
    gap: 20px;
}

.kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 12px;
}

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

.split-grid {
    grid-template-columns: 1.2fr 0.8fr;
}

.kpi {
    padding: 18px;
    border-radius: var(--radius-sm);
    background: var(--off-white);
    border: 1px solid var(--line);
}

.kpi strong {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: var(--navy);
}

.flash-list {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.flash {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--white);
}

.flash-success {
    border-color: rgba(15, 118, 110, 0.25);
    background: rgba(15, 118, 110, 0.08);
}

.flash-error {
    border-color: rgba(180, 35, 24, 0.2);
    background: rgba(180, 35, 24, 0.08);
}

.flash-info {
    border-color: rgba(23, 78, 166, 0.2);
    background: rgba(23, 78, 166, 0.08);
}

.impersonation-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.account-popover-form {
    margin: 0;
}

.account-popover-button {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: rgba(201, 164, 64, 0.16);
    color: var(--white);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.account-popover-button:hover {
    background: rgba(201, 164, 64, 0.3);
}

h1,
h2,
h3 {
    margin: 0 0 14px;
    font-family: var(--font-serif);
    line-height: 1.2;
}

h1 {
    font-size: var(--h1-size);
}

h2 {
    font-size: var(--h2-size);
}

h3 {
    font-size: var(--h3-size);
}

p {
    margin: 0 0 14px;
}

ul {
    margin: 0 0 14px 20px;
    padding: 0;
}

li {
    margin-bottom: 8px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin: 0;
}

legend {
    padding: 0 8px;
    color: var(--navy);
}

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

.form-grid {
    display: grid;
    gap: 16px;
}

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

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

.span-full {
    grid-column: 1 / -1;
}

.form-grid.two > .span-full {
    grid-column: 1 / -1;
    width: 100%;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
    color: var(--navy-ink);
}

.choice-option {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.choice-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
}

.choice-option span {
    display: inline-block;
    line-height: 1.4;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid rgba(11, 25, 41, 0.18);
    background: var(--white);
    color: var(--text);
}

textarea {
    min-height: 220px;
    resize: vertical;
}

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

.user-actions-cell {
    white-space: nowrap;
    width: auto;
    padding-top: 0;
    padding-bottom: 18px;
}

.user-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.user-actions form {
    margin: 0;
}

.user-actions .btn,
.user-actions button {
    width: auto;
    padding: var(--button-compact-padding-y) var(--button-compact-padding-x);
    font-size: var(--button-compact-font-size);
    text-align: center;
    white-space: nowrap;
}

.users-edit-card {
    background: rgba(255, 255, 255, 0.78);
}

.users-inline-form {
    margin-top: 18px;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-actions form {
    margin: 0;
}

.form-grid > .actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: var(--button-padding-y) var(--button-padding-x);
    font-size: var(--button-font-size);
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--gold);
    color: var(--navy);
}

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

.btn-secondary {
    background: var(--navy);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--navy-soft);
}

.btn-subtle {
    background: transparent;
    color: var(--navy);
    border-color: rgba(11, 25, 41, 0.15);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--gold-dim);
    color: var(--navy);
    font-size: 0.88rem;
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
}

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

.users-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

th,
td {
    text-align: left;
    padding: 14px 12px;
    vertical-align: top;
}

th {
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

tbody td {
    border-bottom: 1px solid var(--line);
}

.users-table thead th {
    border-bottom: 0;
    padding-bottom: 18px;
}

.users-table tbody td {
    border-bottom: 0;
}

.users-table .user-entry-row > td {
    padding-top: 20px;
    padding-bottom: 10px;
}

.users-table .user-actions-row > td {
    padding-top: 0;
}

.users-table .users-row-even > td {
    background: rgba(255, 255, 255, 0.92);
}

.users-table .users-row-odd > td {
    background: rgba(238, 243, 247, 0.82);
}

.users-table .user-entry-row > td:first-child {
    border-top-left-radius: 16px;
}

.users-table .user-entry-row > td:last-child {
    border-top-right-radius: 16px;
}

.users-table .user-actions-row > td:first-child {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-ok {
    background: rgba(15, 118, 110, 0.12);
    color: var(--success);
}

.status-pending {
    background: rgba(201, 164, 64, 0.18);
    color: #7a5b00;
}

.status-warn {
    background: rgba(201, 164, 64, 0.18);
    color: #7a5b00;
}

.status-off {
    background: rgba(180, 35, 24, 0.1);
    color: var(--danger);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 32px 0;
}

.auth-card,
.setup-card {
    width: min(740px, calc(100% - 32px));
}

.auth-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.auth-brand,
.auth-form {
    padding: 32px;
}

.auth-brand {
    background: linear-gradient(160deg, rgba(11, 25, 41, 0.98), rgba(18, 33, 54, 0.96));
    color: var(--white);
}

.auth-brand p {
    color: rgba(255, 255, 255, 0.78);
}

.code-block {
    font-family: "SFMono-Regular", Consolas, monospace;
    background: var(--off-white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    overflow-x: auto;
    word-break: break-all;
}

.document-content {
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--off-white);
    white-space: normal;
    line-height: 1.75;
}

.document-panel {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
    overflow: hidden;
}

.document-panel-summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(17, 33, 54, 0.04) 0%, rgba(17, 33, 54, 0.01) 100%);
}

.document-panel-summary::-webkit-details-marker {
    display: none;
}

.document-panel-summary::after {
    content: "Mehr anzeigen";
    justify-self: start;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--gold-dim);
    color: var(--navy);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.document-panel[open] .document-panel-summary::after {
    content: "Weniger anzeigen";
}

.document-panel-title {
    font-weight: 800;
    color: var(--navy);
}

.document-panel-preview {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.document-panel .document-content {
    margin: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.78);
}

.document-content p {
    margin: 0 0 14px;
}

.document-content p:last-child {
    margin-bottom: 0;
}

.document-heading {
    margin: 18px 0 10px;
    font-size: 1rem;
    color: var(--navy);
}

.document-content > .document-heading:first-child {
    margin-top: 0;
}

.document-list {
    margin: 0 0 14px;
    padding-left: 20px;
}

.document-list:last-child {
    margin-bottom: 0;
}

.payroll-panel {
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.payroll-panel-summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    gap: 4px;
    padding: 18px 22px;
    background: linear-gradient(180deg, rgba(17, 33, 54, 0.04) 0%, rgba(17, 33, 54, 0.01) 100%);
}

.payroll-panel-summary::-webkit-details-marker {
    display: none;
}

.payroll-panel-summary span {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--navy);
}

.payroll-panel-summary small {
    font-size: 0.92rem;
    color: var(--muted);
}

.payroll-panel-summary::after {
    content: "Bereich oeffnen";
    justify-self: start;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--gold-dim);
    color: var(--navy);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payroll-panel[open] .payroll-panel-summary::after {
    content: "Bereich schliessen";
}

.payroll-panel-body {
    padding: 22px;
    border-top: 1px solid var(--line);
}

.typography-preview-card .pill {
    margin-bottom: 18px;
}

.typography-preview {
    display: grid;
    gap: 14px;
    font-family: var(--font-sans);
    font-size: var(--body-font-size);
}

.typography-preview .brand-title {
    color: var(--navy);
}

.typography-preview .brand-subtitle {
    color: var(--muted);
}

.typography-sample-nav {
    justify-content: flex-start;
}

@media (max-width: 900px) {
    .split-grid,
    .auth-panel,
    .form-grid.two {
        grid-template-columns: 1fr;
    }

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

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

    .topbar-main,
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-main {
        width: 100%;
    }

    .nav-toggle {
        display: inline-flex;
        position: absolute;
        top: 18px;
        right: 0;
        flex-direction: column;
    }

    .topbar-inner {
        position: relative;
    }

    .topbar-nav-row {
        display: none;
        width: 100%;
    }

    .topbar-nav-row.is-open {
        display: flex;
    }

    .nav {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-submenu-links {
        position: static;
        min-width: 0;
        margin-top: 10px;
    }

    .account-trigger,
    .account-popover {
        width: 100%;
    }

    .account-popover {
        position: static;
        margin-top: 12px;
    }
}
