@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');
@font-face{
  font-family:'Uncut Sans';
  src: url('/fonts/UncutSans-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg: #F7F5EE;
  --surface: #FFFFFF;
  --surface-2: #EFEDE3;
  --surface-3: #E4E1D3;
  --border: #DEDACB;
  --border-strong: #C7C2AE;
  --text: #121210;
  --text-muted: #5B584C;
  --text-faint: #8A8672;
  --accent: #F4E409;
  --accent-strong: #D9CB05;
  --accent-contrast: #121210;
  --accent-bg: #FBF6C9;
  --good: #2E6E4B;
  --good-bg: #E1EEE3;
  --warn: #B4501E;
  --warn-bg: #F7E3D3;
  --bad: #9B2F2F;
  --bad-bg: #F5DCDC;
  --focus: #B4A300;
  --shadow: 0 1px 2px hsl(28 20% 8% / 0.05), 0 8px 20px -12px hsl(28 20% 8% / 0.14);
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg: #121210;
    --surface: #1B1B17;
    --surface-2: #232320;
    --surface-3: #2C2C27;
    --border: #34342E;
    --border-strong: #46453C;
    --text: #F6F4EA;
    --text-muted: #ABA795;
    --text-faint: #7E7A69;
    --accent: #F4E409;
    --accent-strong: #FFF25C;
    --accent-contrast: #121210;
    --accent-bg: #3A3300;
    --good: #8FD1A8;
    --good-bg: #1B3226;
    --warn: #F0A268;
    --warn-bg: #3B2413;
    --bad: #E58B8B;
    --bad-bg: #3A1D1D;
    --focus: #F4E409;
    --shadow: 0 1px 2px hsl(0 0% 0% / 0.3), 0 8px 24px -12px hsl(0 0% 0% / 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"]{
  --bg: #121210;
  --surface: #1B1B17;
  --surface-2: #232320;
  --surface-3: #2C2C27;
  --border: #34342E;
  --border-strong: #46453C;
  --text: #F6F4EA;
  --text-muted: #ABA795;
  --text-faint: #7E7A69;
  --accent: #F4E409;
  --accent-strong: #FFF25C;
  --accent-contrast: #121210;
  --accent-bg: #3A3300;
  --good: #8FD1A8;
  --good-bg: #1B3226;
  --warn: #F0A268;
  --warn-bg: #3B2413;
  --bad: #E58B8B;
  --bad-bg: #3A1D1D;
  --focus: #F4E409;
  --shadow: 0 1px 2px hsl(0 0% 0% / 0.3), 0 8px 24px -12px hsl(0 0% 0% / 0.5);
  color-scheme: dark;
}

*,*::before,*::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Uncut Sans', ui-sans-serif, system-ui, sans-serif;
  font-size:15px;
  line-height:1.5;
  min-height:100vh;
}
h1,h2,h3,h4{
  font-family:'Uncut Sans', ui-sans-serif, system-ui, sans-serif;
  font-weight:700;
  letter-spacing:-0.015em;
  text-wrap:balance;
  margin:0;
  color:var(--text);
}
p{ margin:0; }
.mono{ font-family:'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
a{ color:var(--accent); }
button{ font-family:inherit; }
input,select,textarea{ font-family:inherit; font-size:inherit; color:inherit; }
::selection{ background:var(--accent-bg); }
:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; border-radius:4px; }
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}

.app-shell{ min-height:100vh; display:flex; flex-direction:column; }

/* ---------- Header ---------- */
.topbar{
  position:sticky; top:0; z-index:20;
  background:var(--surface);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  max-width:1180px; margin:0 auto;
  display:flex; align-items:center; gap:20px;
  padding:14px 20px;
}
@media (max-width:720px){
  .topbar-inner{ flex-wrap:wrap; row-gap:10px; padding:12px 16px; }
  .brand{ order:1; }
  .header-actions{ order:2; margin-left:auto; }
  .tabs{ order:3; flex-basis:100%; }
}
.brand{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.brand-logo{
  height:28px; width:auto;
  display:block;
  flex-shrink:0;
}
.brand-text h1{ font-size:16px; line-height:1.15; }
.brand-text span{ display:block; font-size:11.5px; color:var(--text-faint); font-weight:500; letter-spacing:0.02em; margin-top:1px; }

.tabs{ display:flex; gap:4px; flex:1; flex-wrap:wrap; row-gap:2px; }
.tab-btn{
  border:none; background:transparent; color:var(--text-muted);
  padding:8px 14px; border-radius:999px; font-weight:600; font-size:13.5px;
  cursor:pointer; white-space:nowrap; transition:background .12s,color .12s;
}
.tab-btn:hover{ background:var(--surface-2); color:var(--text); }
.tab-btn.is-active{ background:var(--accent-bg); color:var(--accent-strong); }

.header-actions{ display:flex; align-items:center; gap:8px; flex-shrink:0; }

.user-chip{
  color:var(--text-muted); font-size:12.5px; font-weight:600;
  padding:6px 4px;
}

.readonly-banner{
  background:var(--warn-bg); color:var(--warn);
  font-size:13px; font-weight:600;
  padding:9px 20px; text-align:center; border-bottom:1px solid var(--border);
}

/* ---------- Layout ---------- */
main{ flex:1; max-width:1180px; margin:0 auto; padding:24px 20px 64px; width:100%; }
.view{ display:flex; flex-direction:column; gap:22px; }

.section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.section-head h2{ font-size:19px; }
.section-sub{ color:var(--text-muted); font-size:13px; margin-top:2px; }

.card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-l); box-shadow:var(--shadow);
}
.card-pad{ padding:18px 20px; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border-radius:var(--radius-s); border:1px solid transparent;
  font-weight:600; font-size:13.5px; padding:8px 14px;
  cursor:pointer; transition:filter .12s, background .12s, border-color .12s;
  white-space:nowrap;
}
.btn:active{ filter:brightness(0.94); }
.btn-primary{ background:var(--accent); color:var(--accent-contrast); border-radius:999px; font-weight:700; }
.btn-primary:hover{ background:var(--accent-strong); }
.btn-secondary{ background:var(--surface-2); color:var(--text); border-color:var(--border-strong); }
.btn-secondary:hover{ background:var(--surface-3); }
.btn-ghost{ background:transparent; color:var(--text-muted); }
.btn-ghost:hover{ background:var(--surface-2); color:var(--text); }
.btn-danger{ background:transparent; color:var(--bad); border-color:var(--bad); }
.btn-danger:hover{ background:var(--bad-bg); }
.btn-sm{ padding:5px 10px; font-size:12.5px; border-radius:7px; }
.btn-primary.btn-sm{ border-radius:999px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.icon-btn{
  width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:8px; border:1px solid transparent; background:transparent; color:var(--text-muted);
  cursor:pointer; font-size:15px; flex-shrink:0;
}
.icon-btn:hover{ background:var(--surface-2); color:var(--text); }
.icon-btn.danger:hover{ background:var(--bad-bg); color:var(--bad); }

/* ---------- Stat tiles ---------- */
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px; }
@media (max-width:720px){ .stat-grid{ grid-template-columns:repeat(2,1fr); } }
.split-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; }
@media (max-width:640px){ .split-grid{ grid-template-columns:1fr; } }
.stat-tile{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-m);
  padding:14px 16px; display:flex; flex-direction:column; gap:6px;
}
.stat-tile .num{ font-family:'JetBrains Mono'; font-size:26px; font-weight:600; line-height:1; }
.stat-tile .lbl{ display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text-muted); font-weight:600; }
.stat-tile .swatch{ width:8px; height:8px; border-radius:50%; }

/* ---------- Pills / badges ---------- */
.pill{
  display:inline-flex; align-items:center; gap:5px;
  font-size:12px; font-weight:600; padding:3px 9px; border-radius:999px;
  white-space:nowrap; line-height:1.4;
}
.pill .dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill-good{ background:var(--good-bg); color:var(--good); }
.pill-bad{ background:var(--bad-bg); color:var(--bad); }
.pill-warn{ background:var(--warn-bg); color:var(--warn); }
.pill-neutral{ background:var(--surface-2); color:var(--text-muted); border:1px solid var(--border); }
.tag{
  font-size:11.5px; font-weight:600; color:var(--text-muted);
  background:var(--surface-2); border:1px solid var(--border);
  padding:2px 8px; border-radius:6px; white-space:nowrap;
}
.pill-btn{ border:none; cursor:pointer; font-family:inherit; }
.pill-btn:hover{ filter:brightness(0.95); }

/* ---------- Due-date rows ---------- */
.due-row{ display:flex; align-items:center; gap:10px; padding:10px 16px; border-bottom:1px solid var(--border); }
.due-row:last-child{ border-bottom:none; }
.due-main{ flex:1; min-width:0; }
.due-main b{ font-weight:700; }
.due-sub{ color:var(--text-muted); font-size:12.5px; margin-top:2px; }
.forgotten-line{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:12.5px; color:var(--warn); font-weight:600; }
.forgotten-chip{ display:inline-flex; align-items:center; gap:5px; background:var(--warn-bg); color:var(--warn); padding:2px 4px 2px 9px; border-radius:999px; font-size:11.5px; font-weight:600; }
.forgotten-chip button{ border:none; background:var(--warn); color:var(--surface); width:16px; height:16px; border-radius:50%; cursor:pointer; font-size:10px; line-height:1; display:flex; align-items:center; justify-content:center; }

/* ---------- Return-check modal ---------- */
.return-choice-row{ display:flex; align-items:center; justify-content:center; gap:12px; }
.return-choice-row .btn{ flex:1; padding:14px; font-size:14px; }
.return-item{ padding:10px 0; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:8px; }
.return-item:last-child{ border-bottom:none; }
.return-item-name{ font-weight:600; font-size:13.5px; }
.chip-choices{ display:flex; gap:6px; flex-wrap:wrap; }
.chip-choice{
  border:1px solid var(--border-strong); background:var(--surface); color:var(--text-muted);
  font-size:12px; font-weight:600; padding:5px 11px; border-radius:999px; cursor:pointer;
}
.chip-choice.is-active.choice-back{ background:var(--good); border-color:var(--good); color:white; }
.chip-choice.is-active.choice-forgotten{ background:var(--warn); border-color:var(--warn); color:white; }
.chip-choice.is-active.choice-damaged{ background:var(--bad); border-color:var(--bad); color:white; }
.damage-note-input{
  padding:7px 10px; border-radius:7px; border:1px solid var(--border-strong);
  background:var(--surface); color:var(--text); font-size:13px; width:100%;
}
.return-groups-scroll{ max-height:52vh; overflow-y:auto; padding-right:2px; }
.return-group{ margin-bottom:16px; }
.return-group:last-child{ margin-bottom:0; }
.return-group-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding-bottom:6px; margin-bottom:2px; border-bottom:1px solid var(--border-strong);
}
.return-group-title{ font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); }

/* ---------- Filter bar ---------- */
.filter-bar{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.search-input-wrap{ position:relative; flex:1; min-width:200px; }
.search-input-wrap input{
  width:100%; padding:9px 32px 9px 32px; border-radius:999px;
  border:1px solid var(--border-strong); background:var(--surface); color:var(--text);
}
.search-input-wrap svg{ position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--text-faint); }
.search-clear{
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  width:22px; height:22px; border:none; border-radius:50%; background:var(--surface-2);
  color:var(--text-muted); font-size:13px; line-height:1; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.search-clear:hover{ background:var(--surface-3); color:var(--text); }
.pill-filter{
  border:1px solid var(--border-strong); background:var(--surface); color:var(--text-muted);
  font-size:12.5px; font-weight:600; padding:6px 12px; border-radius:999px; cursor:pointer;
}
.pill-filter.is-active{ background:var(--text); color:var(--bg); border-color:var(--text); }
.pill-filter.status-verfuegbar.is-active{ background:var(--good); border-color:var(--good); color:white; }
.pill-filter.status-verliehen.is-active{ background:var(--bad); border-color:var(--bad); color:white; }
.pill-filter.status-unklar.is-active{ background:var(--warn); border-color:var(--warn); color:white; }

/* ---------- Equipment list ---------- */
.cat-block{ display:flex; flex-direction:column; gap:10px; }
.cat-block-title{ font-size:15px; font-weight:700; font-family:'Uncut Sans'; margin-top:4px; }
.group-block{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-m); overflow:hidden; }
.group-title{
  font-size:12px; font-weight:700; letter-spacing:0.04em; text-transform:uppercase;
  color:var(--text-faint); padding:10px 16px; background:var(--surface-2); border-bottom:1px solid var(--border);
}
.item-row{
  display:flex; align-items:center; gap:12px; padding:10px 16px;
  border-bottom:1px solid var(--border);
}
.item-row:last-child{ border-bottom:none; }
.item-main{ flex:1; min-width:0; display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.item-name{ font-weight:600; font-size:14px; }
.item-meta{ color:var(--text-muted); font-size:12.5px; }
.item-note{ color:var(--text-faint); font-size:12px; font-style:italic; }
.item-actions{ display:flex; align-items:center; gap:6px; flex-shrink:0; }

/* ---------- Bookings ---------- */
.booking-list{ display:flex; flex-direction:column; gap:10px; }
.booking-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-m);
  padding:14px 16px; display:flex; flex-direction:column; gap:8px;
}
.booking-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.booking-dates{ font-family:'JetBrains Mono'; font-weight:600; font-size:13.5px; }
.booking-zeitraum{ color:var(--text-muted); font-size:12.5px; }
.booking-who{ font-size:14px; }
.booking-who b{ font-weight:700; }
.booking-items{ display:flex; flex-wrap:wrap; gap:5px; }
.booking-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.check-line{ display:flex; align-items:center; gap:7px; font-size:13px; color:var(--text-muted); font-weight:600; cursor:pointer; }
.check-line input{ width:16px; height:16px; accent-color:var(--accent); cursor:pointer; }

.collapse-toggle{
  align-self:flex-start; background:none; border:none; color:var(--accent); font-weight:600;
  font-size:13px; cursor:pointer; padding:6px 2px;
}
.booking-card.is-highlighted{ outline:2px solid var(--accent); outline-offset:2px; animation:highlight-fade 2.2s ease-out; }
@keyframes highlight-fade{ 0%{ background:var(--accent-bg); } 100%{ background:var(--surface); } }
.cancel-reason{ background:var(--bad-bg); color:var(--bad); border-radius:8px; padding:8px 10px; font-size:12.5px; font-weight:600; }

/* ---------- Calendar grid ---------- */
.cal-wrap{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-m); padding:14px 16px; margin-bottom:16px; }
.cal-header{ display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.cal-header h3{ flex:1; text-align:center; font-size:15px; font-weight:700; }
.cal-weekdays{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:4px; }
.cal-weekday{ text-align:center; font-size:11px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:0.03em; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-cell{ min-height:64px; border:1px solid var(--border); border-radius:7px; padding:4px; display:flex; flex-direction:column; gap:2px; background:var(--surface-2); }
.cal-cell.cal-empty{ border:none; background:transparent; }
.cal-cell.cal-today{ border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.cal-daynum{ font-size:11px; font-weight:700; color:var(--text-muted); }
.cal-pill{
  font-size:10px; font-weight:600; padding:2px 5px; border-radius:5px; cursor:pointer;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.cal-pill-yeswhy{ background:var(--accent-bg); color:var(--accent-strong); }
.cal-pill-privat{ background:var(--surface); color:var(--text-muted); border:1px solid var(--border-strong); }
.cal-pill-anfrage{ background:var(--warn-bg); color:var(--warn); border:1px dashed var(--warn); }
.cal-pill-dreh-only{ background:transparent; color:var(--text-faint); border:1px dashed var(--border-strong); }
.cal-more{ font-size:10px; color:var(--text-faint); font-weight:600; }
.cal-hint{ margin-top:10px; font-size:11.5px; color:var(--text-faint); }
@media (max-width:640px){
  .cal-cell{ min-height:44px; }
  .cal-pill{ font-size:0; padding:3px; height:6px; border-radius:3px; }
  .cal-daynum{ font-size:10px; }
}

.empty-state{ text-align:center; padding:36px 20px; color:var(--text-faint); }
.empty-state p{ font-size:14px; }

/* ---------- Forms ---------- */
.form-grid{ display:flex; flex-direction:column; gap:14px; }
.form-row{ display:flex; gap:12px; flex-wrap:wrap; }
.field{ flex:1; min-width:160px; display:flex; flex-direction:column; gap:5px; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-muted); }
.field input[type="text"],.field input[type="date"],.field input[type="password"],.field select,.field textarea{
  padding:9px 11px; border-radius:8px; border:1px solid var(--border-strong);
  background:var(--surface); color:var(--text); width:100%;
}
.field textarea{ resize:vertical; min-height:64px; }
.password-field{ display:flex; align-items:center; gap:6px; }
.password-field input{ flex:1; }
.password-field .icon-btn{ flex-shrink:0; border:1px solid var(--border-strong); }
.hint{ font-size:11.5px; color:var(--text-faint); }
.checklist{
  border:1px solid var(--border); border-radius:8px; max-height:260px; overflow:auto;
  background:var(--surface);
}
.checklist-group-label{
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.03em;
  color:var(--text-faint); padding:8px 12px 4px;
}
.checklist-row{ display:flex; align-items:center; gap:9px; padding:6px 12px; font-size:13.5px; }
.checklist-row input{ width:15px; height:15px; accent-color:var(--accent); flex-shrink:0; }
.checklist-row.is-unavailable{ color:var(--text-faint); }
.selected-count{ font-size:12px; color:var(--text-muted); font-weight:600; }

/* ---------- Modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; background:hsl(26 20% 6% / 0.5);
  display:flex; align-items:flex-start; justify-content:center;
  padding:5vh 16px; overflow-y:auto; z-index:100;
}
.modal{
  background:var(--surface); border-radius:var(--radius-l); border:1px solid var(--border);
  width:100%; max-width:480px; box-shadow:var(--shadow);
}
.modal.modal-wide{ max-width:600px; }
.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.modal-header h2{ font-size:16px; }
.modal-body{ padding:20px; display:flex; flex-direction:column; gap:16px; }
.modal-footer{ display:flex; justify-content:flex-end; gap:8px; padding:14px 20px; border-top:1px solid var(--border); }
.pin-input{
  width:100%; text-align:center; letter-spacing:0.5em; font-family:'JetBrains Mono'; font-size:22px;
  padding:12px; border-radius:8px; border:1px solid var(--border-strong); background:var(--surface); color:var(--text);
}
.modal-note{ font-size:12.5px; color:var(--text-muted); }
.warn-box{ background:var(--warn-bg); color:var(--warn); border-radius:8px; padding:10px 12px; font-size:13px; font-weight:600; }

/* ---------- Toast ---------- */
.toast-wrap{ position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:200; display:flex; flex-direction:column; gap:8px; align-items:center; }
.toast{
  background:var(--text); color:var(--bg); font-size:13.5px; font-weight:600;
  padding:10px 16px; border-radius:999px; box-shadow:var(--shadow);
}

footer.app-footer{ text-align:center; padding:20px; color:var(--text-faint); font-size:12px; }

@media (max-width:640px){
  .item-row{ flex-wrap:wrap; }
  .item-actions{ width:100%; justify-content:flex-end; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
}
