:root{
  --bg:#F7F7F3;
  --cal-color-0:#0066CC;
  --cal-color-0-bg:#E8F1FB;
  --cal-color-1:#1F9254;
  --cal-color-1-bg:#E3F5EA;
  --cal-color-2:#C77700;
  --cal-color-2-bg:#FFF1DC;
  --bg-card:#FFFFFF;
  --ink:#16213A;
  --ink-soft:#475065;
  --rule:#E4E1D8;
  --rule-strong:#D2CEC2;

  --blue:#0066CC;
  --blue-dark:#0055AA;
  --sky:#3D8BFF;

  --gray-50:#FAFBFC;
  --gray-100:#F1F3F5;
  --gray-200:#E4E7EB;
  --gray-300:#C1C7CD;
  --gray-400:#A8AFB8;
  --gray-500:#8C98A4;
  --gray-700:#5C6670;
  --gray-900:#3D4752;

  --success:#1F9254;
  --success-bg:#E3F5EA;
  --warning:#C77700;
  --warning-bg:#FFF1DC;
  --danger:#CC3300;            /* Fehler, destruktive Aktionen — unverändert ggü. heute */
  --danger-bg:#FBE6DE;
  --status-booked:#E53935;     /* nur Kalender — unverändert ggü. heute */
  --status-requested:#FDD835;  /* nur Kalender — unverändert ggü. heute */
  --status-other:#BDBDBD;      /* nur Kalender — unverändert ggü. heute */

  --r-sm:6px;
  --r-md:10px;
  --r-lg:16px;

  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--bg); margin: 0; line-height: 1.55; }
a { color: var(--blue); }
h1 { font-size: 22px; font-weight: 700; margin: 0; color: var(--ink); }
.mt-2 { margin-top: 0.5rem; }

/* ---------- layout shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; flex: none;
    background: var(--ink); color: #fff;
    padding: 24px 16px;
    display: flex; flex-direction: column; gap: 28px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand, .drawer .brand { display: flex; align-items: center; gap: 9px; }
.sidebar .brand .word, .drawer .brand .word, .topbar .word { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.sidebar .brand .word b, .drawer .brand .word b, .topbar .word b { color: var(--sky); font-weight: 700; }
.sidebar nav, .drawer nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .drawer nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 7px;
    font-size: 13px; font-weight: 600; color: #C9D2E3; text-decoration: none;
}
.sidebar nav a svg, .drawer nav a svg { width: 15px; height: 15px; flex: none; }
.sidebar nav a:hover, .drawer nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active, .drawer nav a.active { background: rgba(255,255,255,0.14); color: #fff; }
.sidebar .nav-user, .drawer .nav-user {
    margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12);
    font-size: 11.5px; color: var(--gray-400); line-height: 1.6;
}
.sidebar .nav-user a, .drawer .nav-user a { color: var(--gray-400); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.topbar {
    display: none;
    align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--rule);
    background: var(--bg-card);
}
.topbar .word { flex: 1; color: var(--ink); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--r-sm);
    background: var(--gray-100); border: none; color: var(--ink-soft); cursor: pointer; flex: none;
    text-decoration: none;
}
.icon-btn:hover { background: var(--gray-200); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn-danger:hover { background: var(--danger-bg); color: var(--danger); }

.drawer-toggle { display: none; }
.drawer-scrim, .drawer { display: none; }

/* ---------- auth pages (login, password reset/forget) ---------- */
.auth-main {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 28px; padding: 24px;
}
.auth-lockup { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.auth-lockup .wordmark { font-weight: 700; font-size: 20px; color: var(--ink); }
.auth-lockup .wordmark b { color: var(--blue); font-weight: 700; }
.auth-card {
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-lg);
    padding: 28px 32px; width: 100%; max-width: 380px;
    box-shadow: 0 8px 24px rgba(22,33,58,0.06);
}
.auth-card h1 { margin-bottom: 1rem; }

/* ---------- buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    font-family: var(--sans);
}
.btn:hover { background: var(--gray-100); }
.btn-primary { background: var(--blue); border-color: var(--blue-dark); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--danger); border-color: #aa2200; color: #fff; }
.btn-danger:hover { background: #aa2200; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 12px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge-requested { background: var(--warning-bg); color: var(--warning); }
.badge-requested::before { background: var(--warning); }
.badge-booked { background: rgba(229,57,53,0.12); color: var(--status-booked); }
.badge-booked::before { background: var(--status-booked); }

/* ---------- forms ---------- */
.form-narrow { max-width: 380px; }
.form-wide { max-width: 600px; }
.form-card {
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md);
    padding: 22px 24px; max-width: 600px;
}
.form-card.form-narrow, .form-card.form-wide { max-width: 600px; }
.form-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--gray-500); margin: 0 0 14px; padding-top: 18px; border-top: 1px solid var(--rule);
}
.form-section-title:first-child { padding-top: 0; border-top: none; }
.form-actions { display: flex; gap: 10px; margin-top: 1.25rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-grid .field.full { grid-column: 1 / -1; }

.field { margin-bottom: 0.9rem; display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-weight: 600; font-size: 12.5px; color: var(--gray-700); }
.field small { color: var(--gray-500); font-size: 12px; }
.field input, .field select, .field textarea {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-family: var(--sans);
    width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}
.field input[readonly] { background: var(--gray-100); color: var(--gray-700); }

/* Inline filter row */
.filter-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md);
    padding: 12px 14px;
}
.field-inline { display: flex; flex-direction: column; gap: 0.25rem; }
.field-inline label { font-size: 11.5px; font-weight: 600; color: var(--gray-700); }
.field-inline input, .field-inline select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: var(--sans);
}

/* Alert */
.alert {
    padding: 0.7rem 1rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--r-sm);
    margin-bottom: 1rem;
    color: var(--warning);
}

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 1.25rem; max-width: 720px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; }
.kpi-card .v { font-weight: 700; font-size: 20px; color: var(--ink); }
.kpi-card .l { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ---------- panel (card wrapper, e.g. calendar) ---------- */
.panel { background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 14px; font-weight: 700; margin: 0; color: var(--ink); }

/* ---------- tables ---------- */
.scroll-x { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
table.data-table th { background: var(--gray-50); text-align: left; font-size: 12.5px; font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--rule); color: var(--gray-700); white-space: nowrap; }
table.data-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--gray-50); }
.actions { white-space: nowrap; }
.action-icons { display: flex; gap: 6px; justify-content: flex-end; }
.action-icons form { display: inline; }

/* ---------- mobile card list (replaces table on narrow screens) ---------- */
.card-list { display: none; flex-direction: column; gap: 10px; }
.item-card { background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; }
.item-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-card .name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.item-card .meta { font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.item-card .meta + .meta { margin-top: 1px; }
.item-card .prices { font-size: 12px; color: var(--ink-soft); margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- filter row extras ---------- */
.resource-filter-ts { width: 200px; }
.field-inline-check { justify-content: flex-end; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 0.4rem 0; white-space: nowrap; }

/* ---------- calendar outer wrapper ---------- */
.cal-outer { display: flex; align-items: flex-start; }
.cal-labels-svg { flex: none; display: block; }
.cal-outer > .scroll-x { flex: 1; min-width: 0; }

/* SVG Calendar */
svg .label-bg { fill: var(--bg-card); }
svg .label-sep { stroke: var(--rule); stroke-width: 1; }
svg .cal-sep-line { stroke: var(--rule-strong); stroke-width: 1.5; }
svg .cal-sep-label { font-size: 9px; fill: var(--gray-400); font-style: italic; }
svg .header-month { fill: #f0f0f0; stroke: #ccc; stroke-width: 0.5; }
svg .header-day { fill: #fff; stroke: #ddd; stroke-width: 0.5; }
svg .header-day.saturday { fill: #f0f4ff; }
svg .header-day.sunday { fill: #f0f4ff; }
svg .header-day.today { fill: #fde68a; stroke: #f59e0b; }
svg .cell { fill: #fafafa; stroke: #eee; stroke-width: 0.5; }
svg .cell.saturday { fill: #f0f4ff; }
svg .cell.sunday { fill: #f0f4ff; }
svg .cell.today { fill: #fffbeb; }
svg .label-month { font-size: 11px; fill: #444; }
svg .label-day { font-size: 9px; fill: #666; }
svg .label-row { font-size: 11px; fill: #333; }
svg .block { rx: 2; ry: 2; stroke: rgba(255,255,255,0.9); stroke-width: 1.5; }
svg .block.status-requested { fill: var(--status-requested); }
svg .block.status-booked { fill: var(--status-booked); }
svg .block.status-other { fill: var(--status-other); }
svg a:hover .block { opacity: 0.8; }

/* Tooltip */
.svg-tooltip {
    position: fixed;
    background: #fff;
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    padding: 0.4rem 0.6rem;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 1000;
    max-width: 280px;
}

/* ---------- view toggle (Zeitleiste | Kalender) ---------- */
.view-toggle { display: flex; gap: 3px; background: var(--gray-100); border-radius: var(--r-sm); padding: 3px; }
.view-toggle-btn {
    padding: 5px 13px; border-radius: calc(var(--r-sm) - 2px);
    font-size: 12.5px; font-weight: 600; color: var(--gray-700); text-decoration: none;
    transition: background 0.1s;
}
.view-toggle-btn:hover { background: var(--gray-200); color: var(--ink); }
.view-toggle-active { background: var(--bg-card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* ---------- month view: filter row extras ---------- */
.month-nav-row { display: flex; align-items: center; gap: 6px; }
.month-nav-label { min-width: 130px; text-align: center; font-weight: 600; font-size: 13px; color: var(--ink); }
.month-res-select {
    width: 200px; font-family: var(--sans); font-size: 13px;
    border: 1px solid var(--gray-300); border-radius: var(--r-sm); padding: 3px;
}
.field-hint { font-weight: 400; color: var(--gray-400); font-size: 11px; }

/* ---------- month view: legend ---------- */
.month-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }
.month-legend-item { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.month-color-0 { background: var(--cal-color-0-bg); color: var(--cal-color-0); }
.month-color-1 { background: var(--cal-color-1-bg); color: var(--cal-color-1); }
.month-color-2 { background: var(--cal-color-2-bg); color: var(--cal-color-2); }

/* ---------- month calendar grid ---------- */
.month-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--rule);
    border-radius: calc(var(--r-md) - 1px);
    overflow: hidden;
}
.month-wday {
    background: var(--gray-50);
    text-align: center;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--gray-500); padding: 6px 4px;
}
.month-wday-we { color: var(--blue); }

.month-day {
    background: var(--bg-card);
    min-height: 80px; padding: 6px;
    display: flex; flex-direction: column; gap: 3px;
}
.month-day-out { background: var(--gray-50); }
.month-day-we { background: #f0f4ff; }
.month-day-out.month-day-we { background: #eef2ff; }
.month-day-today { background: #fffbeb; }

.month-day-num {
    font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1; margin-bottom: 1px;
}
.month-day-out .month-day-num { color: var(--gray-400); font-weight: 400; }
.month-day-today .month-day-num { color: var(--blue); }

.month-chip {
    display: block;
    font-size: 10.5px; font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-decoration: none; line-height: 1.45;
    border-left: 3px solid transparent;
}
.month-chip:hover { opacity: 0.82; }
.month-chip.month-color-0 { background: var(--cal-color-0-bg); color: var(--cal-color-0); border-left-color: var(--cal-color-0); }
.month-chip.month-color-1 { background: var(--cal-color-1-bg); color: var(--cal-color-1); border-left-color: var(--cal-color-1); }
.month-chip.month-color-2 { background: var(--cal-color-2-bg); color: var(--cal-color-2); border-left-color: var(--cal-color-2); }
.month-chip.month-status-requested { opacity: 0.7; }

/* ---------- mobile (<880px) ---------- */
@media (max-width: 880px) {
    .sidebar { display: none; }
    .topbar { display: flex; }
    .content { padding: 16px 16px 32px; }

    .drawer-toggle:checked ~ .drawer-scrim,
    .drawer-toggle:checked ~ .drawer { display: block; }
    .drawer-scrim { position: fixed; inset: 0; background: rgba(22,33,58,0.45); z-index: 20; }
    .drawer {
        position: fixed; top: 0; left: 0; bottom: 0; width: 78%; max-width: 300px;
        background: var(--ink); color: #fff; z-index: 21; padding: 20px 18px;
        display: flex; flex-direction: column; gap: 24px; overflow-y: auto;
    }
    .drawer-head { display: flex; align-items: center; justify-content: space-between; }

    .page-head { margin-bottom: 16px; }
    h1 { font-size: 19px; }

    .filter-row { flex-direction: column; align-items: stretch; }
    .field-inline { width: 100%; }

    table.data-table { display: none; }
    .card-list { display: flex; }

    .field-grid { grid-template-columns: 1fr; }
    .form-card { padding-bottom: 88px; }
    .form-actions {
        position: fixed; left: 0; right: 0; bottom: 0;
        background: var(--bg-card); border-top: 1px solid var(--rule);
        padding: 12px 16px; margin: 0; z-index: 5;
    }
    .form-actions .btn { flex: 1; text-align: center; }
}
