/* ============================================================
   Belegungskalender · Casa Mallorca
   Warm, mediterran, ruhig: Sand, Kalkweiß, Terrakotta, Meerblau.
   ============================================================ */

:root {
  --sand: #f3eee4;
  --sand-2: #ebe4d6;
  --paper: #fffdf8;
  --ink: #1e2a30;
  --ink-2: #5b6a72;
  --ink-3: #8b979d;
  --line: #e2d9c8;
  --line-2: #efe8da;
  --terra: #c3573a;
  --terra-d: #a2452c;
  --sea: #2b7f9c;
  --olive: #7d8c4b;
  --ochre: #d6a13f;
  --danger: #b4382a;
  --radius: 18px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(50, 36, 14, .05), 0 14px 34px -18px rgba(50, 36, 14, .28);
  --font-body: 'Albert Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: 'tnum' 1;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--ink-2); }

/* Hintergrund mit Lichtschein und feinem Korn */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 520px at 8% -12%, rgba(43, 127, 156, .20), transparent 62%),
    radial-gradient(760px 420px at 100% -4%, rgba(214, 161, 63, .20), transparent 60%),
    radial-gradient(600px 400px at 90% 110%, rgba(195, 87, 58, .12), transparent 60%),
    var(--sand);
}
.bg::after {
  content: ''; position: absolute; inset: 0; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0 0.2 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Kopf ---------- */
.top {
  max-width: 1180px; margin: 0 auto;
  padding: 30px 24px 10px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand-eyebrow {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--terra);
}
.brand h1 { font-size: clamp(32px, 4.6vw, 46px); font-style: italic; line-height: 1.05; margin-top: 4px; }
.top-actions { display: flex; gap: 8px; }

/* ---------- Layout ---------- */
main {
  max-width: 1180px; margin: 0 auto;
  padding: 10px 24px 70px;
  display: grid; gap: 18px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 24px; }

/* Sanfter Einstieg beim Laden */
main > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
main > *:nth-child(2) { animation-delay: .07s; }
main > *:nth-child(3) { animation-delay: .14s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main > * { animation: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--terra); color: #fff; box-shadow: 0 6px 16px -8px rgba(195, 87, 58, .7); }
.btn.primary:hover { background: var(--terra-d); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--paper); border-color: var(--ink-3); }
.btn.danger { background: transparent; border-color: rgba(180, 56, 42, .35); color: var(--danger); }
.btn.danger:hover, .btn.danger.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.link:hover { color: var(--ink); }
.icon {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-size: 22px; line-height: 1; display: grid; place-items: center; color: var(--ink);
}
.icon:hover { border-color: var(--ink-3); }

/* ---------- Formular ---------- */
.booking-form {
  display: grid; gap: 12px 14px;
  grid-template-columns: 2fr 1fr 1fr .7fr 1.2fr 1fr;
  grid-template-areas:
    "name from to persons tariff price"
    "note note note note note note"
    "foot foot foot foot foot foot";
}
.f-name { grid-area: name; } .f-from { grid-area: from; } .f-to { grid-area: to; }
.f-persons { grid-area: persons; } .f-tariff { grid-area: tariff; } .f-price { grid-area: price; }
.f-note { grid-area: note; } .form-foot { grid-area: foot; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
input, select {
  width: 100%; min-width: 0;
  padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: #fff; font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--ink-3); font-weight: 400; }
input:focus, select:focus { outline: none; border-color: var(--terra); box-shadow: 0 0 0 4px rgba(195, 87, 58, .14); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6a72' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center; }
input[type=date] { min-height: 42px; }
.money { position: relative; display: block; }
.money input { padding-right: 32px; }
.money .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 600; font-size: 14px; }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.form-hint { font-size: 13px; color: var(--ink-2); }
.form-hint strong { color: var(--ink); font-weight: 600; }
.form-buttons { display: flex; gap: 8px; margin-left: auto; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; }
.form-card.editing { border-color: rgba(195, 87, 58, .5); box-shadow: 0 0 0 4px rgba(195, 87, 58, .08), var(--shadow); }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--sea)); }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.stat .v { font-family: var(--font-display); font-size: 30px; line-height: 1.1; margin-top: 4px; }
.stat .s { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

/* ---------- Kalender-Karte ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--sand-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s;
}
.seg button.on { background: var(--ink); color: var(--paper); }
.nav { display: flex; align-items: center; gap: 8px; }
.nav h2 { font-size: 26px; min-width: 190px; text-align: center; font-style: italic; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 2px 0 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* Monat */
.month-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.wd { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 4px 0 6px; }
.wd:nth-child(6), .wd:nth-child(7) { color: var(--terra); }
.day {
  position: relative; min-height: 86px; border-radius: 12px;
  background: #faf7f0; border: 1px solid var(--line-2);
  padding: 6px; cursor: pointer; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.day:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -12px rgba(50, 36, 14, .5); }
.day.other { opacity: .42; }
.day.booked { border-color: transparent; }
.num {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
}
.day.today .num { background: var(--ink); color: var(--paper); }
.pill {
  position: absolute; left: 5px; right: 5px; bottom: 6px;
  font-size: 11.5px; font-weight: 600; color: #fff; padding: 3px 8px; border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .35);
}

/* Buchungsliste neben dem Monat */
.side h3 { font-size: 18px; margin-bottom: 10px; }
.blist { display: grid; gap: 8px; }
.bk {
  display: grid; grid-template-columns: 6px 1fr auto; gap: 12px; align-items: stretch;
  background: #faf7f0; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px 10px 10px;
  cursor: pointer; transition: border-color .15s;
}
.bk:hover { border-color: var(--ink-3); }
.bk .bar { border-radius: 3px; }
.bk .t { font-weight: 600; }
.bk .d { font-size: 12.5px; color: var(--ink-2); }
.bk .n { font-size: 12.5px; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.bk .amt { font-family: var(--font-display); font-size: 18px; align-self: center; white-space: nowrap; }
.empty { color: var(--ink-3); font-size: 14px; padding: 12px 0; font-style: italic; }

/* Jahr */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px 20px; }
.mini { cursor: pointer; border-radius: 14px; padding: 12px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.mini:hover { background: #faf7f0; border-color: var(--line-2); }
.mini h3 { font-size: 18px; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mini h3 small { font-family: var(--font-body); font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini-grid .wd { font-size: 9px; padding: 0 0 2px; letter-spacing: .06em; }
.mini-day {
  aspect-ratio: 1; border-radius: 5px; background: #f0eadf; font-size: 10.5px; font-weight: 500;
  display: grid; place-items: center; color: var(--ink-2);
}
.mini-day.booked { color: var(--ink); font-weight: 600; }
.mini-day.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.mini-day.blank { background: transparent; }

/* Umsatz */
.rev { display: grid; gap: 24px; }
.rev-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rev-total { font-family: var(--font-display); font-size: 44px; line-height: 1; }
.rev-compare { font-size: 13.5px; color: var(--ink-2); }
.rev-compare b { color: var(--ink); font-weight: 600; }
.rev-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; height: 230px; align-items: end; padding-top: 10px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; gap: 6px; }
.bar-v { font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.bar { background: linear-gradient(180deg, #3b95b3, var(--sea)); border-radius: 8px 8px 4px 4px; min-height: 3px; transition: height .5s cubic-bezier(.2, .7, .2, 1); }
.bar.zero { background: var(--sand-2); }
.bar-l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.rev-sub { font-size: 12.5px; color: var(--ink-2); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.tbl .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #faf7f0; }
.tbl-wrap { overflow-x: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; box-shadow: 0 16px 36px -14px rgba(0, 0, 0, .5);
  z-index: 50; max-width: calc(100vw - 32px); text-align: center;
  animation: pop .25s cubic-bezier(.2, .7, .2, 1);
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Modal (Tarife) ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(30, 42, 48, .45); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.modal-box { width: 100%; max-width: 760px; max-height: calc(100vh - 32px); overflow: auto; }
.tariff-list { display: grid; gap: 10px; margin-top: 16px; }
.trow {
  display: grid; grid-template-columns: 1.4fr 1.3fr .8fr 44px auto auto; gap: 8px; align-items: end;
  padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #faf7f0;
}
.trow label { font-size: 10px; }
.trow input[type=color] { padding: 0; height: 42px; width: 44px; border-radius: 10px; cursor: pointer; }
.trow .btn { margin-bottom: 1px; }
.modal-foot { margin-top: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; display: grid; gap: 14px; padding: 30px 28px 26px; }
.login-card h1 { font-size: 36px; font-style: italic; }
.login-card .btn { margin-top: 4px; }

/* ---------- Responsiv ---------- */
@media (max-width: 960px) {
  .booking-form {
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "name name persons"
      "from to tariff"
      "price note note"
      "foot foot foot";
  }
  .month-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .top { padding: 22px 16px 6px; }
  main { padding: 6px 14px 60px; gap: 14px; }
  .card { padding: 16px 14px; border-radius: 16px; }
  .booking-form {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "from to"
      "persons tariff"
      "price price"
      "note note"
      "foot foot";
  }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px 10px 14px; }
  .stat .v { font-size: 22px; }
  .nav h2 { font-size: 20px; min-width: 130px; }
  .month-grid { gap: 3px; }
  .day { min-height: 58px; border-radius: 8px; padding: 3px 4px; }
  .num { min-width: 20px; height: 20px; font-size: 12px; padding: 0 4px; }
  .pill { left: 3px; right: 3px; bottom: 3px; font-size: 9.5px; padding: 2px 5px; border-radius: 5px; }
  .rev-chart { gap: 3px; height: 180px; }
  .bar-v { display: none; }
  .bar-l { font-size: 9px; letter-spacing: 0; }
  .rev-total { font-size: 34px; }
  .trow { grid-template-columns: 1fr 1fr; }
  .form-buttons { width: 100%; }
  .form-buttons .btn { flex: 1; }
}
