:root {
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --bg: #f3efe7;
  --surface: #fffdfb;
  --ink: #1a1814;
  --muted: #6f675e;
  --line: #e6dfd2;
  --accent: #145c4a;
  --accent-2: #1f8a68;
  --sidebar: #14241f;
  --side-text: #e7f0ec;
  --danger: #9f2d2d;
  --warn: #9a6700;
  --shadow: 0 18px 50px rgba(28, 24, 20, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
h1, h2, h3 { font-family: var(--display); font-weight: 560; letter-spacing: -.03em; }
h1 { font-size: clamp(32px, 4vw, 58px); line-height: 1.05; margin: 0; }
h2 { margin: 0 0 8px; font-size: 28px; }
.muted, small { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }
.loading, .empty { padding: 28px 8px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

.btn, .icon-btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  background: var(--sidebar);
  color: #f6f3ec;
  padding: 11px 16px;
  font-weight: 600;
}
.btn.light, .icon-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: white; border: 0; }
.btn.tiny, .btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { width: 36px; height: 36px; padding: 0; }

.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid #ddd4c6;
  background: white;
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 6px;
}
label { display: grid; font-size: 14px; font-weight: 600; }
.checkline { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.alert {
  background: #fde8e4;
  color: #7a241c;
  border-radius: 12px;
  padding: 10px 12px;
}
.alert.ok { background: #e5f4ee; color: #145c4a; }
code { font-size: .92em; }

.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--sidebar); color: #e7f3ee;
  font-family: var(--display); font-size: 24px;
}

.public { background: #f6f1e8; }
.site-head, .site-foot {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
}
.head-phone { text-decoration: none; font-weight: 650; }
.site { width: min(1120px, calc(100% - 32px)); margin: 0 auto 40px; display: grid; gap: 18px; }
.hero {
  background: var(--sidebar);
  color: #f6f1e8;
  border-radius: 28px;
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 24px;
  min-height: 280px;
}
.hero .eyebrow { color: #b7d4c8; }
.hero p { font-size: 18px; max-width: 46ch; }
.hero-meta { display: grid; gap: 14px; align-content: end; margin: 0; }
.hero-meta dt { color: #b7d4c8; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.hero-meta dd { margin: 4px 0 0; font-size: 18px; }
.wizard-card, .panel-card, .login-card, .modal, .install {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.wizard-card { padding: 22px; }
.stepbar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.stepbar span { padding: 6px 10px; border-radius: 999px; background: #f3efe7; color: var(--muted); font-size: 13px; }
.stepbar span.on { background: #e5f4ee; color: var(--accent); font-weight: 700; }
.choice-grid, .slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.choice, .slot {
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
}
.choice.on, .slot.on, .choice:hover, .slot:hover { border-color: var(--accent); background: #f3faf7; }
.choice b, .slot b { display: block; }
.day-row { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; }
.day-chip { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 8px 10px; min-width: 72px; cursor: pointer; }
.day-chip.on { background: var(--sidebar); color: white; border-color: var(--sidebar); }
.site-foot a { color: var(--muted); }

.chat-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  background: #128c7e; color: white; border: 0; border-radius: 999px;
  padding: 14px 18px; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 30px rgba(18, 140, 126, .35);
}
.wchat {
  position: fixed; right: 18px; bottom: 76px; z-index: 31;
  width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 110px));
  background: #efeae2; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.wchat header, .chat-main header {
  background: #075e54; color: white; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.wchat header small { display: block; color: #d9fdd3; }
.wchat #wchat-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; }
.wchat form, .composer { display: flex; gap: 8px; padding: 10px; background: #f0f2f5; }
.wchat textarea, .composer textarea {
  flex: 1; border: 0; border-radius: 12px; padding: 10px; resize: none; min-height: 44px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}
.login-copy {
  background: var(--sidebar);
  color: #f3efe7;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}
.login-copy h1 { font-size: clamp(36px, 5vw, 64px); }
.login-card { margin: auto; width: min(420px, calc(100% - 32px)); padding: 28px; display: grid; gap: 12px; }
body.authed .login-screen { display: none; }
body:not(.authed) .shell { display: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.side {
  background: var(--sidebar);
  color: var(--side-text);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .brand strong { color: white; }
.side .brand small { color: #b7d4c8; }
.side nav { display: grid; gap: 4px; margin-top: 12px; }
.side nav a {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  color: #d5e6df;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.side nav a.active, .side nav a:hover { background: rgba(255,255,255,.08); color: white; }
.side nav em {
  background: #25d366; color: #083; color: white;
  border-radius: 999px; font-style: normal; font-size: 12px; padding: 1px 7px;
}
.nav-logout {
  margin-top: auto;
  background: transparent;
  color: #d5e6df;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}
.ver { color: #8eaaa1; padding: 4px 8px; }
.main { min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; padding: 22px 22px 0; }
.top h1 { font-size: 40px; }
.who { color: var(--muted); }
#view { padding: 16px 22px 48px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat b { display: block; font-family: var(--display); font-size: 32px; margin-top: 6px; }
.panel-card { padding: 8px 12px 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #efe8dc; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 650; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #faf7f2; }
.pill { display: inline-flex; border-radius: 999px; padding: 3px 8px; background: #eef2ef; font-size: 12px; font-weight: 700; }
.pill.pending { background: #fff4d6; color: var(--warn); }
.pill.confirmed { background: #e5f4ee; color: var(--accent); }
.pill.completed { background: #e7eef8; color: #234e78; }
.pill.cancelled, .pill.no_show { background: #f6e8e6; color: var(--danger); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.cal-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.cal-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: white; max-height: calc(100vh - 180px); }
.cal-sheet { min-width: 760px; }
.cal-head, .cal-body { display: grid; }
.cal-head { position: sticky; top: 0; z-index: 5; background: #fffdfb; border-bottom: 1px solid var(--line); }
.gutter { width: 64px; }
.col-h { display: flex; gap: 8px; align-items: center; padding: 10px; min-height: 58px; }
.col-h i { width: 8px; height: 28px; border-radius: 99px; display: block; }
.col-h small { display: block; color: var(--muted); }
.cal-body { position: relative; }
.times { position: relative; }
.t-label { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-7px); }
.cal-col { border-left: 1px solid #f0e9de; background-image: linear-gradient(to bottom, transparent calc(var(--line, 48px) - 1px), #f3eee6 var(--line, 48px)); background-size: 100% var(--line, 48px); }
.company { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.col-hit { position: relative; }
.shade {
  position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(20,36,31,.035) 0 6px, rgba(20,36,31,.08) 6px 12px);
}
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #c2413c; z-index: 4; pointer-events: none; }
.now-line::before { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #c2413c; top: -3px; left: -2px; }
.hover-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(20,36,31,.35); z-index: 3; pointer-events: none; }
.appt {
  position: absolute; z-index: 2; overflow: hidden; border: 0; border-left: 3px solid var(--c);
  background: var(--bg); border-radius: 8px; text-align: left; padding: 3px 6px; cursor: grab;
  font: inherit; touch-action: none; user-select: none;
}
.appt.dragging { z-index: 6; cursor: grabbing; }
.appt.st-cancelled { opacity: .45; }
.appt.st-pending { box-shadow: inset 0 0 0 1px var(--c); }
.appt strong, .appt em, .appt span { display: block; font-style: normal; line-height: 1.25; }
.appt strong { font-size: 12px; }
.appt em, .appt span { font-size: 11px; color: #4e483f; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }

.chat {
  display: grid; grid-template-columns: 320px 1fr;
  height: calc(100vh - 150px); min-height: 520px;
  background: white; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.chat-list { border-right: 1px solid #f0f2f5; display: flex; flex-direction: column; background: #fff; min-height: 0; }
.chat-search { padding: 10px; border-bottom: 1px solid #f0f2f5; }
.conv-scroll { overflow: auto; }
.conv {
  width: 100%; text-align: left; border: 0; background: white; cursor: pointer;
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; padding: 12px;
  border-bottom: 1px solid #f5f6f6;
}
.conv.active { background: #f0f2f5; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 700; }
.conv b, .conv small { display: block; }
.conv small { color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.unread-n { background: #25d366; color: white; border-radius: 999px; min-width: 20px; text-align: center; font-size: 12px; padding: 2px 6px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; background: #efeae2; }
.chat-log {
  flex: 1; overflow: auto; padding: 16px 8%;
  background-image: radial-gradient(#d9d1c7 .7px, transparent .7px);
  background-size: 16px 16px;
}
.bubble { max-width: min(78%, 520px); padding: 6px 8px 4px; border-radius: 8px; margin: 2px 0 6px; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.bubble.in { background: white; }
.bubble.out { background: #d9fdd3; margin-left: auto; }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble .meta { display: flex; justify-content: flex-end; gap: 6px; color: #667781; font-size: 11px; }
.bubble.failed { outline: 1px solid #e7b2b2; }
.day-sep { text-align: center; margin: 10px 0; }
.day-sep span { background: #fff; border-radius: 8px; padding: 4px 8px; font-size: 12px; color: #546056; }
.quick { display: flex; gap: 6px; overflow: auto; padding: 8px 10px 0; background: #f0f2f5; }
.quick button { border: 0; background: white; border-radius: 999px; padding: 6px 10px; cursor: pointer; white-space: nowrap; }

.modal-back {
  position: fixed; inset: 0; z-index: 40; background: rgba(26, 24, 20, .46);
  display: flex; justify-content: center; align-items: flex-start; overflow: auto; padding: 32px 16px;
}
.modal { width: min(640px, 100%); padding: 22px; }
.modal h2 { font-size: 32px; }
.results { display: grid; gap: 4px; margin-top: 6px; }
.results button { text-align: left; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px; cursor: pointer; }
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--sidebar); color: white; border-radius: 999px; padding: 12px 16px;
}
.toast.err { background: var(--danger); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.svc { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 90px 1fr 1fr auto; gap: 8px; align-items: center; }
.token-box { background: #14241f; color: #e7f3ee; border-radius: 12px; padding: 12px; word-break: break-all; }
.install-body { background: #efe8dc; }
.install { width: min(760px, calc(100% - 28px)); margin: 28px auto; padding: 28px; }
.install h1 { font-size: 42px; margin-bottom: 8px; }
.checks { list-style: none; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks .bad strong { color: var(--danger); }
.checks .ok strong { color: var(--accent); }
.install .steps { padding-left: 18px; }

@media (max-width: 980px) {
  .hero, .login-screen, .stats, .grid-2 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; z-index: 6; }
  .side nav { display: flex; overflow: auto; }
  .side nav a { white-space: nowrap; }
  .nav-logout, .ver, .side .brand small { display: none; }
  .login-copy { min-height: 240px; }
}
@media (max-width: 800px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 210px); }
  .chat.show-thread .chat-list { display: none; }
  .chat:not(.show-thread) .chat-main { display: none; }
  .top h1 { font-size: 32px; }
  .hours-row { grid-template-columns: 1fr 1fr; }
}
