:root {
  --ink: #17241f;
  --moss: #12352c;
  --moss-2: #1c4a3d;
  --leaf: #0f6e56;
  --cream: #f4efe6;
  --paper: #fbf8f3;
  --card: #ffffff;
  --line: #e4ddd2;
  --muted: #6d756f;
  --gold: #b86e3a;
  --danger: #9f2d2d;
  --ok: #0f6e56;
  --shadow: 0 16px 40px rgba(18, 53, 44, 0.08);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 560; letter-spacing: -0.03em; margin: 0; }
a { color: var(--leaf); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top left, rgba(15, 110, 86, 0.16), transparent 32%),
    var(--cream);
}
.gate-card, .panel, .appt, .day-card, .chat-log {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gate-card { width: min(440px, 100%); padding: 32px 28px; }
.brand-mark { width: 48px; height: 48px; }
.eyebrow { color: var(--leaf); font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; margin: 14px 0 4px; }
.lede { color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 6px; margin-top: 14px; }
.field label, .label { font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 12px 12px;
}
textarea { min-height: 80px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--moss);
  color: white;
  font-weight: 650;
}
.btn.secondary { background: transparent; color: var(--moss); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #efc7c7; }
.btn.full { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.form-error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.demo-accounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.demo-accounts p { width: 100%; color: var(--muted); margin: 0 0 4px; font-size: 13px; }
.demo-accounts button, .chip, .slot, .qr {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
}
.chip.active, .slot.active, .nav-btn.active, .tab.active { background: var(--moss); color: white; border-color: var(--moss); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  background: var(--moss);
  color: #f6f1e8;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.workspace { min-width: 0; padding: 28px 28px 96px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; }
.sidebar .brand { display: flex; gap: 10px; align-items: center; }
.sidebar strong { display: block; }
.sidebar span { color: #d5c7ae; font-size: 13px; }
.nav-btn, .tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 12px;
  padding: 10px 12px;
}
.sidebar .nav-btn.active { background: rgba(255,255,255,0.12); }
.sidebar .book-link { margin-top: auto; color: #f6f1e8; text-decoration: none; font-weight: 650; }
.topbar h1 { font-size: 40px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: white; position: relative;
}
.badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--gold); color: white; border-radius: 99px;
  min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center;
}
.grid { display: grid; gap: 12px; }
.appt { padding: 14px 16px; display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; }
.appt time { font-weight: 700; }
.appt p, .muted { color: var(--muted); margin: 4px 0 0; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--leaf); }
.calendar-head, .row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.weekdays, .month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays { margin: 14px 0 6px; color: var(--muted); font-size: 12px; text-align: center; }
.month button {
  border: 1px solid transparent; background: white; border-radius: 12px; min-height: 64px; padding: 6px;
}
.month button strong { display: block; }
.month button.has { box-shadow: inset 0 -3px 0 var(--leaf); }
.month button.selected { border-color: var(--moss); background: #e7f3ee; }
.month button.out { opacity: 0.35; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; align-items: start; }
.tabs-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.panel { padding: 16px; }
.hours-day { display: grid; grid-template-columns: 92px 28px 1fr 1fr; gap: 8px; align-items: center; margin-top: 8px; }
.person { display: flex; gap: 10px; align-items: center; }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.list-btn { width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.chat-log { min-height: 320px; max-height: 460px; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; line-height: 1.4; }
.bubble.bot { background: #e7f3ee; align-self: flex-start; }
.bubble.me { background: var(--moss); color: white; align-self: flex-end; }
.qr-row { display: flex; flex-wrap: wrap; gap: 6px; }
.composer { display: flex; gap: 8px; margin-top: 10px; }
.composer input { flex: 1; }
.modal-back, .alert-back {
  position: fixed; inset: 0; background: rgba(18, 27, 23, 0.46);
  display: grid; place-items: end center; padding: 16px; z-index: 20;
}
.sheet { width: min(560px, 100%); background: white; border-radius: 20px; padding: 18px; max-height: min(88vh, 760px); overflow: auto; }
.alert-panel { width: min(420px, 100%); margin-left: auto; background: white; border-radius: 20px; padding: 16px; max-height: 80vh; overflow: auto; align-self: start; }
.tabbar { display: none; }
.empty { padding: 28px 8px; color: var(--muted); }
.steps { display: flex; gap: 6px; margin: 8px 0 18px; }
.steps i { height: 4px; flex: 1; border-radius: 99px; background: var(--line); display: block; }
.steps i.on { background: var(--leaf); }
.choice {
  width: 100%; text-align: left; background: white; border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; margin-bottom: 10px;
}
.choice small { display: block; color: var(--muted); margin-top: 4px; }
.slot-group { margin-top: 12px; }
.slot-group .slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.success { text-align: center; padding: 12px 8px 4px; }
.book-page { max-width: 520px; margin: 0 auto; padding: 28px 16px 48px; }
.member-card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.plan-note { margin: 14px 0; }
.plan-note p { margin: 6px 0; }
.visit-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 8px; }
.visit-row .actions { display: flex; gap: 4px; }
.links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.links a, .text-btn { background: none; border: 0; color: var(--leaf); font-weight: 700; padding: 8px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { padding: 18px 16px 108px; }
  .topbar h1 { font-size: 32px; }
  .split, .appt { grid-template-columns: 1fr; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0;
    background: white; border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + var(--safe-bottom));
  }
  .tab { justify-content: center; flex-direction: column; font-size: 12px; gap: 2px; }
  .hours-day { grid-template-columns: 1fr 28px 1fr 1fr; }
}
