/* Case file design
   court   – cool court-wall grey, the page
   navy    – the advocate's band: header, main actions
   khaki   – the file cover: a matter's own page, pending matters
   tape    – red tape: only for what is new, changed or due soon
*/
:root {
  --court: #F1F3F1;
  --sheet: #FFFFFF;
  --ink: #1C2433;
  --ink-2: #4A5465;
  --ink-3: #737D8E;
  --line: #E1E4E8;
  --line-2: #CBD1D9;
  --navy: #1F3354;
  --navy-2: #2C4772;
  --navy-soft: #E7ECF4;
  --khaki: #E8DCBC;
  --khaki-2: #F4EDDA;
  --khaki-line: #D3C397;
  --khaki-ink: #6E5A2E;
  --tape: #B42318;
  --tape-soft: #FBE9E7;
  --green: #2E6A4E;
  --green-soft: #E3EFE8;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", -apple-system, "Segoe UI", sans-serif;
  --r-s: 4px;
  --r-m: 8px;
  --r-l: 14px;
  --focus: 0 0 0 3px rgba(44, 71, 114, .28);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--court); color: var(--ink); font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 19px; line-height: 1.25; }
h3 { font-size: 15.5px; margin: 24px 0 8px; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); font-weight: 400; font-size: 13px; }
a { color: var(--navy-2); }

/* ---------- top bar: the advocate's band */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(24px, env(safe-area-inset-left)); padding-top: max(12px, env(safe-area-inset-top));
  background: var(--navy); color: #F4F6FA; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; }
.mark svg { width: 40px; height: 40px; display: block; }
.brand h1 { font-size: 19px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 2px 0 0; color: #B9C4D8; font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.job { font-size: 13px; padding: 5px 11px; border-radius: 99px; border: 1px solid rgba(255,255,255,.22); color: #C9D2E3;
  max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job.busy { background: rgba(232,220,188,.16); border-color: rgba(232,220,188,.5); color: #F4EDDA; }
.job.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--khaki); margin-right: 7px; animation: pulse 1.2s infinite; vertical-align: 1px; }
@keyframes pulse { 50% { opacity: .25; } }
.top .btn.primary { background: var(--khaki); color: var(--navy); }
.top .btn.primary:hover { background: #F1E7CC; }
.top .btn.ghost { border-color: rgba(255,255,255,.28); color: #F4F6FA; background: transparent; }
.top .btn.ghost:hover { border-color: #fff; color: #fff; }

/* ---------- tabs */
.tabs { position: relative; display: flex; gap: 2px; padding: 0 max(18px, env(safe-area-inset-left)); background: var(--sheet);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; border: 0; background: none; padding: 13px 12px 12px; cursor: pointer; color: var(--ink-2);
  font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }
.tabs.ink-ready .tab.active { border-bottom-color: transparent; }
.tab-ink { position: absolute; left: 0; bottom: 0; height: 3px; width: 100px; background: var(--navy);
  transform-origin: left center; pointer-events: none; will-change: transform; }
.count { background: var(--tape); color: #fff; border-radius: 99px; font-size: 11.5px; font-weight: 700; padding: 1px 7px;
  margin-left: 5px; display: inline-block; }

main { padding: 22px max(24px, env(safe-area-inset-left)) 64px; max-width: 1240px; margin: 0 auto; }

/* ---------- buttons */
.btn { border: 1px solid transparent; border-radius: var(--r-m); padding: 8px 15px; cursor: pointer; font-weight: 700;
  background: var(--sheet); line-height: 1.35; transition: background-color .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { border-color: var(--line-2); color: var(--ink-2); font-weight: 500; }
.btn.ghost:hover { border-color: var(--navy-2); color: var(--navy); }
.btn.danger { border-color: #EBC4BF; color: var(--tape); font-weight: 500; }
.btn.danger:hover { background: var(--tape-soft); }
.btn.small { padding: 5px 11px; font-size: 13.5px; }
.btn.wide { width: 100%; padding: 11px 14px; }
.btn:disabled { opacity: .5; cursor: default; }
a.btn { text-decoration: none; display: inline-block; }
.icon-btn { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--ink-3); padding: 4px 8px; border-radius: var(--r-s); }
.icon-btn:hover { color: var(--ink); }
.btn:focus-visible, .tab:focus-visible, .icon-btn:focus-visible, tr[data-id]:focus-visible, summary:focus-visible,
.ph-chip:focus-visible, .link-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- sheets & forms */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px; }
.seg { display: inline-flex; background: var(--court); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 13px; cursor: pointer; color: var(--ink-2); font-size: 14px; border-radius: 6px; }
.seg input:checked + span { background: var(--sheet); color: var(--navy); font-weight: 700; box-shadow: 0 1px 2px rgba(28,36,51,.12); }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.f input, .f select, textarea, .search, .link-box input {
  border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 8px 10px; background: #fff;
  font-weight: 400; font-size: 15px; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.f input:focus, .f select:focus, textarea:focus, .search:focus { outline: none; border-color: var(--navy-2); box-shadow: var(--focus); }
.f .muted { font-weight: 400; }
.f-num input { width: 120px; } .f-year input { width: 90px; } .f-cnr input { width: 230px; }
.f-label { flex: 1 1 240px; } .f-label input { width: 100%; }
.f-type { flex: 1 1 260px; } .type-row { display: flex; gap: 6px; } .type-row select { flex: 1; min-width: 0; }
.f-client { flex: 0 1 200px; } .f-client input { width: 100%; }
.add-btn { height: 40px; }
textarea { font: inherit; color: inherit; width: 100%; resize: vertical; }
.msg { margin: 8px 0 0; font-size: 13.5px; min-height: 1em; color: var(--ink-2); }
.msg.error { color: var(--tape); }
.msg.ok { color: var(--green); }
.hint { color: var(--ink-3); font-size: 13.5px; margin: 2px 0 8px; max-width: 72ch; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14.5px; margin: 6px 0 10px; }
.check input, .toggle input { accent-color: var(--navy); width: 16px; height: 16px; }
.settings { max-width: 580px; display: flex; flex-direction: column; gap: 10px; }
.settings h2 { margin-top: 16px; font-size: 17px; } .settings h2:first-child { margin-top: 0; }
.settings .f input, .settings .f select { max-width: 320px; }
.admin-only { display: flex; flex-direction: column; gap: 10px; }
.admin-only h2:first-child { margin-top: 16px; }
code { font: 13px ui-monospace, Menlo, monospace; background: var(--court); padding: 1px 5px; border-radius: var(--r-s); }

/* ---------- add form */
.add-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.add-head h2 { font-size: 17px; }
.add-head .seg { margin-bottom: 0; }
.search { padding: 7px 11px; font-size: 14px; width: 220px; border-radius: 99px; }

/* ---------- lists */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 12px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions.end { justify-content: flex-end; margin-top: 12px; }
.toggle { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.empty { color: var(--ink-2); padding: 26px 20px; text-align: center; background: var(--sheet);
  border: 1px dashed var(--line-2); border-radius: var(--r-l); }

/* matters list: reads like a cause list */
table.matters { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.matters th { text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 700; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: #F8F9F8; }
.matters td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14.5px; }
.matters tr:last-child td { border-bottom: 0; }
.matters tbody tr { cursor: pointer; transition: background-color .12s; }
.matters tbody tr:hover { background: #F7F8FA; }
.matters tbody tr.has-new td:first-child { box-shadow: inset 4px 0 0 var(--tape); }
.matters tr.stopped td { color: var(--ink-3); }
.m-title { font-weight: 700; font-size: 15.5px; }
.m-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.m-parties { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--court); color: var(--ink-2); border: 1px solid var(--line); }
.badge.pending { background: var(--khaki-2); color: var(--khaki-ink); border-color: var(--khaki-line); }
.badge.disposed { background: var(--green-soft); color: var(--green); border-color: #C6DDD0; }
.badge.err { background: var(--tape-soft); color: var(--tape); border-color: #F0C8C3; }
.badge.new { background: var(--tape); color: #fff; border-color: var(--tape); margin-left: 8px; vertical-align: 1px; }
.stage { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.date { white-space: nowrap; }
.date.soon { color: var(--tape); font-weight: 700; }
td.go { text-align: right; color: var(--ink-3); width: 1%; font-size: 18px; }

/* changes */
.changes { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.changes li { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.changes li:last-child { border-bottom: 0; }
.changes li.unseen { box-shadow: inset 4px 0 0 var(--tape); }
.changes .when { color: var(--ink-3); font-size: 12.5px; }
.changes .what { font-weight: 700; }
.changes .old { color: var(--ink-3); text-decoration: line-through; }
.changes .new { color: var(--ink); }
.changes.compact li { padding: 9px 12px; font-size: 13.5px; }
.changes a { color: var(--navy-2); }
.changes .mname { cursor: pointer; color: var(--navy-2); font-weight: 700; }

/* ---------- the matter page: a case file */
.shade { position: fixed; inset: 0; background: rgba(20, 28, 44, .34); z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100%); background: var(--court); z-index: 11;
  display: flex; flex-direction: column; box-shadow: -18px 0 40px rgba(20, 28, 44, .18); will-change: transform; }
.drawer-head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 20px 22px 24px; padding-top: max(20px, env(safe-area-inset-top)); background: var(--khaki);
  border-bottom: 1px solid var(--khaki-line); }
.drawer-head h2 { font-size: 21px; color: var(--ink); max-width: 46ch; }
.drawer-head .icon-btn { color: var(--khaki-ink); }
.tape { position: absolute; left: 0; right: 0; bottom: 9px; height: 5px; background: var(--tape); transform-origin: left center; }
.eyebrow { margin: 0 0 4px; color: var(--khaki-ink); font-size: 14px; font-weight: 700; }
.drawer-body { padding: 18px 22px 44px; overflow-y: auto; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fields-grid { display: grid; grid-template-columns: 150px 1fr; margin: 10px 0 0; background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.fields-grid dt, .fields-grid dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fields-grid dt { color: var(--ink-3); font-size: 13px; font-weight: 700; background: #F8F9F8; }
.fields-grid dt:nth-last-child(2), .fields-grid dd:last-child { border-bottom: 0; }
.notes-box { background: var(--khaki-2); border: 1px solid var(--khaki-line); border-radius: var(--r-m); padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.notes-box p { margin: 4px 0 0; white-space: pre-wrap; }
.orders { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); }
.orders li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.orders li:last-child { border-bottom: 0; }
.orders a { color: var(--navy-2); font-weight: 700; text-decoration: none; white-space: nowrap; }
.orders a:hover { text-decoration: underline; }
.orders .empty-li { color: var(--ink-3); }

/* case-page sections */
.sec-box { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); margin-top: 12px; overflow: hidden; }
.sec-box summary { cursor: pointer; padding: 11px 12px; font-weight: 700; font-size: 15px; list-style: none; }
.sec-box summary::-webkit-details-marker { display: none; }
.sec-box summary::before { content: "▸"; color: var(--navy-2); margin-right: 8px; display: inline-block; transition: transform .15s; }
.sec-box[open] summary::before { transform: rotate(90deg); }
.sec-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table.sec { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.sec th { text-align: left; background: #F8F9F8; color: var(--ink-3); font-weight: 700; font-size: 12px;
  padding: 7px 9px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.sec td { padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 70px; }
table.sec tr:last-child td { border-bottom: 0; }
table.sec a { color: var(--navy-2); font-weight: 700; }
table.sec td.wide { min-width: 210px; }
table.sec select { font-size: 13px; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: #fff; }
table.sec input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--navy); }
.sec-title { margin: 9px 12px 4px; font-size: 13px; font-weight: 700; color: var(--khaki-ink); }
.sec-none { padding: 0 12px 10px; margin: 0; }

/* papers */
.papers-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; }
.papers-head h3 { margin: 0; }
.file-btn { cursor: pointer; }
.folder-line { margin: 6px 0 8px; word-break: break-word; }
.move-note { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--khaki-2); border: 1px solid var(--khaki-line); border-radius: var(--r-m); padding: 8px 12px; font-size: 14px; margin-bottom: 8px; }
.papers li { align-items: flex-start; }
.paper-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; word-break: break-word; }
.paper-name .muted { font-size: 12.5px; }
.paper-actions { display: flex; gap: 14px; align-items: center; flex-shrink: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--tape); font: inherit; font-size: 14px; cursor: pointer; border-radius: var(--r-s); }
#dPaperMsg:empty { display: none; }

.log { background: #19222F; color: #DDE3EC; padding: 14px; border-radius: var(--r-m); font: 12px/1.55 ui-monospace, Menlo, monospace;
  overflow: auto; max-height: 70vh; white-space: pre-wrap; word-break: break-word; }

/* ---------- sign-in pages */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: var(--navy); }
.auth-wrap { width: min(470px, 100%); padding: 0; margin: 0; }
.auth-card { padding: 0; overflow: hidden; border: 0; box-shadow: 0 24px 60px rgba(8, 14, 26, .35); }
.auth-card .brand { position: relative; padding: 22px 24px 26px; background: var(--khaki); }
.auth-card .brand h1 { color: var(--ink); }
.auth-card .mark { background: var(--navy); border-radius: 10px; }
.auth-card .mark svg { width: 30px; height: 30px; }
.auth-card .brand p { color: var(--khaki-ink); }
.auth-card .tape { bottom: 9px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px 26px; }
.auth-form h2 { font-size: 20px; }
.auth-form h3 { font-size: 15px; margin: 8px 0 0; }
.auth-form .f input, .auth-form .f select { width: 100%; }
.auth-foot { text-align: center; color: #9FAAC0; font-size: 12.5px; margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; min-width: 0; }
.pw-toggle { border: 1px solid var(--line-2); background: var(--sheet); border-radius: var(--r-s); padding: 0 11px;
  font-size: 13px; color: var(--ink-2); cursor: pointer; }

/* ---------- account menu */
.menu-wrap { position: relative; }
.me-btn { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--sheet); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: 0 14px 34px rgba(20, 28, 44, .18); min-width: 220px; z-index: 20; padding: 6px; }
.menu-head { margin: 4px 8px 8px; font-size: 13.5px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--court); }

/* ---------- dialog & toast */
.modal-shade { z-index: 30; }
.modal { position: fixed; z-index: 31; inset: 0; margin: auto; height: fit-content; width: min(480px, calc(100% - 32px));
  max-height: calc(100% - 40px); overflow: auto; background: var(--sheet); border-radius: var(--r-l); padding: 22px;
  box-shadow: 0 24px 60px rgba(20, 28, 44, .28); display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font-size: 19px; }
.modal p { margin: 0; }
.modal .f input, .modal .f textarea { width: 100%; }
#modalBody { display: flex; flex-direction: column; gap: 12px; }
.link-box input { width: 100%; font: 13px ui-monospace, Menlo, monospace; padding: 9px 10px; }
.toast { position: fixed; bottom: max(22px, env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0 auto; width: fit-content;
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: 14px; font-weight: 500; z-index: 40;
  box-shadow: 0 10px 28px rgba(20, 28, 44, .28); max-width: calc(100% - 32px); }

/* ---------- welcome & steps */
.welcome { position: relative; margin-bottom: 18px; background: var(--khaki-2); border-color: var(--khaki-line); }
.welcome h2 { margin-bottom: 4px; }
.welcome-close { position: absolute; top: 10px; right: 10px; }
.steps { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; max-width: 80ch; }
.steps a { color: var(--navy-2); font-weight: 700; }
.compact-steps { font-size: 14px; margin-bottom: 12px; }

/* ---------- import */
.file-drop { display: block; border: 1.5px dashed var(--line-2); border-radius: var(--r-m); padding: 20px; text-align: center;
  cursor: pointer; background: #FAFBFA; color: var(--ink-2); font-weight: 700; }
.file-drop:hover { border-color: var(--navy-2); color: var(--navy); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#mapBox, #previewBox { margin-top: 14px; }
#mapBox h3, #previewBox h3 { margin-top: 0; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; margin: 10px 0; }
.map-grid select { width: 100%; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--court); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bronze { background: var(--khaki-2); color: var(--khaki-ink); }
.pill.red { background: var(--tape-soft); color: var(--tape); }
.pill.grey { background: var(--court); color: var(--ink-3); }
.preview-table td { vertical-align: top; }
.sheet-flat { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); }
td.actions { white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
.aor-card { margin-bottom: 16px; }
.aor-card .fields { margin-top: 12px; }
.aor-card .f input[name=code] { width: 130px; }
.aor-head h3 { margin: 0; }
.aor-card .check { margin-top: 12px; font-size: 14px; }

/* ---------- feature preview */
.intro { margin-bottom: 8px; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.tag.here { background: var(--green-soft); color: var(--green); }
.tag.ready { background: var(--navy-soft); color: var(--navy-2); }
.tag.idea { background: var(--khaki-2); color: var(--khaki-ink); }
.group-head { margin: 30px 0 12px; font-size: 18px; }
.feature { display: grid; grid-template-columns: 1fr 300px; gap: 22px; margin-bottom: 12px; align-items: start; }
.feature-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.feature h3 { margin: 0; font-size: 17px; }
.feature p { margin: 4px 0; font-size: 14.5px; color: var(--ink-2); max-width: 70ch; }
.feature .why { color: var(--ink); }
.choice { margin: 10px 0 6px; flex-wrap: wrap; }
.note-f { margin-top: 4px; }
.saved { font-size: 12px; min-height: 1em; display: block; margin-top: 2px; }
.others { margin-top: 8px; border-top: 1px dashed var(--line-2); padding-top: 6px; }
.others p { font-size: 13px; margin: 2px 0; }
.mock { border: 1px solid var(--line-2); border-radius: var(--r-m); background: #fff; overflow: hidden; font-size: 12.5px;
  box-shadow: 0 8px 22px rgba(20, 28, 44, .08); }
.mock-bar { display: flex; align-items: center; gap: 5px; padding: 8px 10px; background: var(--navy); color: #fff; }
.mock-bar span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); }
.mock-bar b { margin-left: 6px; font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.mock-row:last-child { border-bottom: 0; }
.mock-row b { display: block; font-weight: 700; font-size: 12.5px; }
.mock-row small { display: block; color: var(--ink-3); font-size: 11.5px; }
.chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--court); color: var(--ink-2); white-space: nowrap; }
.chip.olive { background: var(--navy); color: #fff; }
.chip.bronze { background: var(--khaki-2); color: var(--khaki-ink); }
.chip.red { background: var(--tape-soft); color: var(--tape); }
.chip.grey { background: var(--court); color: var(--ink-3); }
.q-card { margin-bottom: 10px; }
.q-card .f { font-size: 15px; color: var(--ink); font-weight: 700; gap: 8px; }
.q-num { color: var(--khaki-ink); }

/* team */
.roles-help { margin-top: 12px; font-size: 14px; }
.roles-help summary { cursor: pointer; color: var(--navy-2); font-weight: 700; }
.roles-help ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- papers settings */
.papers-settings { margin-top: 16px; }
.papers-settings h3 { margin: 14px 0 0; font-size: 15.5px; }
.store-choice { border: 0; padding: 0; margin: 0; }
.store-choice legend { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.store-choice .check { margin: 4px 0; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-chip { border: 1px solid var(--line-2); background: #fff; border-radius: 99px; padding: 3px 10px;
  font: 13px/1.4 ui-monospace, Menlo, monospace; cursor: pointer; color: var(--ink); }
.ph-chip:hover { border-color: var(--navy-2); color: var(--navy); }
.sample-box { background: var(--court); border-radius: var(--r-m); padding: 10px 12px; font-size: 14px; }
.samples { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.samples code { word-break: break-word; background: #fff; }
.steps-box { border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 12px; font-size: 14px; }
.steps-box summary { cursor: pointer; font-weight: 700; }
.connect-box { border: 1px solid var(--navy-2); border-radius: var(--r-m); padding: 12px 14px; background: var(--navy-soft); }
.connect-box p { margin: 4px 0; }
.code-big { font: 700 28px/1.3 ui-monospace, Menlo, monospace; letter-spacing: 3px; color: var(--navy); }

/* ---------- phone & tablet */
@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
  .mock { max-width: 420px; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); gap: 10px; }
  .brand { width: 100%; }
  .top-actions { width: 100%; justify-content: space-between; flex-wrap: nowrap; gap: 8px; }
  .top-actions .job { flex: 1 1 auto; min-width: 0; max-width: none; }
  #checkAll { padding: 7px 11px; white-space: nowrap; }
  .me-btn { max-width: 110px; padding: 7px 10px; }
  .tabs { padding: 0 8px; }
  main { padding: 16px 16px 64px; }
  .f-num input, .f-year input, .f-cnr input { width: 100%; }
  .f-num, .f-year { flex: 1 1 40%; } .f-cnr { flex: 1 1 100%; } .add-btn { width: 100%; }
  .f-client { flex: 1 1 100%; }
  table.matters, .matters tbody, .matters tr, .matters td { display: block; width: 100%; }
  .matters thead { display: none; }
  .matters tr { border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .matters tbody tr:last-child { border-bottom: 0; }
  .matters tbody tr.has-new { box-shadow: inset 4px 0 0 var(--tape); }
  .matters tbody tr.has-new td:first-child { box-shadow: none; }
  .matters td { border: 0; padding: 2px 0; }
  .matters td[data-l]::before { content: attr(data-l) ": "; color: var(--ink-3); font-size: 12.5px; font-weight: 700; }
  td.go { display: none !important; }
  .fields-grid { grid-template-columns: 118px 1fr; }
  .two { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .list-head .row-actions { width: 100%; }
  .choice { display: flex; }
  .choice label { flex: 1; }
  .choice span { text-align: center; padding: 6px 8px; font-size: 13.5px; }
  td.actions .btn { margin: 2px 0; }
  .drawer-head { padding-left: 18px; padding-right: 14px; }
  .drawer-body { padding: 16px 16px 44px; }
}
@media (max-width: 560px) {
  .papers li { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- settings: one section at a time */
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-l); padding: 6px; }
.set-nav button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: var(--r-m);
  cursor: pointer; color: var(--ink-2); font-weight: 500; }
.set-nav button:hover { background: var(--court); color: var(--ink); }
.set-nav button.active { background: var(--navy-soft); color: var(--navy); font-weight: 700; }
.set-nav button:focus-visible { outline: none; box-shadow: var(--focus); }
.set-body { min-width: 0; }
.set-body .settings { max-width: 640px; }
.set-body .papers-settings { margin-top: 0; }
.set-sec { display: flex; flex-direction: column; gap: 10px; }
.set-sec h2 { margin-top: 0; }
.court-list { column-count: 2; column-gap: 18px; max-height: 340px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-m); padding: 6px 10px; }
.court-list .check { margin: 4px 0; font-size: 14px; break-inside: avoid; }
.court-list .check.bench { padding-left: 22px; color: var(--ink-2); }
#courtFilter { width: 100%; max-width: 320px; }
@media (max-width: 760px) {
  .set-layout { grid-template-columns: 1fr; gap: 12px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 4px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav button { white-space: nowrap; padding: 7px 11px; }
  .court-list { column-count: 1; max-height: 300px; }
}
.chosen-courts { display: flex; flex-direction: column; gap: 8px; }
.chosen-court { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px) auto; gap: 6px 14px; align-items: end;
  background: var(--court); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; }
.chosen-court .cc-name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; align-self: center; }
.chosen-court .f input { width: 100%; max-width: none; }
.chosen-court .cc-remove { padding-bottom: 9px; }
@media (max-width: 560px) {
  .chosen-court { grid-template-columns: 1fr auto; }
  .chosen-court .f { grid-column: 1 / -1; grid-row: 2; }
}
