/* ── Fonts ──────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/static/fonts/space-grotesk-medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/static/fonts/space-grotesk-semibold.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/space-grotesk-bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/inter-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/static/fonts/inter-medium.woff2') format('woff2');
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --tinte:    #14171A;
  --schiefer: #1D2126;
  --asche:    #33403F;
  --petrol:   #0E7A76;
  --salbei:   #8FBDB8;
  --papier:   #F7F4EF;
  --nebel:    #5F6670;

  --space: 'Space Grotesk', system-ui, sans-serif;
  --inter: 'Inter', system-ui, sans-serif;

  --sidebar-w:     240px;
  --bottom-nav-h:  60px;
  --pad-x:         1.25rem;

  /* Stacking order — single source of truth. A sheet (teleported to <body>)
     always sits above the bottom navigation. */
  --z-nav:            100;
  --z-sheet-backdrop: 200;
  --z-sheet:          210;
  --z-skip-link:      9999;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: var(--inter);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--tinte);
  background: var(--papier);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--petrol); }
a:hover { color: var(--tinte); }

/* ── Focus ──────────────────────────────────────────────────────────────── */

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

/* ── Skip link ──────────────────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -999px; left: 1rem;
  padding: .5rem 1rem;
  background: var(--petrol); color: var(--papier);
  font-size: .875rem; font-weight: 500;
  text-decoration: none;
  border-radius: 0 0 6px 6px;
  z-index: var(--z-skip-link);
}
.skip-link:focus { top: 0; }

/* ── View transitions ───────────────────────────────────────────────────── */

@view-transition { navigation: auto; }

#main-content { view-transition-name: main; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(main) {
    animation: 160ms ease both fade-out;
  }
  ::view-transition-new(main) {
    animation: 160ms ease both fade-in;
  }
}

@keyframes fade-out { to   { opacity: 0; } }
@keyframes fade-in  { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(main),
  ::view-transition-new(main) { animation: none; }
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.site-layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.main-content {
  flex: 1;
  padding: 1.5rem var(--pad-x);
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--bottom-nav-h) + 1.5rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  cache-control: no-store;  /* belt-and-suspenders */
}

/* ── Sidebar (≥ 900 px) ─────────────────────────────────────────────────── */

.sidebar {
  display: none;
}

@media (min-width: 900px) {
  .site-layout { flex-direction: row; }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    flex-shrink: 0;
    height: 100dvh;
    position: sticky;
    top: 0;
    border-right: 1px solid color-mix(in srgb, var(--asche) 25%, transparent);
    background: var(--papier);
    overflow-y: auto;
  }

  .main-content {
    padding-bottom: 1.5rem;
  }
}

.sidebar-top {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--tinte);
  margin-bottom: .75rem;
}

.sidebar-brand-name {
  font-family: var(--space);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.05em;
}

.sidebar-salon {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--nebel);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  list-style: none;
  padding: .75rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .125rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: .9375rem;
  color: var(--nebel);
  transition: background .12s, color .12s;
}

.sidebar-link:hover {
  background: color-mix(in srgb, var(--asche) 12%, transparent);
  color: var(--tinte);
}

.sidebar-link.active {
  background: color-mix(in srgb, var(--petrol) 10%, transparent);
  color: var(--petrol);
  font-weight: 500;
}

.sidebar-bottom {
  padding: 1rem .5rem;
  border-top: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
}

.sidebar-logout {
  width: 100%;
  padding: .5rem .875rem;
  border-radius: 8px;
  border: none;
  background: none;
  font-family: var(--inter);
  font-size: .9375rem;
  color: var(--nebel);
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}

.sidebar-logout:hover {
  background: color-mix(in srgb, var(--asche) 12%, transparent);
  color: var(--tinte);
}

/* ── Bottom navigation (< 900 px) ───────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--papier);
  border-top: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  display: flex;
  z-index: var(--z-nav);
}

@media (min-width: 900px) {
  .bottom-nav { display: none; }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-height: 48px;
  text-decoration: none;
  color: var(--nebel);
  font-size: .6875rem;
  font-weight: 500;
  transition: color .12s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.active { color: var(--petrol); }
.bottom-nav-item:hover  { color: var(--tinte); }

/* While a sheet is open the nav is behind it (z-index) AND inert, mirroring
   how iOS hides the tab bar behind a sheet. Bound by Alpine (see base.html). */
.bottom-nav.sheet-open { pointer-events: none; }

/* ── Auth pages ─────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem var(--pad-x);
}

.auth-card {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  gap: .125rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--tinte);
  margin-bottom: 2rem;
}

.auth-wordmark {
  font-family: var(--space);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.05em;
}

.auth-heading {
  font-family: var(--space);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: -.04em;
  line-height: 1.1;
  color: var(--tinte);
  margin-bottom: .625rem;
}

.auth-sub {
  color: var(--nebel);
  font-size: .9375rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.auth-hint {
  color: var(--nebel);
  font-size: .875rem;
  line-height: 1.5;
  margin-top: 1.25rem;
}

.auth-error {
  background: color-mix(in srgb, #c0392b 10%, transparent);
  border-left: 3px solid #c0392b;
  color: #7d1c11;
  padding: .625rem .875rem;
  border-radius: 0 6px 6px 0;
  font-size: .875rem;
  margin-bottom: 1.25rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.auth-back {
  margin-top: 1.5rem;
  display: inline-block;
  font-size: .9375rem;
  color: var(--petrol);
}

.auth-sent-icon {
  margin-bottom: 1.5rem;
}

.btn-auth {
  width: 100%;
  padding: .9375rem;
  background: var(--petrol);
  color: var(--papier);
  border: none;
  border-radius: 8px;
  font-family: var(--inter);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}
.btn-auth:hover { background: var(--tinte); color: var(--papier); }

/* ── Form fields (shared) ───────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: .375rem; }

.field label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--tinte);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: var(--inter);
  font-size: 1rem;
  color: var(--tinte);
  background: #fff;
  border: 1px solid #cdc7bd;
  border-radius: 8px;
  padding: .75rem .875rem;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--petrol);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--petrol) 15%, transparent);
}

/* ── Dashboard pages ────────────────────────────────────────────────────── */

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 22%, transparent);
}

.page-salon-name {
  font-family: var(--space);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -.035em;
  color: var(--tinte);
  margin-bottom: .25rem;
}

.page-date {
  font-size: .9375rem;
  color: var(--nebel);
}

.page-notice {
  color: var(--nebel);
  font-size: .9375rem;
}

.page-title {
  font-family: var(--space);
  font-weight: 600;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  letter-spacing: -.03em;
  color: var(--tinte);
  margin-bottom: 1rem;
}

/* ── Bottom sheet ───────────────────────────────────────────────────────── */

[x-cloak] { display: none !important; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: var(--z-sheet-backdrop);
  backdrop-filter: blur(2px);
}

.sheet-backdrop-enter {
  transition: opacity .2s ease;
}
.sheet-backdrop-from { opacity: 0; }
.sheet-backdrop-to   { opacity: 1; }

/* iOS-style three-zone sheet: the panel is a flex column that never scrolls
   itself. Only .sheet-body scrolls; the header and .sheet-actions are pinned.
   This guarantees the action buttons are ALWAYS visible, regardless of how
   tall the form is or how small the viewport (short landscape / PWA) gets. */
.sheet-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--papier);
  border-radius: 20px 20px 0 0;
  z-index: var(--z-sheet);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* the panel itself must not scroll */
}

/* Fade-only enter/leave. The panel's geometry never moves during the
   transition, so shrinking the viewport mid-transition (e.g. rotating a
   phone, or a desktop→mobile resize) can never push the action buttons
   off-screen or behind the bottom-nav. Drag-to-dismiss still applies an
   inline transform, but only while the user is actively dragging. */
.sheet-enter { transition: opacity .2s ease; }
.sheet-from  { opacity: 0; }
.sheet-to    { opacity: 1; }

@media (min-width: 900px) {
  .sheet-panel {
    /* Centre without a persistent transform: left/right + margin auto keeps
       the fixed panel horizontally centred, top+translateY handles vertical.
       transform is NOT part of the transition, so it never animates/leaks. */
    left: 0; right: 0;
    margin-inline: auto;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    width: min(480px, 92vw);
    border-radius: 16px;
    max-height: 80dvh;
  }
  .sheet-handle { display: none; }
}

.sheet-handle {
  flex: none;
  width: 40px; height: 4px;
  background: color-mix(in srgb, var(--asche) 35%, transparent);
  border-radius: 2px;
  margin: .875rem auto .25rem;
}

.sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
}

.sheet-title {
  font-family: var(--space);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -.025em;
}

.sheet-close {
  background: none;
  border: none;
  color: var(--nebel);
  cursor: pointer;
  padding: .25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
}
.sheet-close:hover { color: var(--tinte); }

/* The caller's form (or a bare .sheet-content wrapper) fills the panel and
   itself becomes the flex column that splits body from actions. */
.sheet-panel > form,
.sheet-panel > .sheet-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Middle zone — the only scrollable region. */
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem;
}

/* Bottom zone — fixed action bar. Buttons live here, never in the scroll
   area. env() falls back to var(--sai-b) so PWA safe-area can be simulated. */
.sheet-actions {
  flex: none;
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  /* Real device: env() adds the notch inset. Tests can simulate a PWA inset
     by setting --sai-b (env() returns 0 on non-standalone browsers). */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--sai-b, 0px));
  border-top: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  background: var(--papier);
}

@media (prefers-reduced-motion: reduce) {
  .sheet-enter,
  .sheet-backdrop-enter { transition: none; }
}

/* ── Settings / Mehr ─────────────────────────────────────────────────────── */

.page-settings {
  max-width: 560px;
}

.settings-nav-list { list-style: none; }

.settings-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9375rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  text-decoration: none;
  color: var(--tinte);
  gap: .75rem;
}
.settings-nav-item:last-child { border-bottom: none; }

.settings-nav-label {
  display: block;
  font-weight: 500;
  font-size: .9375rem;
}
.settings-nav-sub {
  display: block;
  font-size: .8125rem;
  color: var(--nebel);
  margin-top: .125rem;
}
.settings-nav-arrow { color: var(--nebel); flex-shrink: 0; }

.settings-section { margin-bottom: 2rem; }

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .875rem;
}

.settings-section-title {
  font-family: var(--space);
  font-weight: 600;
  font-size: .9375rem;
  letter-spacing: -.02em;
  color: var(--tinte);
  margin-bottom: .875rem;
}

.settings-form { max-width: 480px; }

.settings-logout {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .625rem 1.25rem;
  border-radius: 8px;
  font-family: var(--inter);
  font-size: .9375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary  { background: var(--petrol); color: var(--papier); }
.btn-primary:hover { background: var(--tinte); color: var(--papier); }
.btn-secondary { background: color-mix(in srgb, var(--asche) 12%, transparent); color: var(--tinte); }
.btn-secondary:hover { background: color-mix(in srgb, var(--asche) 22%, transparent); }
.btn-danger { background: color-mix(in srgb, #c0392b 12%, transparent); color: #c0392b; }
.btn-danger:hover { background: color-mix(in srgb, #c0392b 22%, transparent); }
.btn-sm { padding: .375rem .875rem; font-size: .8125rem; border-radius: 6px; }
.btn-ghost { background: none; color: var(--petrol); text-decoration: none; }
.btn-ghost:hover { background: color-mix(in srgb, var(--petrol) 8%, transparent); }

/* ── Segmented control (iOS-style) ──────────────────────────────────────── */

.seg-control {
  display: flex;
  background: color-mix(in srgb, var(--asche) 15%, transparent);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  flex: 1;
  padding: .375rem .75rem;
  border-radius: 7px;
  border: none;
  background: none;
  font-family: var(--inter);
  font-size: .875rem;
  font-weight: 500;
  color: var(--nebel);
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: center;
  white-space: nowrap;
}

.seg-btn.seg-active {
  background: var(--papier);
  color: var(--tinte);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  cursor: default;
}

/* ── Form feedback text ──────────────────────────────────────────────────── */

.form-hint {
  font-size: .8125rem;
  color: var(--nebel);
}

.btn-icon {
  background: none;
  border: none;
  padding: .375rem;
  cursor: pointer;
  color: var(--nebel);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}
.btn-icon:hover { color: var(--tinte); background: color-mix(in srgb, var(--asche) 12%, transparent); }

/* ── Form helpers ────────────────────────────────────────────────────────── */

.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; align-items: center; }

.form-ok {
  color: #1a6b45;
  font-size: .875rem;
  padding: .5rem .875rem;
  background: color-mix(in srgb, #27ae60 10%, transparent);
  border-radius: 6px;
  border-left: 3px solid #27ae60;
  margin-top: .75rem;
}

.form-error {
  color: #7d1c11;
  font-size: .8125rem;
  padding: .2rem 0;
}

/* ── Readiness banner ────────────────────────────────────────────────────── */

.readiness-ok {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .875rem 1rem;
  background: color-mix(in srgb, #27ae60 10%, transparent);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  color: #1a6b45;
  font-size: .9375rem;
  font-weight: 500;
}

.readiness-warn {
  padding: .875rem 1rem;
  background: color-mix(in srgb, #e67e22 10%, transparent);
  border-radius: 10px;
  margin-bottom: 1.5rem;
}
.readiness-warn-title {
  font-weight: 500;
  color: #7d4b0d;
  font-size: .9375rem;
  margin-bottom: .5rem;
}
.readiness-warn ul { padding-left: 1.25rem; }
.readiness-warn li { font-size: .875rem; color: #7d4b0d; margin-bottom: .25rem; }
.readiness-warn a { color: #7d4b0d; font-weight: 500; }

/* ── Toggle switch ───────────────────────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 15%, transparent);
  gap: 1rem;
}
.toggle-row:last-child { border-bottom: none; }

.toggle-label { font-weight: 500; font-size: .9375rem; }
.toggle-sub   { font-size: .8125rem; color: var(--nebel); margin-top: .125rem; }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle input[type="checkbox"] { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--asche) 35%, transparent);
  border-radius: 12px;
  transition: background .2s;
  cursor: pointer;
}
.toggle input[type="checkbox"]:checked ~ .toggle-track { background: var(--petrol); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input[type="checkbox"]:checked ~ .toggle-track::after { transform: translateX(20px); }

/* Alpine-driven button toggle (opening_hours_form, staff_hours) */
button.toggle { border: none; background: none; padding: 0; }
button.toggle.toggle-on .toggle-track { background: var(--petrol); }
button.toggle.toggle-on .toggle-track::after { transform: translateX(20px); }

/* ── Staff/service hours grid ────────────────────────────────────────────── */

.hours-grid { display: flex; flex-direction: column; }

.hours-times {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding-bottom: .375rem;
}

.hours-label {
  font-size: .8125rem;
  color: var(--nebel);
  min-width: 6.5rem;
}

.hours-range {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.hours-dash { color: var(--nebel); }

@media (max-width: 900px) {
  .hours-times { flex-direction: column; align-items: flex-start; }
  .hours-label { min-width: 0; }
}

.hours-times input[type="time"] {
  font-family: var(--inter);
  font-size: .875rem;
  color: var(--tinte);
  background: #fff;
  border: 1px solid #cdc7bd;
  border-radius: 6px;
  padding: .375rem .625rem;
  width: 8rem;
}

/* ── List / item rows ────────────────────────────────────────────────────── */

.item-list { list-style: none; }

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  flex-wrap: wrap;
  gap: .5rem;
}
.item-row:last-child { border-bottom: none; }

.item-row-main { display: flex; flex-direction: column; gap: .125rem; flex: 1; }
.item-row-name { font-weight: 500; font-size: .9375rem; }
.item-row-meta { font-size: .8125rem; color: var(--nebel); }
.item-row-actions { display: flex; align-items: center; gap: .375rem; }

/* ── Badge ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: .1875rem .5rem;
  border-radius: 20px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-active   { background: color-mix(in srgb, #27ae60 12%, transparent); color: #1a6b45; }
.badge-inactive { background: color-mix(in srgb, var(--asche) 15%, transparent); color: var(--nebel); }

/* ── Block / absence rows ────────────────────────────────────────────────── */

.block-row {
  padding: .875rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.block-row:last-child { border-bottom: none; }
.block-info { flex: 1; }
.block-date { font-weight: 500; font-size: .9375rem; }
.block-meta { font-size: .8125rem; color: var(--nebel); }

.absence-row {
  padding: .75rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 20%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.absence-row:last-child { border-bottom: none; }

/* ── Checkbox list ───────────────────────────────────────────────────────── */

.check-list { list-style: none; display: flex; flex-direction: column; }
.check-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--asche) 15%, transparent);
}
.check-item:last-child { border-bottom: none; }
.check-item input[type="checkbox"] {
  width: 1.25rem; height: 1.25rem;
  accent-color: var(--petrol);
  cursor: pointer;
  flex-shrink: 0;
}
.check-item label { font-size: .9375rem; cursor: pointer; }

/* ── Page back / subpage header ──────────────────────────────────────────── */

.page-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--petrol);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.page-back:hover { color: var(--tinte); }

.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.subpage-title {
  font-family: var(--space);
  font-weight: 700;
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  letter-spacing: -.035em;
  color: var(--tinte);
}

/* ── Mobile touch-target minimums (≤ 900 px) ─────────────────────────────── */

@media (max-width: 900px) {
  /* Buttons and primary CTAs */
  .btn         { min-height: 44px; }
  .btn-icon    { min-width: 44px; min-height: 44px; justify-content: center; }

  /* Back link */
  .page-back   { min-height: 44px; display: inline-flex; align-items: center; }

  /* List row: whole row becomes the tap target */
  .item-row-main a, .item-row-main { min-height: 56px; justify-content: center; }

  /* iOS-style toggle: 51×31, knob 27 px */
  .toggle                     { width: 51px; height: 31px; }
  .toggle-track               { border-radius: 15.5px; }
  .toggle-track::after        { width: 27px; height: 27px; }
  .toggle input[type="checkbox"]:checked ~ .toggle-track::after,
  button.toggle.toggle-on .toggle-track::after { transform: translateX(20px); }

  /* Time / number inputs */
  .hours-times input[type="time"],
  input[type="time"],
  input[type="number"] { min-height: 44px; }
}

/* ── Heute — Tagesansicht ────────────────────────────────────────────────── */

/* Staff stripe palette — a calm 4-colour set that deliberately excludes petrol
   (petrol is reserved for the "+" button, the now-line and the active nav). */
:root {
  --staff-0: #8FBDB8;  /* salbei */
  --staff-1: #BE8A3C;  /* warmes ocker */
  --staff-2: #6B86A8;  /* gedecktes blau */
  --staff-3: #B0796B;  /* clay */
}
.staff-c0 { --stripe: var(--staff-0); }
.staff-c1 { --stripe: var(--staff-1); }
.staff-c2 { --stripe: var(--staff-2); }
.staff-c3 { --stripe: var(--staff-3); }

.heute { position: relative; --axis-w: 3rem; }

.heute-header { margin-bottom: 1rem; }
.heute-daynav { display: flex; align-items: center; gap: .5rem; }
.heute-headings { flex: 1; min-width: 0; text-align: center; }
.heute-nav-arrow {
  flex: none;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; line-height: 1;
  color: var(--nebel); text-decoration: none;
  border-radius: 8px;
}
.heute-nav-arrow:hover { background: color-mix(in srgb, var(--asche) 12%, transparent); color: var(--tinte); }
.heute-today-btn {
  display: inline-block; margin: .5rem auto 0;
  font-size: .8125rem; font-weight: 500; color: var(--petrol);
  text-decoration: none;
}

.heute-stats { color: var(--nebel); font-size: .9375rem; margin-bottom: 1rem; }

.heute-legend { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; margin-bottom: .75rem; }
.legend-item { display: inline-flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--nebel); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--stripe); }

.tl-scroll {
  position: relative;
  overflow-y: auto;
  max-height: 68dvh;
  border-radius: 12px;
  /* Working time is paper; only the off-time areas are grey, so the gaps read. */
  background: var(--papier);
  -webkit-overflow-scrolling: touch;
  /* The hour labels are centred on their line (translateY(-50%)), so the first
     and last stick half their height (~8px) past the grid. Pad the scroller so
     the 07:00 label is not clipped at the top nor the last one at the bottom. */
  padding-top: 8px;
  padding-bottom: 8px;
}
.tl-grid { position: relative; --axis-w: 3rem; }

/* Hour grid: the line starts to the right of the time-axis column so the label
   is never struck through; the label sits in the gutter, centred on the line. */
.tl-hourline {
  position: absolute; left: var(--axis-w); right: .25rem;
  border-top: 1px solid color-mix(in srgb, var(--asche) 30%, transparent);
}
.tl-hourlabel {
  position: absolute; left: 0;
  width: calc(var(--axis-w) - .375rem);
  text-align: right;
  transform: translateY(-50%);
  font-size: 11px; color: var(--nebel);
}

.tl-lanes { position: absolute; top: 0; bottom: 0; left: var(--axis-w); right: .25rem; }

/* Non-working time (before opening, lunch, after closing, salon-wide sperrzeiten). */
.tl-offtime {
  position: absolute; left: 0; right: 0; z-index: 0;
  background: color-mix(in srgb, var(--asche) 12%, transparent);
}

.tl-block {
  position: absolute;
  /* left / width set by noshoLayout() from data-col / data-ncols (overlap layout) */
  z-index: 1;
  padding: .25rem .5rem .25rem .625rem;
  border: none;
  border-left: 4px solid var(--stripe);
  border-radius: 8px;
  /* Filled in the staff colour at 18% opacity; the left stripe stays full colour. */
  background: color-mix(in srgb, var(--stripe) 18%, transparent);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column; gap: .0625rem;
  font-family: var(--inter);
}
.tl-block-name { font-size: 15px; font-weight: 500; color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block-svc  { font-size: 13px; color: var(--nebel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block--past { opacity: .5; }
.tl-block--now  { opacity: 1; box-shadow: inset 0 0 0 1px var(--petrol); }

@media (prefers-reduced-motion: no-preference) {
  .tl-block--new { animation: tl-fade-in 150ms ease both; }
}
@keyframes tl-fade-in { from { opacity: 0; } to { opacity: 1; } }

.tl-nowline { position: absolute; left: var(--axis-w); right: .25rem; height: 0; border-top: 1px solid var(--petrol); z-index: 3; pointer-events: none; }
.tl-nowdot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--petrol); }

/* ── Sticky header, only the timeline scrolls ─────────────────────────────── */
/* On the Heute screen the page itself does not scroll: the header, stats and
   legend stay put and only .tl-scroll scrolls. This keeps the "+" button and
   the now-line stable. Scoped with :has() so other dashboard pages are
   unaffected. */
.main-content:has(.heute) {
  height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* main-content is itself a flex item of .site-layout; without this its
     default min-height:auto lets its content push it past 100dvh, so nothing
     is clipped and the page scrolls instead of .tl-scroll. Pin it so the fixed
     07:00–20:00 axis scrolls INSIDE .tl-scroll and the header stays put. */
  min-height: 0;
}
/* Mobile column layout: main-content must also NOT flex-grow to its content
   (that too pushes it past 100dvh). Pinning to 100dvh via flex:none is only
   needed here — the desktop row layout keeps flex:1 so it still fills width. */
@media (max-width: 899px) {
  .main-content:has(.heute) { flex: none; }
}
.heute { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#day-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.heute-header, .readiness-warn, .heute-stats, .heute-legend { flex: none; }
.main-content:has(.heute) .tl-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }

/* ── Walk-in FAB — the one petrol button on the screen ────────────────────── */
.fab-walkin {
  position: fixed;
  right: var(--pad-x);
  bottom: calc(var(--bottom-nav-h) + 1rem + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--petrol);
  color: var(--papier);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14,122,118,.35);
  z-index: 150;
  transition: background .15s;
}
.fab-walkin:hover { background: var(--tinte); }
@media (min-width: 900px) {
  .fab-walkin { top: 1.25rem; bottom: auto; right: 1.5rem; }
  /* Keep the day-nav's next arrow clear of the floating FAB (top-right). */
  .heute-header { padding-right: 5.5rem; }
}

/* ── Walk-in autocomplete ────────────────────────────────────────────────── */
.wi-results { position: relative; }
.wi-result-list { list-style: none; margin-top: .375rem; border: 1px solid color-mix(in srgb, var(--asche) 20%, transparent); border-radius: 8px; overflow: hidden; }
.wi-result { width: 100%; text-align: left; background: #fff; border: none; border-bottom: 1px solid color-mix(in srgb, var(--asche) 12%, transparent); padding: .625rem .75rem; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; align-items: center; font-family: var(--inter); }
.wi-result:last-child { border-bottom: none; }
.wi-result:hover,
.wi-result-active { background: color-mix(in srgb, var(--petrol) 8%, transparent); }
.wi-result-name { font-size: .9375rem; color: var(--tinte); }
.wi-result-phone { font-size: .8125rem; color: var(--nebel); }

/* ── Appointment action sheet ────────────────────────────────────────────── */
.appt-detail { margin-bottom: 1rem; }
.appt-detail-name { font-family: var(--space); font-weight: 600; font-size: 1.125rem; color: var(--tinte); }
.appt-detail-meta { font-size: .875rem; color: var(--nebel); margin-top: .125rem; }
.appt-actions-list { display: flex; flex-direction: column; }
.appt-action {
  width: 100%; text-align: left;
  padding: .9375rem .25rem;
  background: none; border: none;
  border-top: 1px solid color-mix(in srgb, var(--asche) 18%, transparent);
  font-family: var(--inter); font-size: 1rem; color: var(--tinte);
  cursor: pointer;
}
.appt-action:last-child { border-bottom: 1px solid color-mix(in srgb, var(--asche) 18%, transparent); }
.appt-action:hover { color: var(--petrol); }
.appt-action-danger { color: #c0392b; }
.appt-action-danger:hover { color: #c0392b; }
.appt-confirm { font-size: .9375rem; color: var(--tinte); margin-bottom: 1rem; }
.appt-actions-row { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .appt-action { min-height: 48px; }
}

/* ── Global error banner ─────────────────────────────────────────────────── */
.app-error {
  /* Hidden by default via CSS (class-driven), NOT via x-show — after an hx-boost
     body swap x-show could leave the freshly-inserted element visible with an
     empty message. It is shown only when JS adds .is-visible. */
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 400;
  background: #c0392b; color: #fff;
  padding: .875rem var(--pad-x);
  padding-top: calc(.875rem + env(safe-area-inset-top, 0px));
  text-align: center; font-size: .9375rem; font-family: var(--inter);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  /* A transient toast must never steal clicks from the content beneath it
     (it auto-hides after 6 s). Without this it covered the top of the screen
     and intercepted e.g. a sheet-backdrop close click. */
  pointer-events: none;
}
.app-error.is-visible { display: block; }

/* ── Leave-page confirm ──────────────────────────────────────────────────── */
/* Hidden by default via CSS (class-driven, not x-show) so an hx-boost swap can
   never leave this full-screen overlay visible and blocking the page. */
.leave-confirm { position: fixed; inset: 0; z-index: 500; display: none; align-items: center; justify-content: center; }
.leave-confirm.is-visible { display: flex; }
.leave-confirm-backdrop { position: absolute; inset: 0; background: rgba(20,23,26,.45); }
.leave-confirm-panel {
  position: relative; background: var(--papier); border-radius: 14px;
  padding: 1.5rem; width: min(400px, 92vw);
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.leave-confirm-title { font-family: var(--space); font-weight: 600; font-size: 1.125rem; color: var(--tinte); }
.leave-confirm-text { color: var(--nebel); font-size: .9375rem; margin: .5rem 0 1.25rem; }
.leave-confirm-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ── Unsaved-changes bar ─────────────────────────────────────────────────── */
.dirty-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 150;   /* above the nav (100), below any sheet (200+) */
  background: var(--papier);
  border-top: 1px solid color-mix(in srgb, var(--asche) 25%, transparent);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  padding: .75rem var(--pad-x);
}
.dirty-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 760px; margin: 0 auto; }
.dirty-bar-label { font-size: .9375rem; color: var(--tinte); font-family: var(--inter); }
.dirty-bar-actions { display: flex; gap: .5rem; }
@media (min-width: 900px) {
  .dirty-bar { left: var(--sidebar-w); bottom: 0; }
}
@media (max-width: 560px) {
  .dirty-bar-label { display: none; }   /* make room for the buttons on phones */
  .dirty-bar-actions { flex: 1; }
  .dirty-bar-actions .btn { flex: 1; }
}
/* While the sticky bar is shown it overlaps the bottom of the form (e.g. the
   "+ Zeitfenster hinzufügen" button on the last weekday). Pad the form by the
   bar's height plus the safe-area inset so everything stays scrollable above it.
   Toggled by Alpine (:class on dirty) so it only applies when the bar is up. */
.form-below-dirty-bar { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

/* ── Setup wizard (/dashboard/einrichtung) ──────────────────────────────────── */

.wizard-page {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem var(--pad-x);
}

.wizard-card { width: min(100%, 520px); display: flex; flex-direction: column; }

.wizard-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--tinte);
  margin-bottom: 2rem;
}
.wizard-wordmark {
  font-family: var(--space);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.05em;
}

.wizard-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: 0;
  margin: 0 0 2rem;
}
.wizard-step {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--nebel);
}
.wizard-step-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--asche) 15%, transparent);
  color: var(--nebel);
  font-size: .8125rem;
  font-weight: 600;
  flex-shrink: 0;
}
.wizard-step.is-current { color: var(--tinte); font-weight: 600; }
.wizard-step.is-current .wizard-step-marker {
  background: var(--petrol);
  color: var(--papier);
}
.wizard-step.is-done .wizard-step-marker {
  background: color-mix(in srgb, var(--petrol) 18%, transparent);
  color: var(--petrol);
}

.wizard-title {
  font-family: var(--space);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -.04em;
  line-height: 1.15;
  color: var(--tinte);
  margin-bottom: 1rem;
}
.wizard-text {
  color: var(--tinte);
  font-size: .9375rem;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}
.wizard-notice { color: var(--nebel); font-size: .9375rem; line-height: 1.6; }

.btn-wa-connect {
  width: 100%;
  padding: .9375rem;
  background: var(--petrol);
  color: var(--papier);
  border: none;
  border-radius: 8px;
  font-family: var(--inter);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-wa-connect:hover { background: var(--tinte); }

.wizard-error {
  margin-top: 1.25rem;
  background: color-mix(in srgb, #c0392b 10%, transparent);
  border-left: 3px solid #c0392b;
  color: #7d1c11;
  padding: .625rem .875rem;
  border-radius: 0 6px 6px 0;
  font-size: .875rem;
  line-height: 1.5;
}
.wizard-error a { color: #7d1c11; text-decoration: underline; }

.wizard-logout-form { margin-top: 2.5rem; }
.wizard-logout {
  background: none;
  border: none;
  color: var(--nebel);
  font-size: .875rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ── Wizard part 2 — dots, steps, footer, finish, arrival ─────────────────── */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Progress: five small dots, no numbers, no labels. */
.wizard-dots {
  list-style: none; display: flex; gap: .625rem; padding: 0; margin: 0 0 2rem;
  align-items: center;
}
.wizard-dot {
  width: .625rem; height: .625rem; border-radius: 50%;
  background: color-mix(in srgb, var(--asche) 30%, transparent);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s, width .2s;
}
.wizard-dot.is-done {
  background: color-mix(in srgb, var(--petrol) 22%, transparent);
  color: var(--petrol);
}
.wizard-dot.is-done svg { width: .5rem; height: .5rem; }
.wizard-dot.is-current {
  width: 1.75rem; border-radius: 5px; background: var(--petrol);
}

.wizard-back {
  display: inline-flex; align-items: center; gap: .25rem;
  background: none; border: none; padding: 0; margin-bottom: 1rem;
  color: var(--nebel); font-size: .9375rem; text-decoration: none; cursor: pointer;
}
.wizard-back:hover { color: var(--tinte); }

.wizard-subhead { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

.wizard-footer { margin-top: 2rem; display: flex; justify-content: flex-end; }
.btn-wizard-next,
.btn-wizard-activate {
  appearance: none; border: none; cursor: pointer;
  background: var(--petrol); color: var(--papier);
  font-family: var(--inter); font-size: 1rem; font-weight: 600;
  padding: .8125rem 2rem; border-radius: 10px;
  transition: background .15s, opacity .15s;
  text-decoration: none; display: inline-block;
}
.btn-wizard-next:hover,
.btn-wizard-activate:hover { background: var(--tinte); }
.btn-wizard-activate { width: 100%; text-align: center; margin-top: 1.25rem; }
.btn-wizard-activate:disabled { opacity: .4; cursor: not-allowed; }
.btn-wizard-activate:disabled:hover { background: var(--petrol); }

.wizard-hint {
  color: #7d1c11; font-size: .875rem; line-height: 1.5;
  margin-top: .75rem; text-align: right;
}
.wizard-hint:empty { display: none; }

/* Finish step fields + readiness */
.field-hint { color: var(--nebel); font-size: .8125rem; margin-top: .25rem; }
.wizard-finish .field { margin-bottom: 1.25rem; }
.wizard-finish textarea,
.wizard-finish select,
.wizard-finish input[type="tel"] {
  width: 100%; padding: .6875rem .75rem; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--asche) 30%, transparent);
  font-family: var(--inter); font-size: 1rem; color: var(--tinte); background: var(--papier);
}
.wizard-finish textarea { resize: vertical; }

.wizard-checks { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.wizard-check {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 0; font-size: .9375rem;
  border-top: 1px solid color-mix(in srgb, var(--asche) 12%, transparent);
}
.wizard-check.is-ok { color: var(--tinte); }
.wizard-check.is-ok svg { color: var(--petrol); }
.wizard-check.is-missing { color: var(--nebel); }
.wizard-check.is-missing svg { color: #c0392b; }
.wizard-check.is-missing a { color: #7d1c11; text-decoration: underline; }

/* Arrival */
.wizard-arrival { text-align: center; padding: 1.5rem 0; }
.wizard-arrival-check { color: var(--petrol); display: flex; justify-content: center; margin-bottom: 1rem; }
.wizard-arrival-title {
  font-family: var(--space); font-weight: 700; font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -.04em; color: var(--tinte); margin-bottom: .5rem;
}
.wizard-arrival-phone { color: var(--nebel); font-size: 1.0625rem; margin-bottom: 1.75rem; }

/* Horizontal slide between wizard steps (full-page navigations). */
#wizard-flow { view-transition-name: wizard-flow; }
@view-transition { navigation: auto; }

/* Dashboard "your salon is ready" banner (one-time). */
.ready-banner {
  display: flex; align-items: flex-start; gap: .75rem;
  background: color-mix(in srgb, var(--petrol) 10%, transparent);
  border-left: 3px solid var(--petrol);
  color: var(--tinte); padding: .75rem .875rem; border-radius: 0 8px 8px 0;
  margin: 0 0 1rem; font-size: .9375rem; line-height: 1.5;
}
.ready-banner-body { display: flex; align-items: flex-start; gap: .5rem; flex: 1; }
.ready-banner-body svg { color: var(--petrol); flex-shrink: 0; margin-top: .125rem; }
.ready-banner-close {
  background: none; border: none; color: var(--nebel); cursor: pointer;
  font-size: 1.25rem; line-height: 1; padding: 0 .25rem; flex-shrink: 0;
}
.ready-banner-close:hover { color: var(--tinte); }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
