/* Owner-facing design: sign-in, setup and the owner app. Calm, roomy and familiar, in the style of an
   iPhone's own setup and Settings: large titles, grouped lists, pill buttons, system colours. */
/* Bright and calm: a white base with soft colour glows (light), or deep navy instead of black (dark). */
:root {
  --bg: #fbfbfe;
  --bg-elevated: #ffffff;
  --fill: rgba(94, 92, 230, 0.07);
  --fill-strong: rgba(60, 60, 110, 0.14);
  --label: #14142b;
  --label-2: rgba(40, 40, 80, 0.62);
  --label-3: rgba(40, 40, 80, 0.3);
  --separator: rgba(40, 40, 90, 0.1);
  --blue: #2f6bff;
  --green: #22c55e;
  --orange: #ff8a00;
  --red: #ff3b5c;
  --indigo: #6d5dfc;
  --bar: rgba(255, 255, 255, 0.8);
  --radius: 16px;
  --ink-on-tint: #ffffff;
  --accent-grad: linear-gradient(135deg, #2f6bff 0%, #6d5dfc 60%, #a855f7 100%);
  --shadow: 0 1px 2px rgba(30, 30, 80, 0.04), 0 6px 20px rgba(60, 60, 140, 0.07);
  --glow: radial-gradient(60% 45% at 0% 0%, rgba(47, 107, 255, 0.13), transparent 70%), radial-gradient(50% 40% at 100% 10%, rgba(168, 85, 247, 0.12), transparent 70%), radial-gradient(60% 45% at 50% 100%, rgba(255, 138, 0, 0.08), transparent 70%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1330;
    --bg-elevated: #1a2147;
    --fill: rgba(150, 160, 255, 0.1);
    --fill-strong: rgba(150, 160, 255, 0.2);
    --label: #f4f5ff;
    --label-2: rgba(225, 228, 255, 0.66);
    --label-3: rgba(225, 228, 255, 0.32);
    --separator: rgba(160, 170, 255, 0.16);
    --blue: #5b8cff;
    --green: #34d77b;
    --orange: #ffa53a;
    --red: #ff5c78;
    --indigo: #8b7dff;
    --bar: rgba(16, 21, 52, 0.82);
    --accent-grad: linear-gradient(135deg, #3d7bff 0%, #7a6bff 60%, #b26bff 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 20, 0.25);
    --glow: radial-gradient(60% 45% at 0% 0%, rgba(61, 123, 255, 0.28), transparent 70%), radial-gradient(50% 40% at 100% 10%, rgba(178, 107, 255, 0.22), transparent 70%), radial-gradient(60% 45% at 50% 100%, rgba(255, 120, 80, 0.1), transparent 70%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1330; --bg-elevated: #1a2147; --fill: rgba(150, 160, 255, 0.1); --fill-strong: rgba(150, 160, 255, 0.2);
  --label: #f4f5ff; --label-2: rgba(225, 228, 255, 0.66); --label-3: rgba(225, 228, 255, 0.32); --separator: rgba(160, 170, 255, 0.16);
  --blue: #5b8cff; --green: #34d77b; --orange: #ffa53a; --red: #ff5c78; --indigo: #8b7dff; --bar: rgba(16, 21, 52, 0.82);
  --accent-grad: linear-gradient(135deg, #3d7bff 0%, #7a6bff 60%, #b26bff 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 20, 0.25);
  --glow: radial-gradient(60% 45% at 0% 0%, rgba(61, 123, 255, 0.28), transparent 70%), radial-gradient(50% 40% at 100% 10%, rgba(178, 107, 255, 0.22), transparent 70%), radial-gradient(60% 45% at 50% 100%, rgba(255, 120, 80, 0.1), transparent 70%);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--glow), var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  color: var(--label);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--label-2); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Setup-style screens: one idea per page ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom)); animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.screen .body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.screen .foot { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; }
.hero { text-align: center; }
.hero h1, .title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.03em; margin: 18px 0 10px; }
.hero p.sub, .sub { font-size: 17px; color: var(--label-2); margin: 0 auto; max-width: 30em; }
.glyph { width: 72px; height: 72px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--accent-grad); box-shadow: 0 10px 30px rgba(10, 132, 255, 0.3); }
.glyph svg { width: 38px; height: 38px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .fade { animation: none !important; } }

/* Progress dots, like the iPhone setup pages */
.dots { display: flex; gap: 7px; justify-content: center; padding: 6px 0 2px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--fill-strong); transition: background 0.3s, transform 0.3s; }
.dots span.done { background: var(--label-3); }
.dots span.now { background: var(--accent-grad); transform: scale(1.25); }

/* ---------- Buttons ---------- */
button, .btn {
  appearance: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; padding: 0 22px; border-radius: 14px; background: var(--accent-grad); color: var(--ink-on-tint); box-shadow: 0 6px 18px rgba(80, 90, 255, 0.22);
  transition: transform 0.12s, opacity 0.2s, background 0.2s;
}
button:active, .btn:active { transform: scale(0.97); opacity: 0.85; }
button:disabled { opacity: 0.4; cursor: default; }
.btn-block { width: 100%; }
button.tinted, .btn.tinted { background: color-mix(in srgb, var(--blue) 13%, transparent); color: var(--blue); box-shadow: none; }
button.plain, .btn.plain { background: transparent; color: var(--blue); min-height: 44px; font-weight: 500; box-shadow: none; }
button.danger, .btn.danger { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); box-shadow: none; }
button.ok, .btn.ok { background: linear-gradient(135deg, #22c55e, #10b981); box-shadow: 0 6px 18px rgba(34, 197, 94, 0.25); }
button.small:not(.tinted):not(.plain):not(.danger):not(.secondary) { box-shadow: 0 3px 10px rgba(80, 90, 255, 0.18); }
button.small, .btn.small { min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 15px; }

/* ---------- Fields ---------- */
input, textarea, select {
  width: 100%; font: inherit; color: var(--label); background: var(--bg-elevated); border: 0; border-radius: 12px;
  padding: 14px 16px; min-height: 52px; outline: none; box-shadow: inset 0 0 0 1px var(--separator); transition: box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 2px var(--blue); }
textarea { min-height: 120px; resize: vertical; line-height: 1.4; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
label.field { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--label-2); margin: 18px 4px 6px; font-weight: 500; }
/* iOS switch */
input[type="checkbox"].switch { appearance: none; width: 51px; min-width: 51px; height: 31px; min-height: 31px; padding: 0; border-radius: 16px; background: var(--fill-strong); box-shadow: none; position: relative; cursor: pointer; transition: background 0.25s; }
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.25s; }
input[type="checkbox"].switch:checked { background: var(--green); }
input[type="checkbox"].switch:checked::after { transform: translateX(20px); }

/* ---------- Grouped lists (Settings style) ---------- */
.section-head { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--label-2); margin: 26px 16px 7px; font-weight: 500; display: flex; justify-content: space-between; }
.section-foot { font-size: 13px; color: var(--label-2); margin: 7px 16px 0; }
.group { background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.group > .item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; min-height: 48px; position: relative; }
.group > .item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
.group > .item.tap { cursor: pointer; }
.group > .item.tap:active { background: var(--fill); }
.item .chev { color: var(--label-3); font-size: 20px; line-height: 1; }
.item .value { color: var(--label-2); }
.item .icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.item .icon svg { width: 18px; height: 18px; }
.group .pad { padding: 14px 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: linear-gradient(135deg, #8e8e93, #636366); flex: none; }

.card { background: var(--bg-elevated); border-radius: var(--radius); padding: 16px; margin: 10px 0; position: relative; box-shadow: var(--shadow); }
.card.accent-red { box-shadow: inset 4px 0 0 var(--red); }
.card.accent-orange { box-shadow: inset 4px 0 0 var(--orange); }
.card.accent-green { box-shadow: inset 4px 0 0 var(--green); }
.card h3 { margin: 0 0 4px; font-size: 17px; }
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--fill); color: var(--label-2); white-space: nowrap; }
.badge.red { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.badge.orange { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.badge.green { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge.blue { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.empty { text-align: center; color: var(--label-2); padding: 18px 12px; font-size: 15px; }

/* ---------- App shell: large title + bottom tab bar ---------- */
.app { max-width: 720px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 2px 0 2px; }
.subtitle { color: var(--label-2); font-size: 15px; margin: 0 0 6px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--separator); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .inner { display: flex; width: 100%; max-width: 720px; }
.tabbar button, .orb { box-shadow: none; }
.tabbar button { flex: 1; flex-direction: column; gap: 2px; background: transparent; color: var(--label-2); font-size: 10.5px; font-weight: 500; min-height: 54px; padding: 6px 0 4px; border-radius: 0; position: relative; }
.tabbar button svg { width: 25px; height: 25px; }
.tabbar button.active { color: var(--blue); }
.tabbar .count { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; font-weight: 600; }
.fade { animation: rise 0.3s ease-out; }

/* Full-screen sheet (a conversation) */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--glow), var(--bg); display: flex; flex-direction: column; animation: slideup 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet header { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 0.5px solid var(--separator); }
.sheet header .t { flex: 1; text-align: center; font-weight: 600; }
.sheet .scroll { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.sheet .composer { display: flex; gap: 8px; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid var(--separator); }
.sheet .composer input { border-radius: 20px; min-height: 40px; padding: 8px 14px; }
.sheet .composer button { min-height: 40px; border-radius: 20px; padding: 0 16px; }
.bubble { max-width: 78%; padding: 8px 13px; border-radius: 19px; white-space: pre-wrap; word-wrap: break-word; font-size: 16px; }
.bubble.in { align-self: flex-start; background: var(--bg-elevated); box-shadow: var(--shadow); }
.bubble.out { align-self: flex-end; background: var(--accent-grad); color: #fff; }
.bubble.owner { background: var(--green); }
.bubble .meta { display: block; font-size: 11px; opacity: 0.7; margin-top: 3px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; }

/* Stats (usage) */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg-elevated); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 30px; letter-spacing: -0.02em; }

/* ---------- The talk button: a glowing orb, like Siri ---------- */
.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 18px 0 8px; }
.orb { width: 96px; height: 96px; min-height: 96px; padding: 0; border-radius: 50%; position: relative; background: transparent; isolation: isolate; }
.orb::before, .orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.orb::before { background: conic-gradient(from 0deg, #0a84ff, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #30d158, #64d2ff, #0a84ff); filter: blur(10px); opacity: 0.55; transition: opacity 0.3s, filter 0.3s; }
.orb::after { inset: 8px; background: radial-gradient(circle at 35% 30%, #ffffff 0%, #c9e4ff 22%, #6aa9ff 55%, #5e5ce6 100%); box-shadow: inset 0 -6px 16px rgba(0, 0, 0, 0.18); }
.orb svg { position: relative; z-index: 1; width: 34px; height: 34px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.orb.listening::before { opacity: 1; filter: blur(16px); animation: spin 3s linear infinite; }
.orb.listening::after { animation: breathe 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .orb.listening::before, .orb.listening::after { animation: none; } }
.orb-label { font-size: 15px; color: var(--label-2); font-weight: 500; }

/* Speech bubble for "a customer texts..." */
.texted { align-self: flex-start; background: var(--bg-elevated); border-radius: 19px; padding: 10px 14px; max-width: 85%; font-size: 16px; margin: 6px auto 0 0; }
.texted-from { font-size: 12px; color: var(--label-2); margin: 0 0 4px 6px; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--fill); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; margin: 8px 0; }

/* QR codes stay black on white in dark mode, so phone cameras can read them. */
.qr { background: #fff; padding: 12px; border-radius: 16px; width: 232px; box-shadow: var(--shadow); }
.qr svg { display: block; width: 100%; height: auto; }
