:root {
  --ink: #111015;
  --ink-2: #3b3942;
  --muted: #6e6a78;
  --line: #ececf1;
  --fill: #f3f3f6;
  --bg: #ffffff;
  --blue: #0a84ff;
  --urgent: #e5484d;
  --green: #30a46c;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)); }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--fill); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.iconbtn svg { width: 20px; height: 20px; }

h1 { font-size: 30px; line-height: 1.12; letter-spacing: -0.03em; margin: 6px 0 10px; }
h2 { font-size: 20px; letter-spacing: -0.02em; margin: 26px 0 10px; }
p.lead { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* forms */
label.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.input, select.input { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--fill); padding: 0 14px; font-size: 17px; outline: none; }
.input:focus { border-color: #c9c7d1; background: #fff; }
.phone-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.code-input { letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; font-size: 24px; }
.hint { font-size: 13px; color: var(--muted); margin-top: -6px; margin-bottom: 14px; line-height: 1.4; }
.err { color: var(--urgent); font-size: 14px; min-height: 20px; margin: 2px 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 54px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600; font-size: 17px; background: var(--fill); color: var(--ink); text-decoration: none; }
.btn.primary { background: radial-gradient(120% 140% at 50% -20%, #55525e 0%, #27252d 40%, #121116 72%, #08080b 100%); color: #fff; box-shadow: inset 0 1px 0 #ffffff59, 0 3px 0 #0b0a0e, 0 10px 22px -10px #00000070; }
.btn.google { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px #dedde3, 0 1px 2px #0000000d; }
.btn:disabled { opacity: .55; cursor: default; }
.btn + .btn { margin-top: 10px; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 0; font-size: 15px; }

/* onboarding */
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--fill); }
.steps span.on { background: var(--ink); }
.choice { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 10px; cursor: pointer; }
.choice b { display: block; font-size: 17px; margin-bottom: 4px; }
.choice span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.choice.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: #fff; box-shadow: 0 1px 3px #0000001f; color: var(--ink); }

.greeting { background: var(--fill); border-radius: var(--radius); padding: 14px 16px; font-size: 15px; line-height: 1.45; margin: 4px 0 18px; }
.greeting .who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.code-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.code-card b { font-size: 15px; }
.code-card code { grid-column: 1; font: 600 17px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; word-break: break-all; }
.code-card .actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.chip { border: 0; background: var(--fill); border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.wait { display: flex; gap: 12px; align-items: center; background: var(--fill); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.wait.ok { background: #e9f7ef; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c7d1; flex: none; animation: pulse 1.4s ease-in-out infinite; }
.wait.ok .dot { background: var(--green); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.bignum { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row div b { display: block; font-size: 16px; font-weight: 500; }
.toggle-row div span { font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #e3e3e8; border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px #0003; transition: transform .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

/* calls */
.filters { margin-bottom: 14px; }
.group { font-size: 15px; font-weight: 600; margin: 18px 0 4px; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-weight: 600; color: var(--ink-2); position: relative; }
.avatar .unread { position: absolute; left: -12px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.row .main { min-width: 0; }
.row .title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .time { color: var(--muted); font-size: 13px; text-align: right; display: grid; gap: 4px; justify-items: end; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--fill); color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.badge.urgent { background: #fde8e8; color: var(--urgent); }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; line-height: 1.5; }

/* call detail */
.call-head { text-align: center; margin: 4px 0 18px; }
.call-head .avatar { width: 64px; height: 64px; margin: 0 auto 10px; font-size: 22px; }
.call-head h1 { font-size: 26px; margin: 0 0 4px; }
.call-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; }
.call-actions a, .call-actions button { display: grid; gap: 6px; justify-items: center; text-decoration: none; font-size: 12px; color: var(--ink-2); background: none; border: 0; cursor: pointer; }
.call-actions .ic { width: 100%; height: 50px; border-radius: 14px; background: var(--fill); display: grid; place-items: center; }
.call-actions .ic.dark { background: var(--ink); color: #fff; }
.call-actions svg { width: 22px; height: 22px; }
.summary { background: var(--fill); border-radius: var(--radius); padding: 16px; }
.summary .eyebrowless { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.summary h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.summary ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.summary .meta { border-top: 1px solid #e2e1e8; margin-top: 12px; padding-top: 10px; font-size: 14px; }
audio { width: 100%; margin-top: 4px; }
.bubbles { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 18px; font-size: 16px; line-height: 1.35; }
.bubble.tilo { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.bubble.caller { align-self: flex-start; background: var(--fill); border-bottom-left-radius: 6px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }

#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }

/* plan & billing */
.choice.plan b { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.choice.plan em { font-style: normal; font-weight: 600; font-size: 16px; white-space: nowrap; }
.choice.plan em small { font-weight: 400; color: var(--muted); font-size: 13px; }
.choice.plan:hover { border-color: var(--ink-2); }
.choice.plan:disabled { opacity: .55; cursor: default; }
.meter { margin: 10px 0 14px; }
.meter p { margin: 6px 0 0; }
.meter-bar { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.meter-bar span.full { background: var(--urgent); }
