:root {
  color-scheme: light;
  --ink: #12343b;
  --ink-soft: #4f6a70;
  --paper: #ffffff;
  --mist: #e8f0ee;
  --line: #d3dfdc;
  --teal: #17656f;
  --good: #1a7a55;
  --marigold: #f2b01e;
  --marigold-pale: #fdf1cf;
  --marigold-ink: #6b4a00;
  --alarm: #b3271a;
  --alarm-pale: #fbe6e3;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
[hidden] { display: none !important; }

button, input { font: inherit; }
.button {
  appearance: none; border: 0; border-radius: 6px; cursor: pointer; font-weight: 600;
  background: var(--ink); color: #fff; padding: 11px 18px; min-height: 44px;
}
.button:hover { background: var(--teal); }
.button:disabled { opacity: .55; cursor: default; }
.button-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.button-quiet:hover { background: var(--mist); }
.link-button { appearance: none; background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; text-decoration: underline; min-height: 44px; }

/* Shell: a rail on wide screens, tabs at the bottom on phones. */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--ink); color: #fff; padding: 24px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.company { font-weight: 700; font-size: 17px; line-height: 1.25; padding: 0 12px 20px; overflow-wrap: anywhere; }
.tab { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; color: #d6e6e3; text-decoration: none; }
.tab:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.tab[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; }
.rail-foot { margin-top: auto; padding: 0 12px; font-size: 14px; color: #a9c4c0; overflow-wrap: anywhere; }
.rail-foot .link-button { color: #fff; display: block; }

.page { padding: 40px clamp(16px, 5vw, 56px) 56px; max-width: 980px; width: 100%; }
.page-title { font-size: 26px; line-height: 1.2; font-weight: 700; margin-bottom: 20px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.error-text { color: var(--alarm); }

/* The band that says WhatsApp needs a person. It is the loudest thing on any page. */
.band { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px clamp(16px, 5vw, 56px); background: var(--alarm); color: #fff; font-weight: 600; }
.band .button { background: #fff; color: var(--alarm); }
.band-warn { background: var(--marigold); color: var(--ink); }
.band-warn .button { background: var(--ink); color: #fff; }
.band-quiet { background: var(--mist); color: var(--ink); font-weight: 400; }

/* Replies left: the headline of the product. */
.allowance { margin-bottom: 40px; }
.allowance-figure { font-size: clamp(44px, 9vw, 76px); line-height: 1.02; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.allowance-words { font-size: clamp(19px, 3vw, 24px); margin-top: 4px; }
.meter { height: 14px; background: var(--mist); margin: 20px 0 10px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--teal); min-width: 2px; }
.meter-fill.warn { background: var(--marigold); }
.meter-fill.full { background: var(--alarm); }
.allowance-facts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 24px; font-variant-numeric: tabular-nums; }

.section-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.facts { margin: 0 0 36px; }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact dt { color: var(--ink-soft); }
.fact dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.fact-good { color: var(--good); }
.fact-bad { color: var(--alarm); }
.fact a { color: var(--teal); }

/* WhatsApp */
.state-line { font-size: clamp(24px, 4vw, 32px); font-weight: 700; line-height: 1.2; margin-bottom: 8px; }
.state-good { color: var(--good); }
.state-bad { color: var(--alarm); }
.link-area { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; margin: 24px 0; }
.qr { width: 280px; height: 280px; background: var(--mist); display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; }
.qr img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.steps { margin: 0 0 16px; padding-left: 22px; }
.steps li { margin-bottom: 8px; }
.notice { padding: 12px 14px; background: var(--marigold-pale); color: var(--marigold-ink); margin: 16px 0; border-left: 4px solid var(--marigold); }
.notice-bad { background: var(--alarm-pale); color: var(--alarm); border-left-color: var(--alarm); }
.pairing { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pairing-code { font-size: 28px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1 1 200px; }

/* Conversations */
.inbox { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); height: 100vh; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; }
.inbox-title { font-size: 26px; font-weight: 700; padding: 40px 16px 12px; }
.chat-row { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.chat-row:hover { background: var(--mist); }
.chat-row[aria-current="true"] { background: var(--mist); box-shadow: inset 4px 0 0 var(--teal); }
.chat-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-name { font-weight: 600; overflow-wrap: anywhere; }
.chat-time { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.chat-preview { font-size: 14px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag { display: inline-block; font-size: 13px; font-weight: 600; padding: 0 7px; margin: 4px 4px 0 0; border-radius: 3px; background: var(--marigold-pale); color: var(--marigold-ink); }
.flag-bad { background: var(--alarm-pale); color: var(--alarm); }

.thread { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.thread-head { padding: 16px clamp(16px, 3vw, 28px); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.thread-name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px clamp(16px, 3vw, 28px); background: var(--mist); display: flex; flex-direction: column; gap: 10px; }
.thread-empty { margin: auto; text-align: center; max-width: 340px; padding: 24px; }
.back-link { display: none; color: var(--teal); min-height: 44px; align-items: center; }

.bubble { max-width: min(78%, 620px); padding: 8px 12px; border-radius: 8px; background: var(--paper); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble-ai { align-self: flex-end; background: #cfe6e4; }
.bubble-human { align-self: flex-end; background: var(--marigold-pale); box-shadow: inset 3px 0 0 var(--marigold); }
.bubble-system { align-self: center; background: transparent; color: var(--ink-soft); font-size: 14px; }
.bubble-meta { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 2px; white-space: normal; }
.bubble-failed { display: block; font-size: 13px; color: var(--alarm); font-weight: 600; }

/* Sign-in */
.signin { min-height: 100%; background: var(--ink); display: flex; align-items: center; justify-content: center; padding: 16px; }
.signin-form { background: var(--paper); padding: 32px clamp(20px, 5vw, 36px); width: 100%; max-width: 400px; border-radius: 6px; }
.signin-form h1 { font-size: 24px; line-height: 1.2; margin-bottom: 6px; }
.field { display: block; margin-top: 16px; font-weight: 600; font-size: 15px; }
.field input, .inline-form input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; min-height: 44px; font-weight: 400;
  border: 1px solid #93aaa6; border-radius: 6px; background: #fff; color: var(--ink);
}
.signin-form .button { width: 100%; margin: 20px 0 12px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 60px; }
  .rail { position: fixed; z-index: 5; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px; gap: 2px; }
  .company, .rail-foot { display: none; }
  .tab { flex: 1 1 0; justify-content: center; padding: 0 2px; font-size: 13.5px; text-align: center; }
  .page { padding-top: 24px; }
  .signout-mobile { display: block !important; }
  .link-area { grid-template-columns: minmax(0, 1fr); }
  .qr { width: 100%; max-width: 300px; height: auto; aspect-ratio: 1; margin: 0 auto; }
  .inbox { display: block; height: auto; }
  .inbox-list { border-right: 0; }
  .inbox-title { padding-top: 24px; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .thread { height: calc(100vh - 60px); }
  .back-link { display: inline-flex; width: 100%; }
  .bubble { max-width: 90%; }
}
.signout-mobile { display: none; margin-top: 24px; }
.action-row { margin-top: 16px; }
