:root {
    --bg: #f3efe5;
    --panel: #fffdf9;
    --panel-strong: #f8f3ea;
    --text: #1f1b16;
    --muted: #74695d;
    --line: #d9cfbf;
    --primary: #1f6f5f;
    --primary-dark: #155346;
    --danger: #ab2f2f;
    --shadow: 0 20px 50px rgba(35, 26, 16, 0.08);
    --radius: 20px;
    --radius-sm: 12px;
    --font-display: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
    --bg-gradient:
        radial-gradient(circle at top left, rgba(31, 111, 95, 0.14), transparent 26%),
        linear-gradient(180deg, #f5f1e8 0%, #efe7d9 100%);
    --sidebar-bg: rgba(31, 27, 22, 0.94);
    --sidebar-text: #f4ecdf;
    --sidebar-muted: rgba(244, 236, 223, 0.72);
    --sidebar-eyebrow: rgba(244, 236, 223, 0.56);
    --field-bg: #fffcf7;
    --surface-soft: rgba(31, 111, 95, 0.05);
    --surface-hover: rgba(31, 111, 95, 0.05);
    --nav-bg: rgba(255, 255, 255, 0.06);
    --nav-bg-hover: rgba(255, 255, 255, 0.12);
    --track-bg: rgba(31, 27, 22, 0.08);
    --code-bg: rgba(31, 27, 22, 0.08);
}

[data-theme="dark"] {
    --bg: #11161b;
    --panel: #182028;
    --panel-strong: #202a34;
    --text: #eef3f7;
    --muted: #9eb0bf;
    --line: #32404d;
    --primary: #3ca186;
    --primary-dark: #2e866e;
    --danger: #ff7f7f;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    --bg-gradient:
        radial-gradient(circle at top left, rgba(60, 161, 134, 0.18), transparent 26%),
        linear-gradient(180deg, #11161b 0%, #0b1015 100%);
    --sidebar-bg: #0d1318;
    --sidebar-text: #eef3f7;
    --sidebar-muted: rgba(238, 243, 247, 0.74);
    --sidebar-eyebrow: rgba(238, 243, 247, 0.52);
    --field-bg: #111920;
    --surface-soft: rgba(60, 161, 134, 0.12);
    --surface-hover: rgba(60, 161, 134, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.05);
    --nav-bg-hover: rgba(255, 255, 255, 0.11);
    --track-bg: rgba(255, 255, 255, 0.1);
    --code-bg: rgba(255, 255, 255, 0.1);
}

[data-theme="pink"] {
    --bg: #fff1f7;
    --panel: #fffafe;
    --panel-strong: #ffe7f2;
    --text: #311724;
    --muted: #8c6074;
    --line: #e8bfd2;
    --primary: #c04f86;
    --primary-dark: #a33d70;
    --danger: #b1375a;
    --shadow: 0 20px 50px rgba(120, 35, 78, 0.1);
    --bg-gradient:
        radial-gradient(circle at top left, rgba(192, 79, 134, 0.18), transparent 26%),
        linear-gradient(180deg, #fff4f9 0%, #ffe8f2 100%);
    --sidebar-bg: #341928;
    --sidebar-text: #fff3f8;
    --sidebar-muted: rgba(255, 243, 248, 0.74);
    --sidebar-eyebrow: rgba(255, 243, 248, 0.56);
    --field-bg: #fff9fc;
    --surface-soft: rgba(192, 79, 134, 0.08);
    --surface-hover: rgba(192, 79, 134, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.08);
    --nav-bg-hover: rgba(255, 255, 255, 0.14);
    --track-bg: rgba(49, 23, 36, 0.08);
    --code-bg: rgba(49, 23, 36, 0.08);
}

[data-theme="green"] {
    --bg: #eef7ef;
    --panel: #fbfffb;
    --panel-strong: #e3f1e3;
    --text: #15261b;
    --muted: #60796a;
    --line: #bed4c3;
    --primary: #2f7d4b;
    --primary-dark: #24623a;
    --danger: #9d3f3f;
    --shadow: 0 20px 50px rgba(29, 63, 36, 0.1);
    --bg-gradient:
        radial-gradient(circle at top left, rgba(47, 125, 75, 0.16), transparent 26%),
        linear-gradient(180deg, #f2faf2 0%, #e4f0e5 100%);
    --sidebar-bg: #17261b;
    --sidebar-text: #eef8ef;
    --sidebar-muted: rgba(238, 248, 239, 0.74);
    --sidebar-eyebrow: rgba(238, 248, 239, 0.56);
    --field-bg: #fafffa;
    --surface-soft: rgba(47, 125, 75, 0.08);
    --surface-hover: rgba(47, 125, 75, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.07);
    --nav-bg-hover: rgba(255, 255, 255, 0.13);
    --track-bg: rgba(21, 38, 27, 0.08);
    --code-bg: rgba(21, 38, 27, 0.08);
}

[data-theme="visie"] {
    --bg: #faf7fb;
    --panel: #fffefe;
    --panel-strong: #f7edf7;
    --text: #2f2331;
    --muted: #76657b;
    --line: #ddcfe0;
    --primary: #982b8e;
    --primary-dark: #7f2177;
    --danger: #bd4a5f;
    --shadow: 0 20px 50px rgba(92, 30, 89, 0.1);
    --bg-gradient:
        radial-gradient(circle at top left, rgba(152, 43, 142, 0.16), transparent 24%),
        radial-gradient(circle at bottom right, rgba(245, 154, 0, 0.14), transparent 20%),
        linear-gradient(180deg, #fffefe 0%, #f7eef8 100%);
    --sidebar-bg: #4f1d55;
    --sidebar-text: #fff7fc;
    --sidebar-muted: rgba(255, 247, 252, 0.76);
    --sidebar-eyebrow: rgba(255, 247, 252, 0.58);
    --field-bg: #fffdfd;
    --surface-soft: rgba(152, 43, 142, 0.08);
    --surface-hover: rgba(245, 154, 0, 0.08);
    --nav-bg: rgba(255, 255, 255, 0.09);
    --nav-bg-hover: rgba(255, 255, 255, 0.15);
    --track-bg: rgba(47, 35, 49, 0.08);
    --code-bg: rgba(47, 35, 49, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-display);
    color: var(--text);
    background: var(--bg-gradient);
}

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

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

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

.auth-card,
.panel,
.stat-card {
    background: var(--panel);
    border: 1px solid rgba(217, 207, 191, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(460px, 100%);
    padding: 32px;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 32px 24px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-top {
    padding-bottom: 24px;
}

.sidebar h1,
.page-header h2,
.panel-header h3,
.auth-card h2 {
    margin: 6px 0 0;
}

.sidebar-footer {
    display: grid;
    gap: 12px;
}

.sidebar-footer p,
.muted,
.table-subline {
    margin: 4px 0 0;
    color: var(--muted);
}

.sidebar .muted,
.sidebar-footer p {
    color: var(--sidebar-muted);
}

.eyebrow {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar .eyebrow {
    color: var(--sidebar-eyebrow);
}

.sidebar-home-link {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    color: var(--sidebar-text);
}

.sidebar-home-link span {
    color: var(--sidebar-muted);
    font-size: 14px;
    font-weight: 600;
}

.sidebar-home-link:hover span,
.sidebar-home-link:hover h1 {
    color: #ffffff;
}

.nav {
    display: grid;
    gap: 10px;
    margin: 28px 0 0;
}

.nav-link,
.primary-button,
.ghost-button,
.table-link {
    transition: 160ms ease;
}

.nav-link {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--nav-bg);
}

.nav-link:hover {
    background: var(--nav-bg-hover);
}

.sidebar-footer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.theme-toggle {
    width: 54px;
    height: 54px;
    padding: 0;
    flex: 0 0 54px;
    border-color: rgba(217, 207, 191, 0.5);
    background: transparent;
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    opacity: 0.82;
}

.theme-toggle:hover svg,
.theme-toggle:focus-visible svg {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle,
[data-theme="pink"] .theme-toggle,
[data-theme="green"] .theme-toggle,
[data-theme="visie"] .theme-toggle {
    background: rgba(255, 255, 255, 0.04);
}

.main-content {
    padding: 32px;
}

.page-header,
.panel-header,
.filters,
.form-actions,
.actions-cell,
.stack,
.button-row {
    display: flex;
    gap: 16px;
}

.page-header,
.panel-header,
.filters,
.actions-cell {
    align-items: center;
    justify-content: space-between;
}

.page-header {
    margin-bottom: 24px;
}

.page-footer-tools {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 24px;
}

.stat-card,
.panel {
    padding: 24px;
}

.account-sections {
    display: grid;
    gap: 24px;
}

.account-panel {
    max-width: 760px;
}

.account-panel-header {
    margin-bottom: 20px;
}

.account-panel-header h3 {
    margin: 6px 0 0;
}

.footer-note-trigger {
    gap: 10px;
}

.footer-note-trigger-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--surface-soft);
    font-size: 14px;
}

.stat-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.stat-card strong {
    font-size: 34px;
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.button-row {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ghost-button {
    background: transparent;
    color: inherit;
    border-color: var(--line);
}

.ghost-button:hover {
    background: rgba(31, 27, 22, 0.04);
}

.app-modal[hidden] {
    display: none;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: grid;
    place-items: center;
    padding: 24px;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 12, 8, 0.42);
    backdrop-filter: blur(6px);
}

.app-modal-panel {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(86vh, 960px);
    overflow: auto;
    padding: 24px;
    border: 1px solid rgba(217, 207, 191, 0.9);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.app-modal-header {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
}

.modal-close-button {
    flex: 0 0 auto;
}

.shared-note-textarea {
    min-height: 320px;
    line-height: 1.55;
    resize: vertical;
}

body.modal-open {
    overflow: hidden;
    padding-right: var(--modal-scrollbar-compensation, 0);
}

.stack {
    flex-direction: column;
    margin-top: 20px;
}

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

.panel-split {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    margin-top: 24px;
}

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

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.required-field > span:first-child {
    position: relative;
    display: block;
    padding-right: 62px;
}

.required-field > span:first-child::before {
    content: "*";
    position: absolute;
    top: -4px;
    right: 0;
    font-size: 16px;
    line-height: 1;
    color: var(--danger);
}

.required-field > span:first-child::after {
    content: "verplicht";
    position: absolute;
    top: 7px;
    right: 0;
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--field-bg);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(31, 111, 95, 0.16);
    border-color: var(--primary);
}

.filters {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.filters label {
    min-width: 220px;
}

.inline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.inline-checkbox input {
    width: auto;
    margin: 0;
}

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

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

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    font-size: 13px;
}

.progress-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
}

.task-summary {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.task-status-grid,
.task-summary-columns {
    display: grid;
    gap: 14px;
}

.task-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

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

.task-status-card,
.task-summary-list {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--field-bg);
}

.task-status-card p,
.task-summary-list p,
.task-summary-list ul {
    margin: 0;
}

.task-status-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.task-summary-list ul {
    padding-left: 18px;
    margin-top: 10px;
}

.progress-head,
.note-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.progress-bar,
.mini-progress {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--track-bg);
}

.progress-bar {
    margin: 14px 0 10px;
}

.progress-bar span,
.mini-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1f6f5f 0%, #3e9d7d 100%);
}

.mini-progress {
    width: 140px;
    margin: 8px 0 6px;
    height: 9px;
}

.phase-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.phase-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--field-bg);
}

.phase-item-active {
    border-color: rgba(31, 111, 95, 0.32);
    background: var(--surface-soft);
}

.note-timeline {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.contact-log-scroll,
.company-contact-list {
    max-height: 332px;
    overflow-y: auto;
    padding-right: 8px;
}

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

.company-contact-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--field-bg);
}

.company-contact-item p,
.company-contact-empty {
    margin: 0;
}

.company-contact-item p + p {
    margin-top: 6px;
}

.company-contact-head {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.company-contact-head span {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.note-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--field-bg);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.note-card p {
    margin: 12px 0 0;
}

.note-card-important {
    border-color: rgba(171, 47, 47, 0.42);
    box-shadow: 0 10px 24px rgba(171, 47, 47, 0.08);
}

.note-card-important:hover {
    border-color: rgba(171, 47, 47, 0.7);
    box-shadow: 0 16px 32px rgba(171, 47, 47, 0.14);
    transform: translateY(-1px);
}

.client-reset-box {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.client-reset-box p {
    margin-bottom: 0;
}

.client-login-box {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.client-login-box p {
    margin-bottom: 0;
}

.client-reset-box button[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

.hint-box {
    padding: 14px 16px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
}

.dashboard-help {
    margin-top: 18px;
}

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

.task-card {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--field-bg);
}

.task-meta,
.task-actions,
.event-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.task-meta {
    color: var(--muted);
    font-size: 14px;
}

.task-audit-table {
    margin-top: 18px;
}

.event-actions {
    margin-top: 12px;
}

.resource-list {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-resources {
    margin-top: 8px;
}

.resource-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--field-bg);
}

.resource-card:hover {
    border-color: rgba(31, 111, 95, 0.34);
    background: var(--surface-hover);
}

.resource-card p {
    margin: 0;
    color: var(--muted);
}

.notes-textarea {
    min-height: 180px;
    max-height: 280px;
    overflow-y: auto;
    resize: vertical;
    line-height: 1.5;
}

.table-phase {
    font-weight: 600;
}

.table-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
}

.table-link:hover {
    color: var(--primary-dark);
}

.table-link-strong {
    font-weight: 700;
}

.danger-link {
    color: var(--danger);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.theme-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 9999;
    min-width: 180px;
    padding: 16px 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.45);
    backdrop-filter: blur(10px);
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.94);
    transition: opacity 180ms ease, transform 180ms ease;
}

.theme-toast.theme-toast-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.flash-success {
    border-color: rgba(31, 111, 95, 0.28);
}

.flash-error {
    border-color: rgba(171, 47, 47, 0.25);
}

.form-errors,
small,
.empty-state {
    color: var(--danger);
}

small {
    font-weight: 500;
}

.empty-state {
    margin: 0;
}

code {
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--code-bg);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 20px;
        position: static;
        height: auto;
        overflow: visible;
    }

    .sidebar-top {
        position: static;
        padding-bottom: 0;
    }

    .stats-grid,
    .form-grid,
    .panel-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-content,
    .sidebar,
    .auth-card {
        padding: 20px;
    }

    .page-header,
    .panel-header,
    .client-reset-box,
    .client-login-box,
    .sidebar-footer-actions,
    .button-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions-cell {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-modal {
        padding: 12px;
    }

    .app-modal-panel {
        padding: 18px;
    }

    .app-modal-header,
    .page-footer-tools {
        flex-direction: column;
        align-items: flex-start;
    }
}
