:root {
  --bg: #f2f4f5; --card: #fff; --ink: #14202e; --muted: #5a6675; --line: #dde2e6;
  --navy: #1d2d44; --teal: #08786b; --teal-soft: #d8efe9; --signal: #ffc93c; --signal-ink: #2a2100;
  --blue-soft: #dde6f3; --blue-ink: #24406a; --violet-soft: #ece4f7; --violet-ink: #4c2f7a;
  --bubble-me: #1d2d44; --bubble-me-ink: #fff; --bubble-ari: #fff;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1724; --card: #172235; --ink: #e8edf3; --muted: #9fb0c6; --line: #263550;
    --teal: #3cc8b3; --teal-soft: #12352f; --blue-soft: #1d2c46; --blue-ink: #b8cdf0;
    --violet-soft: #2b2140; --violet-ink: #d5c3f2; --bubble-me: #2fc2ad; --bubble-me-ink: #062a25; --bubble-ari: #172235;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 16px/1.45 var(--body); background: var(--bg); color: var(--ink); display: flex; flex-direction: column; }
a { color: var(--teal); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
h1, h2 { font-family: var(--display); line-height: 1.05; margin: 0 0 8px; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 700; }

.top { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
.top-shop { display: flex; align-items: center; gap: 10px; }
.top-shop b { display: block; font: 700 1.2rem/1.1 var(--display); }
.status { font-size: .82rem; color: #b9c6d8; display: inline-flex; align-items: center; gap: 6px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #3cd6be; box-shadow: 0 0 0 3px rgba(60,214,190,.25); }
.status.off i { background: #8a96a8; box-shadow: none; }
.top-link { color: #c9d3e0; font-size: .9rem; text-decoration: none; }

.sample { background: var(--signal); color: var(--signal-ink); font-size: .88rem; padding: 8px 16px; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.sample a { color: var(--signal-ink); font-weight: 600; white-space: nowrap; }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); outline: none; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; text-decoration: none; color: var(--muted); font-size: .78rem; font-weight: 600; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--teal); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--signal); color: var(--signal-ink); font-style: normal; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

/* Week summary */
.week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font: 700 2rem/1 var(--display); }
.stat span { font-size: .82rem; color: var(--muted); }

/* Feed */
.day { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.item { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; margin-bottom: 8px; cursor: pointer; }
.item:hover { border-color: var(--teal); }
.item b { display: block; font-weight: 600; }
.item p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.item time { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.tag { font-size: .72rem; font-weight: 600; padding: 4px 7px; border-radius: 5px; min-width: 54px; text-align: center; margin-top: 1px; }
.k-call { background: var(--teal-soft); color: var(--teal); }
.k-text { background: var(--blue-soft); color: var(--blue-ink); }
.k-booking { background: var(--signal); color: var(--signal-ink); }
.k-review { background: var(--violet-soft); color: var(--violet-ink); }

/* Sheet */
.sheet-scrim { position: fixed; inset: 0; background: rgba(8,14,24,.5); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86vh; overflow: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 14px; }
.sheet .meta { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.sheet .summary { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.transcript { display: grid; gap: 8px; margin: 10px 0 16px; }
.line { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: .94rem; }
.line.c { background: var(--card); border: 1px solid var(--line); justify-self: start; }
.line.a { background: var(--teal-soft); justify-self: end; }
.line small { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 11px 16px; font-weight: 600; border: 2px solid transparent; text-decoration: none; cursor: pointer; background: var(--navy); color: #fff; }
.btn.alt { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.sig { background: var(--signal); color: var(--signal-ink); }
.btn.sm { padding: 7px 11px; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .btn { background: var(--teal); color: #062a25; } .btn.alt { background: transparent; color: var(--ink); } .btn.sig { background: var(--signal); color: var(--signal-ink); } }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 260px); }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-ink); border-bottom-right-radius: 5px; }
.msg.ari { align-self: flex-start; background: var(--bubble-ari); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.typing { color: var(--muted); font-style: italic; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chip { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 7px 12px; font-size: .9rem; cursor: pointer; }
.composer { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); display: flex; gap: 8px; background: var(--bg); padding: 8px 0; }
.composer textarea { flex: 1; resize: none; font: inherit; padding: 11px 13px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); max-height: 140px; }
.composer button { border: 0; border-radius: 50%; width: 46px; height: 46px; background: var(--teal); color: #fff; cursor: pointer; font-size: 1.2rem; flex: none; }
.chat-note { font-size: .8rem; color: var(--muted); text-align: center; margin: 4px 0 0; }

/* To do */
.todo { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.todo input { width: 22px; height: 22px; accent-color: var(--teal); margin-top: 1px; flex: none; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.todo small { display: block; color: var(--muted); font-size: .84rem; }
.add { display: flex; gap: 8px; margin: 14px 0; }
.add input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* My shop */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card p { color: var(--muted); font-size: .92rem; margin: 0 0 10px; }
.card label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
.card input, .card textarea { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
.toggle { display: flex !important; grid-template-columns: none; align-items: center; justify-content: space-between; gap: 12px; }
.toggle input { width: 48px; height: 28px; accent-color: var(--teal); }
.preview { background: var(--blue-soft); color: var(--blue-ink); border-radius: 14px 14px 14px 4px; padding: 10px 12px; font-size: .94rem; margin-top: 4px; }
.plan-card { border: 2px solid var(--navy); }
@media (prefers-color-scheme: dark) { .plan-card { border-color: var(--teal); } }
.fine { font-size: .82rem; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
