/* =============================================================
   Betreiber-Panel — Admin Dashboard
   Standalone product, independent of the Linden & Lorbeer brand.
   Palette/status colors/chart specs follow the dataviz skill's
   validated reference palette (references/palette.md).
   ============================================================= */

:root {
  /* Chrome & ink (validated reference palette) */
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);

  /* Brand action color — sequential "blue", step 450 / 600 */
  --primary: #2a78d6;
  --primary-dark: #184f95;
  --primary-tint: #cde2fb;

  /* Sidebar (dark chrome, independent of the light content surface) */
  --sidebar-bg: #111827;
  --sidebar-text: #97a1b3;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.08);
  --sidebar-border: rgba(255, 255, 255, 0.08);

  /* Status palette — fixed, never themed */
  --status-good: #0ca30c;
  --status-good-bg: #e3f6e3;
  --status-warning: #a66400;
  --status-warning-bg: #fef1d6;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbe4e4;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 12px 32px -18px rgba(11, 11, 11, 0.28);
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: 1rem; top: -100%;
  background: var(--ink); color: #fff; padding: 0.5rem 1rem; border-radius: var(--radius); z-index: 200;
}
.skip-link:focus { top: 1rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 1.3rem 1.25rem; border-bottom: 1px solid var(--sidebar-border);
}
.sidebar__mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(155deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.95rem;
}
.sidebar__brand b { color: #fff; font-size: 1rem; display: block; }
.sidebar__brand span { font-size: 0.72rem; color: var(--sidebar-text); }

.sidebar__nav { flex: 1; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.15rem; overflow-y: auto; }
.sidebar__link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem; border-radius: var(--radius);
  text-decoration: none; color: var(--sidebar-text); font-size: 0.88rem; font-weight: 500;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.sidebar__link svg { flex: none; opacity: 0.85; }
.sidebar__link:hover { background: var(--sidebar-active-bg); color: #fff; }
.sidebar__link[aria-current="page"] {
  background: var(--sidebar-active-bg); color: var(--sidebar-text-active);
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar__foot { padding: 0.75rem; border-top: 1px solid var(--sidebar-border); }

.sidebar-toggle {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius);
  background: none; border: 1px solid var(--border); cursor: pointer; color: var(--ink);
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0 1.75rem; background: var(--surface);
  border-bottom: 1px solid var(--gridline); position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 1.1rem; }
.topbar__meta { display: flex; align-items: center; gap: 1rem; }
.topbar__date { font-size: 0.85rem; color: var(--ink-muted); }
.topbar__user { display: flex; align-items: center; gap: 0.6rem; }
.topbar__avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-tint);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
}
.topbar__user span { font-size: 0.85rem; font-weight: 600; }

.content { padding: 1.75rem; flex: 1; }
.content--narrow { max-width: 960px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 44px; padding: 0.6em 1.3em; font-weight: 600; font-size: 0.88rem;
  border-radius: var(--radius); border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: var(--surface); border-color: var(--gridline); color: var(--ink); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn--danger-ghost { background: var(--surface); border-color: var(--gridline); color: var(--status-critical); }
.btn--danger-ghost:hover { border-color: var(--status-critical); background: var(--status-critical-bg); }
.btn--sm { min-height: 36px; padding: 0.4em 0.9em; font-size: 0.82rem; }
.btn--icon { min-height: 36px; min-width: 36px; padding: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.4rem; }
.page-head p { margin: 0.25rem 0 0; color: var(--ink-muted); font-size: 0.9rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--gridline);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.1rem; }
.card__head h2 { font-size: 1.02rem; }
.card__head p { margin: 0.2rem 0 0; font-size: 0.83rem; color: var(--ink-muted); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.25rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--gridline); border-radius: var(--radius-lg); padding: 1.25rem 1.35rem; }
.stat-tile__label { font-size: 0.82rem; color: var(--ink-secondary); font-weight: 600; }
.stat-tile__value { font-size: 1.9rem; font-weight: 700; margin-top: 0.3rem; letter-spacing: -0.01em; }
.stat-tile__delta { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.8rem; font-weight: 600; margin-top: 0.45rem; }
.stat-tile__delta--up { color: var(--status-good); }
.stat-tile__delta--down { color: var(--status-critical); }
.stat-tile__delta span.muted { color: var(--ink-muted); font-weight: 500; }

/* ---------- Status badges (icon + label — never color alone) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.28em 0.7em; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
}
.badge svg { flex: none; }
.badge--good { background: var(--status-good-bg); color: var(--status-good); }
.badge--warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge--critical { background: var(--status-critical-bg); color: var(--status-critical); }

/* ---------- Filter row ---------- */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; }
.filter-row .chip {
  border: 1.5px solid var(--gridline); background: var(--surface); color: var(--ink-secondary);
  border-radius: 999px; padding: 0.45em 1em; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.filter-row .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-row .chip:hover:not([aria-pressed="true"]) { border-color: var(--primary); color: var(--primary-dark); }
.filter-row .spacer { flex: 1; }

/* ---------- Table ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--gridline); border-radius: var(--radius-lg); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 720px; background: var(--surface); }
.data-table th, .data-table td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--gridline); white-space: nowrap; }
.data-table th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 700; background: color-mix(in srgb, var(--gridline) 35%, var(--surface)); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--primary-tint) 35%, var(--surface)); }
.data-table td.num, .data-table th.num { font-variant-numeric: tabular-nums; }
.data-table .row-actions { display: flex; gap: 0.4rem; white-space: nowrap; }
.data-table .guest-name { font-weight: 600; }
.table-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-muted); }

/* ---------- Chart (weekly/monthly revenue — single sequential hue) ---------- */
.chart-card__legend { font-size: 0.82rem; color: var(--ink-secondary); }
.chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 220px;
  padding: 0.5rem 0.25rem 0;
  border-bottom: 1px solid var(--baseline);
}
.chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.chart__bar {
  width: 100%; max-width: 24px; border-radius: 4px 4px 0 0;
  background: var(--primary); cursor: pointer;
  transition: background-color 0.15s var(--ease), filter 0.15s var(--ease);
}
.chart__col:hover .chart__bar, .chart__bar:focus-visible { filter: brightness(1.12); }
.chart__col--peak .chart__bar { background: var(--primary-dark); }
.chart__label { margin-top: 0.5rem; font-size: 0.75rem; color: var(--ink-muted); }
.chart__tooltip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 0.4rem 0.65rem; border-radius: 6px;
  font-size: 0.78rem; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.12s var(--ease); z-index: 5;
}
.chart__col:hover .chart__tooltip, .chart__bar:focus-visible + .chart__tooltip { opacity: 1; }
.chart__tooltip strong { font-variant-numeric: tabular-nums; }

.table-view-toggle { margin-left: auto; }
.data-table-view { display: none; margin-top: 1rem; }
.data-table-view.is-open { display: block; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--page);
}
.login-brand {
  background: linear-gradient(155deg, var(--sidebar-bg) 0%, #1c2740 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 3rem;
}
.login-brand__mark { display: flex; align-items: center; gap: 0.75rem; }
.login-brand h1 { color: #fff; font-size: 2rem; max-width: 18ch; line-height: 1.2; }
.login-brand p { color: #b7c0d1; max-width: 40ch; }
.login-brand__foot { font-size: 0.8rem; color: #8b96ab; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.login-card > p.muted { color: var(--ink-muted); margin: 0 0 1.5rem; font-size: 0.9rem; }

.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.field label { font-size: 0.85rem; font-weight: 600; }
.field input {
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--gridline);
  border-radius: var(--radius); padding: 0.65em 0.85em; min-height: 46px; width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.field-row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font-size: 0.86rem; }
.checkbox-line { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-line input { width: 17px; height: 17px; accent-color: var(--primary); }
.link { color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.login-card .btn { width: 100%; }
.login-note { margin-top: 1.5rem; font-size: 0.83rem; color: var(--ink-muted); text-align: center; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 11, 11, 0.45);
  display: none; align-items: center; justify-content: center; padding: 1.5rem; z-index: 100;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  width: 100%; max-width: 460px; padding: 1.75rem;
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.1rem; }
.modal__head h2 { font-size: 1.15rem; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--ink-muted); width: 32px; height: 32px; border-radius: 6px; }
.modal-close:hover { background: var(--page); color: var(--ink); }
.modal .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.modal__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }

/* ---------- Settings placeholder ---------- */
.settings-note { color: var(--ink-muted); font-size: 0.9rem; }

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 90;
    transform: translateX(-100%); transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(11,11,11,0.4); z-index: 80;
  }
  .sidebar-scrim.is-open { display: block; }
  .content { padding: 1.25rem; }
  .topbar { padding: 0 1.1rem; }
  .topbar__date { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .modal .field-row { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
}
