:root {
  /* Matched to marwahlaw.com: orange #FB6818, deep teal #0F3A3F, Newsreader headings, Inter text */
  --ink: #0f3a3f; --muted: #4f6b6e; --line: #dfe6e6; --bg: #f7f8f7; --card: #ffffff;
  --brand: #fb6818; --brand-ink: #d9530b; --brand-soft: #fff1e8; --navy: #0f3a3f; --teal-soft: #eaf1f1;
  /* Status colours (22 Nov 2026, Yaman): one theme across Marla, website and phone, by meaning. Every status pill, chip, tag and
     stage uses these and nothing else: green done/ready, yellow waiting on one thing (the client or the bank), red blocked,
     overdue or missing, blue our turn, grey closed/neutral. Tinted pill (soft background, dark text), never coloured text alone. */
  --ok: #1a7f4b; --ok-soft: #e7f5ec; --wait: #8a6100; --wait-soft: #fdf3c8; --bad: #b42318; --bad-soft: #fdecea;
  --turn: #1d4ed8; --turn-soft: #e8f1ff; --off: #6b7480; --off-soft: #eef0f2;
  /* Team chat presence: Microsoft Teams' own colours (Fluent 2 presence badges), fixed (26 Nov 2026, Yaman); public/presence.js draws the icons */
  --pr-available: #13a10e; --pr-busy: #d13438; --pr-away: #eaa300; --pr-offline: #616161;
  --warn: var(--wait); --warn-soft: var(--wait-soft); /* older name for yellow */
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; width: 100%; }
h1, h2, .serif { font-family: Newsreader, Georgia, serif; font-weight: 600; letter-spacing: -.01em; color: var(--navy); }
h1 em, h2 em { color: var(--brand); font-style: italic; }
a { color: var(--brand-ink); }
.top { background: #fff; color: var(--ink); padding: 12px 24px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 14px rgba(15,58,63,.08); position: relative; z-index: 2; }
.top .logo img { height: 52px; width: auto; display: block; }
.top .tag { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); border-left: 1px solid var(--line); padding-left: 16px; }
.top .grow { flex: 1; }
.top a.nl { color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; padding: 8px 4px; }
.top a.nl.on { color: var(--brand); } @media (hover: hover) { .top a.nl:hover { color: var(--brand); } }
.top a.cta { border: 1px solid var(--brand); color: var(--brand); border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 500; text-decoration: none; } @media (hover: hover) { .top a.cta:hover { background: var(--brand); color: #fff; } }
@media (max-width: 640px) { .top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; } .top .logo img { height: 40px; } .top .tag { display: none; } }
.foot { background: var(--navy); color: #cfe0e0; font-size: 14px; padding: 22px 24px; margin-top: 40px; }
.foot .in { max-width: 1180px; margin: 0 auto; display: flex; gap: 10px 28px; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: #fff; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin: 0 0 6px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }
.wide { max-width: 1180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(15,58,63,.04); }
h1 { font-size: 32px; line-height: 1.15; margin: 0 0 8px; } h2 { font-size: 22px; margin: 0 0 6px; } h3 { font-size: 16px; margin: 18px 0 6px; }
.lede { color: var(--muted); margin: 0 0 18px; }
label.f { display: block; font-weight: 600; margin: 14px 0 6px; }
.hint { color: var(--muted); font-weight: 400; font-size: 14px; display: block; margin-top: 2px; }
input[type=text], input:not([type]), input[type=search], input[type=email], input[type=date], input[type=datetime-local], input[type=time], input[type=number], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #c9ced4; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row, .row3 { grid-template-columns: 1fr; } }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; } @media (hover: hover) { .choice:hover { border-color: #b9c0c8; } }
.choice input { margin-top: 4px; accent-color: var(--brand); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice small { display: block; color: var(--muted); }
.repeat { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 10px 0; background: #fbfbfa; position: relative; }
.repeat .rm { position: absolute; top: 8px; right: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 20px; border-radius: 20px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; } @media (hover: hover) { .btn.primary:hover { background: var(--brand-ink); } }
.btn.ghost { background: #fff; border-color: var(--brand); color: var(--brand); } @media (hover: hover) { .btn.ghost:hover { background: var(--brand-soft); } }
.btn.dark { background: var(--navy); color: #fff; }
.btn.link { background: none; color: var(--brand-ink); padding: 4px 6px; }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.nav .btn { flex: none; }
.progress { display: flex; gap: 4px; margin: 0 0 18px; }
.progress span { flex: 1; height: 5px; border-radius: 3px; background: #e2e5e9; }
.progress span.done { background: var(--brand); }
.steplabel { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.saved { font-size: 13px; color: var(--muted); }
.note { padding: 12px 14px; border-radius: 8px; background: var(--brand-soft); border: 1px solid #f3cfae; font-size: 15px; margin: 12px 0; }
.err { color: var(--bad); font-size: 14px; margin-top: 6px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--off-soft); color: #3b4450; white-space: nowrap; }
/* The one status pill: .st plus ok / wait / bad / turn / off (stages carry stageTone from the server). */
.st { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--off-soft); color: var(--off); }
.st.ok, .st-ok { background: var(--ok-soft); color: var(--ok); } .st.wait, .st-wait { background: var(--wait-soft); color: var(--wait); } .st.bad, .st-bad { background: var(--bad-soft); color: var(--bad); } .st.turn, .st-turn { background: var(--turn-soft); color: var(--turn); } .st.off, .st-off { background: var(--off-soft); color: var(--off); }
.pill.drafted { background: var(--warn-soft); color: var(--warn); }
.pill.submitted { background: var(--turn-soft); color: var(--turn); }
.pill.approved, .pill.sent, .pill.signed { background: var(--ok-soft); color: var(--ok); }
.pill.in_progress { background: var(--wait-soft); color: var(--wait); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
tr.click { cursor: pointer; } @media (hover: hover) { tr.click:hover td { background: #fafaf8; } }
.flags li { margin: 6px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 16px; }
pre.mail { white-space: pre-wrap; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: 14px/1.5 inherit; font-family: inherit; }
.muted { color: var(--muted); }
.files a { display: block; padding: 8px 0; }
.summary dt { font-weight: 600; margin-top: 10px; } .summary dd { margin: 2px 0 0; color: #333; }
.files a, #lnk { overflow-wrap: anywhere; }

/* ---------- Marla: files board and file page */
.bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 6px 0 16px; }
.bar .grow { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.tabs[hidden], .btn[hidden] { display: none; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 20px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs button .n { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--teal-soft); color: var(--navy); font-size: 12px; }
.tabs button.on .n { background: rgba(255,255,255,.2); color: #fff; }
.stage { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.stage i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.yes { background: var(--ok-soft); color: var(--ok); } .chip.no { background: var(--warn-soft); color: var(--warn); }
.chip.ctag { background: #eef1f3; color: #3b4a52; } .chip.ctag.client, .chip.ctag.past { background: var(--ok-soft); color: var(--ok); } .chip.ctag.pending { background: var(--wait-soft); color: var(--wait); } /* the contact card's status on a lead */
.chip.due { background: var(--bad-soft); color: var(--bad); } .chip.ready { background: var(--ok-soft); color: var(--ok); }
.status { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.status b { color: var(--ink); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b8c4c4; margin-right: 6px; vertical-align: 1px; } .dot.on { background: var(--ok); }
td .sub { display: block; color: var(--muted); font-size: 13px; }
.tablewrap { overflow-x: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn.next { background: var(--brand); color: #fff; border-color: var(--brand); }
.modal { position: fixed; inset: 0; background: rgba(15,58,63,.45); display: none; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto; z-index: 20; }
.modal.on { display: flex; }
.modal .card { width: 100%; max-width: 760px; margin: 0; }
.modal > .card { position: relative; }
.modal > .card > .mx { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted, #6b7380); font-size: 24px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; } @media (hover: hover) { .modal > .card > .mx:hover { background: rgba(0,0,0,.06); } }
.att { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 14px; overflow-wrap: anywhere; }
.warn { padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 14px; margin: 8px 0; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.log li { margin: 6px 0; font-size: 14px; } .log .when { color: var(--muted); font-size: 12px; display: block; }

/* simple file list */
.flist { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.frow { cursor: pointer; display: grid; grid-template-columns: 1fr 240px 110px 200px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid #eef2f2; color: inherit; text-decoration: none; }
.frow:last-child { border-bottom: 0; } @media (hover: hover) { .frow:hover { background: #fafbfb; } }
.frow small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.frow small.late { color: var(--bad); font-weight: 600; }
.fnext { text-align: right; }
@media (max-width: 720px) { .frow { grid-template-columns: 1fr; gap: 6px; } .fnext { text-align: left; } }
details.more > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: 14px; list-style: none; margin-top: 12px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }

.mlist .mrow { padding: 12px 20px; border-bottom: 1px solid #eef2f2; cursor: pointer; }
.mlist .mrow:last-child { border-bottom: 0; } @media (hover: hover) { .mlist .mrow:hover { background: #fafbfb; } }
.mhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; } .mhead .grow { flex: 1; } .mhead .muted { font-size: 13px; }
.msub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.mprev { font-size: 14px; color: #3d5558; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dir { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
.dir.in { background: var(--teal-soft); color: var(--navy); } .dir.out { background: var(--brand-soft); color: var(--brand-ink); }
.frow small.meet { color: var(--navy); font-weight: 600; }

/* Marla (staff) — compact */
body.staff { font-size: 14px; line-height: 1.5; }
body.staff .top { padding: 8px 20px; } body.staff .top .logo img { height: 38px; }
body.staff .top a.nl { font-size: 13px; }
body.staff h1 { font-size: 22px; } body.staff h2 { font-size: 17px; } body.staff h3 { font-size: 14px; }
body.staff .wrap { padding-top: 18px; }
body.staff .card { padding: 16px 18px; border-radius: 10px; margin-bottom: 12px; }
body.staff .lede { font-size: 13px; margin-bottom: 10px; }
body.staff .btn { padding: 7px 14px; font-size: 13px; border-radius: 16px; } body.staff .btn.small { padding: 4px 10px; font-size: 12px; }
body.staff input[type=text], body.staff input:not([type]), body.staff input[type=search], body.staff input[type=email], body.staff input[type=password], body.staff input[type=datetime-local], body.staff input[type=time], body.staff input[type=date], body.staff input[type=number], body.staff input[type=tel], body.staff select, body.staff textarea { padding: 7px 10px; font-size: 13px; border-radius: 6px; }
body.staff label.f { font-size: 13px; margin: 10px 0 4px; }
body.staff .tabs button { padding: 5px 12px; font-size: 13px; }
body.staff .frow { padding: 9px 14px; } body.staff .frow b { font-size: 14px; } body.staff .frow small { font-size: 12px; }
body.staff table { font-size: 13px; } body.staff td { padding: 8px; } body.staff th { font-size: 11px; padding: 6px 8px; }
body.staff details.more > summary { font-size: 13px !important; }
body.staff .stage { font-size: 12px; } body.staff .toggle { font-size: 13px; }
.depts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dept { display: block; padding: 20px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: var(--navy); }
.dept b { display: block; font-size: 16px; } .dept small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; } @media (hover: hover) { a.dept:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(251,104,24,.12); } } a.dept small { color: var(--brand-ink); font-weight: 600; }
.dept.off { background: #f3f5f5; color: #9aa9aa; cursor: default; } .dept.off b { color: #9aa9aa; }
@media (max-width: 520px) { .depts { grid-template-columns: 1fr; } }

.ai { border-color: #f6c6a6; }
.chat { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.msg { padding: 9px 12px; border-radius: 10px; font-size: 13px; max-width: 92%; }
.msg .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.msg.user { align-self: flex-end; background: var(--teal-soft); } .msg.assistant { align-self: flex-start; background: var(--brand-soft); }
.msg.pending { opacity: .7; font-style: italic; } .msg.undone { opacity: .55; }
.msg .chg { margin: 6px 0; padding-left: 18px; } .msg details summary { cursor: pointer; font-size: 12px; color: var(--brand-ink); }
table.diff { font-size: 12px; margin-top: 6px; } table.diff td { padding: 3px 6px; border-bottom: 1px solid #f0e2d8; vertical-align: top; overflow-wrap: anywhere; }
table.diff td.from { color: var(--bad); text-decoration: line-through; } table.diff td.to { color: var(--ok); }
.ask { display: flex; gap: 8px; align-items: flex-end; } .ask textarea { flex: 1; min-height: 44px; }

.phases { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.ph { border: 0; background: #fff; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; cursor: pointer; border-right: 1px solid var(--line); }
.ph:last-child { border-right: 0; } .ph.done { background: var(--teal-soft); color: var(--navy); } .ph.on { background: var(--navy); color: #fff; cursor: default; }

.fupd { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fhead { display: grid; grid-template-columns: 1fr 240px 110px 200px; gap: 14px; padding: 8px 14px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
@media (max-width: 720px) { .fhead { display: none; } }

/* Questionnaire: lighter, tighter */
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
#app .choice { padding: 9px 12px; }
#app .choice small { font-size: 13px; }
#app label.f { margin: 12px 0 5px; }
#app h3 { margin: 20px 0 6px; }
#app textarea { min-height: 70px; }
.opt { margin: 6px 0; }
.opt .optbody { border-left: 3px solid var(--brand-soft); padding: 2px 0 6px 12px; margin: 6px 0 10px 6px; }
.note ol li { margin: 3px 0; }

/* File page: one client's documents */
.docgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; margin-bottom: 6px; }
.docgrid h4 { margin: 6px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
ul.dl { list-style: none; padding: 0; margin: 0; font-size: 13px; } ul.dl li { margin: 3px 0; word-break: break-word; }
#handform .card, #handform form { box-shadow: none; }

/* Board: the file name always on one line */
.frow .fname { min-width: 0; }
body.staff .frow .fname b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow, .fhead { grid-template-columns: minmax(0, 1fr) 210px 100px 190px; }
@media (max-width: 720px) { .frow { grid-template-columns: 1fr; } .fhead { display: none; } }

/* Questionnaire: pick someone already named, address suggestions */
.picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0; }
.picks .hint { display: inline; margin: 0 2px 0 0; font-size: 13px; }
.pick { border: 1px solid var(--line, #d5dbe0); background: #f4f7f8; color: var(--ink, #12343a); border-radius: 12px; padding: 2px 10px; font-size: 13px; cursor: pointer; } @media (hover: hover) { .pick:hover { background: #fff; } }
.addrwrap { position: relative; }
.sugbox { position: absolute; left: 0; right: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.08); overflow: hidden; }
.sugbox:empty { display: none; }
.sug { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid #eef2f2; background: #fff; font-size: 14px; cursor: pointer; } @media (hover: hover) { .sug:hover { background: var(--brand-soft); } }

/* Reply to the client's latest email */
.rclient details { margin-top: 10px; } .rclient summary { cursor: pointer; font-size: 14px; }
.rclient .rq { margin: 8px 0 4px; padding: 10px 14px; border-left: 3px solid var(--line); background: #fafbfb; font-size: 14px; white-space: normal; max-height: 260px; overflow-y: auto; }
.row + .choice, .row + label.choice { margin-top: 10px; }

.ktag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6b4e16; background: #fbf0d9; border-radius: 4px; padding: 1px 5px; margin-right: 2px; }

/* Corporate: entity list and annual returns due */
.frow.erow, .fhead.ehead { grid-template-columns: minmax(0, 1fr) 230px 90px; }
/* Archived entities: a fourth column for the row's action menu (Re-engage / Link to file). */
.flist.earch .frow.erow, .flist.earch .fhead.ehead { grid-template-columns: minmax(0, 1fr) 230px 90px 170px; }
.frow.erow .fnext { display: flex; justify-content: flex-end; }
div.frow.erow[data-href] { cursor: pointer; }
/* Header search (Contacts, Entities): the Search button opens the box, same look on every page. */
.pga { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; flex: none; }
.pga .msearch[hidden], .pga .btn[hidden] { display: none; }
.pga .msearch { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; background: #fff; }
.pga .msearch input { border: 0; outline: 0; padding: 8px 4px; font: inherit; font-size: 13px; width: 200px; max-width: none; }
.pga .btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.frow.drow, .fhead.dhead { grid-template-columns: minmax(0, 1fr) 140px 180px 190px; } .frow.drow .fnext { text-align: right; }
a.frow.erow { color: inherit; }
.fupd.late { color: var(--bad); font-weight: 600; } span.late { background: var(--bad-soft); color: var(--bad); font-weight: 600; border-radius: 99px; padding: 1px 8px; }
@media (max-width: 720px) { .frow.erow, .frow.drow, .flist.earch .frow.erow { grid-template-columns: 1fr; } .frow.drow .fnext { text-align: left; } .frow.erow .fnext { justify-content: flex-start; } }
.ent h2 { display: flex; align-items: baseline; gap: 8px; } .ent h2 .grow { flex: 1; }
.ent .kv2 { display: grid; grid-template-columns: 170px 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.ent .kv2 dt { color: var(--muted); } .ent .kv2 dd { margin: 0; overflow-wrap: anywhere; }
.ent table td, .ent table th { padding: 5px 6px; } .ent table input, .ent table select { padding: 4px 6px; font-size: 12px; width: 100%; }
.ent .former td { color: var(--muted); }
.ent .edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.prop { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 12px; }
.prop pre { white-space: pre-wrap; font: inherit; font-size: 12px; margin: 4px 0; max-height: 180px; overflow: auto; background: #f7f8f9; padding: 6px; border-radius: 6px; }
@media (max-width: 600px) { .ent .kv2 { grid-template-columns: 1fr; } }
.ent h2 .btn { font-family: Inter, system-ui, sans-serif; }
@media (min-width: 860px) { .ent .kv2 { grid-template-columns: 160px 1fr 160px 1fr; } }

/* Link entity search (file page) */
.entres { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; width: 340px; max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line, #dfe3ea); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: 4px; }
.entres[hidden] { display: none; }
.entres button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; white-space: normal; }
.entres button:focus { background: var(--brand-soft, #eef3fb); } @media (hover: hover) { .entres button:hover { background: var(--brand-soft, #eef3fb); } }
.entres button span { display: block; color: var(--muted, #6b7280); font-size: 12px; }
.entres em { display: block; padding: 8px 10px; font-size: 12px; color: var(--muted, #6b7280); }

.ent .tabs button { padding: 4px 10px; font-size: 12px; }
.modal .card.ent textarea { width: 100%; }

/* Company page pop-ups: fields fit the phone; address search; money */
.modal .card.ent input, .modal .card.ent select, .modal .card.ent textarea { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.modal .card.ent input[type=date] { -webkit-appearance: none; appearance: none; display: block; }
.modal .card.ent .edit-grid > div { min-width: 0; }
.money { display: flex; align-items: center; gap: 6px; } .money > span { color: var(--muted); font-weight: 600; } .money input { flex: 1; }
.addrbox { position: relative; display: block; }
.addrres { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: 4px; max-height: 260px; overflow: auto; }
.addrres[hidden] { display: none; }
.addrres button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; } @media (hover: hover) { .addrres button:hover { background: var(--brand-soft); } }

.clr { display: flex; align-items: center; gap: 8px; } .clr input { flex: 1; min-width: 0; }
.clrbtn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 16px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; } @media (hover: hover) { .clrbtn:hover { color: var(--bad); border-color: currentColor; } }

.modal .card.ent input[type=checkbox] { width: auto; flex: none; margin: 2px 0 0; }
.modal .card.ent label.toggle { display: flex; gap: 10px; align-items: flex-start; }
/* Section headings (Files | Entities): larger, underlined, unlike the pill subtabs beneath them. */
.tabs.main { gap: 26px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; }
.tabs.main button, body.staff .tabs.main button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted, #6b7280); padding: 6px 2px 9px; margin-bottom: -1px; font-size: 18px; font-weight: 600; }
.tabs.main button.on, body.staff .tabs.main button.on { background: none; color: var(--navy); border-bottom-color: var(--navy); }
/* Foldable cards (file and company pages, docs-open.js): like History, a closed card is just its title in the link colour. */
.card.fold > h2, .card.fold > .fhd { cursor: pointer; user-select: none; }
.card.fold.closed > :not(h2):not(.fhd) { display: none !important; }
.card.fold.closed > h2 > *, .card.fold.closed > .fhd > :not(h2) { display: none !important; }
.card.fold.closed > h2, .card.fold.closed > .fhd > h2 { margin: 0; color: var(--brand-ink); font: 600 13px Inter, system-ui, sans-serif; }
.card.fold.closed > .fhd { margin: 0; }
/* Board: the closed tabs sit behind a quiet link. */
.tabs .tabmore { align-self: center; font-size: 13px; color: var(--muted); text-decoration: none; margin-left: 6px; } @media (hover: hover) { .tabs .tabmore:hover { color: var(--ink); text-decoration: underline; } }
.frow .fstage > span.late { color: var(--bad); font-weight: 600; }
.frow .fstage > span { font-size: 13px; }
/* Entity page: details as a line, people as a list with the tables below. */
.dline { margin: 0 0 4px; font-size: 14px; line-height: 1.6; }
.plist { margin: 0 0 8px; padding-left: 18px; font-size: 14px; line-height: 1.7; }
details.psub { margin-top: 6px; } details.psub > summary { font-size: 13px; }
.psubbar { text-align: right; margin: -4px 0 4px; }
/* Secondary actions (Edit, Refresh, Change...) are grey; the orange is kept for the one main button. */
.btn.link { color: var(--muted); } @media (hover: hover) { .btn.link:hover { color: var(--ink); } }

/* Claude: a window like Claude's desktop app (warm paper, serif replies, beige user bubbles, terracotta send). */
.clbtn { display: inline-flex; gap: 7px; align-items: center; border: 1px solid #e3dfd3; background: #faf9f5; color: #3d3929; border-radius: 10px; padding: 7px 14px; font: 500 14px Inter, system-ui, sans-serif; cursor: pointer; } @media (hover: hover) { .clbtn:hover { background: #f0eee6; } }
.actions .clbtn { padding: 4px 12px; font-size: 13px; }
.spark { display: inline-block; width: 1.05em; height: 1.05em; font-size: 17px !important; vertical-align: -0.2em; line-height: 1; color: transparent !important; overflow: hidden; background-color: #d97757; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 2.5v19M2.5 12h19M5.3 5.3l13.4 13.4M18.7 5.3L5.3 18.7'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 2.5v19M2.5 12h19M5.3 5.3l13.4 13.4M18.7 5.3L5.3 18.7'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.clwin { position: fixed; inset: 0; z-index: 60; background: rgba(20,20,19,.38); display: flex; align-items: stretch; justify-content: center; padding: 3vh 2vw; }
.clwin[hidden] { display: none; }
.clpanel { background: #faf9f5; color: #3d3929; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 1400px; display: flex; flex-direction: column; overflow: hidden; }
.clhead { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #ebe8de; font: 500 14px Inter, system-ui, sans-serif; }
.clsub { color: #83827d; font-size: 13px; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clx { border: 0; background: none; color: #73726c; font: 500 13px Inter, system-ui, sans-serif; padding: 4px 8px; border-radius: 8px; cursor: pointer; } @media (hover: hover) { .clx:hover { background: #f0eee6; } }
#clclose { font-size: 22px; line-height: 1; }
.clbody { flex: 1; display: flex; min-height: 0; }
.clconv { flex: 1 1 50%; display: flex; flex-direction: column; min-width: 0; padding: 0 0 14px; }
.clchat { flex: 1; overflow: auto; padding: 22px max(20px, 5%) 10px; display: flex; flex-direction: column; gap: 18px; }
.clchat .msg { max-width: 760px; width: 100%; align-self: center; font: 400 16px/1.65 'Newsreader', ui-serif, Georgia, serif; color: #3d3929; background: none; border: 0; padding: 0; }
.clchat .msg .who { display: none; }
.clchat .msg.user { font: 400 15px/1.55 Inter, system-ui, sans-serif; }
.clchat .msg.user > .ub { display: inline-block; background: #f0eee6; border-radius: 14px; padding: 9px 14px; max-width: 85%; float: right; }
.clchat .msg.user::after { content: ''; display: block; clear: both; }
.clchat .msg.undone { opacity: .55; }
.clchat .chg { margin: 8px 0 4px; padding-left: 18px; font: 400 13.5px/1.5 Inter, system-ui, sans-serif; color: #5e5d59; }
.clchat details, .clchat .clmeta { font: 400 12.5px Inter, system-ui, sans-serif; color: #83827d; }
.clchat .diff { font-size: 12px; }
.clchat details > summary { color: #83827d; font-weight: 400; }
.clchat .ulink { border: 0; background: none; color: #83827d; font: 400 12.5px Inter, system-ui, sans-serif; text-decoration: underline; cursor: pointer; padding: 0; }
.clchat .pending { color: #83827d; font-style: italic; }
.spark.spin { display: inline-block; animation: clspin 2.4s linear infinite; }
.clchat .pending .spark { display: inline-block; animation: clspin 2.4s linear infinite; margin-right: 6px; font-style: normal; }
@keyframes clspin { to { transform: rotate(360deg); } }
.clempty { margin: auto; text-align: center; color: #83827d; font: 400 22px/1.4 'Newsreader', ui-serif, Georgia, serif; max-width: 520px; }
.clempty small { display: block; font: 400 13px Inter, system-ui, sans-serif; margin-top: 8px; }
.clcomp { margin: 0 max(16px, 4%); background: #fff; border: 1px solid #e3dfd3; border-radius: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); padding: 10px 12px 8px; max-width: 760px; align-self: center; width: calc(100% - 32px); box-sizing: border-box; }
.clcomp textarea { border: 0; outline: 0; resize: none; width: 100%; font: 400 15px/1.5 Inter, system-ui, sans-serif; color: #3d3929; background: none; padding: 2px 4px; min-height: 26px; max-height: 220px; box-shadow: none; }
.clrow { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.clmic { border: 1px solid #e3dfd3; background: #fff; border-radius: 9px; width: 32px; height: 32px; cursor: pointer; }
.clmic.on { background: #f0eee6; }
.clsend { border: 0; background: #c96442; color: #fff; border-radius: 9px; width: 32px; height: 32px; font-size: 17px; cursor: pointer; }
.clsend:disabled { opacity: .45; cursor: default; }
.clpv { flex: 1 1 50%; border-left: 1px solid #ebe8de; display: flex; flex-direction: column; min-width: 0; background: #f5f4ee; }
.clpv[hidden] { display: none; }
.clpvbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #ebe8de; }
.clpvbar select { width: auto; max-width: 70%; padding: 4px 8px; font-size: 13px; }
.clpv iframe { flex: 1; border: 0; width: 100%; background: #e9ecec; }
@media (max-width: 900px) { .clwin { padding: 0; } .clpanel { border-radius: 0; } .clpv { position: absolute; inset: 49px 0 0 0; z-index: 2; } }
/* (shared by the matter page and the entity page) */
/* Phone: the status and the age of the last update share a line (age at the right). */
@media (max-width: 720px) {
  .frow:not(.erow):not(.drow) { grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 4px; }
  .frow:not(.erow):not(.drow) .fname { grid-column: 1 / -1; }
  .frow:not(.erow):not(.drow) .fupd { text-align: right; align-self: start; }
  .frow:not(.erow):not(.drow) .fnext { grid-column: 1 / -1; }
  .frow:not(.erow):not(.drow) .fnext:empty { display: none; }
}

/* Departments: what needs action first; the total is small and grey. */
a.dept small .act { color: var(--brand-ink); font-weight: 700; }
a.dept small .clear { color: var(--muted); font-weight: 500; }
a.dept small .tot { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 8px; }

/* Phones: date pickers and option rows must fit the screen */
input[type=date], input[type=datetime-local], input[type=time] { -webkit-appearance: none; appearance: none; box-sizing: border-box; display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 46px; text-align: left; }
input[type=date]::-webkit-date-and-time-value, input[type=datetime-local]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; }
.choice { min-width: 0; overflow-wrap: anywhere; }
input + .choices, input + .choice, textarea + .choices, select + .choices, .row + .choices { margin-top: 12px; }
@media (max-width: 600px) { .choices.inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } #app .choice { padding: 10px 12px; } }
#nextwrap { white-space: nowrap; flex: 0 0 auto; } #acts .btn, #nextwrap .btn { white-space: nowrap; }

/* The Chat card matches the other cards: small orange label when closed, the same serif heading when open. */
#chatcard > summary { cursor: pointer; list-style: none; font: 600 13px Inter, system-ui, sans-serif; color: var(--brand-ink); }
#chatcard > summary::-webkit-details-marker { display: none; }
#chatcard[open] > summary { font-family: Newsreader, Georgia, serif; font-size: 17px; letter-spacing: -.01em; color: var(--navy); margin: 0 0 6px; }

#actdate { display: none !important; }

/* attach widget (all forms) */
.hint.inl { display: inline; margin-left: 8px; font-size: 13px; }
.upbox { border: 1px dashed var(--line, #c9ced6); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: #fafbfc; }
.upbox.need { border-color: #d9b45b; }
.upbox .uphead b { font-weight: 600; display: block; }
.upbox .uphead .hint { margin-top: 2px; }
.upfiles { list-style: none; margin: 8px 0 4px; padding: 0; }
.upfiles li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid #eceff3; font-size: 14px; }
.upfiles li:first-child { border-top: 0; }
.upfiles .fname { flex: 1; overflow-wrap: anywhere; }
.uppick { display: inline-block; margin-top: 8px; padding: 6px 12px; border: 1px solid var(--line, #c9ced6); border-radius: 8px; background: #fff; font-size: 14px; font-weight: 600; }

.choice.sm { padding: 5px 10px; font-size: 13px; width: auto; display: inline-flex; margin: 8px 0 2px; }
.choice.sm input { transform: scale(.9); }

/* smaller explanatory text, name + check on one line, obvious dropdown arrow */
#app .lede, .lede { font-size: 13.5px; }
#app .hint, .hint { font-size: 12.5px; }
#app .note { font-size: 13px; }
.namecheck { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.namecheck .nc .choice { margin: 0 0 2px; white-space: nowrap; }
@media (max-width: 560px) { .namecheck { grid-template-columns: 1fr; } }
input[data-list] { padding-right: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23126a6e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
input[data-list] { position: relative; }

.repnum { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand, #126a6e); margin: 0 0 4px; }

.combo { background: #fff; border: 1px solid var(--line, #d5dbe0); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.1); }
.combo-i { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; font-size: 14px; cursor: pointer; } @media (hover: hover) { .combo-i:hover { background: #eef5f5; } }

/* Phone: larger tap targets, no iOS zoom on focus, upload and dropdown parts that fit the width. */
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px; }
  .uppick, .choice.sm, .combo-i { min-height: 40px; }
  .upbox { padding: 12px; }
  .combo { max-width: calc(100vw - 32px); }
  .combo-i { padding: 10px 12px; }
  .namecheck .nc .choice { white-space: normal; }
  .repnum { margin-top: 6px; }
}

.clq { margin-top: 6px; font: 400 13px/1.4 Inter, system-ui, sans-serif; color: #6b6a5f; } .clq div { margin-top: 2px; }
.clfail { border-left: 3px solid var(--bad); padding-left: 12px !important; } .clfail small { color: #6b6a5f; font: 400 12px Inter, system-ui, sans-serif; }
.clvl { padding: 8px 12px; border-bottom: 1px solid #e3dfd3; max-height: 180px; overflow: auto; font: 400 13px Inter, system-ui, sans-serif; } .clvr { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 3px 0; }
.cltri { border-left: 3px solid #2f7d6d; padding-left: 12px !important; } .cltri small { color: #6b6a5f; font: 400 12px Inter, system-ui, sans-serif; }

/* Yes / No: two small buttons (Yes first), with a detail field (e.g. a deadline) beside them once Yes is chosen. */
.ynrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 2px; }
.choices.yn { display: inline-flex; gap: 8px; margin: 0; }
#app .choices.yn .choice, .choices.yn .choice { width: auto; padding: 6px 16px; min-width: 64px; justify-content: center; }
.ynextra { display: flex; align-items: center; gap: 8px; }
.ynextra label.f, #app .ynextra label.f { margin: 0; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ynextra input { width: auto; min-width: 170px; padding: 6px 10px; }

/* Action menus (a button with its dropdown) and ticked document lists: case Documents, entity minute book. */
.actmenu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 8px 12px; display: grid; grid-template-columns: repeat(2, minmax(150px, auto)); gap: 4px 18px; }
.actmenu[hidden] { display: none; }
.nextmenu { grid-template-columns: 1fr; right: 0; left: auto; min-width: 240px; padding: 6px; gap: 2px; }
.nextmenu .btn { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); padding: 6px 8px; border-radius: 6px; font-weight: 500; } @media (hover: hover) { .nextmenu .btn:hover { background: var(--soft,#f6f7f9); } }
.nextmenu .mh { font-size: 11px; color: var(--muted); padding: 4px 8px 0; text-transform: uppercase; letter-spacing: .04em; }
.actmenu label { display: flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; cursor: pointer; }
.ckl { list-style: none; padding-left: 0; }
.ckl li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ckl .rvck, .ckl .ckgap { width: 15px; height: 15px; flex: none; margin: 0; position: relative; top: 2px; }
@media (max-width: 640px) {
  .nextmenu { max-width: calc(100vw - 32px); }
  .nextmenu .btn { white-space: normal; }
}

/* Staff pages: a date box is the same height as the text boxes and dropdowns beside it. */
body.staff input[type=date] { min-height: 0; line-height: 18px; }
body.staff input[type=date]::-webkit-datetime-edit, body.staff input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
body.staff input[type=date]::-webkit-calendar-picker-indicator { padding: 0; margin: 0 0 0 4px; height: 1em; width: 1em; }

/* ===== Clio look (Nov 2026): look only. Colours, fonts, radii and the top bar; no layout, button, setting or behaviour is changed. =====
   To revert: delete this block. */
:root {
  --ink: #20242c; --muted: #6b7280; --line: #e2e4e8; --bg: #f1f2f4; --card: #ffffff;
  --navy: #20242c; --teal-soft: #eef0f3; --brand-soft: #fff1e8;
  --radius: 12px;
}
body { background: var(--bg); font-family: Inter, "Segoe UI", Arial, sans-serif; }
h1, h2, .serif { font-family: Inter, "Segoe UI", Arial, sans-serif; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
h1 em, h2 em { font-style: normal; }
.top { background: #e9ebee; border-bottom: 1px solid var(--line); box-shadow: none; }
.top .tag { color: var(--brand-ink); border-left-color: #cfd3d9; }
.top a.nl { color: #3d4350; }
.top a.nl.on { color: var(--brand-ink); } @media (hover: hover) { .top a.nl:hover { color: var(--brand-ink); } }
.card { border-radius: 12px; border-color: var(--line); box-shadow: 0 1px 2px rgba(32,36,44,.05); }
.flist { border-radius: 12px; border-color: var(--line); }
.btn { border-radius: 8px; }
.btn.dark { background: #2b303a; }
.tabs button { border-radius: 8px; }
.tabs.main button, body.staff .tabs.main button { border-radius: 0; }
body.staff .btn { border-radius: 8px; }
.modal { background: rgba(32,36,44,.45); }
.foot { background: #e9ebee; color: #5b6270; border-top: 1px solid var(--line); }
.foot a { color: var(--brand-ink); } @media (hover: hover) { tr.click:hover td { background: #f6f7f9; } }
input[type=text], input:not([type]), input[type=search], input[type=email], input[type=date], input[type=datetime-local], input[type=time], input[type=number], input[type=password], input[type=tel], select, textarea { border-color: #d3d6dc; border-radius: 8px; }

/* ===== Phone layout (Nov 2026): look only; scrolls wide tables inside their card and enlarges tap targets. ===== */
@media (max-width: 640px) {
  body, body.staff { font-size: 15px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
  .card, body.staff .card { overflow-x: auto; padding: 14px; }
  .card table, #list table, #rec table { min-width: 520px; }
  .top, body.staff .top { padding: 8px 12px; gap: 10px; }
  .top .grow { flex-basis: 100%; height: 0; order: 5; }
  .top a.nl { padding: 8px 6px; font-size: 14px; }
  .top { flex-wrap: wrap; }
  .tabs.main, body.staff .tabs.main { flex-wrap: nowrap; overflow-x: auto; gap: 18px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs.main button, body.staff .tabs.main button { white-space: nowrap; font-size: 15px; flex: none; }
  .tabs button, body.staff .tabs button { padding: 9px 14px; font-size: 14px; }
  .btn, body.staff .btn { min-height: 40px; }
  .btn.small, body.staff .btn.small { min-height: 34px; }
  input[type=text], input:not([type]), input[type=search], input[type=email], input[type=date], input[type=number], input[type=password], input[type=tel], input[type=datetime-local], input[type=time], select, textarea,
  body.staff input[type=text], body.staff input:not([type]), body.staff input[type=search], body.staff input[type=email], body.staff input[type=password], body.staff input[type=date], body.staff select, body.staff textarea { font-size: 16px; min-height: 42px; }
  .modal { padding: 0; align-items: stretch; }
  .modal .card, .modal .card.ent { max-width: none; border-radius: 0; min-height: 100vh; }
  .grid2 { grid-template-columns: 1fr; }
  .kp { grid-template-columns: 1fr 1fr; }
  .pgrid { grid-template-columns: 1fr; }
  h1, body.staff h1 { font-size: 24px; }
}

/* ===== App shell (mockup layout): left menu and top search. Added navigation only. ===== */
.sb { position: fixed; left: 0; top: 56px; bottom: 0; width: 208px; background: #eceef1; border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; z-index: 3; }
.sb nav { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid transparent; }
.sb nav + nav { padding-top: 6px; }
.sb a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 4px; border-radius: 8px; color: #3d4350; text-decoration: none; font-size: 14.5px; font-weight: 500; } @media (hover: hover) { .sb a:hover { background: #e2e5e9; } }
.sb a.on { background: var(--brand); color: #fff; }
body.shelled { padding-left: 208px; }
body.shelled .top { margin-left: -208px; padding-left: 20px; position: sticky; top: 0; z-index: 4; }
body.shelled .foot { margin-left: 0; }
.gsearch { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 0 14px; width: 340px; max-width: 40vw; margin-left: 8px; color: var(--muted); }
.gsearch input { border: 0 !important; outline: 0 !important; background: transparent; padding: 8px 0 !important; min-height: 0 !important; font-size: 14px; width: 100%; box-shadow: none; }
.sbx, .sbk { display: none; }
.top .sbtn { display: none; background: none; border: 0; padding: 4px; color: var(--ink); cursor: pointer; }
@media (max-width: 900px) {
  body.shelled { padding-left: 0; }
  body.shelled .top { margin-left: 0; }
  .sb { transform: translateX(-100%); transition: transform .18s; top: 0; padding-top: 70px; z-index: 30; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  body.sbopen .sb { transform: none; }
  .top .sbtn { display: block; }
  .gsearch { display: none; }
  body.shelled .top { flex-wrap: nowrap; }
  body.shelled .top .nl:last-child, body.shelled .top .nl:last-of-type { margin-left: auto; }
  .sbx { display: block; position: absolute; top: 58px; left: 12px; width: 44px; height: 44px; padding: 4px; border: 0; background: none; color: var(--ink); cursor: pointer; }
  .sb { padding-top: 116px; }
  .sbk { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 29; }
  body.sbopen .sbk { display: block; }
}

/* Header: refresh button then Sign out, both pushed to the right edge; Sign out small on one line. */
body.shelled .top .refreshbtn { margin-left: auto !important; }
body.shelled .top .nl:last-child, body.shelled .top .nl:last-of-type { margin-left: 8px !important; }
body.shelled .top .refreshbtn ~ .nl:last-of-type { margin-left: 8px !important; }
.top a.nl[href="/logout"] { white-space: nowrap; font-size: 12px; padding-left: 0; padding-right: 0; flex: none; }

/* Phone: no sideways scrolling. Tables become stacked cards (each cell labelled by its column), so Email sits under Phone, etc. */
@media (max-width: 640px) {
  html, body { max-width: 100%; }
  /* clip (not hidden) so the page is not turned into its own scroller: on iPhone that made fixed buttons (Marla AI) drift up while scrolling */
  body { overflow-x: clip; }
  @supports not (overflow: clip) { html, body { overflow-x: hidden; } }
  .card, body.staff .card { overflow-x: visible; }
  .card table, #list table, #rec table, table { min-width: 0 !important; width: 100% !important; }
  table thead { display: none; }
  table, table tbody, table tr, table td { display: block; width: auto; box-sizing: border-box; }
  table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table td { padding: 2px 0 !important; border: 0 !important; text-align: left !important; overflow-wrap: anywhere; }
  table td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: .03em; }
  table td[data-l=""]::before { display: none; }
  table td .stage, table td .chip, table td .pill, table td .fupd { white-space: normal; overflow-wrap: anywhere; } /* long stage names wrap instead of running off the card */
  .tw, .tbl, div[style*="overflow-x"] { overflow-x: visible !important; }
  input, select, textarea { max-width: 100%; }
  .kv { grid-template-columns: minmax(0,1fr) !important; }
}

/* Top search results (matters, clients, leads, entities). */
.gsres { position: absolute; top: 100%; left: 0; right: 0; min-width: 280px; margin-top: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 40; max-height: 70vh; overflow: auto; }
.gsres a { display: block; padding: 9px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); } .gsres a:last-child { border-bottom: 0; } @media (hover: hover) { .gsres a:hover { background: #f7f8fa; } }
.gsres a b { display: block; font-size: 14px; } .gsres a span { font-size: 12px; color: var(--muted); } .gsres p { margin: 0; padding: 10px 14px; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .gsearch { display: block !important; flex: 1 1 100%; order: 6; } }

/* Create new + (header) */
.cnew { position: relative; margin-left: auto; flex: none; } .cnb { background: var(--brand, #e8590c); color: #fff; border: 0; border-radius: 12px; padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: 0 2px 6px rgba(232,89,12,.3); }
.cnm { position: absolute; right: 0; top: 100%; margin-top: 8px; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.14); z-index: 50; padding: 6px 0; } .cnm b { display: block; padding: 8px 16px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); } .cnm a { display: block; padding: 9px 16px; color: var(--ink); text-decoration: none; font-size: 14px; } @media (hover: hover) { .cnm a:hover { background: #f7f8fa; } }
/* Row "Action" button (public/actmenu.js): small and orange like "Create new +", opening the same white menu. */
.am { display: inline-block; vertical-align: middle; } .cnm.am-pop { right: auto; margin-top: 0; min-width: 190px; text-align: left; white-space: nowrap; z-index: 1000; }
.amb { background: var(--brand, #e8590c); color: #fff; border: 0; border-radius: 8px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.5; cursor: pointer; box-shadow: 0 2px 6px rgba(232,89,12,.25); } .amb span { font-size: 10px; color: #fff; opacity: .85; margin-left: 2px; }
.cnm button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 16px; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
@media (hover: hover) { .amb:hover { filter: brightness(.94); } .cnm button:hover { background: #f7f8fa; } }
body.shelled .top .cnew + .refreshbtn, body.shelled .top .cnew ~ .nl:last-of-type { margin-left: 8px !important; }
body.shelled .top .cnew ~ .grow { display: none; }

body.shelled .top .tag { display: none; }
.gskbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px inherit; font-family: inherit; background: #eceef2; color: #4b5563; border-radius: 6px; padding: 2px 7px; pointer-events: none; }

/* Shared page header (matches the mockup): crumb, big title, grey subtitle, underlined tabs */
body.shelled .crumb { font-size: 13px; color: var(--muted, #6b7280); margin: 6px 0 4px; }
body.shelled main > h1, body.shelled .mh h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; margin: 0 0 8px; }
body.shelled .mh { margin: 0 0 4px; }
body.shelled .pgs, body.shelled main > .lede { margin: 0 0 14px; color: var(--muted, #6b7280); font-size: 15px; }
body.shelled .tabs.main { gap: 26px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
body.shelled .tabs.main button, body.shelled.staff .tabs.main button { font-size: 14px; font-weight: 500; padding: 10px 2px; border-bottom: 2px solid transparent; color: var(--muted, #6b7280); }
body.shelled .tabs.main button.on, body.shelled.staff .tabs.main button.on { color: var(--ink, #14181f); font-weight: 600; border-bottom-color: var(--orange, #fb6818); }

/* Type scale matched to the mockup: 14px base, 13px secondary, 12px labels */
body.shelled, body.shelled.staff { font-size: 14px; line-height: 1.45; }
body.shelled main { font-size: 14px; }
body.shelled h2 { font-size: 16px; } body.shelled h3 { font-size: 14px; }
body.shelled main > h1, body.shelled .mh h1 { font-size: 28px; }
body.shelled .pgs, body.shelled main > .lede { font-size: 14px; }
body.shelled table, body.shelled.staff table { font-size: 14px; }
body.shelled td, body.shelled.staff td { padding: 14px 20px; }
body.shelled th, body.shelled.staff th { font-size: 12px; padding: 10px 20px; letter-spacing: .04em; }
body.shelled .muted, body.shelled small { font-size: 12.5px; }
body.shelled .card { font-size: 13.5px; } body.shelled .card p, body.shelled .kv { font-size: 13.5px; }
body.shelled .btn, body.shelled.staff .btn { font-size: 13px; }
body.shelled .chip { font-size: 12px; }
body.shelled .tabs button, body.shelled.staff .tabs button { font-size: 13px; }
body.shelled .tabs.main button, body.shelled.staff .tabs.main button { font-size: 13.5px; }
body.shelled input, body.shelled select, body.shelled textarea { font-size: 13.5px; }
body.shelled .frow b { font-size: 13.5px; } body.shelled .frow small { font-size: 12px; }
body.shelled #addco, body.shelled #addb { display: none !important; }

/* White page-header band, edge to edge, as in the mockup */
body.shelled { overflow-x: clip; }
body.shelled .crumb, body.shelled .mh, body.shelled main > h1, body.shelled .pgs, body.shelled .pgh, body.shelled .tabs.main, body.shelled #dt, body.shelled #bt { position: relative; }
body.shelled .crumb::before, body.shelled .mh::before, body.shelled main > h1::before, body.shelled .pgs::before, body.shelled .pgh::before, body.shelled .tabs.main::before, body.shelled #dt::before, body.shelled #bt::before { content: ''; position: absolute; top: 0; bottom: 0; left: -100vw; right: -100vw; background: #fff; z-index: -1; }
body.shelled .crumb { margin: 0; padding: 22px 0 4px; }
body.shelled .mh, body.shelled main > h1 { margin: 0; padding: 0 0 6px; }
body.shelled .pgs { margin: 0; padding: 0 0 18px; }
body.shelled .pgh { margin: 0; padding: 22px 0 18px; }
body.shelled .pgh .crumb, body.shelled .pgh h1, body.shelled .pgh .pgs { padding-left: 0; }
body.shelled .pgh .crumb::before, body.shelled .pgh .pgs::before, body.shelled .pgh h1::before { display: none; }
body.shelled .pgh .crumb { padding-top: 0; } body.shelled .pgh .pgs { padding-bottom: 0; }
body.shelled .tabs.main, body.shelled #dt, body.shelled #bt { margin: 0; padding: 4px 0 0; }
body.shelled .pgs::after, body.shelled .tabs.main::after, body.shelled #dt::after, body.shelled #bt::after, body.shelled .pgh:not(:has(+ #dt)):not(:has(+ #bt))::after { content: ''; position: absolute; left: -100vw; right: -100vw; bottom: 0; border-bottom: 1px solid var(--line); }
body.shelled .pgs:has(+ .tabs.main)::after, body.shelled .pgs:has(+ #views)::after { display: none; }
body.shelled .wrap > .pgs + .muted, body.shelled .wrap > .pgs + p.muted { margin-top: 14px; }

body.shelled.staff .wrap { padding-top: 0; }
body.shelled .pgh .pgs::after { display: none; }
body.shelled #bt, body.shelled #dt { overflow: visible; }
body.shelled main > h1:has(+ .tabs.main) { padding-bottom: 18px; }

/* Exact mockup type scale: base 14, h1 30, subtitle 15, crumb 13, tabs 14, card title 15, table 14, th 12, secondary 13, chip 12, pills 13, buttons 13 */
body.shelled main > h1, body.shelled .mh h1, body.shelled .pgh h1 { font-size: 30px; }
body.shelled .pgs, body.shelled main > .lede { font-size: 15px; }
body.shelled .crumb { font-size: 13px; }
body.shelled .tabs.main button, body.shelled.staff .tabs.main button, body.shelled #dt button, body.shelled #bt button { font-size: 14px; }
body.shelled h2, body.shelled .cx .ch { font-size: 15px; }
body.shelled .muted, body.shelled small, body.shelled .mt td .muted { font-size: 13px; }
body.shelled .mpills button, body.shelled .fchip, body.shelled .seg button { font-size: 13px; }
body.shelled .sb a { font-size: 14px; }
body.shelled table, body.shelled.staff table, body.shelled td, body.shelled.staff td { font-size: 14px; }
body.shelled th, body.shelled.staff th { font-size: 12px; }
body.shelled .card, body.shelled .card p, body.shelled .kv, body.shelled .kvr { font-size: 14px; }

/* Tabs inside the header band: flat, flush-left with the title, orange underline on the active tab, sitting on the band's bottom line */
body.shelled #dt, body.shelled #bt, body.shelled .tabs.main { display: flex; gap: 28px; flex-wrap: nowrap; padding: 6px 0 0; margin: 0; }
body.shelled #dt button, body.shelled #bt button, body.shelled .tabs.main button, body.shelled.staff .tabs.main button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 0 12px; margin: 0 0 -1px; font-size: 14px; font-weight: 500; color: var(--muted, #6b7280); box-shadow: none; position: relative; z-index: 1; }
body.shelled #dt button.on, body.shelled #bt button.on, body.shelled .tabs.main button.on, body.shelled.staff .tabs.main button.on { background: none; color: var(--ink, #14181f); font-weight: 600; border-bottom-color: var(--orange, #fb6818); }

/* Whole staff app renders at 75% of its drawn size, so what he sees at 100% browser zoom equals the old 75% view (client-facing pages are not shelled and stay untouched) */
html:has(body.shelled) { zoom: 0.75; }
/* a page opened above a call (softphone.js call layer) is scaled by the layer instead: zoom inside an iframe made Safari draw it on 3/4 of the width */
html.inlayer { zoom: 1 !important; }

/* Staff pages fill the width like the mockup (inline per-page max-widths are overridden) */
@media (min-width: 900px) { body.shelled .wrap, body.shelled .wrap.wide, body.shelled main.wrap { max-width: none !important; padding-left: 40px; padding-right: 40px; } }
body.shelled #dt, body.shelled #bt { margin-bottom: 18px; }

/* One header for every staff page: crumb, title, subtitle, actions, then tabs on the band's bottom line */
body.shelled .tabs[hidden] { display: none !important; }
body.shelled .pgh:has(+ .tabs.main)::after { display: none; }
body.shelled .pgh { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 0 18px; margin: 0; }
body.shelled .pgh + .tabs.main { margin-bottom: 18px; }
body.shelled .tabs.main button .n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: #eceef2; color: var(--muted, #6b7280); font-size: 12px; font-weight: 500; }
body.shelled .tabs.main button.on .n { background: #fde3d3; color: #c2410c; }

/* Page actions share the "Create new +" shape; Record payment keeps its white colour */
body.shelled .pga .btn, body.shelled .split .btn { border-radius: 12px; padding: 9px 16px; font-weight: 600; font-size: 14px; }
body.shelled .pga .btn.primary, body.shelled .split .btn.primary { box-shadow: 0 2px 6px rgba(232,89,12,.3); }
body.shelled .split .btn:first-child { border-radius: 12px 0 0 12px; }
body.shelled .split .btn.caret { border-radius: 0 12px 12px 0; padding: 9px 11px; }
/* Same gap under the header band on every page, as on the Dashboard */
body.shelled .pgh:not(:has(+ .tabs)):not(:has(+ #dt)):not(:has(+ #bt)) { margin-bottom: 18px; }
body.shelled #mfil2 .mfil { margin: 0 0 14px; }
body.shelled .tabs.main { margin-bottom: 18px; }

/* Staff header (shelled pages only; client questionnaires keep theirs): wider and a larger logo, 12 Nov 2026 */
body.shelled .top { padding: 14px 40px; }
body.shelled .top .logo img { height: 64px; }

body.shelled .sb { top: 93px; }
/* Matters tabs: the same little count as the Leads board's tabs. */
#mseg button .n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: #eceef2; color: var(--muted, #6b7280); font-size: 12px; font-weight: 500; line-height: 18px; text-align: center; }
#mseg button.on .n { background: #fde3d3; color: #c2410c; }

/* ===== Phone polish (screens 640px and narrower only; the website view is untouched) ===== */
@media (max-width: 640px) {
  /* Header: menu, logo, Create new and Sign out on one line; the search box drops to its own full-width row instead of running off the screen. */
  body.shelled .top { flex-wrap: wrap; row-gap: 8px; padding: 8px 12px; }
  body.shelled .top .logo img { height: 34px; }
  body.shelled .top .gsearch, body.shelled .top .gsearch { order: 9; flex: 1 1 100%; width: 100%; max-width: none; margin: 0; }
  body.shelled .top .gsearch, body.shelled .top .gsearch { display: flex !important; align-items: center; }
  body.shelled .gsearch kbd, body.shelled .gsearch .gskbd { display: none; }
  body.shelled .top .gsearch input { font-size: 16px; }
  body.shelled .tabs, body.shelled .tabs.main { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  body.shelled .tabs > *, body.shelled .tabs.main > * { flex: none; white-space: nowrap; }
  /* The tab strip scrolls sideways on a phone, so the full-width white band can no longer be drawn by boxes sticking out 100vw on each side:
     they made the strip scroll into blank space (tabs dragged off, blank gaps, tabs overlapping the buttons). The strip carries its own band edge to edge instead. */
  body.shelled .tabs.main, body.shelled #dt, body.shelled #bt { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; min-width: 0; max-width: calc(100% + 24px); }
  body.shelled main, body.shelled .wrap, body.shelled main.wrap { min-width: 0; max-width: 100%; }
  /* The other header bands bleed only into the 12px page gutter, not 100vw: the page was twice the screen wide, so it could be dragged sideways into blank space. */
  body.shelled .crumb::before, body.shelled .mh::before, body.shelled main > h1::before, body.shelled .pgs::before, body.shelled .pgs::after, body.shelled .pgh::before, body.shelled .pgh::after { left: -12px; right: -12px; }
  body.shelled .tabs.main::before, body.shelled .tabs.main::after, body.shelled #dt::before, body.shelled #dt::after, body.shelled #bt::before, body.shelled #bt::after { display: none; }
  body.shelled .cnb { padding: 9px 14px; min-height: 40px; }
  body.shelled .top a.nl[href="/logout"] { padding: 10px 4px; }
  /* The closed side menu leaves no shadow strip on the left edge. */
  body:not(.sbopen) .sb { box-shadow: none; visibility: hidden; }
  body.sbopen .sb { visibility: visible; }
  body.shelled .sb nav a { min-height: 44px; display: flex; align-items: center; }
  /* Page title row: the buttons wrap under the title instead of squeezing beside it. */
  body.shelled .pgh { flex-wrap: wrap; row-gap: 10px; padding: 16px 0 12px; }
  body.shelled .pgh .pga { flex-wrap: wrap; gap: 8px; width: 100%; margin-left: 0; }
  body.shelled .pgh .pga .msearch { flex: 1 1 100%; }
  /* Lists: each row is a card with room inside, small facts two to a line, the name on top. */
  body.shelled table tr { padding: 12px !important; display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; }
  body.shelled table td { grid-column: auto; min-width: 0; }
  body.shelled table td:first-child, body.shelled table td[data-l=""], body.shelled table td[colspan], body.shelled table td[data-l="Email"], body.shelled table td[data-l="Matter"], body.shelled table td[data-l="Name"], body.shelled table td[data-l="Client"] { grid-column: 1 / -1; }
  body.shelled table td[data-l]::before { margin-bottom: 1px; }
  /* Touch: fields big enough that the phone does not zoom in when tapped; buttons and tabs easy to hit. */
  body.shelled input:not([type="checkbox"]):not([type="radio"]), body.shelled select, body.shelled textarea { font-size: 15px !important; min-height: 34px; font-family: inherit !important; } /* the staff app draws at 75%, so 21.5px shows as 16px and the phone does not zoom in on tap */
  body.shelled .of-c input:not([type="checkbox"]):not([type="radio"]), body.shelled .of-c select, body.shelled .of-c textarea { font-size: 18px !important; min-height: 38px; padding: 6px 10px; } /* Open file popup: smaller text inside the fields (about 13.5px shown; if the phone zooms in on tap, raise it) */
  body.shelled .btn, body.shelled button.btn { min-height: 40px; }
  body.shelled .btn.small { min-height: 36px; }
  body.shelled .seg button, body.shelled .tabs button, body.shelled .tabs a { min-height: 40px; }
  /* Popups use the whole width, scroll inside, and keep their buttons reachable. */
  body.shelled .modal .card, body.shelled .modal form.card { width: calc(100vw - 20px); max-width: none; max-height: 92vh; overflow-y: auto; padding: 18px 16px; }
  body.shelled .modal .nav, body.shelled .modal .actions { position: sticky; bottom: -18px; background: #fff; padding: 10px 0 4px; }
  /* Side menu on a phone: full height from the top, close button at its top, no big empty gap. */
  body.shelled .sb { top: 0; padding-top: 64px; }
  body.shelled .sbx { top: 10px; }
}

/* Closed / Archive: a small text link beside the tabs, the same everywhere. */
.mmore a { font-size: 13px; color: var(--muted, #6b7280); text-decoration: none; margin-left: 12px; white-space: nowrap; } @media (hover: hover) { .mmore a:hover { color: var(--ink, #111); text-decoration: underline; } }
.mmore a.on { color: var(--ink, #111); font-weight: 600; }
/* Next-step button and its "+" read as one button (all screens). */
#nextwrap { gap: 0 !important; }
#nextwrap #acts .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
#nextwrap #moreb { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
@media (max-width: 640px) {
  /* Tabs line up on one row (the "Closed (n)" / "Archived (n)" link sits level with the others). */
  body.shelled .tabs, body.shelled .tabs.main { align-items: center; }
  body.shelled .tabs > button, body.shelled .tabs > a { display: inline-flex; align-items: center; }
  /* The column titles of a list are not shown on a phone (each card labels its own facts). */
  body.shelled table thead tr, body.shelled table tr:has(> th):not(:has(> td)) { display: none !important; }
  /* Practice-area tabs on Matters: all shown, wrapping onto a second line, instead of sliding sideways. */
  body.shelled #mhead { flex-wrap: wrap !important; overflow: visible; row-gap: 6px; }
  /* Dropdown menus open as a sheet along the bottom of the screen, so they never run off an edge. */
  body.shelled .mmenu, body.shelled .pga .mmenu, body.shelled .acts .mmenu, body.shelled .actmenu, body.shelled .mb-menu { position: fixed !important; left: 8px !important; right: 8px !important; top: auto !important; bottom: 8px !important; width: auto !important; min-width: 0 !important; max-width: none !important; max-height: 65vh; overflow-y: auto; z-index: 70; box-shadow: 0 -6px 30px rgba(0,0,0,.25); border-radius: 14px; padding: 8px; }
  body.shelled .mmenu button, body.shelled .mb-menu button, body.shelled .actmenu button { min-height: 44px; font-size: 15px; }
  /* Date boxes: one even height with the date centred (a phone draws them tall with the text stuck at the top). */
  body.shelled input[type="date"], body.shelled input[type="time"], body.shelled input[type="datetime-local"] { -webkit-appearance: none; appearance: none; height: 44px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; line-height: 44px; box-sizing: border-box; min-width: 170px; }
  body.shelled input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 0; }
}
@media (max-width: 640px) {
  /* Matter > Activity: entries as tidy cards; the delete x sits top right; the total row is plain text. */
  body.shelled tr.arow { position: relative; padding-right: 44px !important; }
  body.shelled tr.arow > td { text-align: left !important; min-width: 0; }
  body.shelled tr.arow > td.asel { grid-column: 1 / -1; padding: 0 !important; }
  body.shelled tr.arow > td.adelc { position: absolute; top: 8px; right: 8px; padding: 0 !important; }
  body.shelled tr.arow > td input:not([type=checkbox]) { width: 100%; text-align: left !important; }
  body.shelled tr.afoot { display: block !important; padding: 12px 0 0 !important; }
  body.shelled tr.afoot > td { display: block !important; text-align: left !important; padding: 2px 0 !important; }
  body.shelled tr.afoot > td::before { display: none !important; }
  body.shelled tr.afoot > td:empty { display: none !important; }
}
/* No grey flash or grey box on a tapped tab or button (phone and website). */
body.shelled { -webkit-tap-highlight-color: transparent; }
body.shelled .tabs.main button, body.shelled .tabs.main button:focus, body.shelled .tabs.main button:active { background: none !important; outline: none; } @media (hover: hover) { body.shelled .tabs.main button:hover { background: none !important; outline: none; } }
/* Phone: every popup opens like New IDV and Open file: a rounded card inset from the sides, just below the top, as tall as its content. */
@media (max-width: 640px) {
  body.shelled .modal { padding: 95px 10px 20px !important; align-items: flex-start !important; }
  body.shelled .modal > .card, body.shelled .modal > form.card, body.shelled .modal .card.ent { width: 100% !important; max-width: none !important; min-height: 0 !important; height: auto !important; max-height: calc(100vh - 140px); border-radius: 16px !important; margin: 0 !important; box-sizing: border-box; }
}

/* Date and time boxes look like every other field (the browser draws them in a monospace font otherwise) */
body.shelled input[type="datetime-local"], body.shelled input[type="date"], body.shelled input[type="time"] { font-family: inherit; border: 1px solid var(--line, #dfe3e8); border-radius: 10px; background: #fff; color: inherit; }

/* The closing-date setter (and Assign) on the Matters list and the corporate boards, on a phone (Nov 2026): a bar across the
   bottom of the screen instead of a little box squeezed into the card, so the date, Save and N/A all fit and can be tapped. */
@media (max-width: 700px) {
  .clpick { position: fixed !important; left: 12px !important; right: 12px !important; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom)) !important; z-index: 1000 !important; padding: 12px !important; gap: 10px !important; flex-wrap: nowrap; box-shadow: 0 -4px 24px rgba(0,0,0,.18) !important; }
  .clpick input[type=date] { flex: 1 1 auto; min-width: 0; font-size: 16px !important; padding: 10px 8px !important; }
  .clpick .btn { flex: none; white-space: nowrap; word-break: normal; writing-mode: horizontal-tb; padding: 10px 14px !important; min-height: 42px; font-size: 15px !important; }
  .clpick.asgpick { max-height: 60vh; overflow: auto; }
}

/* Read the file first: documents we already hold, and the "we've filled in what we have" line on the questionnaire */
.havedoc { background: #eef7f0; border: 1px solid #bfe0c8; color: #1d5a30; border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.havedoc .tick { font-weight: 700; margin-right: 4px; }
.prefillnote { background: #eef4fb; border: 1px solid #c6d9ef; color: #1d3f66; border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; font-size: 14px; }
/* Document side pane (public/docpane.js): computer only. */
html.docpaneopen #cp,html.docpaneopen #cpBtn{display:none!important}
.docpane{position:fixed;top:0;right:0;bottom:0;width:46vw;background:#fff;border-left:1px solid var(--line,#ddd);box-shadow:-6px 0 18px rgba(0,0,0,.08);z-index:55;display:flex;flex-direction:column}
.docpane .dp-head{display:flex;align-items:center;gap:12px;padding:10px 14px;border-bottom:1px solid var(--line,#ddd);font-size:13px}
.docpane .dp-t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:60%}
.docpane .dp-head a{color:var(--brand,#e8590c);text-decoration:underline;cursor:pointer}
.docpane .dp-x{border:0;background:none;font-size:22px;line-height:1;cursor:pointer;color:#555}
.docpane .dp-f{flex:1;border:0;width:100%}
.docpane .dp-drag{position:absolute;left:-4px;top:0;bottom:0;width:8px;cursor:col-resize}
@media (hover: hover){.docpane .dp-x:hover{color:#000}}

/* Search button (Nov 2026): 641 to 900 px wide, where the header has no room for the search box; it opens the box on its own row. */
.top .gsbtn { display: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); align-items: center; justify-content: center; cursor: pointer; padding: 0; flex: none; }
@media (min-width: 641px) and (max-width: 900px) {
  body.shelled .top .gsbtn { display: inline-flex; margin: 0 8px 0 auto; }
  body.shelled.gsopen .top { flex-wrap: wrap; row-gap: 8px; }
  body.shelled.gsopen .top .gsearch { display: flex !important; order: 9; flex: 1 1 100%; width: 100%; max-width: none; margin: 0; }
  body.shelled.gsopen .top .gsearch .gskbd { display: none; }
  body.shelled.gsopen .top .gsbtn { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
}

/* Marla on the phone (public/mobile.js, mobile.css): the tab bar, + button, header icons and sheets exist on every staff page but only show under 641 px. */
.mtab, .mfab, .mtop, .msh, .mset-list, .mset-back { display: none; }
/* the phone's initials circles and one-line summaries (public/mobile.js) never show on the website view */
@media (min-width: 641px) { .mav2, .mav3, .mmeta { display: none !important; } }
.cbr { display: none; } /* a comma between client names, shown only in the phone's one-line rows (mobile.css) */
/* Waiting for the engagement letter / CC (22 Nov 2026): one document yellow, both red; green is only for ready. */
span.waity, .frow .fstage > span.waity { background: var(--wait-soft); color: var(--wait); font-weight: 600; border-radius: 99px; padding: 1px 8px; } span.waitr, .frow .fstage > span.waitr { background: var(--bad-soft); color: var(--bad); font-weight: 600; border-radius: 99px; padding: 1px 8px; }

/* Page switches (22 Nov 2026): the left menu and the top bar stay on screen while the next page loads, and only the page itself fades
   in, so changing tabs no longer flashes white. Browsers without cross-page transitions just load the page as before. */
@view-transition { navigation: auto; }
.sb { view-transition-name: marla-menu; }
header.top { view-transition-name: marla-top; }
::view-transition-group(marla-menu), ::view-transition-group(marla-top) { animation-duration: 0s; }
::view-transition-group(root) { animation-duration: .12s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(root) { animation-duration: 0s; } }
/* Settings: foldable sections and the search box (22 Nov 2026) */
.sfold > .sfh { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; }
.sfold.sclosed > :not(.sfh) { display: none !important; }
#sw > h3.sgh { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; }
#sw > .sgx { display: none !important; }
.sfind { position: relative; margin: 10px 0 14px; max-width: 640px; }
.sfind input { width: 100%; box-sizing: border-box; margin: 0; }
.sres { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 60vh; overflow-y: auto; }
.sfi { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line, #e5e7eb); padding: 10px 14px; font: inherit; color: var(--ink, #111); cursor: pointer; }
.sfi:first-child { border-top: 0; }
.sfi.none { color: var(--muted, #6b7280); cursor: default; }
.sft { display: block; font-weight: 600; font-size: 14px; }
.sfm { display: block; font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; }
@media (hover: hover) { .sfi:not(.none):hover { background: var(--bg, #f6f7f9); } }
@keyframes sfhit { 0%, 60% { box-shadow: 0 0 0 3px var(--orange, #fb6818); } 100% { box-shadow: 0 0 0 0 transparent; } }
.sfhit { animation: sfhit 2.4s ease-out; border-radius: 6px; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; margin-bottom: 8px; }
.strow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto; gap: 8px; align-items: center; padding: 6px 0; }
.strow input, .strow select { margin: 0; width: 100%; box-sizing: border-box; }
@media (max-width: 700px) { .strow { grid-template-columns: minmax(0, 1fr); } .pill-prev { justify-self: start; } }
.sfold.sclosed > .ch, .sfold.sclosed > .cdh { border-bottom: 0; }
.sfold > .sfh { padding-top: 14px; padding-bottom: 14px; }

/* Settings cards (22 Nov 2026): the fold arrow, the title and any badge or button in the header: the arrow and title sit together on the left, the badge or button on the right (the title was floating in the middle) */
.sfold > .sfh > h2, .sfold > .sfh > h3 { flex: 1 1 auto; margin: 0; text-align: left; min-width: 0; }
/* Drafts card (23 Nov 2026): a tick, a cross and a redraft arrow beside each document, to decide one at a time. */
ul.dl li.drow { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 2px 0; }
ul.dl li.drow .dname { min-width: 0; flex: 1; }
.dact { display: inline-flex; gap: 4px; flex: none; }
.dact > button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; padding: 0; border: 1px solid var(--line, #d5dae1); border-radius: 7px; background: #fff; color: var(--off); cursor: pointer; }
.dact > button:disabled { opacity: .5; cursor: default; }
.dact button.busy svg { animation: dspin 1s linear infinite; }
@keyframes dspin { to { transform: rotate(360deg); } }
.dact .y.on { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
li.drow.dok .dname a { color: var(--ok); }
@media (hover: hover) { .dact .y:hover { color: var(--ok); border-color: var(--ok); } .dact .n:hover { color: var(--bad); border-color: var(--bad); } .dact .r:hover { color: var(--turn); border-color: var(--turn); } }
@media (max-width: 640px) { .dact > button { width: 34px; height: 32px; } }
@media (max-width: 640px) { .dact > button { width: 34px; height: 32px; } ul.dl li.drow.dnoact { padding-left: 124px; } }

/* Shared form-field rules (one look for every screen): a hidden field stays hidden whatever else sets display; checkboxes and radios never take text-field sizing. */
input[hidden], select[hidden], textarea[hidden], body.mapp #rform input[hidden] { display: none !important; }

/* Billing page (27 Nov 2026, Yaman): where the file stands before any detail (unbilled, owing, in trust), and the phone's Select all / Clear links. */
.bsum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; margin: 0 0 12px; }
.bsum .bs-i { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; min-width: 0; }
.bsum .bs-i + .bs-i { border-left: 1px solid var(--line); }
.bsum .bs-l { font: 600 11px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bsum b { font-size: 20px; color: var(--ink); line-height: 1.2; }
.bsum .bs-s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.asl { display: none; }
@media (max-width: 420px) { .bsum b { font-size: 17px; } .bsum .bs-i { padding: 0 8px; } }

.sact { display: none; } /* the phone's section Actions button (public/mobile.js) never shows on the website */
