/* Liberty Adjustment app
   Layout: one phone-width column; navy header carries the screen title, white cards on a cool grey ground,
   evidence-marker yellow for anything that needs action. */
:root {
  --ground: #EEF1F4;
  --surface: #FFFFFF;
  --ink: #12243A;
  --ink-2: #3A4A5C;
  --muted: #4A5A6B;
  --line: #C9D3DD;
  --field: #5F7690;
  --header: #12243A;
  --header-2: #1D3550;
  --header-ink: #FFFFFF;
  --header-muted: #C3CEDA;
  --accent: #F5B80A;
  --on-accent: #12243A;
  --primary: #12243A;
  --on-primary: #FFFFFF;
  --chip: #DCE4EC;
  --ok: #1F6B45;
  --ok-bg: #DDF0E5;
  --danger: #A8261E;
  --danger-bg: #FBE4E2;
  --internal-bg: #F4F1E4;
  --focus: #1F66D1;

  --display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0B1522; --surface: #14233A; --ink: #E6ECF2; --ink-2: #C3CEDA; --muted: #9AABBD; --line: #2A3D55; --field: #6E86A0;
    --header: #0F1E31; --header-2: #1B3049; --header-ink: #FFFFFF; --header-muted: #AFBDCC;
    --accent: #F5B80A; --on-accent: #12243A; --primary: #F5B80A; --on-primary: #12243A; --chip: #22364F;
    --ok: #79D7A6; --ok-bg: #173A2A; --danger: #FF9C94; --danger-bg: #3D1C1A; --internal-bg: #2A2818; --focus: #7FB0FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0B1522; --surface: #14233A; --ink: #E6ECF2; --ink-2: #C3CEDA; --muted: #9AABBD; --line: #2A3D55; --field: #6E86A0;
  --header: #0F1E31; --header-2: #1B3049; --header-ink: #FFFFFF; --header-muted: #AFBDCC;
  --accent: #F5B80A; --on-accent: #12243A; --primary: #F5B80A; --on-primary: #12243A; --chip: #22364F;
  --ok: #79D7A6; --ok-bg: #173A2A; --danger: #FF9C94; --danger-bg: #3D1C1A; --internal-bg: #2A2818; --focus: #7FB0FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2 { text-wrap: balance; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sel { user-select: text; -webkit-user-select: text; overflow-wrap: anywhere; }
.boot { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }

/* ---------- header ---------- */
.bar {
  background: var(--header);
  color: var(--header-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 20px 20px;
}
.bar-in, .main, .tabs-in, .auth-body, .auth-hero { max-width: 560px; margin-inline: auto; }
.bar-in { display: flex; flex-direction: column; gap: 12px; }
.bar-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: var(--display); font-stretch: 118%; font-weight: 800; font-size: 16px; }
.mark {
  /* Records-stamp mark from the Liberty logo: double yellow border, slight tilt */
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  background: transparent; color: var(--accent);
  border: 2.5px solid var(--accent);
  box-shadow: inset 0 0 0 2px var(--header), inset 0 0 0 3px var(--accent);
  transform: rotate(-4deg);
  font-family: var(--display); font-stretch: 120%; font-weight: 900; font-size: 14px;
}
.mark-lg { width: 64px; height: 64px; font-size: 26px; border-width: 4px; box-shadow: inset 0 0 0 4px var(--header), inset 0 0 0 5.5px var(--accent); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding-right: 8px; color: var(--header-muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.demo-tag { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--header-muted); color: var(--header-muted); padding: 2px 8px; }
.bar h1 { margin: 0; font-family: var(--display); font-stretch: 120%; font-weight: 900; font-size: 30px; line-height: 1.05; letter-spacing: -.005em; }
.kicker { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--header-muted); font-size: 14px; }
.bar-sub { margin: 0; color: var(--header-muted); font-size: 14px; }

.stats { display: flex; gap: 8px; }
.stat { flex: 1; min-width: 0; background: var(--header-2); padding: 10px 12px; }
.stat.hot { background: var(--accent); color: var(--on-accent); }
.stat-n { font-family: var(--mono); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12.5px; line-height: 1.25; color: var(--header-muted); }
.stat.hot .stat-l { color: var(--on-accent); }

.seg { display: flex; background: var(--header-2); padding: 4px; gap: 4px; }
.seg-b { flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--header-muted); font-weight: 600; font-size: 15px; cursor: pointer; }
.seg-b.on { background: var(--surface); color: var(--ink); }
.seg-n { font-family: var(--mono); font-size: 13px; font-weight: 600; }

/* ---------- main ---------- */
.main {
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 96px);
  display: flex; flex-direction: column; gap: 14px;
}
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); padding: 14px 16px; text-decoration: none; color: var(--ink);
  border: 1px solid transparent;
}
.card:active { border-color: var(--field); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.card-who { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.card-title { font-weight: 700; font-size: 17px; line-height: 1.25; }
.card-loc { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.card-loc svg { flex: none; margin-top: 2px; }
.card-meta { font-size: 13px; color: var(--muted); }

.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; white-space: nowrap; font-family: var(--body); }
.pill-new { background: var(--accent); color: var(--on-accent); }
.pill-active { background: var(--chip); color: var(--ink); }
.pill-done { background: var(--ok-bg); color: var(--ok); }
.pill-closed { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pill-declined { background: var(--danger-bg); color: var(--danger); }
.pill-rush { background: var(--danger-bg); color: var(--danger); }
.bar .pill-active { background: var(--header-2); color: var(--header-ink); }
.bar .pill-closed { color: var(--header-muted); box-shadow: inset 0 0 0 1px var(--header-muted); }

.empty { background: var(--surface); padding: 24px 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.empty p { margin: 0; }
.empty-title { font-weight: 700; color: var(--ink); font-size: 17px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border: 0; cursor: pointer; text-decoration: none;
  font-weight: 700; font-size: 16px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--field); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; cursor: pointer; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; border: 0; margin: 0; padding: 0; }
.label { font-weight: 600; font-size: 14px; padding: 0; }
.label-s { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--field); border-radius: 0; background: var(--surface); color: var(--ink);
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  -webkit-appearance: none; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea.input { resize: vertical; line-height: 1.4; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--field); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip-check input:checked + span { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.chip-check input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radio { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); padding: 12px 14px; box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; }
.radio input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.radio span { display: flex; flex-direction: column; }
.radio small { color: var(--muted); font-size: 13px; }
.radio:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.form-error { margin: 0; padding: 10px 12px; background: var(--danger-bg); color: var(--danger); font-weight: 600; font-size: 14px; }

/* ---------- detail ---------- */
.panel { background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-accent { box-shadow: inset 0 0 0 2px var(--accent); }
.panel-row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.panel-row .btn { flex: 1 1 100%; }
.panel-text { margin: 0; color: var(--ink-2); }
.who strong, .due strong { font-size: 16px; }
.h2 { margin: 0; font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: 18px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.dl { margin: 0; background: var(--surface); }
.dl-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dl-row:last-child { border-bottom: 0; }
.dl dt { font-size: 13px; color: var(--muted); padding-top: 1px; }
.dl dd { margin: 0; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.dl dd a { text-underline-offset: 3px; }

.steps { list-style: none; margin: 0; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-n { flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.step-done .step-n { background: var(--primary); color: var(--on-primary); }
.step-now .step-n { background: var(--accent); color: var(--on-accent); }
.step-todo .step-n { box-shadow: inset 0 0 0 1.5px var(--field); color: var(--muted); }
.step-l { display: flex; flex-direction: column; font-size: 15px; font-weight: 600; padding-top: 2px; }
.step-now .step-l { font-weight: 800; }
.step-todo .step-l { color: var(--muted); font-weight: 500; }
.step-l small { font-weight: 400; font-size: 13px; color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; margin-right: 32px; }
.msg-client { margin-right: 0; margin-left: 32px; box-shadow: inset 3px 0 0 var(--field); }
.msg-status { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.msg-internal { background: var(--internal-bg); }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.msg-head strong { color: var(--ink); }
.msg-body { font-size: 15px; }
.msg-flag { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.compose { display: flex; flex-direction: column; gap: 10px; background: var(--surface); padding: 14px 16px; }
.compose .btn { align-self: flex-start; }

/* ---------- billing ---------- */
.inv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.h3 { margin: 0; font-size: 15px; font-weight: 700; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.line-desc { grid-column: 1 / -1; }
.line-end { display: flex; align-items: flex-end; justify-content: flex-end; gap: 4px; min-height: 48px; }
.line-amt { font-weight: 600; padding-bottom: 13px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.inv-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-weight: 600; padding-top: 4px; }
.inv-total strong { font-size: 22px; }
.table-wrap { overflow-x: auto; background: var(--surface); }
.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th, .inv-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-table thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.inv-table .num { text-align: right; white-space: nowrap; }
.inv-table tfoot th, .inv-table tfoot td { border-bottom: 0; font-size: 16px; }
.inv-table tfoot th { text-align: right; }

/* ---------- account ---------- */
.acct-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero { width: 100%; max-width: none; background: var(--header); color: var(--header-ink); padding: calc(env(safe-area-inset-top, 0px) + 56px) 24px 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-hero > * { width: 100%; max-width: 512px; margin-inline: auto; }
.auth-hero .mark-lg { width: 56px; }
.auth-title { margin: 0; font-family: var(--display); font-stretch: 122%; font-weight: 900; font-size: 36px; line-height: 1; }
.auth-sub { margin: 0; color: var(--header-muted); font-size: 17px; }
.auth-body { width: 100%; padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 32px); display: flex; flex-direction: column; gap: 16px; }
.auth-lead { margin: 0; font-size: 17px; }
.auth-choices { display: flex; flex-direction: column; gap: 10px; }
.choice { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 18px; background: var(--surface); border: 0; box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; }
.choice strong { font-size: 18px; }
.choice span { color: var(--muted); font-size: 14px; }
.choice:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 8px calc(env(safe-area-inset-bottom, 0px) + 4px);
}
.tabs-in { display: flex; }
.tab { flex: 1; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.tab.on { color: var(--ink); font-weight: 800; }
.tab-icon { position: relative; display: inline-flex; }
.badge { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

.toast {
  position: fixed; left: 16px; right: 16px; z-index: 20;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  max-width: 528px; margin-inline: auto;
  background: var(--ink); color: var(--surface); padding: 12px 16px; font-weight: 600; font-size: 15px;
}

@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- files and rush (v4) ---------- */
.card-rush { border-left: 4px solid var(--danger); }
.file-btn { position: relative; align-self: flex-start; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.picks, .files { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick, .file-row { display: flex; align-items: center; gap: 10px; background: var(--surface); padding: 4px 4px 4px 12px; min-height: 48px; font-size: 14px; }
.file-row { padding-right: 8px; }
.pick svg, .file-row svg { flex: none; color: var(--muted); }
.pick-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.btn-s { min-height: 40px; padding: 0 14px; font-size: 14px; }
.form .panel-text { margin: 0; }
