/* Harbour & Vale client portal: a static demonstration of the Lenn client portal.
   Design A, "Letterhead", as the real portal draws it: warm paper and ink, the
   firm's red only in the mark, one rule under it, and focus outlines. Light only. */

:root {
  --brand: #c8102e;
  --paper: #fbf9f6;
  --ink: #1c1917;
  --soft: #57514b;
  --faint: #736b63;
  --rule: #e6e0d8;
  --panel: #f4f0ea;
  --field: #8c8379;
  --open: #2f6b4a;
  --open-bg: #dcebe2;
  --closed: #6b645c;
  --due: #9a3412;
  --track: #efe7dc;
  --white: #fff;
  --sans: 'Source Sans 3', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --tabbar: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; background: var(--paper); font-size: 16px; line-height: 1.5; }
body.modal-open { overflow: hidden; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; top: 12px; left: 12px; z-index: 60; width: auto; height: auto;
  clip: auto; margin: 0; padding: 8px 16px; border-radius: 8px;
  background: var(--ink); color: var(--white); font-weight: 600; text-decoration: none;
}

.serif { font-family: var(--serif); font-weight: 600; }
.soft { color: var(--soft); }
.faint { color: var(--faint); }
.label {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}

/* ---------- The demo marker (not part of the real portal) ---------- */

.demo-strip {
  background: var(--ink); color: #f4f0ea; font-size: 13px; line-height: 1.3;
}
.demo-strip-in {
  max-width: 760px; margin: 0 auto; padding: 7px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.demo-strip b { font-weight: 600; letter-spacing: 0.02em; }
.demo-strip .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f2a7b3; margin-right: 8px; vertical-align: 1px;
}
.demo-strip button {
  background: none; border: 0; color: #f4f0ea; text-decoration: underline;
  text-underline-offset: 3px; font-size: 13px; padding: 6px 0; min-height: 32px;
}
.demo-strip .why { color: #c9c1b7; }
@media (max-width: 479px) { .demo-strip .why { display: none; } }
@media (min-width: 640px) { .demo-strip-in { padding: 7px 32px; } }

/* ---------- Letterhead ---------- */

.letterhead { min-height: 100dvh; }
.lh-header { max-width: 760px; margin: 0 auto; padding: 24px 16px 0; }
@media (min-width: 640px) { .lh-header { padding: 40px 32px 0; } }
.lh-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 16px;
}
.lh-rule { margin-top: 20px; height: 3px; background: var(--brand); }
@media (min-width: 640px) { .lh-rule { margin-top: 24px; } }

.firm-mark {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
}
.firm-mark svg { width: 34px; height: 34px; flex: none; }
.firm-mark .fm-name {
  font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1; letter-spacing: -0.01em;
  display: block;
}
.firm-mark .fm-sub {
  display: block; margin-top: 5px; font-size: 10.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--brand); font-weight: 600;
}
@media (min-width: 640px) {
  .firm-mark svg { width: 42px; height: 42px; }
  .firm-mark .fm-name { font-size: 25px; }
  .firm-mark .fm-sub { font-size: 11.5px; }
}

/* The real portal's menu: 15 px, soft, each a 44 px target, the current one underlined. */
.nav { display: flex; flex-wrap: wrap; align-items: center; column-gap: 20px; margin: -8px 0; }
.nav a, .nav button {
  display: inline-flex; min-height: 44px; align-items: center; font-size: 15px;
  color: var(--soft); text-decoration: none; background: none; border: 0; padding: 0;
  text-underline-offset: 4px; white-space: nowrap;
}
.nav a:hover, .nav button:hover { text-decoration: underline; }
.nav a.cur { color: var(--ink); text-decoration: underline; }
.nav .badge { margin-left: 6px; }
.lh-util { flex-basis: 100%; }
@media (min-width: 640px) { .lh-util { flex-basis: auto; } }
.lh-util .only-wide { display: none; }
@media (min-width: 768px) { .lh-util .only-wide { display: inline-flex; } }

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: var(--white);
  font-size: 12px; font-weight: 700; line-height: 1;
}

main.page {
  max-width: 760px; margin: 0 auto; padding: 0 16px 64px; outline: none;
}
@media (min-width: 640px) { main.page { padding: 0 32px 64px; } }
body.with-tabs main.page { padding-bottom: calc(var(--tabbar) + 48px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body.with-tabs main.page { padding-bottom: 64px; } }

.page-head { margin-top: 40px; }
@media (min-width: 640px) { .page-head { margin-top: 56px; } }
.page-head h1 {
  font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.15; letter-spacing: -0.005em;
}
@media (min-width: 640px) { .page-head h1 { font-size: 40px; } }
.page-head .intro { margin-top: 12px; max-width: 460px; font-size: 17px; color: var(--soft); }
.page-head .sub { margin-top: 6px; font-size: 15px; color: var(--faint); }
h1:focus { outline: none; }

.section { margin-top: 44px; }
.section > h2, .h2 {
  font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.25;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a { font-size: 15px; color: var(--soft); }

/* A small sheet under the mark, for the pages a client reads before entering. */
.sheet { max-width: 440px; margin: 40px auto 0; }
@media (min-width: 640px) { .sheet { margin-top: 64px; } }
.sheet h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.15; }
@media (min-width: 640px) { .sheet h1 { font-size: 32px; } }
.sheet-body { margin-top: 16px; display: grid; gap: 16px; font-size: 17px; color: var(--soft); }

.footer {
  max-width: 760px; margin: 0 auto; padding: 8px 16px 32px; font-size: 13px; color: var(--faint);
  display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between;
}
@media (min-width: 640px) { .footer { padding: 8px 32px 40px; } }
body.with-tabs .footer { padding-bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body.with-tabs .footer { padding-bottom: 40px; } }
body.with-tabs main.page { padding-bottom: 32px; }

/* ---------- Forms, as the real portal's ---------- */

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 15px; font-weight: 600; color: var(--ink); }
.input, .textarea, .select {
  width: 100%; height: 44px; border-radius: 8px; border: 1px solid var(--field);
  background: var(--white); padding: 0 12px; font: inherit; font-size: 17px; color: var(--ink);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly] { background: var(--panel); }
.input:disabled { background: var(--panel); color: var(--faint); cursor: not-allowed; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.hint { font-size: 14px; color: var(--faint); }
.pw { position: relative; }
.pw .input { padding-right: 80px; }
.pw button {
  position: absolute; top: 4px; bottom: 4px; right: 4px; border: 0; background: none;
  border-radius: 6px; padding: 0 12px; font-size: 14px; color: var(--soft);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--white); font-weight: 600; font-size: 16px;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--white); color: var(--ink); border-color: var(--field); }
.btn.small { height: 36px; padding: 0 12px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--field); }
.btn.link {
  background: none; border: 0; color: var(--ink); padding: 0; height: auto; min-height: 44px;
  text-decoration: underline; font-weight: 400;
}

.form-error {
  border-radius: 8px; border: 1px solid rgba(200, 16, 46, 0.3); background: var(--white);
  padding: 8px 12px; font-size: 15px; color: var(--ink);
}
.form-notice { border-radius: 8px; background: var(--panel); padding: 8px 12px; font-size: 15px; color: var(--ink); }
.or { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--faint); }
.or::before, .or::after { content: ''; height: 1px; flex: 1; background: var(--rule); }

.demo-hint {
  border: 1px dashed var(--field); border-radius: 10px; padding: 14px 16px; font-size: 15px;
  color: var(--soft); background: rgba(255, 255, 255, 0.5);
}
.demo-hint .label { display: block; margin-bottom: 6px; }
.demo-hint .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- Matters (the real page) ---------- */

.matters { margin-top: 32px; border-top: 0; }
.matters > li { padding: 28px 0; border-bottom: 1px solid var(--rule); }
.matters > li:last-child { border-bottom: 0; }
.matter-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.matter-top h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.3; }
.matter-top h2 a { text-decoration: none; }
.matter-top h2 a:hover { text-decoration: underline; }
.matter-file { margin-top: 4px; font-size: 15px; color: var(--faint); }
.state { display: flex; flex: none; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.state .d { width: 8px; height: 8px; border-radius: 50%; }
.state.open { color: var(--open); } .state.open .d { background: var(--open); }
.state.closed { color: var(--closed); } .state.closed .d { border: 1px solid var(--closed); }
.facts { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (min-width: 640px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.facts dd { margin-top: 4px; font-size: 16px; }
.matter-go {
  margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px;
  text-decoration: none;
}
.matter-go:hover { border-color: var(--field); }
.matter-go .mg-step { font-size: 15px; color: var(--soft); }
.matter-go .mg-head { font-weight: 600; font-size: 16px; }
.mini-track { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.mini-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #e9c7b9, #e38c93 70%, var(--brand)); }
.chev { flex: none; color: var(--faint); font-size: 22px; line-height: 1; }

.panel { margin-top: 48px; border-radius: 8px; background: var(--panel); padding: 24px; }
@media (min-width: 640px) { .panel { padding: 24px 32px; } }
.panel h2 { font-family: var(--serif); font-weight: 600; font-size: 20px; }
.panel .p-intro { margin-top: 4px; font-size: 15px; color: var(--soft); }
.contact-dl { margin-top: 16px; display: grid; gap: 16px; font-size: 16px; }
@media (min-width: 640px) { .contact-dl { grid-template-columns: 1fr 1fr; } }
.contact-dl dd { margin-top: 4px; white-space: pre-line; }
.contact-dl a { text-decoration: underline; }

.rows > li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.rows > li:last-child { border-bottom: 0; }

/* ---------- Waiting on you ---------- */

.todo { margin-top: 28px; background: var(--white); border: 1px solid var(--rule); border-radius: 10px; }
.todo-head { padding: 16px 18px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.todo-head h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.todo ul { padding: 0 6px 6px; }
.todo li a {
  display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px;
  padding: 12px; border-radius: 8px; text-decoration: none; min-height: 56px;
}
.todo li a:hover { background: var(--paper); }
.todo .ic {
  width: 32px; height: 32px; border-radius: 8px; background: var(--panel); display: grid; place-items: center; color: var(--soft);
}
.todo .ic svg { width: 18px; height: 18px; }
.todo .t { font-size: 16px; font-weight: 600; line-height: 1.3; }
.todo .s { font-size: 14px; color: var(--faint); }
.todo .all-done { padding: 4px 18px 18px; color: var(--soft); font-size: 15px; }

/* ---------- The tracker (portal-status design, variant B) ---------- */

.tracker {
  margin-top: 28px; background: var(--white); border-radius: 24px;
  box-shadow: 0 12px 40px rgba(120, 90, 60, 0.08); padding: 26px 28px 22px;
}
@media (max-width: 639px) { .tracker { padding: 22px 18px 18px; border-radius: 20px; margin-left: -4px; margin-right: -4px; } }
.tr-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; }
.tr-head { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.2; }
@media (max-width: 639px) { .tr-head { font-size: 22px; } }
.tr-pct { font-size: 15px; color: var(--faint); }
.tr-track { position: relative; height: 20px; border-radius: 999px; background: var(--track); margin: 28px 0 14px; }
.tr-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, #e9c7b9, #e38c93 70%, var(--brand)); }
.tr-knob {
  position: absolute; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  background: var(--white); box-shadow: 0 4px 14px rgba(200, 16, 46, 0.3); display: grid; place-items: center;
}
.tr-knob::after { content: ''; width: 15px; height: 15px; border-radius: 50%; background: var(--brand); }
.tr-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.tr-step {
  display: grid; justify-items: center; align-content: start; gap: 6px; background: none; border: 0;
  padding: 6px 2px; border-radius: 10px; font-size: 13.5px; line-height: 1.25; color: var(--faint); text-align: center;
  min-height: 44px;
}
.tr-step:hover { background: var(--paper); }
.tr-step .n {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--track); color: var(--soft); font-size: 12px; font-weight: 700;
}
.tr-step.done { color: var(--soft); }
.tr-step.done .n { background: var(--open-bg); color: var(--open); }
.tr-step.now { color: var(--ink); font-weight: 700; }
.tr-step.now .n { background: var(--brand); color: var(--white); }
.tr-step.sel { background: var(--panel); }
.tr-step.sel .t { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 639px) {
  .tr-step .t { display: none; }
  .tr-step { align-content: center; }
  .tr-step.sel { background: none; }
  .tr-step.sel .n { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--ink); }
}
.tr-by { margin-top: 18px; font-size: 15px; color: var(--faint); }

.now-card { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 22px; margin-top: 22px; }
@media (min-width: 640px) { .now-card { padding: 26px 28px; } }
.now-card .since { color: var(--faint); font-size: 14px; }
.now-card h3 { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.25; margin: 6px 0 10px; }
.now-card p { font-size: 17px; color: var(--soft); line-height: 1.55; }
.now-card p + p { margin-top: 10px; }
.prep { margin-top: 10px; display: grid; gap: 2px; }
.prep label {
  display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 16px;
  padding: 8px 0; cursor: pointer;
}
.prep input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--open); }
.prep input:checked + span { color: var(--faint); text-decoration: line-through; }

.next { border-top: 1px solid var(--rule); margin-top: 14px; }
.next li { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.next b { font-size: 17px; }
.next span { color: var(--soft); font-size: 15px; grid-column: 1; }
.next .when { grid-column: 2; grid-row: 1; color: var(--faint); font-size: 14px; text-align: right; }

.update { background: var(--panel); border-radius: 10px; padding: 20px 22px; margin-top: 14px; }
.update + .update { margin-top: 10px; }
.update p { margin-top: 8px; font-size: 16px; color: var(--soft); line-height: 1.55; }

.team { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 640px) { .team { grid-template-columns: 1fr 1fr; } }
.person { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 18px; display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start; }
.ph { width: 48px; height: 48px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 700; color: var(--soft); font-size: 15px; }
.person .name { font-size: 17px; font-weight: 700; margin-top: 2px; }
.person .c { font-size: 15px; margin-top: 6px; display: grid; gap: 2px; }
.person .c a { text-decoration: underline; overflow-wrap: anywhere; }

/* ---------- Documents ---------- */

.cards { display: grid; gap: 12px; margin-top: 14px; }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 18px; }
@media (min-width: 640px) { .card { padding: 20px 22px; } }
.card-row { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.doc-ic {
  width: 40px; height: 48px; border-radius: 6px; background: var(--panel); border: 1px solid var(--rule);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--soft); letter-spacing: 0.04em;
}
.doc-ic.req { border-style: dashed; background: transparent; }
.card h3 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.card .meta { margin-top: 3px; font-size: 14px; color: var(--faint); }
.card .why { margin-top: 8px; font-size: 15px; color: var(--soft); }
.card .acts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 479px) { .card .acts .btn { flex: 1 1 auto; } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: var(--panel); color: var(--soft); white-space: nowrap;
}
.pill.ok { background: var(--open-bg); color: var(--open); }
.pill.due { background: #fbe7dc; color: var(--due); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.progress { margin-top: 12px; }
.progress .bar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 999px; transition: width 0.12s linear; }
.progress .ptxt { margin-top: 6px; display: flex; justify-content: space-between; font-size: 14px; color: var(--soft); }
.file-line { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.file-line .fn { font-weight: 600; overflow-wrap: anywhere; }

.drop {
  margin-top: 14px; border: 1.5px dashed var(--field); border-radius: 10px; padding: 22px 18px;
  text-align: center; background: rgba(255, 255, 255, 0.6); color: var(--soft); font-size: 15px;
}
.drop.over { background: var(--white); border-color: var(--ink); }
.drop .btn { margin-top: 10px; }

.files > li { border-bottom: 1px solid var(--rule); }
.files > li:last-child { border-bottom: 0; }
.files button {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 0; background: none; border: 0; text-align: left; min-height: 64px;
}
.files button:hover .ft { text-decoration: underline; }
.files .ft { font-size: 16px; font-weight: 600; line-height: 1.3; }
.files .fm { font-size: 14px; color: var(--faint); }
.files .doc-ic { width: 34px; height: 42px; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--white);
  font-size: 15px; color: var(--soft);
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ---------- The reader / dialog ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(28, 25, 23, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } }
.dialog {
  background: var(--paper); width: 100%; max-width: 720px; max-height: 94dvh; display: flex; flex-direction: column;
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18); outline: none;
}
@media (min-width: 640px) { .dialog { border-radius: 16px; max-height: 88dvh; } }
.dialog.narrow { max-width: 480px; }
.dlg-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--rule);
}
@media (min-width: 640px) { .dlg-head { padding: 20px 24px 16px; } }
.dlg-head h2 { font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.25; }
.dlg-head .meta { font-size: 14px; color: var(--faint); margin-top: 2px; }
.x {
  flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: none; border-radius: 8px;
  font-size: 26px; line-height: 1; color: var(--soft);
}
.dlg-body { overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
@media (min-width: 640px) { .dlg-body { padding: 22px 24px; } }
.dlg-foot { border-top: 1px solid var(--rule); padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 12px; background: var(--paper); border-radius: 0 0 16px 16px; }
@media (min-width: 640px) { .dlg-foot { padding: 16px 24px; } }

.paper {
  background: var(--white); border: 1px solid var(--rule); border-radius: 4px; padding: 26px 22px;
  box-shadow: 0 2px 10px rgba(120, 90, 60, 0.06); font-family: var(--serif); font-size: 15.5px; line-height: 1.6; color: #2a2522;
}
@media (min-width: 640px) { .paper { padding: 40px 48px; } }
.paper h3 { font-size: 17px; font-weight: 600; text-align: center; letter-spacing: 0.02em; }
.paper .court { text-align: center; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); margin-bottom: 14px; font-family: var(--sans); }
.paper p { margin-top: 12px; }
.paper .demo-wm { margin-top: 18px; font-family: var(--sans); font-size: 13px; color: var(--faint); text-align: center; border-top: 1px dashed var(--rule); padding-top: 12px; }
.paper table { width: 100%; border-collapse: collapse; margin-top: 12px; font-family: var(--sans); font-size: 15px; }
.paper td, .paper th { padding: 8px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.paper th { font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.paper td.r, .paper th.r { text-align: right; }
.paper tr.tot td { font-weight: 700; border-bottom: 0; }
.sig-line { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; font-family: var(--sans); font-size: 13px; color: var(--faint); }
.sig-line div { border-top: 1px solid var(--ink); padding-top: 6px; }
.signature { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.25; color: #1d3a6b; min-height: 34px; display: block; }

.check { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 15px; color: var(--soft); align-items: start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }

/* ---------- Messages ---------- */

.thread { margin-top: 24px; display: grid; gap: 14px; }
.day-sep { text-align: center; font-size: 13px; color: var(--faint); margin: 8px 0 -2px; }
.msg { max-width: 86%; display: grid; gap: 4px; }
@media (min-width: 640px) { .msg { max-width: 76%; } }
.msg .who { font-size: 13px; color: var(--faint); }
.msg .who b { color: var(--soft); font-weight: 600; }
.msg .bubble {
  background: var(--white); border: 1px solid var(--rule); border-radius: 4px 16px 16px 16px;
  padding: 11px 14px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.me { justify-self: end; justify-items: end; }
.msg.me .bubble { background: var(--ink); color: var(--white); border-color: var(--ink); border-radius: 16px 4px 16px 16px; }
.msg .att { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 10px; border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; border: 0; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: 0.6; } }

.composer {
  position: sticky; bottom: 0; margin-top: 22px; padding: 12px 0 14px; background: linear-gradient(to bottom, rgba(251, 249, 246, 0), var(--paper) 18px);
}
body.with-tabs .composer { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body.with-tabs .composer { bottom: 0; } }
.composer form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; background: var(--white); border: 1px solid var(--field); border-radius: 12px; padding: 6px 6px 6px 12px; }
.composer textarea { border: 0; outline: none; resize: none; font: inherit; font-size: 17px; line-height: 1.4; padding: 8px 0; min-height: 40px; max-height: 160px; background: transparent; color: var(--ink); }
.composer:focus-within form { outline: 2px solid var(--brand); outline-offset: 2px; }
.composer textarea:focus-visible { outline: none; }
.composer .btn { height: 40px; }
.composer .hint { margin-top: 6px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Appointments ---------- */

.appt { display: grid; grid-template-columns: 56px 1fr; gap: 14px; }
.cal {
  width: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); text-align: center; background: var(--white);
  align-self: start;
}
.cal .m { background: var(--brand); color: var(--white); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; padding: 3px 0; text-transform: uppercase; }
.cal .dd { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.15; padding: 4px 0 0; }
.cal .wd { font-size: 11px; color: var(--faint); padding-bottom: 5px; }
.appt h3 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.appt .when { font-size: 15px; color: var(--ink); margin-top: 2px; }
.appt .where { font-size: 15px; color: var(--soft); margin-top: 2px; }

.choices { display: grid; gap: 10px; }
@media (min-width: 640px) { .choices.three { grid-template-columns: repeat(3, 1fr); } }
.choice {
  display: grid; gap: 2px; text-align: left; background: var(--white); border: 1px solid var(--rule);
  border-radius: 10px; padding: 14px 16px; min-height: 44px;
}
.choice:hover { border-color: var(--field); }
.choice[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice b { font-size: 16px; }
.choice span { font-size: 14px; color: var(--faint); }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.day {
  flex: none; width: 64px; display: grid; justify-items: center; gap: 0; padding: 8px 0; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--white); scroll-snap-align: start;
}
.day .wd { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.day .dd { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.2; }
.day .mm { font-size: 12px; color: var(--faint); }
.day[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.day[aria-pressed="true"] .wd, .day[aria-pressed="true"] .mm { color: #d8d1c8; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) { .slots { grid-template-columns: repeat(5, 1fr); } }
.slot { height: 44px; border-radius: 8px; border: 1px solid var(--field); background: var(--white); font-size: 16px; }
.slot[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.step-label { margin: 22px 0 10px; font-size: 15px; font-weight: 600; }
.summary { background: var(--panel); border-radius: 10px; padding: 16px 18px; font-size: 16px; display: grid; gap: 4px; }

/* ---------- Billing ---------- */

.money { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 640px) { .money { grid-template-columns: 1fr 1fr; } }
.money .card { display: grid; align-content: space-between; gap: 14px; }
.amt { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; margin-top: 4px; }
.meter { height: 8px; border-radius: 999px; background: var(--track); position: relative; margin-top: 12px; }
.meter span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--open); }
.meter i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.meter-l { display: flex; justify-content: space-between; font-size: 13px; color: var(--faint); margin-top: 6px; }
.note { color: var(--faint); font-size: 14px; margin-top: 10px; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 16px; }
.tbl th { text-align: left; font-weight: 400; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 13px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; padding-right: 16px; }
.tbl td.a { text-align: right; width: 1%; white-space: nowrap; }
.tbl .sub2 { display: block; font-size: 13px; color: var(--faint); }
.st { font-size: 14px; font-weight: 600; white-space: nowrap; }
.st.paid { color: var(--open); } .st.owing { color: var(--due); }
@media (max-width: 639px) { .hide-s { display: none; } .tbl td.r, .tbl th.r { padding-right: 10px; } }
.ledger .plus { color: var(--open); }

.pay-steps { display: flex; gap: 6px; margin-top: 22px; font-size: 14px; color: var(--faint); flex-wrap: wrap; }
.pay-steps span { display: inline-flex; align-items: center; gap: 6px; }
.pay-steps span.on { color: var(--ink); font-weight: 600; }
.pay-steps span + span::before { content: '›'; margin-right: 6px; color: var(--rule); }
.card-field { position: relative; }
.card-field .input { letter-spacing: 0.06em; }
.lock-note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--soft); background: var(--panel); border-radius: 8px; padding: 10px 12px; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--open-bg); color: var(--open); display: grid; place-items: center; }
.done-mark svg { width: 30px; height: 30px; }
.stamp {
  display: inline-block; border: 2px solid var(--due); color: var(--due); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; font-size: 13px; padding: 4px 10px; border-radius: 6px; transform: rotate(-2deg);
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 16px; }
.kv dt { color: var(--faint); }
.kv dd { text-align: right; }

/* ---------- Account ---------- */

.sessions > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.sessions > li:last-child { border-bottom: 0; }
.sessions .w { font-size: 16px; }
.sessions .m { font-size: 14px; color: var(--faint); }
.this { font-size: 14px; font-weight: 600; color: var(--open); }

/* ---------- Phone tab bar (design note: B's navigation, A's look) ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: saturate(1.2) blur(8px);
}
.tabbar ul { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 560px; margin: 0 auto; }
.tabbar a {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; height: var(--tabbar);
  font-size: 11.5px; color: var(--faint); text-decoration: none; letter-spacing: 0.01em;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.cur { color: var(--ink); font-weight: 600; }
.tabbar a.cur::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--brand); border-radius: 0 0 2px 2px; }
.tabbar .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
@media (min-width: 768px) { .tabbar { display: none; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 10px; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); max-width: calc(100vw - 32px); width: max-content;
  animation: rise 0.2s ease-out;
}
body.with-tabs .toast { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body.with-tabs .toast { bottom: 24px; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.spin.dark { border-color: rgba(28, 25, 23, 0.2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.w-sheet { max-width: 460px; }
.file-line svg { flex: none; }
.file-line .fn { flex: 1 1 0; min-width: 0; }
