/*
 * Built for a cheap Android phone on a bad connection: no webfont download, no
 * framework, no layout shift. The type does the work through scale and weight.
 */

:root {
  --ink:      #10222A;
  --ink-soft: #4A5F68;
  --surface:  #F6F7F6;
  --card:     #FFFFFF;
  --line:     #DFE5E2;
  --deep:     #1B4348;
  --ok:       #3E7C5A;
  --low:      #B8621B;
  --out:      #9E2B25;
  --focus:    #2F6F78;

  --pad: 1.125rem;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,34,42,.06), 0 6px 16px rgba(16,34,42,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.view { max-width: 34rem; margin: 0 auto; padding: 0 var(--pad) 4rem; }

/* ---------- bar ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 34rem; margin: 0 auto; padding: 1rem var(--pad);
}
.mark {
  font-weight: 700; letter-spacing: -.02em; color: var(--deep); font-size: 1.05rem;
}
.bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: .25rem; }
.language-switch {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--line); border-radius: 9px;
}
.language-button {
  border: 0; border-radius: 7px; min-height: 36px; padding: .35rem .6rem;
  background: transparent; color: var(--ink-soft); font: inherit; font-size: .78rem;
  cursor: pointer;
}
.language-button[aria-pressed="true"] {
  background: var(--card); color: var(--deep); font-weight: 700;
  box-shadow: 0 1px 2px rgba(16,34,42,.12);
}

/* ---------- signed out ---------- */
.welcome { padding-top: 12vh; }
.welcome h1 {
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 0 0 .6rem;
}
.welcome p { color: var(--ink-soft); margin: 0 0 1.6rem; }
.fine { color: var(--ink-soft); font-size: .85rem; }
.fine.center { text-align: center; margin-top: 2rem; }

/* ---------- account strip ---------- */
.account {
  background: var(--deep); color: #EAF2F0;
  border-radius: var(--radius); padding: var(--pad);
  margin-bottom: 1.25rem;
}
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.eyebrow {
  display: block; text-transform: uppercase; letter-spacing: .09em;
  font-size: .68rem; font-weight: 600; opacity: .72;
}
.acct-num {
  font-size: 2rem; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.account .fine { color: #B9CFCB; margin: .5rem 0 0; }
.account .btn { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.account .btn:hover { background: rgba(255,255,255,.22); }

/* ---------- main line callout ---------- */
.callout {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--deep);
  border-radius: var(--radius); padding: .9rem var(--pad);
  margin-bottom: 1.25rem; font-size: .95rem;
}
.callout p { margin: 0; color: var(--ink-soft); }
.callout strong { color: var(--ink); }
.strongnum {
  color: var(--deep); font-weight: 700; font-variant-numeric: tabular-nums;
  text-decoration: none; white-space: nowrap;
}
.strongnum:hover { text-decoration: underline; }

/* ---------- person card ---------- */
.person {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad);
  margin-bottom: 1rem; box-shadow: var(--shadow);
}
.person-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.person-name { font-size: 1.05rem; margin: 0; letter-spacing: -.01em; }
.doc { color: var(--ink-soft); font-size: .8rem; font-variant-numeric: tabular-nums; }

.line {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  margin: .6rem 0 0; font-size: .95rem;
}
.line-label {
  text-transform: uppercase; letter-spacing: .08em; font-size: .68rem;
  font-weight: 600; color: var(--ink-soft);
}
.line-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.line-num.none { color: var(--ink-soft); font-weight: 400; }
.numbtn { padding: 0 .25rem; min-height: 0; }

/* the signature: the balance stated as a sentence, not a number */
.reach {
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  line-height: 1.15; letter-spacing: -.025em; font-weight: 650;
  margin: .85rem 0 .2rem;
}
.reach-sub { color: var(--ink-soft); margin: 0 0 .8rem; font-size: .95rem; }

.meter { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .35s ease; }
.person[data-state="low"] .fill { background: var(--low); }
.person[data-state="out"] .fill { background: var(--out); }
.person[data-state="low"] .reach { color: var(--low); }
.person[data-state="out"] .reach { color: var(--out); }

.actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }

/* ---------- allocate ---------- */
.allocate { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.alloc-label { display: block; font-weight: 600; margin-bottom: .6rem; font-size: .95rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 99px; padding: .55rem .9rem; font: inherit; font-size: .9rem;
  cursor: pointer; min-height: 44px;
}
.chip[aria-pressed="true"] { border-color: var(--deep); background: #EDF3F2; font-weight: 600; }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.alloc-actions { display: flex; align-items: center; gap: .75rem; margin-top: .9rem; }

/* ---------- voicemail ---------- */
.vms { list-style: none; margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line); }
.vms li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; }
.vms li + li { border-top: 1px solid var(--line); }
.vm-when { font-weight: 600; font-size: .95rem; }
.vm-exp { color: var(--ink-soft); font-size: .8rem; }
.vms audio { width: 100%; margin-top: .4rem; }
.vm-empty { color: var(--ink-soft); font-size: .9rem; padding: .5rem 0; }

/* ---------- add someone ---------- */
.add-person { margin-bottom: 1.25rem; }
.field {
  width: 100%; font: inherit; font-size: 1rem; padding: .7rem .8rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); margin-bottom: .35rem; min-height: 46px;
}
.field:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
#addForm .alloc-label { margin-top: .8rem; }
.remove-person { margin-left: auto; }

/* ---------- panel / switch ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel h2 { font-size: 1rem; margin: 0; }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.track {
  width: 46px; height: 28px; border-radius: 99px; background: var(--line);
  position: relative; transition: background .2s ease; flex: none;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s ease;
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-label { font-size: .9rem; color: var(--ink-soft); min-width: 2.2rem; }
.warn { color: var(--low); font-size: .9rem; margin: .6rem 0 0; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: .7rem 1.05rem; min-height: 46px;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn-primary:hover { background: #16383C; }
.btn-lg { width: 100%; font-size: 1.05rem; padding: .95rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link {
  background: none; border: 0; color: var(--ink-soft); font: inherit;
  font-size: .9rem; text-decoration: underline; cursor: pointer;
  padding: .5rem; min-height: 44px;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .75rem 1.1rem;
  border-radius: 10px; font-size: .92rem; max-width: calc(100vw - 2rem);
  box-shadow: 0 8px 24px rgba(16,34,42,.28); z-index: 20;
}
.toast[data-kind="error"] { background: var(--out); }

.skeleton { color: var(--ink-soft); padding: 2rem 0; text-align: center; }
.help-view { padding-top: 1.5rem; }
.help-panel h1 { margin-top: 0; }
.help-panel p:last-child { margin-bottom: 0; }

@media (max-width: 27rem) {
  .bar { align-items: flex-start; }
  .bar-actions { flex-wrap: wrap; }
  .language-switch { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
