:root {
    --bg: #f5f3ef;
    --surface: #ffffff;
    --surface-soft: #faf9f7;

    --text: #232323;
    --muted: #6f6a64;

    --primary: #2f2925;
    --primary-dark: #211c19;

    --accent: #b08a55;
    --accent-dark: #8b6a3f;
    --accent-soft: #f0e6d6;

    --border: #ded8cf;
    --shadow: 0 8px 22px rgba(35, 35, 35, 0.08);

    --danger: #9b2d2d;
    --danger-dark: #7f2222;

    --office-bg: #dceee2;
    --office-border: #8ab79a;

    --homeoffice-bg: #dde8f2;
    --homeoffice-border: #8ea7bd;

    --absent-bg: #f2ddd6;
    --absent-border: #c49584;

    --unknown-bg: #eeeeee;
    --unknown-border: #c8c8c8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Grundlayout */

.container,
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

h1,
h2,
h3,
h4 {
    color: var(--primary);
    margin-top: 0;
}

h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

h3 {
    font-size: 20px;
    margin-bottom: 14px;
}

p {
    color: var(--text);
}

/* Header / Navigation */

header,
.navbar {
    background: var(--primary);
    color: #ffffff;
    border-bottom: 4px solid var(--accent);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    padding: 8px 24px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
}

.header-brand h1 {
    font-size: 18px;
    margin: 0;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
}

header nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    justify-self: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 8px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
}

.nav-toggle span {
    display: block;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

header.is-open .nav-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

header.is-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

header.is-open .nav-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

header a,
.navbar a,
nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 5px;
}

header a:hover,
.navbar a:hover,
nav a:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #f2d9b3;
}

.logo,
.company-logo {
    max-height: 28px;
    width: auto;
    display: block;
}

/* Karten / Sektionen */

.admin-section,
.dashboard-info-section,
.week-planner,
.dashboard-actions,
.form-card,
.info-card,
.week-day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.admin-section,
.dashboard-info-section,
.week-planner,
.dashboard-actions,
.form-card {
    padding: 20px;
    margin-bottom: 22px;
}

.info-card,
.week-day-card {
    padding: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.section-header p,
.section-subtitle,
.muted-text {
    color: var(--muted);
}

/* Dashboard */

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 24px;
    align-items: start;
}

.week-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.week-form {
    display: grid;
    gap: 14px;
}

.week-day-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--primary);
}

.day-booking-info {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
}

/* Statuskarten im Dashboard */

.status-office {
    background: var(--office-bg);
    border-left: 5px solid var(--office-border);
}

.status-homeoffice {
    background: var(--homeoffice-bg);
    border-left: 5px solid var(--homeoffice-border);
}

.status-absent {
    background: var(--absent-bg);
    border-left: 5px solid var(--absent-border);
}

.status-unknown {
    background: var(--unknown-bg);
    border-left: 5px solid var(--unknown-border);
}

/* Formulare */

label {
    display: block;
    font-weight: 600;
    color: var(--primary);
    margin-top: 10px;
    margin-bottom: 5px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 14px;
    background: #ffffff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 138, 85, 0.18);
}

.week-day-card .week-status-select,
.week-day-card .week-desk-select,
.week-day-card .week-parking-select,
.week-day-card input[type="text"],
.status-form select,
.status-form input[type="date"],
.status-form input[type="text"] {
    width: 100%;
}

.booking-fields-disabled {
    opacity: 0.78;
}

/* Buttons */

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
}

button:hover,
.button-link:hover {
    background: var(--accent-dark);
    color: #ffffff;
}

button.danger,
.danger-button {
    background: var(--danger);
}

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

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

.action-buttons form {
    margin: 0;
    display: flex;
}

/* Admin-Aktionsbuttons gleich hoch */

.action-buttons .button-link,
.action-buttons button {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 14px;
    margin: 0;
}

/* Tabellen */

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

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

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

th {
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

tr:nth-child(even) td {
    background: var(--surface-soft);
}

tr:hover td {
    background: #f2eadf;
}

/* Teamübersicht */

.status-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px 0;
}

.status-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    font-size: 13px;
}

.team-status-cell {
    min-width: 130px;
    border-radius: 6px;
}

.small-info {
    font-size: 12px;
    color: var(--muted);
}

/* Teamübersicht: ganze Statusfelder einfärben */

.status-table .status-office,
.team-status-cell.status-office {
    background: var(--office-bg);
    border-left: none;
    border: 1px solid var(--office-border);
}

.status-table .status-homeoffice,
.team-status-cell.status-homeoffice {
    background: var(--homeoffice-bg);
    border-left: none;
    border: 1px solid var(--homeoffice-border);
}

.status-table .status-absent,
.team-status-cell.status-absent {
    background: var(--absent-bg);
    border-left: none;
    border: 1px solid var(--absent-border);
}

.status-table .status-unknown,
.team-status-cell.status-unknown {
    background: var(--unknown-bg);
    border-left: none;
    border: 1px solid var(--unknown-border);
}

/* Damit Tabellen-Hover die Statusfarben nicht überdeckt */

.status-table tr:hover .status-office,
.status-table tr:hover .status-homeoffice,
.status-table tr:hover .status-absent,
.status-table tr:hover .status-unknown {
    filter: brightness(0.98);
}

/* Flash-Nachrichten */

.flash,
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--primary);
    margin-bottom: 16px;
}

/* Logout-Timer */

.logout-timer {
    color: #f0d9b5;
    font-size: 13px;
}

/* Responsive */

@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1830px) {
    header,
    .navbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand toggle"
            "nav nav"
            "actions actions";
        row-gap: 0;
    }

    header.is-open {
        row-gap: 8px;
    }

    .header-brand {
        grid-area: brand;
        justify-self: start;
    }

    .nav-toggle {
        grid-area: toggle;
        display: flex;
        justify-self: end;
    }

    header nav {
        grid-area: nav;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        justify-self: stretch;
        display: none;
    }

    header nav a {
        padding: 10px 12px;
    }

    .header-actions {
        grid-area: actions;
        flex-wrap: wrap;
        justify-self: stretch;
        justify-content: space-between;
        display: none;
    }

    header.is-open nav,
    header.is-open .header-actions {
        display: flex;
    }
}

/* Sichtbare Büroplatz-/Parkplatz-Auswahl */

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.resource-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.resource-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: #fffaf3;
}

.resource-card input {
    width: auto;
    margin-right: 8px;
}

.resource-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.resource-card-title {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}

.resource-card-main {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

.resource-card-status {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.resource-card-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--unknown-bg);
}

.resource-card-disabled:hover {
    transform: none;
    border-color: var(--border);
    background: var(--unknown-bg);
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 12px 0 18px 0;
    color: var(--muted);
    font-size: 14px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 12px;
}

/* Legendenpunkte kräftiger einfärben */
.legend-dot.status-office {
    background: #2f9e44;
    border: 1px solid #2f9e44;
}

.legend-dot.status-homeoffice {
    background: #1c7ed6;
    border: 1px solid #1c7ed6;
}

.legend-dot.status-absent {
    background: #e03131;
    border: 1px solid #e03131;
}

.legend-dot.status-unknown {
    background: #adb5bd;
    border: 1px solid #adb5bd;
}