:root {
  --ink: #0f1b2d;
  --ink-soft: #3d4a5c;
  --muted: #6b7686;
  --bg: #f1eee8;
  --card: #ffffff;
  --line: #e4e0d8;
  --accent: #e8611a;
  --navy: #0f1b2d;
  --sms-out: #34c759;
  --sms-in: #e9e9eb;
  --danger: #d92d20;
  --ok: #12825b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: "Archivo", "Inter", sans-serif; margin: 0 0 .4em; line-height: 1.15; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); font-size: 14px; margin: 0; }

/* Brand */
.brand { display: flex; align-items: center; gap: 8px; font-family: "Archivo", sans-serif; font-weight: 800; font-size: 17px; margin-bottom: 18px; }
.brand.light { color: #fff; margin: 0; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.tag { font: 600 12px "Inter", sans-serif; background: rgba(255,255,255,.14); padding: 3px 8px; border-radius: 99px; color: #dfe5ee; }

/* Buttons + forms */
.btn { appearance: none; border: 0; background: var(--accent); color: #fff; font: 700 15px "Inter", sans-serif; padding: 12px 18px; border-radius: 10px; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-small { padding: 7px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.screen.center { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.narrow-card { width: 100%; max-width: 440px; display: grid; gap: 12px; }
.narrow-card h1 { font-size: 28px; margin: 0; }
.narrow-card p { margin: 0; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
input, select { font: 16px "Inter", sans-serif; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
.check input { width: auto; margin-top: 3px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-out { font-size: 13px; word-break: break-all; background: #f6f4f0; border-radius: 8px; padding: 10px; color: var(--ink-soft); }

/* Demo layout */
#demo { min-height: 100%; display: flex; flex-direction: column; }
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; gap: 12px; }
.tabs { display: none; }
.stage { flex: 1; display: flex; justify-content: center; align-items: flex-start; gap: 40px; padding: 28px 20px 40px; }
.caption { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 10px; text-align: center; }
.phone-col { flex: 0 0 auto; }
.owner-col { flex: 1 1 420px; max-width: 460px; display: grid; gap: 16px; align-content: start; }
.owner-col .caption { text-align: left; margin-bottom: -6px; }

/* Phone frame */
.phone {
  position: relative;
  width: 372px;
  height: 760px;
  background: #fff;
  border: 12px solid #101114;
  border-radius: 52px;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(15, 27, 45, .45);
  display: flex;
  flex-direction: column;
}
.phone-notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 110px; height: 30px; background: #101114; border-radius: 20px; z-index: 5; }

/* Call screen */
.call { flex: 1; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(180deg, #3b4656, #1a212c); color: #fff; padding: 90px 24px 60px; text-align: center; }
.call-avatar { width: 92px; height: 92px; border-radius: 50%; background: #6b7686; display: grid; place-items: center; margin: 0 auto 16px; font: 700 38px "Inter", sans-serif; }
.call-name { font-size: 28px; font-weight: 600; }
.call-status { color: #c6cdd8; margin-top: 6px; font-size: 17px; }
.call-start { width: 74px; height: 74px; border-radius: 50%; border: 0; background: #34c759; display: grid; place-items: center; margin: 0 auto; cursor: pointer; }
.call-start.end { background: #ff3b30; }
.call-start.end svg { transform: rotate(135deg); }
.call-start:disabled { cursor: default; }
.call-hint { color: #c6cdd8; font-size: 14px; margin: 14px 0 0; }
.ringing .call-avatar { animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 50% { box-shadow: 0 0 0 16px rgba(255,255,255,0); } }

/* SMS screen */
.sms { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sms-head { padding: 48px 12px 10px; text-align: center; border-bottom: 1px solid #ececec; background: #f8f8f8; }
.sms-avatar { width: 44px; height: 44px; border-radius: 50%; background: #9aa3af; color: #fff; display: grid; place-items: center; margin: 0 auto 4px; font-weight: 700; }
.sms-name { font-size: 13px; font-weight: 600; }
.sms-list { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 8px 13px; border-radius: 18px; font-size: 15.5px; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; animation: pop .18s ease-out; }
.msg.in { align-self: flex-start; background: var(--sms-in); color: #000; border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end; background: var(--sms-out); color: #fff; border-bottom-right-radius: 6px; }
.msg.link { background: #fff; border: 1px solid #ddd; color: #000; padding: 0; overflow: hidden; cursor: pointer; text-align: left; font: inherit; max-width: 78%; align-self: flex-start; border-radius: 18px; }
.msg.link .link-top { background: var(--navy); color: #fff; padding: 12px 14px; font-weight: 700; font-size: 15px; }
.msg.link .link-bottom { padding: 8px 14px 10px; font-size: 13px; color: #555; }
.sys { align-self: center; font-size: 12px; color: #8e8e93; margin: 6px 0; text-align: center; }
.typing { align-self: flex-start; background: var(--sms-in); border-radius: 18px; padding: 12px 14px; display: flex; gap: 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #8e8e93; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid #d1d1d6; background: #fff; border-radius: 99px; padding: 6px 12px; font: 500 13px "Inter", sans-serif; color: #1c1c1e; cursor: pointer; }
.chip:hover { background: #f2f2f7; }

.sms-input { display: flex; gap: 8px; padding: 8px 10px 22px; border-top: 1px solid #ececec; }
.sms-input input { border-radius: 99px; padding: 9px 14px; font-size: 15.5px; }
.sms-input button { flex: 0 0 36px; height: 36px; border-radius: 50%; border: 0; background: var(--sms-out); display: grid; place-items: center; cursor: pointer; align-self: center; }
.sms-input button:disabled { background: #c7c7cc; }

/* Booking sheet */
.sheet { position: absolute; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; z-index: 6; }
.sheet-card { background: #fff; width: 100%; border-radius: 22px 22px 0 0; padding: 12px 18px 26px; animation: up .22s ease-out; }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: #d1d1d6; margin: 0 auto 14px; }
.sheet h3 { font-size: 19px; margin: 0; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.slot { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px; font: 600 14px "Inter", sans-serif; cursor: pointer; color: var(--ink); }
.slot small { display: block; color: var(--muted); font-weight: 500; }
.slot:hover { border-color: var(--accent); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Owner view */
.alert { background: #fff1f0; border: 1px solid #ffc9c4; border-left: 5px solid var(--danger); border-radius: 14px; padding: 16px 18px; animation: pop .2s ease-out; }
.alert-head { display: flex; align-items: center; gap: 10px; color: var(--danger); font-size: 14px; letter-spacing: .06em; }
.alert p { margin: 8px 0; color: var(--ink); font-weight: 500; }
.alert-call { font-size: 14px; color: var(--ink-soft); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,45,32,.5); } 100% { box-shadow: 0 0 0 12px rgba(217,45,32,0); } }

.lead-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.lead h2, .log h2 { font-size: 18px; margin: 0; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: #eef0f3; color: var(--ink-soft); white-space: nowrap; }
.badge.hot { background: #fde3e1; color: var(--danger); }
.badge.good { background: #dcf3e9; color: var(--ok); }
.fields { margin: 0; display: grid; }
.fields div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid #f0ede7; }
.fields dt { color: var(--muted); font-size: 14px; }
.fields dd { margin: 0; font-weight: 600; font-size: 15px; }
.fields dd.empty { color: #b3b9c2; font-weight: 400; }
.fields dd.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: #fff3c4; } 100% { background: transparent; } }
.log ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.log li { display: grid; grid-template-columns: 62px 1fr; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.log li time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log li.hot { color: var(--danger); font-weight: 600; }
.log li.good { color: var(--ok); font-weight: 600; }
.log li:empty { display: none; }

/* Mobile: one pane at a time, frameless phone */
@media (max-width: 899px) {
  .tabs { display: flex; background: var(--navy); padding: 0 12px 10px; gap: 6px; }
  .tab { flex: 1; appearance: none; border: 0; border-radius: 10px; padding: 9px; font: 600 14px "Inter", sans-serif; background: rgba(255,255,255,.1); color: #cfd6e0; cursor: pointer; position: relative; }
  .tab.is-active { background: #fff; color: var(--ink); }
  .dot { position: absolute; top: 7px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  .stage { padding: 0; gap: 0; flex-direction: column; align-items: stretch; }
  .stage [data-pane] { display: none; }
  .stage [data-pane].is-visible { display: grid; }
  .phone-col.is-visible { display: flex; flex: 1; }
  .phone-col .caption { display: none; }
  .phone { width: 100%; height: calc(100dvh - 110px); border: 0; border-radius: 0; box-shadow: none; }
  .phone-notch { display: none; }
  .call { padding-top: 48px; }
  .sms-head { padding-top: 10px; }
  .owner-col { max-width: none; padding: 16px; }
  .row { grid-template-columns: 1fr; }
}
