:root{--bg:#f6f7f9;--panel:#fff;--ink:#1c2430;--muted:#5b6470;--line:#e3e6ea;--accent:#1f5f8b;--accent-ink:#fff;--ok:#1b7047;--warn:#8e5400;--bad:#b3261e;--radius:8px;font-size:15px}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;background:var(--bg);color:var(--ink);line-height:1.45}
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
.layout{display:grid;grid-template-columns:220px 1fr;min-height:100vh}
.sidebar{background:#18222e;color:#d7dde5;padding:18px 14px;position:sticky;top:0;height:100vh;overflow:auto}
.sidebar .brand{font-weight:700;color:#fff;font-size:1.05rem;margin-bottom:14px;display:block}
.sidebar a.nav{display:block;color:#c2cbd6;padding:7px 10px;border-radius:6px;margin:2px 0;font-size:.95rem}
.sidebar a.nav:hover,.sidebar a.nav.active{background:#26364a;color:#fff;text-decoration:none}
.sidebar .sec{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:#7f8c9b;margin:14px 10px 4px}.sidebar .sec-note{font-size:.82rem;line-height:1.35;color:#c2cbd6;margin:0 10px 6px}
.sidebar-quick{display:flex;align-items:center;gap:14px;margin:-6px 10px 10px;font-size:.85rem}
.sidebar-quick a,.sidebar-quick button{color:#c2cbd6;background:none;border:0;padding:0;font:inherit;cursor:pointer;text-decoration:underline}
.sidebar-quick a:hover,.sidebar-quick button:hover{color:#fff}
.sidebar .user{margin-top:18px;border-top:1px solid #2c3a4b;padding-top:12px;font-size:.85rem;color:#9fb0c2}
.main{padding:22px 28px;max-width:1300px;width:100%;min-width:0}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px;flex-wrap:wrap}
h1{font-size:1.45rem;margin:0}h2{font-size:1.15rem;margin:0 0 10px}h3{font-size:1rem;margin:0 0 8px}
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:16px 18px;margin-bottom:16px;overflow-x:auto}
.grid{display:grid;gap:16px}.grid.c2{grid-template-columns:repeat(2,1fr)}.grid.c3{grid-template-columns:repeat(3,1fr)}.grid.c4{grid-template-columns:repeat(4,1fr)}
/* Narrow screens stack the grids. minmax(0,1fr) and min-width:0 stop one wide child (a long
   select, an unbroken URL, a table) from stretching the whole column past the screen. */
@media(max-width:1000px){.grid.c2,.grid.c3,.grid.c4{grid-template-columns:minmax(0,1fr)}.grid>*{min-width:0}.layout{grid-template-columns:minmax(0,1fr)}.sidebar{position:static;height:auto}}
/* INVOICE-ISSUE-1 (QA): on the Tasks page at desktop widths the task table's minimum width pushed the two equal
   columns past the window (a 1280px window was 1439px wide), cutting off Due and Assignee. The task list gets
   the wider column and both columns may shrink, so the page never scrolls sideways. Phone widths are unchanged. */
@media(min-width:1001px){.grid.c2.tasks-grid{grid-template-columns:minmax(0,3fr) minmax(0,2fr)}.grid.tasks-grid>*{min-width:0}}
/* PWA-BACK-1 (QA, real data at 1920px): one long unbroken task title or matter name set the title column's
   minimum width to the whole string (about 3268px) and pushed Due and Assignee off the screen. On the Tasks
   page a long text cell may now break such a string at any point, keeping at least 8em (the phone rule); the full text is
   all still there, for reading and for screen readers. Other tables (documents, messages) are unchanged. */
.tasks-grid .longtext{overflow-wrap:anywhere;min-width:8em}
/* Phone layout, below 1000px only, so desktop is unchanged.
   Top bar and Menu button (base.html, app.js): the html element gets class "js" from an inline
   script, so without JavaScript the sidebar stays stacked above the page as before.
   .table-scroll wraps a table that may be wider than the screen so it scrolls inside its card.
   .longtext lets a cell break a long unbroken string (a URL, a pasted reference) anywhere.
   table.sticky-actions keeps the last column (Edit and similar) in view while the table scrolls. */
.mobilebar{display:none}
@media(max-width:1000px){
  select{max-width:100%}
  .topbar>*,.actions>*,.searchbar>*{min-width:0;max-width:100%}
  .searchbar{flex-wrap:wrap}
  /* Time grid fields must shrink around long matter labels. [Codex] */
  .time-filters>*,.time-form .row>*{min-width:0}
  .time-filters select,.time-form select{min-width:0;max-width:100%}
  .kv dd{min-width:0;overflow-wrap:anywhere}
  .longtext{overflow-wrap:anywhere;min-width:8em}
  .table-scroll{overflow-x:auto;max-width:100%}
  .table-scroll td.nowrap{white-space:normal}
  /* Milestone values keep readable widths inside their scroll box. [Codex] */
  #ms_table input[name=ms_description]{min-width:16rem}
  #ms_table input[name=ms_amount]{min-width:10rem}
  #ms_table input[name=ms_due]{min-width:12rem}
  table.sticky-actions td:last-child,table.sticky-actions th:last-child{position:sticky;right:0;background:var(--panel);z-index:1;box-shadow:-8px 0 8px -8px rgba(0,0,0,.3)}
  .js .mobilebar{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:0;z-index:40;height:56px;padding:0 10px 0 16px;background:#18222e;color:#fff}
  .mobilebar .brand{color:#fff;font-weight:700;font-size:1.05rem;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:12px 0}
  .menu-toggle{display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px;padding:0 14px;background:transparent;color:#fff;border:1px solid #3a4b60;border-radius:6px;font:inherit;font-weight:600;cursor:pointer;flex:none}
  .menu-toggle:focus-visible{outline:3px solid #bcd6ea;outline-offset:2px}
  .menu-toggle[aria-expanded=true]{background:#26364a}
  .menu-icon,.menu-icon::before,.menu-icon::after{display:block;width:18px;height:2px;background:currentColor;border-radius:1px}
  .menu-icon{position:relative}.menu-icon::before,.menu-icon::after{content:"";position:absolute;left:0}.menu-icon::before{top:-6px}.menu-icon::after{top:6px}
  .js .sidebar{display:none}
  .js .sidebar .brand{display:none}
  .js .menu-open{overflow:hidden}
  .js .menu-open .sidebar{display:block;position:fixed;top:56px;left:0;right:0;bottom:0;height:auto;z-index:39;overflow-y:auto;overscroll-behavior:contain;padding:8px 12px 24px}
  .sidebar a.nav{display:flex;align-items:center;min-height:44px;padding:8px 12px}
  .sidebar .user a{display:flex;align-items:center;min-height:44px;color:#c2cbd6}
  .sidebar .user .btn{min-height:44px;padding:8px 14px}
  .sidebar .user br{display:none}
  .sidebar-quick{margin:0 12px 8px;gap:18px}.sidebar-quick a,.sidebar-quick button{display:inline-flex;align-items:center;min-height:44px}
  .sidebar .user form.inline{display:block}
}
/* table.stack-mobile: on a phone each row becomes a small block, cells one under another with
   the column name from data-label, so row actions (td.stack-actions) sit under the row instead
   of screens away to the right. tr.stack-head is the header row (hidden, except th.stack-keep),
   tr.stack-group a full-width group heading, td.stack-check a row checkbox. */
@media(max-width:700px){
  .main{padding:16px 16px 24px}
  table.stack-mobile,table.stack-mobile>tbody,table.stack-mobile tr,table.stack-mobile td{display:block;width:auto}
  table.stack-mobile tr.stack-head{display:block;border-bottom:1px solid var(--line)}
  table.stack-mobile tr.stack-head th{display:none}
  table.stack-mobile tr.stack-head th.stack-keep{display:block;width:auto;border:0}
  table.stack-mobile tr{padding:8px 0;border-bottom:1px solid var(--line)}
  table.stack-mobile tr.stack-group{padding:0;border:0}
  table.stack-mobile td{border:0;padding:3px 0;text-align:left;white-space:normal;min-width:0}
  table.stack-mobile tr.stack-group td{padding:6px 8px}
  table.stack-mobile td[data-label]::before{content:attr(data-label) ": ";color:var(--muted);font-size:.85rem}
  table.stack-mobile td.stack-check{float:left;padding:2px 10px 0 0}
  table.stack-mobile td.stack-actions{display:flex;flex-wrap:wrap;gap:6px;padding-top:6px}
  table.stack-mobile td.stack-actions>a:not(.btn){display:inline-flex;align-items:center;min-height:44px}
}
.firm-theme-forest .mobilebar{background:#183329}.firm-theme-plum .mobilebar{background:#332037}
.stat{padding:14px 16px}.stat .label{color:var(--muted);font-size:.8rem;text-transform:uppercase;letter-spacing:.04em}.stat .value{font-size:1.5rem;font-weight:600;margin-top:2px}
table{width:100%;border-collapse:collapse;font-size:.93rem}th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}th{color:var(--muted);font-weight:600;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
/* Money cells in report tables may wrap: a mixed-currency total ("€950.00 + £900.00 + $3,200.00")
   breaks at its spaces, and an amount has none, so it never splits inside a figure (#191, #192). */
table.wide td.num,table.wide th.num,table.wrapnum td.num,table.wrapnum th.num{white-space:normal}.breakall{word-break:break-all}.scroll-hint{display:none}
/* Contacts list, wider than 1000px only: a name with no spaces (a pasted run, an import error) breaks inside
   its own cell, so the row stays inside its card and Edit and New matter stay in view. Ordinary names do not
   break. At 1000px and below the six-column table already scrolls sideways inside its card, and there every
   column shrinks to its narrowest, so this rule could split ordinary names and the 8em floor pushed the
   Phone column out of view. Phones keep the earlier layout, long names included. */
@media(min-width:1001px){td.contact-name{overflow-wrap:anywhere;min-width:8em}}
/* Wide tables on a phone: say they scroll, and keep the first column in view while they do (#189, #191, #192). */
@media(max-width:700px){.scroll-hint{display:block;margin:0 0 6px;position:sticky;left:0}table.wide th:first-child,table.wide td:first-child{position:sticky;left:-18px;background:var(--panel);z-index:1}table.wide input,table.wide select{min-width:96px}}
tr:hover td{background:#fafbfc}
.btn{display:inline-block;background:var(--accent);color:var(--accent-ink);border:1px solid var(--accent);padding:7px 13px;border-radius:6px;font-size:.92rem;cursor:pointer;font-family:inherit;line-height:1.3}
.btn:hover{filter:brightness(1.08);text-decoration:none}.btn.secondary{background:#fff;color:var(--ink);border-color:#c8ced6}.btn.danger{background:var(--bad);border-color:var(--bad)}.btn.small{padding:4px 9px;font-size:.82rem}.btn.ok{background:var(--ok);border-color:var(--ok)}
.btn:disabled{opacity:.5;cursor:not-allowed}
form.inline{display:inline}
label{display:block;font-size:.85rem;color:var(--muted);margin:10px 0 4px}
input[type=text],input[type=email],input[type=password],input[type=number],input[type=date],input[type=datetime-local],input[type=tel],input[type=url],select,textarea{width:100%;padding:8px 10px;border:1px solid #c8ced6;border-radius:6px;font:inherit;background:#fff;color:var(--ink)}
textarea{min-height:90px}input:focus,select:focus,textarea:focus{outline:2px solid #bcd6ea;border-color:var(--accent)}
.row{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:14px}
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:.75rem;font-weight:600;background:#e8ecf1;color:#3c4652;text-transform:capitalize}
.badge.open,.badge.paid,.badge.signed,.badge.clear,.badge.converted{background:#dff3e8;color:var(--ok)}
.badge.sent,.badge.viewed,.badge.pending,.badge.new,.badge.partial{background:#e4eefb;color:#1f4f8b}
.badge.overdue,.badge.void,.badge.conflict,.badge.declined,.badge.closed{background:#f8e0de;color:var(--bad)}
.badge.draft,.badge.waived,.badge.unresolved{background:#f4e9d2;color:var(--warn)}
.muted{color:var(--muted)}.small{font-size:.85rem}.right{text-align:right}.nowrap{white-space:nowrap}
.muted a,td a:not(.btn),.empty a,dd a,.public p a{text-decoration:underline}
.flash{padding:10px 14px;border-radius:6px;margin-bottom:14px;background:#e4eefb;color:#1f4f8b}.flash.error{background:#f8e0de;color:var(--bad)}.flash.ok{background:#dff3e8;color:var(--ok)}
.empty{color:var(--muted);padding:18px;text-align:center}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:14px;flex-wrap:wrap}.tabs a{padding:8px 12px;border-bottom:2px solid transparent;color:var(--muted)}.tabs a.active{border-color:var(--accent);color:var(--ink);font-weight:600}
.timerbar{background:#fff7e0;border:1px solid #f1d58a;border-radius:6px;padding:6px 10px;font-size:.9rem;display:flex;gap:10px;align-items:center}
.auth{max-width:420px;margin:60px auto;padding:0 16px}
.public{max-width:820px;margin:30px auto;padding:0 16px}.public .powered{margin-top:28px;text-align:center}
.letter{background:#fff;border:1px solid var(--line);padding:36px 44px;border-radius:8px;font-family:Georgia,serif;font-size:1.02rem;line-height:1.6}
.kv{display:grid;grid-template-columns:160px 1fr;gap:4px 12px;font-size:.93rem}.kv dt{color:var(--muted)}.kv dd{margin:0}
.searchbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.searchbar input{max-width:360px}
details summary{cursor:pointer;color:var(--accent)}
.timeline{list-style:none;padding:0;margin:0;font-size:.88rem}.timeline li{padding:4px 0;border-bottom:1px dashed var(--line)}
pre.code{background:#f1f3f5;padding:10px;border-radius:6px;overflow:auto;font-size:.85rem}
@media print{.sidebar,.topbar .actions,.no-print{display:none}.layout{display:block}.main{padding:0}}

/* Firm appearance uses curated colours; configuration never injects CSS. */
.firm-theme-forest{--accent:#216044}.firm-theme-forest .sidebar{background:#183329}
.firm-theme-plum{--accent:#71376b}.firm-theme-plum .sidebar{background:#332037}
.firm-density-compact .card{padding:10px 12px;margin-bottom:10px}
.firm-density-compact th,.firm-density-compact td{padding:5px 8px}
.firm-width-wide .main{max-width:1600px}

/* Skip link (QA S211): off screen until focused, then the first thing a keyboard user sees. */
.skip-link{position:absolute;left:8px;top:-60px;z-index:1000;background:#fff;color:#1d4ed8;padding:8px 12px;border:2px solid #1d4ed8;border-radius:6px;font-weight:600}
.skip-link:focus{top:8px}
.main:focus{outline:none}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Phones and other touch screens (QA S228): about 40px for anything you tap. Buttons grow; links in
   tables and lists get a taller hit area with a matching negative margin so rows do not get taller. */
@media(max-width:700px),(pointer:coarse){
:is(.main,.public) .btn,:is(.main,.public) .btn.small{min-height:40px;display:inline-flex;align-items:center;justify-content:center;padding-top:6px;padding-bottom:6px}
:is(.main,.public) :is(td,th,li,nav) a:not(.btn),:is(.main,.public) .card .small a,:is(.main,.public) a.small:not(.btn),:is(.main,.public) :is(.topbar,.empty,.actions) a:not(.btn),:is(.main,.public) p.small a:not(.btn){display:inline-block;padding:11px 0;margin:-8px 0}
:is(.main,.public) input[type=checkbox],:is(.main,.public) input[type=radio]{width:22px;height:22px}
:is(.main,.public) :is(select,input[type=text],input[type=date],input[type=number],input[type=email]){min-height:40px}
}
@media(max-width:700px){
table.gen-fields td{display:block;width:auto!important;white-space:normal;border-bottom:0;padding:4px 0}
table.gen-fields tr{display:block;border-bottom:1px solid var(--line);padding:6px 0}
table.gen-fields input{width:100%}
}
/* Consent checkboxes on sign and card pages: the whole label is the tap target, at least 44 px tall, with a
   checkbox big enough to see (QA R167: well under 40 px on a phone). */
label.consent{display:flex;gap:10px;align-items:flex-start;color:var(--ink);margin-top:14px;min-height:44px;padding:8px 0;cursor:pointer}
label.consent input[type=checkbox]{width:22px;height:22px;margin:1px 0 0;flex:none}
/* New interface (Settings > Appearance > Interface). Every rule is scoped to body.ui-next, so the classic
   interface renders exactly as before. Behaviour is in static/ui-next.js, loaded only in this mode. */
.ui-next .appbar{display:flex;align-items:center;gap:8px;margin:-6px 0 16px;flex-wrap:wrap}
/* Keep the timer and creation controls together; only the label gives up width. [Codex] */
.ui-next .appbar-actions{display:flex;align-items:center;gap:8px;flex:1 1 0;min-width:0}
.ui-next .appbar-actions>.btn,.ui-next .appbar-actions>.create-menu{flex:none;white-space:nowrap}
.ui-next .appbar-actions>.timer-chip{flex:0 1 auto;min-width:0}
@media(max-width:700px){.ui-next .appbar>.qs-open{flex-basis:100%;max-width:none}.ui-next .appbar-actions{flex-basis:100%}}
.ui-next .create-menu{position:relative;max-width:100%}
.ui-next .create-menu summary{cursor:pointer;list-style:none}
.ui-next .create-menu summary::-webkit-details-marker{display:none}
.ui-next .create-menu-items{position:absolute;right:0;top:calc(100% + 4px);z-index:45;min-width:190px;max-width:calc(100vw - 48px);padding:6px;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 8px 24px rgba(20,30,45,.14)}
.ui-next .create-menu-items a{display:block!important;margin:0!important;padding:10px 12px!important;min-height:40px;color:var(--ink);text-decoration:none;border-radius:4px}
.ui-next .create-menu-items a:hover,.ui-next .create-menu-items a:focus-visible{background:var(--accent);color:var(--accent-ink)}
.ui-next .qs-open{flex:1 1 260px;max-width:440px;display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:38px;padding:6px 10px;border:1px solid #c8ced6;border-radius:6px;background:var(--panel);color:var(--muted);font:inherit;cursor:pointer;text-align:left}
.ui-next .qs-open:hover{border-color:var(--accent)}
.ui-next kbd{font:12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;border:1px solid var(--line);border-bottom-width:2px;border-radius:4px;padding:3px 5px;color:var(--muted);background:var(--bg)}
.ui-next .timer-chip{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:4px 10px;border-radius:999px;background:var(--accent);color:var(--accent-ink);text-decoration:none;font-variant-numeric:tabular-nums;font-size:14px}
.ui-next .timer-chip .dot{width:8px;height:8px;border-radius:50%;background:currentColor;animation:ui-pulse 1.6s ease-in-out infinite}
.ui-next .timer-chip.paused{background:var(--panel);color:var(--warn);border:1px solid var(--warn)}
.ui-next .timer-chip.paused .dot{animation:none}
.ui-next .timer-chip.stopped{background:var(--panel);color:var(--ink);border:1px solid var(--line)}.ui-next .timer-chip-state{font-weight:600}
.ui-next .timer-chip{min-width:0;max-width:100%}
.ui-next .timer-chip .dot,.ui-next .timer-chip [data-chip-seconds]{flex:none}
.ui-next .timer-chip-label{min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:700px){.ui-next .timer-chip-label{max-width:150px}}
@keyframes ui-pulse{50%{opacity:.35}}
@media (prefers-reduced-motion:reduce){.ui-next .timer-chip .dot{animation:none}}
/* TIMER-LOG-1: the timer notice on Log time, the timers page Stop button, and Stop beside the chip and
   in the + menu. Every timer control is at least 44px tall so it is easy to hit on a phone. [Claude] */
.timer-notice{padding:12px 14px;margin:0 0 14px;border:2px solid var(--accent);border-radius:8px;background:var(--panel);color:var(--ink)}
.timer-notice p{margin:0 0 8px;line-height:1.4}
.timer-notice .timer-notice-matter{font-weight:600;color:var(--warn)}
.timer-notice-actions{margin:0 0 8px}.timer-notice-actions form{margin:0}
.timer-notice .btn,.timer-card .btn,.timer-chip-stop .btn,.phone-timer-stop .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center}
.timers-hint{font-weight:600;margin-bottom:4px}
.timer-card-clock{font-size:1.6rem;font-weight:600;font-variant-numeric:tabular-nums;margin:4px 0}
.timer-card-state{font-size:1rem;color:var(--muted)}
.timer-card-primary{margin:12px 0 0}.timer-card-primary .btn{width:100%;font-size:1rem;font-weight:600}
.timer-card-secondary{margin-top:8px}.timer-card-secondary form{margin:0}
.ui-next .appbar-actions>.timer-chip-stop{flex:none;margin:0}
.ui-next .appbar-actions>.timer-chip-stop .btn{min-height:34px}
.create-menu-items form.phone-timer-stop{display:none;margin:0}
@media(max-width:480px){.timer-notice-actions .btn{width:100%}}
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  .ui-next .appbar-actions>.timer-chip,.ui-next .appbar-actions>.timer-chip-stop .btn{min-height:44px}
  .ui-next .appbar-actions>.create-menu form.phone-timer-stop{display:block;padding:6px 0;border-bottom:1px solid var(--line)}
  .ui-next .appbar-actions>.create-menu form.phone-timer-stop .btn{width:100%}
}
/* Searchable picker: a text box in front of the original select, which stays in the form and is what submits. */
.ui-next .picker{position:relative;width:100%}
.ui-next .picker-input{width:100%;padding:8px 10px;border:1px solid #c8ced6;border-radius:6px;font:inherit;background:#fff;color:var(--ink);min-height:40px}
.ui-next .picker-input:focus{outline:2px solid var(--accent);outline-offset:1px}
.ui-next .picker-list,.ui-next .qs-list{list-style:none;margin:0;padding:4px 0;overflow-y:auto}
.ui-next .picker-list{position:absolute;z-index:40;left:0;right:0;top:calc(100% + 4px);max-height:320px;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 8px 24px rgba(20,30,45,.14)}
.ui-next .picker-list li,.ui-next .qs-list li[role=option]{padding:8px 12px;cursor:pointer;line-height:1.35}
.ui-next .picker-list li[aria-selected=true],.ui-next .qs-list li[aria-selected=true]{background:var(--accent);color:var(--accent-ink)}
.ui-next .picker-list li[aria-selected=true] .muted,.ui-next .qs-list li[aria-selected=true] .muted{color:inherit;opacity:.85}
.ui-next .picker-list li.note,.ui-next .qs-list li.note{cursor:default;color:var(--muted);font-size:13px}
/* Quick search */
.ui-next dialog.qs{width:min(640px,calc(100vw - 32px));max-height:min(560px,calc(100vh - 80px));margin:10vh auto auto;padding:0;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink);box-shadow:0 24px 60px rgba(20,30,45,.25);display:none;flex-direction:column}
.ui-next dialog.qs[open]{display:flex}
.ui-next dialog.qs::backdrop{background:rgba(20,30,45,.35)}
.ui-next .qs-input{border:0;border-bottom:1px solid var(--line);border-radius:12px 12px 0 0;padding:16px 18px;font:inherit;font-size:17px;width:100%;background:transparent;color:var(--ink)}
.ui-next .qs-input:focus{outline:none}
.ui-next .qs-list{flex:1 1 auto;max-height:420px}
.ui-next .qs-list li.group{padding:10px 18px 4px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.ui-next .qs-list li[role=option]{padding:9px 18px;display:flex;justify-content:space-between;gap:12px}
.ui-next .qs-list li[role=option] .muted{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:45%}
.ui-next .qs-hint{margin:0;padding:8px 18px;border-top:1px solid var(--line);font-size:12px;color:var(--muted)}
@media(max-width:700px){.ui-next dialog.qs{margin-top:8px;max-height:calc(100vh - 16px)}.ui-next .qs-open kbd{display:none}.ui-next .qs-list li[role=option]{flex-direction:column;gap:2px}.ui-next .qs-list li[role=option] .muted{max-width:none}}
.ui-next .searchbar .picker{width:auto;flex:1 1 260px;max-width:420px}

/* Time-entry dialog fits a 390px viewport without horizontal scrolling. [Codex] */
.ui-next .quick-time-dialog{box-sizing:border-box;width:min(640px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:20px;border:1px solid var(--line);border-radius:14px;overflow:auto;background:var(--panel);color:var(--ink)}
.ui-next .quick-time-dialog::backdrop{background:rgba(20,33,31,.38)}
.ui-next .quick-time-dialog .card{padding:0;border:0;box-shadow:none;min-width:0}
.ui-next .quick-time-dialog .row>*{min-width:0}
.ui-next .quick-time-dialog input,.ui-next .quick-time-dialog select,.ui-next .quick-time-dialog textarea{max-width:100%;box-sizing:border-box}
@media(max-width:480px){.ui-next .quick-time-dialog{padding:12px}.ui-next .quick-time-dialog .row{grid-template-columns:minmax(0,1fr)}.ui-next .quick-time-dialog .actions{flex-wrap:wrap}}
/* Bulk rows stay compact on desktop and stack on phones. [Codex] */
.bulk-time-row{min-width:0}
.bulk-time-row .row>*{min-width:0}
.bulk-time-row input,.bulk-time-row select,.bulk-time-row textarea{max-width:100%;box-sizing:border-box}
@media(min-width:1000px){.bulk-time-row{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr) auto;gap:12px;align-items:end}.bulk-time-row>.row{grid-template-columns:minmax(0,2fr) repeat(3,minmax(0,1fr))}.bulk-time-description{min-width:0}.bulk-time-description textarea{min-height:42px;height:42px}.bulk-time-row>.flash{grid-column:1/-1}}
@media(max-width:480px){.bulk-time-row .row{grid-template-columns:minmax(0,1fr)}}

/* Matter overview keeps dates and actions readable on narrow screens. [Codex] */
.ui-next .matter-stage-strip{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:16px}
.ui-next .matter-stage{flex:1 1 100px;padding:8px 12px;background:var(--bg);border:1px solid var(--line);border-radius:6px;text-align:center;overflow-wrap:anywhere}
.ui-next .matter-stage.current{background:var(--accent);color:var(--accent-ink);font-weight:600}
.ui-next .matter-key-dates{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:16px}
.ui-next .matter-key-date{margin:0;min-width:0;overflow-wrap:anywhere}
.ui-next .matter-key-date h2{font-size:.85rem;margin:0 0 8px;color:var(--muted)}
.ui-next .matter-key-date p{margin:6px 0 0}
.ui-next .matter-key-date.limitations{border-color:#bf8a38}
.ui-next .matter-primary-actions{align-items:flex-start;flex-wrap:wrap;min-width:0}
.ui-next .matter-more{max-width:100%;min-width:0}
.ui-next .matter-more-actions{padding:12px;border:1px solid var(--line);border-radius:8px;background:var(--panel);max-width:540px;box-sizing:border-box}
.ui-next .matter-more-actions a,.ui-next .matter-more-actions form{max-width:100%;overflow-wrap:anywhere;white-space:normal}
.ui-next .matter-tab-count{display:inline-block;padding:0 6px;border-radius:12px;background:var(--bg);font-size:.8rem}
.ui-next .matter-money .btn{margin-top:10px}
@media(max-width:600px){.ui-next .matter-key-dates{grid-template-columns:minmax(0,1fr)}.ui-next .matter-more[open]{flex-basis:100%;width:100%}.ui-next .matter-more-actions{width:100%}.ui-next .matter-primary-actions{width:100%}}

/* Personal navigation in the new shell. [Codex] */
.ui-next .nav-core { padding-bottom: 8px; }
.ui-next .nav-group { border: 0; margin: 4px 0; }
.ui-next .nav-group > summary { cursor: pointer; padding: 12px 8px; min-height: 44px; font-weight: 600; color: #c2cbd6; }
.ui-next .nav-group > summary:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.ui-next .nav-group .nav { padding-left: 22px; }
.ui-next .nav-beta { font-size: 10px; font-weight: normal; opacity: .8; }
.ui-next .nav-edit { font-size: 12px; }
.ui-next .nav-preferences label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.ui-next .nav-preferences input[type=checkbox] { width: auto; }
.ui-next .nav-group .nav, .ui-next .nav-shortcuts .nav { overflow-wrap: anywhere; }
/* Personal work leads Home; compact rows retain the firm's chosen visual theme. [Codex] */
.ui-next .today-work{margin-bottom:24px}
.ui-next .today-columns{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:24px}
.ui-next .today-columns>*,.ui-next .today-item-text{min-width:0}
.ui-next .today-columns>:only-child{grid-column:1/-1}
.ui-next .today-tasks section{margin-bottom:20px}
.ui-next .today-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.ui-next .today-item-text{overflow-wrap:anywhere}
.ui-next .today-item form{flex:none;margin:0}
.ui-next .today-item button{min-height:44px}
.ui-next .dashboard-cards-heading{margin:0 0 12px}
@media(max-width:700px){.ui-next .today-columns{grid-template-columns:minmax(0,1fr);gap:16px}}
.ui-next .dash .empty{padding:10px 0;text-align:left}

/* UX-14 slice 1: phone navigation only in the next interface. [Codex]
   The phone shell (tabs, docked +, cards, matter page) applies below 601px wide, and also to a phone
   held sideways: a short viewport (500px or less) with a touch screen, up to 1000px wide. Tablets
   (taller than 500px) and desktop windows (fine pointer) keep the wide layout. A 2-in-1 in tablet
   posture (touch is its primary pointer) gets the phone shell only in a window 1000px or narrower and
   500px or shorter; that is a touch user in a phone-sized space, so this is intended.
   The same query is written in five places; change them together: the four UX-14 blocks in this file
   (slice 1, safe areas, slice 2, slice 3, plus the FIX-2 block), PHONE in ui-next.js, and the
   short-and-touch rule in matters/pipelines.html. [Claude, UX-14-FIX-1] The TIMER-LOG-1 block (Stop
   beside the timer chip and in the + menu, near the timer chip rules above) repeats it too. */
.phone-tabs,.ui-next .create-menu-items a.phone-timer-action{display:none!important}
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  .ui-next .main{padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))}
  .ui-next .phone-tabs{display:flex!important;position:fixed;bottom:0;left:0;right:0;z-index:50;gap:4px;padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px));background:var(--panel);border-top:1px solid var(--line)}
  .ui-next .phone-tabs a{flex:1;min-width:0;min-height:48px;display:flex;align-items:center;justify-content:center;text-align:center;padding:6px;margin:0;overflow-wrap:anywhere;line-height:1.2;color:var(--ink);text-decoration:none;border-radius:6px;font-size:13px}
  .ui-next .phone-tabs a[aria-current=page]{background:var(--accent);color:var(--accent-ink);font-weight:700}
  .ui-next .appbar-actions>.create-menu{position:fixed;right:8px;bottom:calc(6px + env(safe-area-inset-bottom,0px));z-index:51}
  .ui-next .appbar-actions>.create-menu>summary{min-height:48px;min-width:64px;border-radius:24px;display:flex;align-items:center;justify-content:center}
  .ui-next .appbar-actions>.create-menu>.create-menu-items{top:auto;bottom:calc(100% + 8px);width:280px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 200px);overflow:auto;overscroll-behavior:contain}
  .ui-next .appbar-actions>.create-menu>.create-menu-items a{white-space:normal;overflow-wrap:anywhere;min-height:44px;box-sizing:border-box;display:flex;align-items:center}
  .ui-next .appbar-actions>.create-menu .phone-timer-action{display:block!important;border-bottom:1px solid var(--line);font-weight:700}
  .ui-next.menu-open .phone-tabs,.ui-next.menu-open .appbar-actions>.create-menu{display:none!important}
}
/* UX-14 safe areas. base.html adds viewport-fit=cover only in the next interface, so iPhones report
   real env(safe-area-inset-*) values there; without it they are 0 and the tab bar sits on the home
   indicator. Every inset falls back to 0, so screens without a notch do not move. The phone top bar
   clears the status bar, the page and bars clear the notch in landscape, and the tab bar and +
   button clear the home indicator. Classic keeps its old viewport and is untouched. [Claude] */
@media(max-width:1000px){
  .js .ui-next .mobilebar{height:calc(56px + env(safe-area-inset-top,0px));padding-top:env(safe-area-inset-top,0px);padding-left:calc(16px + env(safe-area-inset-left,0px));padding-right:calc(10px + env(safe-area-inset-right,0px))}
  .js .ui-next.menu-open .sidebar{top:calc(56px + env(safe-area-inset-top,0px));padding-left:calc(12px + env(safe-area-inset-left,0px));padding-right:calc(12px + env(safe-area-inset-right,0px))}
  .ui-next .layout{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
}
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  /* The + sits at the right end of the tab bar row, so nothing floats over the page. */
  .ui-next .phone-tabs{padding-left:calc(8px + env(safe-area-inset-left,0px));padding-right:calc(80px + env(safe-area-inset-right,0px))}
  .ui-next .phone-tabs a:focus-visible{outline:3px solid var(--accent);outline-offset:-3px}
  /* The general phone tap-target rule (td, li, nav links: padding 11px 0, margin -8px 0) is more specific
     than the tab rule and pulled the tabs 8px out of the bar at top and bottom. Keep tabs inside it. */
  .ui-next .main>.phone-tabs a{margin:0;padding:6px}
  .ui-next .appbar-actions>.create-menu{right:calc(8px + env(safe-area-inset-right,0px))}
}

/* UX-14 slice 2: list tables become cards on a phone, next interface only. A table opts in with
   class="phone-cards"; ui-next.js copies the column headings onto the cells (data-label), marks the
   title, action, checkbox and empty cells, and adds ARIA table roles so the semantics survive the
   display change. The heading row stays in the page for screen readers but is visually hidden,
   except headings with a sort link or a select-all box, which stay as a small tool row. The labels
   drawn before each value are silent ("/ ''") because the column header already names the cell.
   Every rule needs data-cards-ready, which ui-next.js sets only at phone width and only on a table it
   understands, so without JavaScript, or for a skipped table, the table keeps its old layout. A row
   checkbox sits in the card's leading column (52px wide, full card height), which ui-next.js wraps in
   a label, so a tap anywhere in that column toggles the box; the select-all box and its "Select all"
   text are one label too. Desktop is untouched. [Claude] */
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  .ui-next table.phone-cards[data-cards-ready],.ui-next table.phone-cards[data-cards-ready]>:is(thead,tbody,tfoot){display:block;width:100%;min-width:0}
  .ui-next .table-scroll:has(>table.phone-cards[data-cards-ready]){overflow:visible}
  .ui-next table.phone-cards[data-cards-ready] tr{display:flex;flex-direction:column;gap:2px;position:relative;margin:0 0 8px;padding:10px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel)}
  .ui-next table.phone-cards[data-cards-ready] :is(td,th){display:block;width:auto!important;min-width:0;padding:0;border:0;background:none;text-align:left;white-space:normal;overflow-wrap:anywhere;position:static;box-shadow:none}
  .ui-next table.phone-cards[data-cards-ready] tr:hover td{background:none}
  .ui-next table.phone-cards[data-cards-ready] [data-label]::before{content:attr(data-label) ": ";content:attr(data-label) ": " / "";color:var(--muted);font-size:.85rem}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-title{font-weight:600;font-size:1rem}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-empty{display:none}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-actions{order:10;display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-actions a:not(.btn){display:inline-flex;align-items:center;min-height:44px;padding:0 4px;margin:0}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-actions .btn{min-height:44px}
  .ui-next table.phone-cards[data-cards-ready] :is(.phone-cards-check,th.phone-cards-keep) input[type=checkbox]{width:24px;height:24px;margin:0;accent-color:var(--accent)}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-has-check{padding-left:56px}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-check{position:absolute;top:0;bottom:0;left:0;width:52px!important;padding:0}
  .ui-next table.phone-cards[data-cards-ready] label.phone-cards-hit{display:flex;align-items:flex-start;justify-content:center;gap:8px;width:100%;height:100%;min-height:44px;margin:0;padding:10px 0 0;color:var(--ink);font-size:.9rem;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .ui-next table.phone-cards[data-cards-ready] th.phone-cards-keep label.phone-cards-hit{align-items:center;justify-content:flex-start;padding:0 12px 0 14px;font-weight:400;text-transform:none;letter-spacing:0;min-width:44px}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-head{flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:0;padding:0;border:0;background:none}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-tools{margin:0 0 8px}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-head>th:not(.phone-cards-keep){display:block;position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-head>th.phone-cards-keep{min-height:44px;min-width:44px;display:flex;align-items:center}
  .ui-next table.phone-cards[data-cards-ready] a.badge{padding:2px 8px;margin:0}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-head>th.phone-cards-keep a{display:inline-flex;align-items:center;min-height:44px;padding:0;margin:0}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-group{border:0;background:none;padding:8px 0 4px;margin:0}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-group td{padding:6px 8px;border-radius:6px}
  .ui-next table.phone-cards[data-cards-ready] td.stack-check{float:none}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-total{background:var(--bg)}
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-total th{color:var(--ink)}
  /* Search boxes and every text field: 16px text so iOS does not zoom the page on focus. */
  .ui-next .main input[type=search]{width:100%;max-width:none;min-height:44px;padding:8px 10px;border:1px solid #c8ced6;border-radius:6px;background:#fff;color:var(--ink)}
  .ui-next .main :is(input:not([type=checkbox],[type=radio],[type=file]),select,textarea),.ui-next .picker-input,.ui-next .qs-input{font-size:16px}
}

/* UX-14 slice 3: the matter page on a phone, next interface only, CSS only (no template change).
   Long names wrap anywhere; Log time, + New on this matter and More fill the row as 44px buttons;
   the money cards sit two to a row so the sections are not pushed a screen down; the section
   tabs become a grid of 44px tiles with their counts instead of wrapping into a ragged list.
   The floating + keeps its matter context, so new items still open on this matter. [Claude] */
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  .ui-next .topbar h1{overflow-wrap:anywhere;min-width:0}
  .ui-next .topbar>div:first-child{min-width:0;max-width:100%}
  .ui-next .matter-primary-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .ui-next .matter-primary-actions>.btn,.ui-next .matter-primary-actions>.create-menu>summary,.ui-next .matter-primary-actions>.matter-more>summary{width:100%;min-height:44px;justify-content:center;text-align:center;white-space:normal}
  .ui-next .matter-primary-actions>.create-menu,.ui-next .matter-primary-actions>.matter-more{min-width:0}
  .ui-next .matter-primary-actions>.matter-more[open]{grid-column:1/-1}
  .ui-next .matter-primary-actions .create-menu-items{left:0;right:auto;max-width:calc(100vw - 32px)}
  .ui-next .matter-more-actions .btn{min-height:44px}
  .ui-next .matter-primary-actions .create-menu-items a{min-height:44px;display:flex!important;align-items:center}
  .ui-next .matter-stage-strip{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .ui-next .matter-stage{display:flex;align-items:center;justify-content:center;min-height:44px;padding:6px 10px}
  .ui-next .matter-stage-strip>.matter-stage:only-child{grid-column:1/-1}
  .ui-next .grid.matter-money{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:16px}
  .ui-next .matter-money>.card{margin:0;padding:10px 12px}
  .ui-next .matter-money .stat .value{font-size:1.2rem}
  .ui-next .matter-money .label{overflow-wrap:anywhere}
  .ui-next .matter-money .btn{margin-top:8px;max-width:100%;white-space:normal}
  .ui-next .matter-money~.tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;border:0}
  .ui-next .matter-money~.tabs a{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:44px;margin:0;padding:8px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--ink)}
  .ui-next .matter-money~.tabs a.active{border-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}
}

/* UX-14-FIX-2 (phone QA round 2). Elements only the phone layout uses stay hidden elsewhere. [Claude] */
.phone-start-timer,.phone-cards-inline-label{display:none}
/* A page that was phone sized and is widened again (a resized window, iPad Split View, a foldable) keeps
   the checkbox labels ui-next.js added; outside the phone query they must not change the table. */
.ui-next label.phone-cards-hit{display:contents}
.ui-next label.phone-cards-hit>span{display:none}
@media screen and (max-width:600px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  /* Matter page: Start timer joins the primary actions (two per row). */
  .ui-next .matter-primary-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ui-next .matter-primary-actions>.phone-start-timer{display:block;margin:0;min-width:0}
  .ui-next .matter-primary-actions>.phone-start-timer .btn{width:100%;min-height:44px;justify-content:center}
  /* Cards: a value that sits under the title (the matter of a task) gets its own label. */
  .ui-next table.phone-cards[data-cards-ready] label.phone-cards-hit>span{display:inline}
  /* Links inside card values: at least 44px tall to tap (the general phone rule gives about 40). */
  .ui-next table.phone-cards[data-cards-ready] td:not(.phone-cards-actions) a:not(.btn):not(.badge){padding:12px 0;margin:-10px 0}
  .ui-next table.phone-cards[data-cards-ready] .phone-cards-inline-label{display:inline;color:var(--muted);font-size:.85rem;font-weight:400}
  /* A table with no heading row has no column headers, so its drawn labels are read aloud. */
  .ui-next table.phone-cards.phone-cards-headless[data-cards-ready] [data-label]::before{content:attr(data-label) ": "}
  /* Long values wrap inside the card, whatever their own white-space or width rules say. */
  .ui-next table.phone-cards[data-cards-ready] :is(td,th) *{max-width:100%;overflow-wrap:anywhere}
  .ui-next table.phone-cards[data-cards-ready] :is(td,th) :is(.nowrap,span,a:not(.btn)){white-space:normal}
  /* Sortable lists: the heading row's sort links stay visible as a "Sort by" row. */
  .ui-next table.phone-cards[data-cards-ready] tr.phone-cards-sortable::before{content:"Sort by";content:"Sort by" / "";color:var(--muted);font-size:.85rem;align-self:center}
  /* File pickers and grid fields never push a form wider than the page (Documents upload at 480 to 600px). */
  .ui-next .main input[type=file]{max-width:100%;min-width:0}
  .ui-next .main .row>*{min-width:0}
  /* A long single-line field ui-next.js turns into a wrapping box (matter name). */
  .ui-next textarea.phone-wrap{min-height:44px;height:auto;resize:none;overflow:hidden;line-height:1.35}
}
/* HELP-1: the Help page (app/templates/help/index.html). One column, readable at 390px. */
.help-section{max-width:66ch;margin-bottom:16px}
.help-section h2{margin-top:0}
.help-address{user-select:all;overflow-wrap:anywhere}
.help-types{border:0;padding:0;margin:0 0 6px;min-width:0}
.help-types legend{font-size:.85rem;color:var(--muted);padding:0;margin:10px 0 4px}
label.help-choice{display:flex;gap:10px;align-items:center;color:var(--ink);margin:0;min-height:44px;cursor:pointer;font-size:1rem}
label.help-choice input{width:20px;height:20px;margin:0;flex:none}
.help-links{padding-left:18px}.help-links li{margin-bottom:10px}

/* LIST-SORT-1: sortable list headers. The header links work everywhere; the "Sort by" form (a plain
   GET form, no script) shows only on narrow screens, where the list turns into cards or the header
   row is hidden. In the next interface's phone cards the header sort links are then only for screen
   readers, so the form is the one visible sort control. [Claude] */
a.sort-link{color:inherit;text-decoration:none}
a.sort-link:hover,a.sort-link:focus-visible{text-decoration:underline}
a.sort-link.sort-active{color:var(--accent)}
.list-sort-phone,.list-sort-phone-card{display:none}
@media screen and (max-width:700px),screen and (max-height:500px) and (max-width:1000px) and (pointer:coarse){
  .list-sort-phone{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:0 0 10px}
  .list-sort-phone-card{display:block}
  .list-sort-phone-card .list-sort-phone{margin:0}
  .list-sort-phone label{margin:0;color:var(--muted);font-size:.85rem}
  .list-sort-phone :is(select,.btn){min-height:44px}
  .ui-next table.phone-cards[data-sort-select][data-cards-ready] tr.phone-cards-head>th.phone-cards-keep:not(:has(input)){display:block;position:absolute;width:1px;height:1px;min-height:0;min-width:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .ui-next table.phone-cards[data-sort-select][data-cards-ready] tr.phone-cards-sortable::before{content:none}
  .ui-next table.phone-cards[data-sort-select][data-cards-ready] tr.phone-cards-tools:not(:has(input)){margin:0}
}
/* PWA-3 (P0.1). No dark mode yet: native controls, date pickers and scrollbars stay light on a
   light page. The offline pages use viewport-fit=cover, so they keep clear of the notch and the
   home indicator themselves. [Claude] */
:root{color-scheme:light}
.offline-page{padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
/* PWA-3 (P0.5): Call, Text and Email on contacts and matters. 44px targets on touch screens. */
.contact-reach{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 0}
.contact-reach .btn{display:inline-flex;align-items:center;justify-content:center}
.contact-reach .btn[aria-disabled="true"]{opacity:.55;cursor:not-allowed}
/* PWA-3 S1: the selector names .main and .public so it outranks the 40px touch rule above
   (:is(.main,.public) .btn.small), which every page's buttons carry. */
@media (pointer:coarse), screen and (max-width:600px){:is(.main,.public) .contact-reach .btn.small,:is(.main,.public) .contact-reach .btn{min-height:44px;min-width:44px;padding:10px 14px}}
