/* MRC Portal - staff app & client portal styles.
   Colours and type follow MRC's brand kit and design principles (mrc-platform brand/tokens.css and
   brand/DESIGN-PRINCIPLES.md): navy ink for text and dark surfaces, flat MRC purple for the next action, no
   gradients or glows, Proxima Nova in two weights (400, 700), IBM Plex Mono only for references and dates. */
:root {
  --font: proxima-nova, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --navy: #09152b;
  --purple-ink: #6a0a9c;
  --lavender: #d2caff;
  --brand: #8300bd;
  --brand-600: #6a0a9c;
  --brand-500: #8300bd;
  --brand-100: #f3f0ff;
  --brand-50: #f8f7ff;
  --lilac: #d2caff;
  --ink: #09152b;
  --ink-2: #3d4a66;
  --muted: #5e6b85; /* small grey text: at least 4.5:1 contrast on the page, cards and highlights (WCAG 2.2 AA) */
  --line: #e3e8f0;
  --bg: #f7f9fc;
  --card: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e8f4ee;
  --warn: #8a5300;
  --warn-bg: #fdf4e3;
  --danger: #b42318;
  --danger-bg: #fcebea;
  --info-bg: #eaf1fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(9, 21, 43, .06), 0 4px 16px rgba(9, 21, 43, .06);
  --sidebar-w: 268px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--brand-600); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 23px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15.5px; font-weight: 700; }
/* Only two weights: anything that asked for 500/600/650 gets the nearest of 400/700. */
strong, b, th { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
/* The sidebar floats as its own rounded panel, with a gap between it and the window edges. */
.app { --side-gap: 14px; display: grid; grid-template-columns: calc(var(--sidebar-w) + var(--side-gap) * 2) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #e8ecf4; display: flex; flex-direction: column; position: sticky; top: var(--side-gap); margin: var(--side-gap); height: calc(100vh - var(--side-gap) * 2); border-radius: 24px; box-shadow: 0 10px 30px rgba(9, 21, 43, .22), 0 2px 6px rgba(9, 21, 43, .12); overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; } /* only scrolls on very short screens; the firm list has its own scroller */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 14px 14px 20px; }
.brand-img { height: 54px; width: auto; display: block; }
.brand-link { display: block; border-radius: 8px; }
.brand-link:hover .brand-img { opacity: .88; }
.brand-link:focus-visible { outline: 2px solid #d2caff; outline-offset: 3px; }
.portal-head .brand-link img { display: block; }
.side-search-icon { display: none; margin: 4px auto 10px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; place-items: center; }
.firm-section { display: flex; flex-direction: column; flex: 1; min-height: 180px; } /* never squeezed away; the sidebar scrolls if the screen is very short */

/* collapsed sidebar: icon rail (desktop only - on small screens the sidebar slides in instead) */
@media (min-width: 821px) {
  .app { transition: grid-template-columns .2s ease; }
  .app.collapsed { grid-template-columns: calc(72px + var(--side-gap) * 2) 1fr; }
  .app.collapsed .brand { flex-direction: column; padding: 14px 8px 10px; gap: 10px; }
  .app.collapsed .brand-img { height: auto; width: 50px; }
  .app.collapsed .side-search, .app.collapsed .firm-section, .app.collapsed .side-foot, .app.collapsed .nav .lbl { display: none; }
  .app.collapsed .side-search-icon { display: grid; }
  .app.collapsed .nav { padding: 4px 12px; }
  .app.collapsed .nav a { justify-content: center; padding: 10px 0; }
  .app.collapsed .nav-group { justify-content: center; padding: 10px 0; }
  .app.collapsed .sidebar:not(:hover):not(:has(:focus-visible)) .nav-sub { display: none; }

  /* Collapsed sidebar opens over the page while hovered (or while keyboard focus is inside it). */
  .sidebar { z-index: 30; transition: width .2s ease, box-shadow .2s ease; }
  .app.collapsed .sidebar { width: 72px; overflow: hidden; }
  .app.collapsed .sidebar:hover, .app.collapsed .sidebar:has(:focus-visible) { width: var(--sidebar-w); transition-delay: .12s; }
  /* ...and the page moves across with it, so nothing is ever hidden behind the sidebar. */
  .app.collapsed:has(.sidebar:hover), .app.collapsed:has(.sidebar :focus-visible) { grid-template-columns: calc(var(--sidebar-w) + var(--side-gap) * 2) 1fr; transition-delay: .12s; }
  .app.collapsed .sidebar:hover .brand, .app.collapsed .sidebar:has(:focus-visible) .brand { flex-direction: row; padding: 18px 14px 14px 20px; gap: 8px; }
  .app.collapsed .sidebar:hover .brand-img, .app.collapsed .sidebar:has(:focus-visible) .brand-img { height: 54px; width: auto; }
  .app.collapsed .sidebar:hover .side-search, .app.collapsed .sidebar:has(:focus-visible) .side-search { display: block; }
  .app.collapsed .sidebar:hover .firm-section, .app.collapsed .sidebar:has(:focus-visible) .firm-section { display: flex; }
  .app.collapsed .sidebar:hover .side-foot, .app.collapsed .sidebar:has(:focus-visible) .side-foot { display: block; }
  .app.collapsed .sidebar:hover .nav .lbl, .app.collapsed .sidebar:has(:focus-visible) .nav .lbl { display: inline; }
  .app.collapsed .sidebar:hover .side-search-icon, .app.collapsed .sidebar:has(:focus-visible) .side-search-icon { display: none; }
  .app.collapsed .sidebar:hover .nav, .app.collapsed .sidebar:has(:focus-visible) .nav { padding: 4px 10px; }
  .app.collapsed .sidebar:hover .nav a, .app.collapsed .sidebar:has(:focus-visible) .nav a { justify-content: flex-start; padding: 9px 10px; }
  .app.collapsed .sidebar:hover .nav-group, .app.collapsed .sidebar:has(:focus-visible) .nav-group { justify-content: flex-start; padding: 9px 10px; }
  .app.collapsed .sidebar:hover .nav-sub a, .app.collapsed .sidebar:has(:focus-visible) .nav-sub a { padding: 7px 10px; }
  .app.collapsed .sidebar:hover *, .app.collapsed .sidebar:has(:focus-visible) * { white-space: nowrap; }
}
.side-search { margin: 4px 14px 10px; position: relative; }
.side-search input { width: 100%; border: 0; border-radius: 14px; padding: 10px 12px 10px 36px; background: rgba(255,255,255,.14); color: #fff; font: inherit; }
.side-search input::placeholder { color: #dccbe8; }
.side-search input:focus { outline: 2px solid #d2caff; background: rgba(255,255,255,.2); }
.side-search svg { position: absolute; left: 11px; top: 11px; color: #e5d4f1; }
.nav { padding: 4px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; color: #e8ecf4; text-decoration: none; font-weight: 400; }
.nav a:hover { background: rgba(255,255,255,.1); }
.nav a.active { background: rgba(255,255,255,.18); color: #fff; }
/* Pin button (top of the sidebar): shown when the sidebar is open, hidden in the slim bar */
.pin-btn { flex: none; width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .15s; }
.pin-btn:hover { background: rgba(255,255,255,.24); }
.pin-btn:focus-visible { outline: 2px solid #d2caff; }
.pin-btn svg { transform: rotate(45deg); transition: transform .15s; }
.app.pinned .pin-btn { background: #fff; color: var(--brand); }
.app.pinned .pin-btn svg { transform: none; }
.app.collapsed .sidebar:not(:hover):not(:has(:focus-visible)) .pin-btn { display: none; }
@media (max-width: 820px) { .pin-btn { display: none; } }

/* "Admin" group in the sidebar */
.nav-group { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: transparent; color: #e8ecf4; font: inherit; font-weight: 400; cursor: pointer; text-align: left; }
.nav-group:hover { background: rgba(255,255,255,.1); }
.nav-group.active { color: #fff; }
.nav-group .chev { margin-left: auto; display: inline-flex; transition: transform .15s; }
.nav-group .chev svg { width: 16px; height: 16px; }
.nav-group[aria-expanded="true"] { background: rgba(255,255,255,.1); }
.nav-group[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-group:focus-visible { outline: 2px solid #d2caff; }
.nav-sub { margin: 3px 0 4px 19px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.22); }
.nav-sub a { padding: 7px 10px; font-size: 13.5px; }
.nav-label { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #aab4c8; }
.nav-label button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 7px; width: 26px; height: 24px; cursor: pointer; display: grid; place-items: center; }
.nav-label button:hover { background: rgba(255,255,255,.25); }
.firm-filter { margin: 0 14px 6px; }
.firm-filter input { width: 100%; border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; border-radius: 12px; padding: 6px 10px; font: inherit; font-size: 13px; }
.firm-filter input::placeholder { color: #aab4c8; }
/* Solicitor firms list: scrolls on its own with a slim, visible scrollbar and a soft fade at the edges */
.firms { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 12px 10px; margin-right: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.45) rgba(255,255,255,.08);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 22px), transparent 100%); }
.firms::-webkit-scrollbar { width: 8px; }
.firms::-webkit-scrollbar-track { background: rgba(255,255,255,.08); border-radius: 8px; }
.firms::-webkit-scrollbar-thumb { background: rgba(255,255,255,.45); border-radius: 8px; }
.firms::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.7); }
.firms a { display: block; padding: 7px 10px; border-radius: 12px; color: #e8ecf4; text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.firms a:hover { background: rgba(255,255,255,.1); }
.firms a.active { background: #fff; color: var(--brand); font-weight: 700; }
.side-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; color: #c3cad8; }

.main { min-width: 0; display: flex; flex-direction: column; }
/* No white bar: breadcrumb, search and the user sit straight on the page above the purple banner. */
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; background: transparent; position: relative; z-index: 5; }
.icon-btn.menu-btn { display: none; }
.crumbs { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; min-width: 0; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs .sep { color: #9aa5ba; }
.crumbs .current { font-weight: 700; color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-meta { line-height: 1.2; }
.user-meta .name { font-weight: 700; font-size: 13.5px; }
.content { padding: 24px 28px 48px; width: 100%; } /* fills the screen, whatever its size */
.content:focus { outline: none; }
.proto-banner { background: #fff7e0; color: #6b4a00; border-bottom: 1px solid #f1dfae; padding: 7px 28px; font-size: 12.5px; }

/* ---------- common components ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c9c1f2; background: var(--brand-50); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--danger); border-color: #f2c4bf; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; color: var(--ink-2); width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--brand-100); color: var(--brand); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; background: var(--brand-100); color: var(--brand); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.grey { background: #eef1f6; color: #4a5878; }
.mod { display: inline-block; background: #f3f0ff; color: #8300bd; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.notice { border-radius: 10px; padding: 12px 14px; background: var(--info-bg); color: #1d3b63; font-size: 13.5px; }
.notice.warn { background: var(--warn-bg); color: #6b4300; }
.notice.danger { background: var(--danger-bg); color: #7a1b13; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--brand); }
.kpi .l { color: var(--muted); font-size: 13px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }

.client-details { display: flex; flex-wrap: wrap; gap: 14px 40px; align-items: center; margin-bottom: 16px; }
.client-details > div { min-width: 140px; }
.client-details .btn { margin-left: auto; }

/* ---------- folder tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px 12px; text-align: center; cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s; }
.tile:hover { border-color: #c9c1f2; box-shadow: var(--shadow); transform: translateY(-1px); }
.tile:focus-visible { outline: 2px solid var(--brand-500); }
.tile .folder-ico { width: 64px; height: 52px; margin: 2px auto 8px; display: block; }
.tile .t-name { font-weight: 700; word-break: break-word; }
.tile .t-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile .t-badge { margin-top: 8px; min-height: 22px; }
.tile .t-actions { display: flex; justify-content: center; gap: 2px; margin-top: 6px; }
.tile.new { border-style: dashed; color: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 170px; background: var(--brand-50); }
.tile.new svg { width: 30px; height: 30px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f9fafc; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: #f9fafc; }
table.t tr.clickable { cursor: pointer; }
table.t tr.selected { background: var(--brand-50); }
table.t td.num, table.t th.num { text-align: right; }
table.t .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: var(--brand-50); border-bottom: 1px solid var(--line); }
.bulkbar .count { font-weight: 700; color: var(--brand); margin-right: 6px; }

/* ---------- upload ---------- */
.upload-row { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 18px 0; }
.dropzone { border: 2px dashed #c9c1f2; border-radius: var(--radius); background: var(--card); padding: 22px; text-align: center; color: var(--ink-2); transition: background .15s, border-color .15s; }
.dropzone.drag { background: var(--brand-50); border-color: var(--brand-500); }
.dropzone svg.big { width: 42px; height: 42px; color: var(--brand); }
.dropzone .dz-title { font-weight: 700; font-size: 15px; margin-top: 6px; }
.dropzone .dz-actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.progress { height: 8px; background: var(--brand-100); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.upload-status { text-align: left; }

/* ---------- forms & dialogs ---------- */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 5px; }
label.f > small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input.in, select.in, textarea.in { width: 100%; border: 1px solid #cfd6e3; border-radius: 9px; padding: 9px 11px; font: inherit; background: #fff; color: var(--ink); }
textarea.in { min-height: 72px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; font-size: 13.5px; }
.form-error { color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 12px; }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(30, 10, 50, .3); color: var(--ink); }
dialog.modal.wide { width: min(780px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(30, 14, 44, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #f9fafc; border-radius: 0 0 14px 14px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; font-family: var(--mono); font-size: 13px; }
.link-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.link-card .lc-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-card .lc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- Radiology / Casework ---------- */
.tile.section-tile { padding-top: 22px; min-height: 190px; }
.tile.section-tile .t-name { font-size: 16px; }
.tile.section-tile.radiology { border-top: 4px solid var(--brand); }
.tile.section-tile.casework { border-top: 4px solid #233f73; }
.section-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 4px; }
.section-card { display: flex; flex-direction: column; min-height: 270px; padding: 30px 28px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; transition: box-shadow .15s, border-color .15s, transform .15s; }
.section-card:hover { border-color: #c9c1f2; box-shadow: var(--shadow); transform: translateY(-2px); }
.section-card:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.section-card .sc-icon { width: 68px; height: 68px; border-radius: 16px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.section-card.casework .sc-icon { background: #233f73; }
.section-card .sc-icon svg { width: 36px; height: 36px; stroke-width: 1.6; }
.section-card .sc-title { font-size: 23px; font-weight: 700; margin-top: 18px; }
.section-card .sc-desc { color: var(--muted); margin-top: 4px; }
.section-card .sc-stats { display: flex; gap: 22px; margin-top: auto; padding-top: 20px; font-size: 13.5px; }
.section-card .sc-num { font-size: 21px; font-weight: 700; color: var(--ink); }
.section-cards.portal { gap: 24px; }
.section-cards.portal .section-card { min-height: 380px; padding: 40px 36px 32px; }
.section-cards.portal .sc-icon { width: 84px; height: 84px; border-radius: 20px; }
.section-cards.portal .sc-icon svg { width: 44px; height: 44px; }
.section-cards.portal .sc-title { font-size: 28px; margin-top: 22px; }
.section-cards.portal .sc-desc { font-size: 15.5px; }
.section-card .sc-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: var(--brand); font-weight: 700; }
.dropzone.slim { padding: 14px 18px; margin-bottom: 16px; text-align: left; }
.cw-name { display: inline-flex; align-items: center; gap: 10px; }
.cw-name svg.cw-folder { width: 24px; height: 24px; color: #6a0a9c; fill: #f3f0ff; }
.ftype { flex: none; display: inline-grid; place-items: center; width: 34px; height: 22px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: #fff; background: #7a6d8b; }
.ftype.pdf { background: #e5533d; }
.ftype.word { background: #2b579a; }
.ftype.email { background: #0f7b8a; }
.ftype.image { background: #2f8a4c; }
.cw-by { display: inline-flex; align-items: center; gap: 8px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10.5px; }
.cw-table td { white-space: nowrap; }
.cw-table td:nth-child(2) { white-space: normal; min-width: 240px; }
.pop-menu { position: absolute; z-index: 60; min-width: 170px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(9, 21, 43, .18); padding: 5px; display: grid; }
.pop-menu button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--brand-50); outline: none; }
.pop-menu button.danger { color: var(--danger); }
.pop-menu button.danger:hover { background: var(--danger-bg); }
fieldset.sections-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 2px; margin: 0 0 14px; }
fieldset.sections-pick legend { font-weight: 700; font-size: 13.5px; padding: 0 6px; }

/* ---------- top-right search ---------- */
.top-search { position: relative; display: flex; align-items: center; gap: 8px; width: min(340px, 34vw); border: 1px solid #cfd6e3; border-radius: 14px; padding: 0 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.top-search:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.top-search svg.i { color: var(--brand-500); }
.top-search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 9px 0; font: inherit; font-size: 14px; background: transparent; color: var(--ink); }
.top-search kbd { font: 11px/1 inherit; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--brand-50); }
.top-search:focus-within kbd { display: none; }
.ts-list { position: absolute; right: 0; top: calc(100% + 6px); width: max(100%, 380px); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(9, 21, 43, .18); padding: 6px; z-index: 50; }
.ts-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.ts-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.ts-item svg.i { color: var(--brand); margin-top: 2px; }
.ts-item .ts-title { display: block; }
.ts-item .ts-title b, .ts-sub b { color: var(--brand); font-weight: 700; }
.ts-item .ts-sub { display: block; font-size: 12px; color: var(--muted); }
.ts-item.active, .ts-item:hover { background: var(--brand-50); }
.ts-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; }
.ts-all { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 10px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--brand); font-weight: 700; text-decoration: none; }
.ts-all.active, .ts-all:hover { background: var(--brand-50); }
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar .crumbs { min-width: 0; }
  .top-search { order: 3; flex: 1 1 100%; width: 100%; }
  .top-search kbd { display: none; }
  .ts-list { width: 100%; }
}

/* ---------- dashboard welcome banner ---------- */
.dash-banner { position: relative; overflow: hidden; background: var(--navy); color: #fff; border-radius: 22px; padding: 30px 32px 74px; }
.dash-banner .db-pattern { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .09; pointer-events: none; }
.dash-banner .db-logo { position: absolute; top: 24px; right: 30px; height: 90px; width: auto; pointer-events: none; }
.dash-banner > :not(.db-pattern):not(.db-logo) { position: relative; }
@media (max-width: 820px) { .dash-banner { padding: 86px 20px 70px; } .dash-banner .db-logo { height: 54px; top: 18px; right: 18px; } .dash-banner h1 { font-size: 24px; } }
.dash-banner .db-date { font-size: 13px; opacity: .82; }
.dash-banner h1 { font-size: 28px; font-weight: 700; margin-top: 4px; color: #fff; }
.dash-banner .db-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; position: relative; }
.dash-banner .btn { border: 0; background: rgba(255, 255, 255, .16); color: #fff; border-radius: 12px; }
.dash-banner .btn:hover { background: rgba(255, 255, 255, .26); }
.dash-banner .btn.light { background: #fff; color: var(--brand); }
.dash-banner .btn.light:hover { background: var(--brand-50); }
.grid-kpi.overlap { position: relative; margin-top: -52px; padding: 0 18px; }
.grid-kpi.overlap .kpi { box-shadow: 0 6px 20px rgba(9, 21, 43, .10); }

/* ---------- branded banner on every staff page (same look as the dashboard) ---------- */
.app .page-head { position: relative; overflow: hidden; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; min-height: 140px; margin-bottom: 22px; padding: 26px 250px 26px 32px; border-radius: 22px; color: #fff; background: var(--navy); }
.app .page-head::before { content: ""; position: absolute; inset: 0; background: url("/img/banner-pattern.svg") left top / 1800px auto no-repeat; opacity: .09; pointer-events: none; }
.app .page-head::after { content: ""; position: absolute; top: 24px; right: 30px; width: 196px; height: 90px; background: url("/img/mrc-portal-logo-white.png") right top / contain no-repeat; pointer-events: none; }
.app .page-head > * { position: relative; z-index: 1; }
.app .page-head h1 { color: #fff; font-size: 26px; }
.page-head .title-row { display: flex; align-items: center; gap: 6px; }
/* "Instruct MRC": MRC brand purple (the brand kit's colour for the next action), on any banner colour */
.page-head .btn.instruct-btn, .app .page-head .actions .btn.instruct-btn, .portal-main .page-head .actions .btn.instruct-btn { background: #8300bd; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 12px; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.page-head .btn.instruct-btn:hover, .app .page-head .actions .btn.instruct-btn:hover, .portal-main .page-head .actions .btn.instruct-btn:hover { background: #6a0a9c; color: #fff; }
.page-head .btn.instruct-btn svg { width: 16px; height: 16px; }
.app .page-head .title-edit { background: rgba(255, 255, 255, .14); }
.app .page-head .title-edit:hover { background: rgba(255, 255, 255, .28); }
.app .page-head .sub, .app .page-head .muted { color: rgba(255, 255, 255, .82) !important; }
.app .page-head .actions .btn { border: 0; background: rgba(255, 255, 255, .16); color: #fff; border-radius: 12px; }
.app .page-head .actions .btn:hover { background: rgba(255, 255, 255, .26); }
.app .page-head .actions .btn.primary { background: #fff; color: var(--brand); }
.app .page-head .actions .btn.primary:hover { background: var(--brand-50); }
.app .page-head .actions .btn.danger { color: #ffd9d6; }
.app .page-head .actions .btn.danger:hover { background: rgba(255, 120, 110, .3); color: #fff; }
.app .page-head .icon-btn { color: #fff; }
.app .page-head .icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.app .page-head .icon-btn.danger:hover { background: rgba(255, 120, 110, .3); color: #fff; }
@media (max-width: 820px) {
  .app .page-head { padding: 22px 20px; padding-top: 86px; }
  .app .page-head::after { top: 18px; right: 18px; width: 118px; height: 54px; }
}

/* ---------- firm co-branding (prototype; question 7 for Pete/Heidi) ---------- */
/* Folder colours: MRC purple by default; a firm's own colours on that firm's pages (staff and share links) */
.folder-ico .fo-back { fill: var(--folder-back, #6a0a9c); }
.folder-ico .fo-front { fill: var(--folder-front, #233f73); }
.folder-ico .fo-line { stroke: var(--folder-back, #6a0a9c); fill: none; }
.folder-ico.section-rad { --folder-back: #8300bd; --folder-front: #8300bd; }
.firm-scope, .firm-branded {
  --folder-back: var(--firm);
  --folder-front: color-mix(in srgb, var(--firm) 72%, #ffffff);
}
.firm-scope .folder-ico.section-rad { --folder-back: var(--firm); --folder-front: color-mix(in srgb, var(--firm) 85%, #ffffff); }
.firm-scope .section-card .sc-icon, .firm-branded .section-card .sc-icon { background: var(--firm); }
.firm-scope .section-card.casework .sc-icon, .firm-branded .section-card.casework .sc-icon { background: color-mix(in srgb, var(--firm) 72%, #ffffff); }
.firm-scope .section-card .sc-open { color: var(--firm); }
.firm-scope .tile.section-tile.radiology { border-top-color: var(--firm); }
.firm-scope .tile.section-tile.casework { border-top-color: color-mix(in srgb, var(--firm) 72%, #ffffff); }
.firm-scope .cw-name svg.cw-folder { color: var(--firm); fill: color-mix(in srgb, var(--firm) 18%, #ffffff); }

/* Share-link pages for a branded firm (after sign-in): firm header, firm banner, "Powered by MRC Portal" */
.firm-branded .portal-head { background: var(--firm); }
.firm-chip { display: inline-flex; align-items: center; background: #fff; border-radius: 12px; padding: 7px 14px; flex: none; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.firm-chip img { height: 40px !important; width: auto; display: block; }
.portal-main .page-head.firm-banner { position: relative; overflow: hidden; flex-direction: column; align-items: flex-start; gap: 14px; min-height: 130px; padding: 24px 210px 24px 28px; border-radius: 20px; color: #fff; background: var(--firm); }
.portal-main .page-head.firm-banner::before { content: ""; position: absolute; inset: 0; background: url("/img/banner-pattern.svg") left top / 1800px auto no-repeat; opacity: .09; pointer-events: none; }
.portal-main .page-head.firm-banner > * { position: relative; z-index: 1; }
.portal-main .page-head.firm-banner h1 { color: #fff; }
.portal-main .page-head.firm-banner .sub { color: rgba(255, 255, 255, .85); }
.portal-main .page-head.firm-banner .btn.primary { background: #fff; color: var(--firm); border-color: #fff; }
.portal-main .page-head.firm-banner .btn.primary:hover { background: #f3f3f3; }
.portal-main .page-head.firm-banner .powered-by { position: absolute; top: 20px; right: 26px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.powered-by span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .8); }
.powered-by img { height: 54px; width: auto; display: block; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 26px 0 0; }
.firm-branded .section-card .sc-icon { background: var(--firm); }
.firm-branded .section-card .sc-open { color: var(--firm); }
/* Inside a firm's workspace: firm colour banner, firm logo in place of the MRC Portal logo */
.app .page-head.firm-head { background: var(--firm); padding-right: 330px; }
.app .page-head.firm-head::after { display: none; }
.app .page-head.firm-head .actions .btn.primary { color: var(--firm); }
.app .page-head .firm-corner-logo { position: absolute; top: 22px; right: 26px; z-index: 1; display: flex; align-items: center; background: #fff; border-radius: 16px; padding: 12px 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.app .page-head .firm-corner-logo img { height: 66px; width: auto; display: block; }
@media (max-width: 820px) {
  .app .page-head.firm-head { padding-right: 20px; }
  .app .page-head .firm-corner-logo { top: 16px; right: 16px; padding: 6px 10px; border-radius: 12px; }
  .app .page-head .firm-corner-logo img { height: 40px; }
}
@media (max-width: 820px) {
  .firm-chip { padding: 5px 9px; } .firm-chip img { height: 26px !important; }
  .portal-main .page-head.firm-banner { padding: 78px 20px 22px; }
  .portal-main .page-head.firm-banner .powered-by { top: 14px; right: 18px; }
  .powered-by img { height: 38px; }
}

/* ---------- firm page: Folders / List switch and client list ---------- */
.view-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; } /* Folders / List switch on the right */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 700; padding: 6px 14px; border-radius: 9px; cursor: pointer; }
.seg button svg { width: 16px; height: 16px; }
.seg button:hover { background: var(--brand-50); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.firm-scope .seg button[aria-pressed="true"] { background: var(--firm); }
/* Main buttons on a firm's pages (e.g. New Client Folder) take the firm's colour; banner buttons keep their white style */
.firm-scope .btn.primary:not(.page-head .btn) { background: var(--firm); border-color: var(--firm); }
.firm-scope .btn.primary:not(.page-head .btn):hover { background: color-mix(in srgb, var(--firm) 85%, #000000); }
.seg button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.client-list th[data-sort] { cursor: pointer; user-select: none; }
.client-list th[data-sort]:hover { color: var(--ink); }
.client-list th[data-sort]:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.client-list .sort-ind { margin-left: 4px; font-size: 9px; }
.client-list .cw-name .folder-ico { width: 28px; height: 23px; flex: none; }
.client-list tr.client-row:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }

/* ---------- dashboard activity feed ---------- */
.card.activity { margin-top: 18px; }
.activity .card-head { flex-wrap: wrap; }
.act-title { display: flex; align-items: center; gap: 10px; }
.act-live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ok); }
.act-live span { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: actPulse 2s ease-in-out infinite; }
@keyframes actPulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .act-live span { animation: none; } }
.act-filters { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip-btn:hover { border-color: #c9c1f2; background: var(--brand-50); }
.chip-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.act-body { padding: 0 20px 6px; }
.act-day { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 0 4px; }
.act-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 6px; border-bottom: 1px solid #edf0f5; border-radius: 8px; }
.act-row.clickable { cursor: pointer; }
.act-row.clickable:hover, .act-row.clickable:focus-visible { background: var(--brand-50); outline: none; }
.act-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-100); color: var(--brand); }
.act-ico.k-upload { background: var(--ok-bg); color: var(--ok); }
.act-ico.k-download, .act-ico.k-client { background: var(--warn-bg); color: var(--warn); }
.act-ico.k-share { background: var(--info-bg); color: #1d3b63; }
.act-ico.k-system, .act-ico.k-signin { background: #eef1f6; color: #4a5878; }
.act-text { min-width: 0; word-break: break-word; }
.act-when { white-space: nowrap; }
.act-more { text-align: center; padding: 10px 0 14px; }

/* ---------- in-platform file viewer ---------- */
dialog.docview { border: 0; padding: 0; width: min(1200px, calc(100vw - 32px)); height: calc(100vh - 32px); max-height: none; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; background: #efe9f3; box-shadow: 0 20px 60px rgba(30, 10, 50, .35); color: var(--ink); }
dialog.docview:not([open]) { display: none; }
dialog.docview::backdrop { background: rgba(30, 14, 44, .6); }
.dv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.dv-title { flex: 1; min-width: 0; }
.dv-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-nav { display: flex; align-items: center; gap: 4px; color: var(--muted); }
svg.i.flip { transform: scaleX(-1); }
.dv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 16px; gap: 12px; }
.dv-frame { flex: 1; width: 100%; min-height: 60vh; border: 0; border-radius: 8px; background: #fff; }
.dv-frame.paper { max-width: 900px; margin: 0 auto; box-shadow: var(--shadow); }
.dv-note { max-width: 900px; width: 100%; margin: 0 auto; }
.dv-image { flex: 1; display: grid; place-items: center; overflow: auto; }
.dv-image img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; background: #fff; box-shadow: var(--shadow); cursor: zoom-in; }
.dv-image.zoom { place-items: start; }
.dv-image.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.dv-email { max-width: 900px; width: 100%; margin: 0 auto; background: #fff; border-radius: 8px; padding: 18px 22px; box-shadow: var(--shadow); }
.dv-email h2 { margin-bottom: 10px; }
.dv-email dl { display: grid; grid-template-columns: 60px 1fr; gap: 3px 12px; margin: 0; font-size: 13.5px; }
.dv-email dt { color: var(--muted); }
.dv-email dd { margin: 0; word-break: break-word; }
.dv-attach { margin-top: 12px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dv-attach .chip { background: var(--brand-50); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.dv-attach > div { flex-basis: 100%; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 700; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: grid; gap: 4px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: #2b1d3a; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; font-size: 14px; animation: tin .2s ease-out; }
.toast.error { background: var(--danger); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- sign-in & client portal ---------- */
.code-input { font-size: 26px; letter-spacing: 10px; text-align: center; font-family: var(--mono); }
.portal-head { background: var(--brand); color: #fff; }
.portal-head-inner { margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 24px; }
.portal-head img { height: 46px; }
.portal-head .muted { color: #e2d1ee; }
.portal-head .icon-btn { color: #fff; }
.portal-head .icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.portal-main { margin: 0 auto; padding: 24px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: var(--sidebar-w); z-index: 20; transform: translateX(calc(-100% - var(--side-gap) * 2)); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .user-meta { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- banner up to the top of the page ----------
   On pages that open with a banner, the search box and the user sit inside the top of the banner
   instead of on a strip of page above it. A thin edge of page stays so the rounded corners show.
   Undo: restore app.css from backup-before-banner-change. */
@media (min-width: 821px) {
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) {
    --tb-h: 68px;
  }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .topbar {
    height: var(--tb-h); margin-bottom: calc(-1 * var(--tb-h)); padding: 22px 60px 0; align-items: center;
  }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content { padding-top: 8px; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .dash-banner:first-child { padding-top: 78px; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .dash-banner:first-child .db-logo { top: 74px; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .page-head:first-child { padding-top: 78px; min-height: 192px; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .page-head:first-child::after { top: 74px; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .page-head:first-child .firm-corner-logo { top: 70px; }

  /* white text and see-through search on the purple (or firm colour) */
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .crumbs:not(:has(a)) { visibility: hidden; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .crumbs a,
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .crumbs .current { color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .crumbs a:hover { color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .crumbs .sep { color: rgba(255, 255, 255, .6); }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search:focus-within { background: #fff; border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search:not(:focus-within) svg.i,
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search:not(:focus-within) input { color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search:not(:focus-within) input::placeholder { color: rgba(255, 255, 255, .78); }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .top-search kbd { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip,
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip .muted { color: #fff !important; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip .muted { opacity: .8; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip .avatar { background: rgba(255, 255, 255, .22); color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip .icon-btn { color: #fff; }
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) .user-chip .icon-btn:hover { background: rgba(255, 255, 255, .2); }
}

/* ---------- dashboard banner: logo on the left, slim line, then greeting and buttons ----------
   Undo: restore app.css and app.js from backup-before-logo-line-change. */
.dash-banner .db-row { display: flex; align-items: center; gap: 28px; position: relative; }
.app .dash-banner .db-row .db-logo { position: static; top: auto; right: auto; height: 96px; flex: none; }
.dash-banner .db-rule { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .42); flex: none; }
.dash-banner .db-text { min-width: 0; }
@media (max-width: 820px) {
  .dash-banner { padding-top: 24px; }
  .dash-banner .db-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .app .dash-banner .db-row .db-logo { height: 54px; }
  .dash-banner .db-rule { display: none; }
}

/* ---------- slimmer Dashboard banner ----------
   On wide screens the search box and the user sit level with the greeting instead of on their own row.
   Narrower screens keep the row above, so the search box never covers the greeting.
   Undo: restore app.css from backup-before-slim-banner. */
.app .dash-banner .db-row .db-logo { height: 78px; }
.dash-banner { padding-bottom: 88px; }
@media (min-width: 1440px) {
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .dash-banner:first-child { padding-top: 52px; }
}

/* ---------- Dashboard: pale purple box headings (Recent Uploads, Expiring Soon, Activity) ----------
   Undo: restore app.css from backup-before-pale-purple-headings. */
#view:has(> .dash-banner) .card > .card-head { background: var(--brand-100); border-bottom-color: #e2d3ec; border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- Solicitor Firms report (Reports > Solicitor Firms, and each firm's Usage Report) ----------
   Undo: restore app.css, app.js and admin.js from backup-before-firms-dashboard. */
.fr-range { align-items: flex-end; }
.fr-range .fr-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.fr-range .fr-quick .btn.on { background: var(--brand-100); border-color: #c9c1f2; color: var(--brand); }
.fr-range .fr-export { margin-left: auto; }
.fr-kpis { margin-bottom: 16px; }
.fr-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.fr-gap { margin-top: 16px; }
.fr-row > .card { min-width: 0; }
.fr-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.fr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.fr-bars { display: flex; align-items: stretch; gap: 14px; height: 200px; padding-top: 6px; }
.fr-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.fr-stack { width: min(56px, 100%); display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; min-height: 2px; }
.fr-stack i { display: block; min-height: 3px; }
.fr-total { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.fr-month { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fr-hbars { display: grid; gap: 12px; }
.fr-hbar { display: grid; gap: 4px; text-decoration: none; color: inherit; border-radius: 8px; }
.fr-hbar:hover .fr-hbar-top span { color: var(--brand); text-decoration: underline; }
.fr-hbar-top { display: flex; justify-content: space-between; font-size: 13px; }
.fr-hbar-track { height: 10px; border-radius: 5px; background: #f1ebf5; overflow: hidden; }
.fr-hbar-track i { display: block; height: 100%; border-radius: 5px; }
.fr-heat { display: grid; gap: 4px; align-items: center; }
.fr-heat i { display: block; height: 22px; border-radius: 4px; background: #f4eff7; position: relative; }
.fr-heat i::after { content: ""; position: absolute; inset: 0; border-radius: 4px; background: var(--heat); opacity: var(--a); }
.fr-heat-h { font-size: 11px; color: var(--muted); text-align: center; }
.fr-heat-d { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.fr-table tbody tr[data-href] { cursor: pointer; }
.fr-table tbody tr[data-href]:hover { background: var(--brand-50); }
.fr-table tbody tr[data-href]:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.fr-table td .i { width: 16px; height: 16px; color: var(--muted); }
.fr-firm { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--c, var(--brand)); text-decoration: none; }
.fr-firm:hover { text-decoration: underline; }
.fr-firm i { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--brand)); flex: none; }
.fr-stale { color: var(--danger); font-weight: 700; }
.fr-tops { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.fr-tops ol, .fr-list { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: fr; display: grid; gap: 6px; }
.fr-tops li, .fr-list li { counter-increment: fr; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.fr-tops li > span, .fr-list li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.fr-tops li::before, .fr-list li::before { content: counter(fr) "."; color: var(--muted); width: 18px; flex: none; }
.fr-tops li > span, .fr-list li > span { flex: 1; }
.fr-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fr-totals > div { display: grid; gap: 2px; }
.fr-totals strong { font-size: 24px; color: var(--brand); }
.firm-scope .fr-totals strong { color: var(--firm); }
.fr-totals span { font-size: 12.5px; color: var(--muted); }
.fr-totals-wide { grid-column: 1 / -1; }
.firm-scope .fr-kpis .kpi .v { color: var(--firm); }
@media (max-width: 1000px) { .fr-row { grid-template-columns: 1fr; } .fr-range .fr-export { margin-left: 0; } }
@media (max-width: 700px) { .fr-heat-h:nth-child(even) { visibility: hidden; } .fr-bars { gap: 6px; } }

/* ---------- Customer accounts: staff "Customer Users" window and the customer portal ----------
   Undo: restore the files in backup-before-customer-accounts. */
.notice.ok { background: var(--ok-bg); color: #1d5130; }
dialog.modal.wide:has(#cuList) { width: min(960px, calc(100vw - 32px)); }
.cu-table td { vertical-align: middle; }
.cu-table select.in.sm { padding: 5px 8px; font-size: 13px; min-width: 170px; }
.cu-table tr.cu-off td { opacity: .6; }
.cu-add-title { margin: 20px 0 10px; font-size: 15px; }
.cu-add { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cu-access { border: 0; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cu-access legend { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.cu-opt { position: relative; display: block; cursor: pointer; }
.cu-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cu-opt > span { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; row-gap: 2px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; height: 100%; }
.cu-opt > span .i { grid-row: 1 / 3; width: 20px; height: 20px; color: var(--muted); margin-top: 1px; }
.cu-opt small { grid-column: 2; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.cu-opt input:checked + span { border: 2px solid var(--brand); background: var(--brand-50); padding: 11px 13px; }
.cu-opt input:checked + span .i { color: var(--brand); }
.cu-opt input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 2px; }
@media (max-width: 700px) { .cu-add, .cu-access { grid-template-columns: 1fr; } }

a.tile.cp-case { text-decoration: none; color: inherit; }
.firm-branded a.tile.cp-case { --folder-back: color-mix(in srgb, var(--firm) 70%, #ffffff); --folder-front: var(--firm); }

/* ---------- Users page: MRC and Customers tables ----------
   Undo: restore app.js, app.css and customers.js from backup-before-users-customers-table. */
.users-card .card-head h2 { font-size: 16px; }
.users-t tr.cu-off td { opacity: .6; }
.co-logo { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 34px; min-width: 34px; max-width: 120px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-decoration: none; }
.co-logo img { height: 24px; width: auto; max-width: 104px; object-fit: contain; display: block; }
.co-initials { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--co, var(--brand)); color: #fff; font-size: 10px; font-weight: 700; }
.co-logo:hover, .co-logo:focus-visible { border-color: var(--co, var(--brand)); }
.co-logo::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #2a1438; color: #fff; font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 5; }
.co-logo:hover::after, .co-logo:focus-visible::after { opacity: 1; }
@media (min-width: 1100px) { .users-card .table-wrap { overflow: visible; } } /* lets the company-name label show above the logo */
.au-kind { margin-bottom: 14px; }

/* ---------- Customer portal: search and Folders / List ----------
   Undo: restore portal.js and app.css from backup-before-portal-search-list. */
.cp-bar { margin: 4px 0 14px; }
.cp-bar #cpCount { margin-right: auto; }
.cp-search { display: flex; align-items: center; gap: 8px; width: min(380px, 100%); border: 1px solid #cfd6e3; border-radius: 12px; padding: 0 12px; background: #fff; }
.cp-search:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.cp-search .i { width: 17px; height: 17px; color: var(--muted); flex: none; }
.cp-search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 9px 0; font: inherit; font-size: 14px; background: transparent; color: var(--ink); }
.firm-branded .cp-search:focus-within { border-color: var(--firm); box-shadow: 0 0 0 3px color-mix(in srgb, var(--firm) 18%, transparent); }
.firm-branded .seg button[aria-pressed="true"] { background: var(--firm); }
.firm-branded .seg button:hover:not([aria-pressed="true"]) { background: color-mix(in srgb, var(--firm) 8%, #ffffff); }
.firm-branded .client-list { --folder-back: color-mix(in srgb, var(--firm) 70%, #ffffff); --folder-front: var(--firm); }
.firm-branded .client-list tr.client-row:hover { background: color-mix(in srgb, var(--firm) 5%, #ffffff); }
.cp-row-link { color: inherit; text-decoration: none; }
.cp-row-link:hover strong { text-decoration: underline; }
@media (max-width: 700px) { .cp-search { order: 3; width: 100%; } }

/* ---------- Customer portal: details above the banner, banner = firm logo | line | title ----------
   Undo: restore portal.js, share.js and app.css from backup-before-portal-banner (and delete custhead.js). */
.cp-page .portal-main { padding-top: 14px; }
.cp-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; min-height: 40px; }
.cp-top-left { flex: 1; min-width: 0; }
.cp-top-left .crumbs { margin: 0 !important; }
.cp-user { display: flex; align-items: center; gap: 10px; }
.cp-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: color-mix(in srgb, var(--firm) 14%, #ffffff); color: var(--firm); flex: none; }
.cp-who { display: flex; flex-direction: column; line-height: 1.25; font-size: 12.5px; text-align: right; }
.cp-who strong { font-size: 13.5px; color: var(--ink); }
.cp-who span { color: var(--muted); }
.cp-user .icon-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.cp-user .icon-btn:hover { border-color: var(--firm); color: var(--firm); }
.portal-main .page-head.firm-banner.cp-banner { flex-direction: row; align-items: center; min-height: 0; padding: 26px 230px 26px 28px; }
.cp-row { display: flex; align-items: center; gap: 26px; min-width: 0; }
.cp-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 16px; padding: 12px 18px; flex: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.cp-logo img { height: 66px; width: auto; display: block; }
.cp-logo-text { color: var(--firm); font-weight: 700; font-size: 18px; max-width: 220px; text-align: center; }
.cp-rule { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .45); flex: none; }
.cp-text { display: grid; gap: 4px; min-width: 0; }
.cp-text h1 { margin: 0; }
.cp-text .actions { margin-top: 10px; }
@media (max-width: 820px) {
  .portal-main .page-head.firm-banner.cp-banner { padding: 78px 20px 22px; }
  .cp-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .cp-rule { display: none; }
  .cp-logo img { height: 40px; }
  .cp-top { flex-wrap: wrap; }
  .cp-who { display: none; }
}

/* ---------- Customer portal: initials menu, back button, Powered By bottom right ----------
   Undo: restore the files in backup-before-customer-menu. */
.cp-top { justify-content: space-between; }
.cp-back { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 11px; font-weight: 700; color: var(--ink); text-decoration: none; }
.cp-back:hover { border-color: var(--firm); color: var(--firm); background: #fff; }
.cp-back .i { width: 17px; height: 17px; }
.cp-menu-wrap { position: relative; }
.cp-menu-wrap .cp-av { width: 38px; height: 38px; border: 2px solid var(--firm); cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; padding: 0; }
.cp-menu-wrap .cp-av:focus-visible { outline: 2px solid var(--firm); outline-offset: 2px; }
.cp-menu { position: absolute; right: 0; top: 100%; padding-top: 8px; min-width: 250px; z-index: 30; display: none; }
.cp-menu-wrap:hover .cp-menu, .cp-menu-wrap.open .cp-menu, .cp-menu-wrap:focus-within .cp-menu { display: block; }
.cp-menu > * { background: #fff; }
.cp-menu-who { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; font-size: 12.5px; box-shadow: 0 12px 30px rgba(30, 10, 50, .14); }
.cp-menu-who strong { font-size: 14px; color: var(--ink); }
.cp-menu-who span { color: var(--muted); word-break: break-all; }
.cp-menu button { display: flex; align-items: center; gap: 9px; width: 100%; border: 1px solid var(--line); border-top: 1px solid #f0e8f4; padding: 10px 14px; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; box-shadow: 0 12px 30px rgba(30, 10, 50, .14); }
.cp-menu button:last-child { border-radius: 0 0 12px 12px; }
.cp-menu button .i { width: 17px; height: 17px; color: var(--muted); }
.cp-menu button:hover, .cp-menu button:focus-visible { background: color-mix(in srgb, var(--firm) 7%, #ffffff); outline: none; }
.cp-menu button.cp-menu-out { color: var(--danger); }
.cp-menu button.cp-menu-out .i { color: var(--danger); }
.portal-main .page-head.firm-banner.cp-banner .powered-by { top: auto; bottom: 18px; }
@media (max-width: 820px) { .portal-main .page-head.firm-banner.cp-banner { padding: 22px 20px 84px; } .portal-main .page-head.firm-banner.cp-banner .powered-by { bottom: 14px; } }

/* ---------- Customer portal: initials (and back) inside the banner, no gap at the top ---------- */
.cp-page .portal-main { padding-top: 8px; }
.portal-main .page-head.firm-banner.cp-banner { overflow: visible; }
.portal-main .page-head.firm-banner.cp-banner::before { border-radius: inherit; }
.portal-main .page-head.firm-banner.cp-banner.has-back { padding-top: 70px; }
.portal-main .page-head.firm-banner.cp-banner > .cp-top { position: absolute; top: 14px; left: 18px; right: 18px; margin: 0; min-height: 0; z-index: 5; pointer-events: none; }
.cp-banner > .cp-top > * { pointer-events: auto; }
.cp-banner .cp-top-left { flex: none; }
.cp-banner .cp-back { background: rgba(255, 255, 255, .16); border: 0; color: #fff; }
.cp-banner .cp-back:hover { background: rgba(255, 255, 255, .28); color: #fff; }
.cp-banner .cp-menu-wrap .cp-av { background: rgba(255, 255, 255, .18); color: #fff; border: 2px solid rgba(255, 255, 255, .7); }
.cp-banner .cp-menu-wrap .cp-av:hover, .cp-banner .cp-menu-wrap.open .cp-av { background: rgba(255, 255, 255, .3); }
.cp-banner .cp-menu-wrap .cp-av:focus-visible { outline-color: #fff; }
.cp-banner .cp-menu { color: var(--ink); }
@media (max-width: 820px) { .portal-main .page-head.firm-banner.cp-banner { padding-top: 64px; } }

/* ---------- Firm page boxes (New Cases / Completed Cases) and the New Cases file manager ----------
   Undo: restore the files in backup-before-new-cases (and delete intake.js in public/js and server/routes, services). */
.firm-boxes { margin-top: 4px; }
.firm-boxes .section-card { min-height: 300px; }
.ws-sub-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.nc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.nc-tools-left, .nc-tools-right { display: flex; align-items: center; gap: 8px; }
.nc-sort { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 0 4px 0 10px; }
.nc-sort .i { width: 16px; height: 16px; color: var(--muted); }
.nc-sort select { border: 0; background: transparent; font: inherit; font-size: 13.5px; padding: 7px 4px; color: var(--ink); }
.nc-split { position: relative; display: inline-flex; }
.nc-split > .btn:first-child { border-radius: 9px 0 0 9px; }
.nc-split .nc-caret { border-radius: 0 9px 9px 0; padding: 8px 8px; border-left: 1px solid rgba(255, 255, 255, .35); }
.nc-split .nc-caret .i { transform: rotate(90deg); width: 14px; height: 14px; }
.nc-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(30, 10, 50, .14); min-width: 200px; z-index: 20; overflow: hidden; }
.nc-menu button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: #fff; padding: 10px 14px; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.nc-menu button:hover { background: var(--brand-50); }
.nc-menu button .i { width: 16px; height: 16px; color: var(--muted); }
.nc-crumbs { margin: 4px 0 10px; }
.nc-note { margin-bottom: 12px; }
.nc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.nc-drop { position: relative; min-height: 220px; }
.nc-drop.drag { outline: 2px dashed var(--brand-500); outline-offset: -6px; }
.nc-dropzone { display: none; position: absolute; inset: 0; background: rgba(248, 243, 251, .92); border-radius: inherit; align-items: center; justify-content: center; flex-direction: column; gap: 8px; font-weight: 700; color: var(--brand); pointer-events: none; }
.nc-dropzone .i { width: 34px; height: 34px; }
.nc-drop.drag .nc-dropzone { display: flex; }
.nc-table th { background: #faf7fc; }
.nc-table td { vertical-align: middle; }
.nc-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nc-name > span { display: flex; flex-direction: column; min-width: 0; }
.nc-name > .i { width: 22px; height: 22px; color: var(--brand); flex: none; }
.firm-scope .nc-name > .i, .firm-branded .nc-name > .i { color: var(--firm); }
.nc-file { color: var(--ink); text-decoration: none; font-weight: 700; word-break: break-word; }
.nc-file:hover { text-decoration: underline; color: var(--brand); }
.nc-ft { flex: none; min-width: 38px; text-align: center; }
.nc-empty { padding: 34px 10px; }
.nc-cust { background: #fdf1d8; color: #7a5200; font-size: 10.5px; padding: 1px 7px; margin-left: 4px; }
.nc-progress { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.nc-bar { flex: 1; height: 8px; border-radius: 4px; background: #f3f0ff; overflow: hidden; }
.nc-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.firm-scope .nc-bar i, .firm-branded .nc-bar i { background: var(--firm); }
.nc-actions h3 { margin: 0 0 12px; font-size: 16px; }
.nc-actions { display: grid; gap: 4px; position: sticky; top: 12px; }
.nc-search { display: flex; align-items: center; gap: 8px; border: 1px solid #cfd6e3; border-radius: 10px; padding: 0 10px; margin-bottom: 8px; background: #fff; }
.nc-search .i { width: 16px; height: 16px; color: var(--muted); }
.nc-search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 8px 0; font: inherit; font-size: 13.5px; background: transparent; }
.nc-act { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
a.nc-act:hover { background: var(--brand-50); }
.nc-act .i { width: 17px; height: 17px; color: var(--muted); flex: none; }
.nc-act select { flex: 1; border: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); padding: 0; cursor: pointer; }
.firm-branded .nc-search:focus-within { border-color: var(--firm); }
.firm-branded .btn.primary { background: var(--firm); border-color: var(--firm); color: #fff; }
.firm-branded .portal-main .page-head .btn.primary { background: #fff; color: var(--firm); border-color: #fff; }
@media (max-width: 1000px) { .nc-grid { grid-template-columns: 1fr; } .nc-actions { position: static; } }

.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; }

/* The New Cases breadcrumb sits on the page, not in the banner: keep it dark. */
.content .crumbs.nc-crumbs a, .portal-main .crumbs.nc-crumbs a { color: var(--ink-2) !important; visibility: visible; }
.content .crumbs.nc-crumbs a:hover, .portal-main .crumbs.nc-crumbs a:hover { color: var(--brand) !important; }
.content .crumbs.nc-crumbs .current, .portal-main .crumbs.nc-crumbs .current { color: var(--ink) !important; }
.content .crumbs.nc-crumbs .sep, .portal-main .crumbs.nc-crumbs .sep { color: #9aa5ba !important; }
.content .crumbs.nc-crumbs, .portal-main .crumbs.nc-crumbs { visibility: visible !important; font-size: 14px; }

/* ---------- New Cases: Folders view tiles and NEW badges ----------
   Undo: restore app.js, intake.js, portal.js and app.css from backup-before-new-cases-views. */
.nc-tiles { padding: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.nc-tile { position: relative; cursor: pointer; padding-bottom: 10px; }
.nc-tile .t-actions { display: flex; justify-content: center; gap: 2px; margin-top: 8px; }
.nc-tile .nc-remove { color: var(--muted); font-size: 11.5px; }
.nc-new { display: inline-block; background: #8300bd; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .05em; border-radius: 6px; padding: 2px 7px; margin-left: 8px; vertical-align: 1px; }
.nc-tile .nc-new { position: absolute; top: 8px; right: 8px; margin: 0; }
.nc-drop > .nc-tiles + .table-wrap { border-top: 1px solid var(--line); }
.nc-drop > .nc-empty { padding: 40px 16px; }
.nc-toolbar .seg { margin-right: 4px; }
.firm-scope .nc-tile, .firm-branded .nc-tile { --folder-back: color-mix(in srgb, var(--firm) 70%, #ffffff); --folder-front: var(--firm); }

/* Share links and customer cases: large folders that fill the page (feedback 17 Nov 2026) */
/* Up to three across, stretching to fill the width (two folders = half each, like the Radiology/Casework boxes). */
.tiles.big { grid-template-columns: repeat(auto-fit, minmax(max(280px, calc((100% - 40px) / 3)), 1fr)); gap: 20px; }
.tiles.big .tile { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; padding: 32px 22px 24px; border-radius: 16px; box-shadow: var(--shadow); }
.tiles.big .tile .folder-ico { width: 112px; height: 92px; margin-bottom: 16px; }
.tiles.big .tile .t-name { font-size: 18px; line-height: 1.3; }
.tiles.big .tile .t-meta { font-size: 14px; margin-top: 6px; }
.tiles.big .tile .sc-open { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--firm, var(--brand)); }
.tiles.big .tile .sc-open svg { width: 15px; height: 15px; }
.firm-branded .tiles.big .tile { --folder-back: color-mix(in srgb, var(--firm) 70%, #ffffff); --folder-front: var(--firm); border-top: 4px solid var(--firm); }
.firm-branded .tiles.big .tile:hover { border-color: color-mix(in srgb, var(--firm) 45%, #ffffff); border-top-color: var(--firm); }
@media (max-width: 640px) { .tiles.big { grid-template-columns: 1fr; } .tiles.big .tile { min-height: 180px; } }
.portal-foot a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* Staff firm pages: logo on the left, a thin line, then the firm name and buttons (like the customer pages) */
.app .page-head.firm-head.firm-row-head { padding-right: 28px; } /* no corner logo any more, so no space kept for it */
.page-head.firm-row-head > .cp-row { flex: 1; align-self: stretch; }
/* A slightly flatter banner on firm pages (no breadcrumb row above the name any more) */
.app .page-head.firm-row-head { display: block; padding-top: 20px; padding-bottom: 18px; min-height: 0; }
/* Wide screens: the search bar and user sit inside the top of the banner, so leave just enough room for them. */
@media (min-width: 821px) {
  .main:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .page-head.firm-row-head:first-child { padding-top: 68px; padding-bottom: 18px; min-height: 0; }
}
/* Wider screens: no empty strip on top - the logo and firm name sit level with the search bar, the name kept clear of it. */
@media (min-width: 1360px) {
  /* Only on pages without a breadcrumb trail (the firm's own pages); client and folder pages keep room for theirs.
     From 1360px wide the buttons fit on one row beside the big logo, so the name stays clear of the search bar. */
  .main.no-crumbs:has(> .content > .page-head:first-child, > .content > .dash-banner:first-child) > .content > .page-head.firm-row-head:first-child { padding-top: 20px; }
}
/* The firm's own pages (firm page, New Cases, Completed Cases): the same height as the Dashboard banner (244px),
   with the logo, name and buttons centred top to bottom. */
@media (min-width: 821px) {
  .main.no-crumbs:has(> .content > .page-head:first-child) > .content > .page-head.firm-row-head:first-child { display: grid; align-content: center; justify-content: stretch; min-height: 244px; }
  /* A bigger logo that fills the left of the taller banner (it starts at the banner's edge, not centred). */
  .main.no-crumbs:has(> .content > .page-head:first-child) > .content > .page-head.firm-row-head:first-child .cp-logo { padding: 16px 26px; border-radius: 20px; }
  .main.no-crumbs:has(> .content > .page-head:first-child) > .content > .page-head.firm-row-head:first-child .cp-logo img { height: clamp(72px, 7.2vw, 100px); width: auto; max-width: clamp(260px, 27vw, 380px); object-fit: contain; }
  .main.no-crumbs:has(> .content > .page-head:first-child) > .content > .page-head.firm-row-head:first-child .cp-row { gap: 30px; }
  /* Name and buttons line up with the bottom of the logo, so they stay below the search bar. */
  .main.no-crumbs:has(> .content > .page-head:first-child) > .content > .page-head.firm-row-head:first-child .cp-text { align-self: flex-end; }
}
.page-head.firm-row-head .cp-logo { padding: 10px 16px; }
.page-head.firm-row-head .cp-logo img { height: 54px; }
.page-head.firm-row-head .cp-text { flex: 1; }
.page-head.firm-row-head .cp-text .actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Dashboard Recent Uploads: every kind of file, with where it went */
.recent-t .ru-item { display: inline-flex; align-items: center; gap: 8px; }
.recent-t .ru-item > span:last-child { word-break: break-word; }
.recent-t .ru-kind { display: inline-block; font-weight: 700; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; margin-bottom: 3px; background: #f3f0ff; color: #8300bd; }
.recent-t .ru-kind.casework { background: #e4f1ea; color: #1d6b43; }
.recent-t .ru-kind.newcase { background: #fff1d6; color: #85570a; }

/* Client details bar: payment terms and status sit with the other details; buttons on the right */
.client-details:has(.cd-actions) { gap: 14px 30px; }
.client-details:has(.cd-actions) > div:not(.cd-actions) { min-width: 0; }
.client-details .cd-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.client-details .cd-actions .btn { margin-left: 0; }
.client-details .sm-select { width: auto; padding: 4px 30px 4px 10px; height: auto; min-height: 0; font-size: 14px; font-weight: 700; margin-top: 2px; }
.client-details .badge { margin-top: 3px; }
.client-details .badge svg { width: 12px; height: 12px; }

/* Customer accounts: time left of their 365 days (Users page, Status column) */
.cu-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.cu-status .small { flex-basis: 100%; }
.badge.tl-green { background: #dcf3e5; color: #17663f; }
.badge.tl-yellow { background: #fff4bf; color: #6b5300; }
.badge.tl-red { background: #fde2df; color: #a5221a; }
.badge.tl-green svg, .badge.tl-yellow svg, .badge.tl-red svg { width: 12px; height: 12px; }
.portal-foot a:hover { color: var(--firm, var(--brand)); }

/* New Cases: countdown to automatic deletion */
.nc-due { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.nc-due .i { width: 13px; height: 13px; }
.nc-due.soon { color: #8a5a00; }
.nc-due.urgent { color: var(--danger); }
.nc-tile .nc-due { justify-content: center; }

/* Deletion countdown highlight: green 11+ days, yellow 6-10, red 5 or fewer */
.nc-due { padding: 2px 8px; border-radius: 999px; }
.nc-due.green { background: #e8f4ee; color: #1d6b3e; }
.nc-due.yellow { background: #fdf1c9; color: #7a5600; }
.nc-due.red { background: #fde4e1; color: #a3261c; }

/* ---------- New Cases: Actions box as a slim icon strip that opens out on hover ----------
   It stays open while it has keyboard focus, or while a search or user filter is in use. */
.nc-grid { grid-template-columns: minmax(0, 1fr) 56px; gap: 12px; }
.nc-actions-slot { position: relative; align-self: stretch; }
.card.nc-actions { position: absolute; top: 0; right: 0; width: 56px; padding: 8px; gap: 2px; overflow: hidden; z-index: 15;
  transition: width .18s ease, box-shadow .18s ease; display: grid; }
.card.nc-actions:hover, .card.nc-actions:focus-within, .card.nc-actions.in-use { width: 280px; box-shadow: 0 14px 36px rgba(30, 10, 50, .16); }
.nc-actions .nc-act { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 9px; border-radius: 9px; white-space: nowrap; border: 0; margin: 0; }
.nc-actions .nc-act > .i { width: 20px; height: 20px; flex: none; }
.nc-actions .nc-lbl { flex: 1; min-width: 0; opacity: 0; transition: opacity .12s; display: flex; align-items: center; }
.card.nc-actions:hover .nc-lbl, .card.nc-actions:focus-within .nc-lbl, .card.nc-actions.in-use .nc-lbl { opacity: 1; }
.nc-actions .nc-act-title h3 { margin: 0; font-size: 15px; }
.nc-actions .nc-act-title .i { color: var(--ink-2); }
.nc-actions .nc-search { border: 1px solid transparent; background: transparent; margin: 2px 0; }
.card.nc-actions:hover .nc-search, .card.nc-actions:focus-within .nc-search, .card.nc-actions.in-use .nc-search { border-color: #cfd6e3; background: #fff; }
.nc-actions .nc-search input { width: 100%; }
.nc-actions .nc-act select { width: 100%; }
.nc-actions.in-use .nc-act-title .i { color: var(--brand); }
@media (max-width: 1000px) {
  .nc-grid { grid-template-columns: 1fr; }
  .nc-actions-slot { position: static; }
  .card.nc-actions { position: static; width: auto; box-shadow: none; }
  .nc-actions .nc-lbl { opacity: 1; }
}

/* New Cases Folders view: tiles sit straight on the page (no white box behind them). */
.card.nc-drop.bare { background: transparent; border: 0; box-shadow: none; }
.nc-drop.bare .nc-tiles { padding: 0; }
.nc-drop.bare > .table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 14px; }
.nc-drop.bare > .nc-tiles:empty + .table-wrap, .nc-drop.bare > .table-wrap:first-child { margin-top: 0; }
.nc-drop.bare > .nc-empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.nc-drop.bare .bulkbar, .nc-drop.bare .nc-progress { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }

/* Customer pages: the banner and firm logo the same size as on MRC's own view of the firm (244px tall, logo up to
   100px high on a larger white panel, 26px heading), on screens wide enough for it. */
@media (min-width: 821px) {
  .portal-main .page-head.firm-banner.cp-banner { min-height: 244px; border-radius: 22px; padding-left: 32px; }
  .cp-banner .cp-row { gap: 30px; }
  .cp-banner .cp-logo { padding: 16px 26px; border-radius: 20px; }
  .cp-banner .cp-logo img { height: clamp(72px, 7.2vw, 100px); width: auto; max-width: clamp(260px, 27vw, 380px); object-fit: contain; }
  .cp-banner .cp-logo-text { font-size: 22px; max-width: 320px; }
  .cp-banner .cp-text h1 { font-size: 26px; }
}

/* "Check Your Woodland", next to Instruct MRC: the same shape, in see-through white so Instruct MRC stays the main button. */
.page-head .btn.woodland-btn, .portal-main .page-head .actions .btn.woodland-btn { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .45); border-radius: 12px; font-weight: 700; text-decoration: none; }
.page-head .btn.woodland-btn:hover, .portal-main .page-head .actions .btn.woodland-btn:hover { background: rgba(255, 255, 255, .28); color: #fff; }
.page-head .btn.woodland-btn svg { width: 16px; height: 16px; }

/* New Workspace / Edit Firm, Firm Branding section (Admins): a small live preview of the firm's banner */
.br-preview { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 18px; margin: 4px 0 16px; border-radius: 14px; color: #fff;
  background: var(--firm, #1f3a5f); }
.br-logo { display: inline-flex; align-items: center; background: #fff; border-radius: 12px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); flex: none; }
.br-logo img { height: 44px; width: auto; max-width: 200px; object-fit: contain; display: block; }
.br-rule { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .45); flex: none; }
.br-name { font-size: 18px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.br-grid { display: grid; gap: 14px; }
.br-colour { display: flex; align-items: center; gap: 10px; }
.br-colour input[type=color] { width: 52px; height: 36px; padding: 2px; border: 1px solid var(--line, #ddd); border-radius: 8px; background: #fff; cursor: pointer; }
#brRemoveLogo { margin-top: 10px; }

/* ---------- Sign-in pages (/portal, /login.html, share links) ----------
   The approved mock-up (mrc-platform design/2026-12/portal): a flat violet field, the headline on the left, dated
   record sheets on a chronology line behind a frosted panel. The panel is near-opaque under all text, and turns
   solid when the device asks for less transparency or more contrast. No animation. */
.signin { --field: var(--brand); --on-field-2: #f1e6f8; --sheet-fill: #9229c8; --sheet-edge: rgba(255, 255, 255, .42);
  --sheet-rule: rgba(255, 255, 255, .26); --control: #5f6a82; --gap: clamp(64px, 12vw, 200px);
  position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) 440px;
  column-gap: var(--gap); align-items: center; padding: 112px clamp(24px, 6vw, 96px) 72px; background: var(--field);
  color: var(--ink); font-size: 16px; -webkit-font-smoothing: antialiased; }
body:has(> #root > .signin) { background: var(--brand); }
.signin a { color: var(--purple-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.signin a:hover { text-decoration-thickness: 2px; }
.signin :focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px; }
.signin-brand { position: absolute; top: 36px; left: clamp(24px, 6vw, 96px); display: block; }
.signin-brand img { display: block; height: 46px; width: auto; }
.signin .signin-brand:focus-visible, .signin-legal a:focus-visible { outline-color: #fff; }
.signin-intro { color: #fff; max-width: 560px; }
.signin-headline { font-size: clamp(44px, 5.2vw, 76px); line-height: 1; letter-spacing: -0.03em; font-weight: 700; margin: 0 0 24px; text-wrap: balance; }
.signin-lead { font-size: 19px; line-height: 1.5; color: var(--on-field-2); margin: 0; max-width: 32ch; text-wrap: pretty; }
.signin-legal { position: absolute; left: clamp(24px, 6vw, 96px); bottom: 30px; margin: 0; font-size: 13px; color: var(--on-field-2); }
.signin .signin-legal a { color: #fff; }
.signin-stage { position: relative; }
.signin-scene { position: absolute; z-index: 0; top: 28px; bottom: 28px; left: calc(-1 * var(--gap) + 18px); width: calc(var(--gap) + 220px); pointer-events: none; }
.signin-gutter { position: absolute; left: 4px; top: 14px; bottom: 30%; width: 1px; background: var(--sheet-edge); }
.signin-sheet { position: absolute; left: calc(24px + var(--i) * 10px); right: 0; top: calc(var(--i) * 22%); height: 32%; border-radius: 6px;
  background: var(--sheet-fill); border: 1px solid var(--sheet-edge); box-shadow: 0 10px 24px -14px rgba(30, 0, 50, .55); color: #fff; padding: 12px 14px; }
.signin-sheet::before { content: ""; position: absolute; left: calc(-24px - var(--i) * 10px); top: 17px; width: 9px; height: 9px; border-radius: 50%; background: var(--field); border: 1.5px solid #fff; }
.signin-sheet b { display: block; font-size: 13px; font-weight: 700; line-height: 1.35; }
.signin-sheet span { display: block; font-size: 12px; line-height: 1.35; }
.signin-sheet i { display: block; height: 1px; background: var(--sheet-rule); margin: 10px 0 0; }
.signin-sheet i + i { width: 78%; } .signin-sheet i + i + i { width: 62%; }
/* The frosted panel: thinner at the top and left rim, so the records show through the edge; near-opaque under the words. */
.signin-panel { --rim: 30px; position: relative; z-index: 1; border-radius: 16px; padding: 34px 34px 26px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .3) var(--rim)), linear-gradient(180deg, transparent, rgba(255, 255, 255, .3) var(--rim)), rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .45); border-top-color: rgba(255, 255, 255, .95); border-left-color: rgba(255, 255, 255, .95);
  box-shadow: 0 30px 70px -28px rgba(40, 0, 70, .6), 0 2px 6px rgba(40, 0, 70, .14), inset 0 1px 0 rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(10px) saturate(1.35); backdrop-filter: blur(10px) saturate(1.35); }
.signin-panel h2 { font-size: 28px; line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 22px; }
.signin-panel h3 { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.signin-sub { color: var(--ink-2); margin: -12px 0 22px; font-size: 15px; }
.signin-panel label.f { display: block; margin-bottom: 16px; }
.signin-panel label.f > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.signin-panel .in { height: 46px; font-size: 16px; border: 1px solid var(--control); border-radius: 8px; padding: 0 14px; background: #fff; color: var(--ink); caret-color: var(--brand); }
.signin-panel .in:hover { border-color: var(--ink); }
.signin-panel .in:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.signin-panel .code-input { font-family: var(--mono); font-size: 24px; letter-spacing: 10px; text-align: center; }
.signin-panel .btn { min-height: 46px; padding: 0 20px; gap: 10px; font-size: 16px; font-weight: 700; border-radius: 8px; border: 1px solid var(--control); background: #fff; color: var(--ink); text-decoration: none; transition: transform 140ms cubic-bezier(.23, 1, .32, 1), background-color 150ms ease, border-color 150ms ease; }
.signin-panel .btn:active { transform: scale(.97); }
.signin-panel .btn.primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .signin-panel .btn:hover { border-color: var(--ink); background: #fff; }
  .signin-panel .btn.primary:hover { background: var(--purple-ink); border-color: var(--purple-ink); }
}
.signin-route + .signin-route { border-top: 1px solid rgba(9, 21, 43, .14); margin-top: 24px; padding-top: 20px; }
.signin-route.staff { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 16px; }
.signin-route.staff h3 { margin: 0; }
.signin-route.staff p { margin: 0; color: var(--ink-2); font-size: 14px; grid-column: 1; }
.signin-route.staff .btn { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; }
.signin-route.staff .signin-error { grid-column: 1 / -1; }
.signin-alt { margin: 16px 0 0; font-size: 14px; color: var(--ink-2); }
.signin-foot { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid rgba(9, 21, 43, .14); font-size: 14px; color: var(--ink-2); }
.signin-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2) !important; text-decoration: none !important; margin: 0 0 16px; }
.signin-back:hover { color: var(--ink) !important; }
.signin-error { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--danger); color: var(--danger); font-size: 14px; }
.signin-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid rgba(9, 21, 43, .18); color: var(--ink); font-size: 14px; }
.signin-proto { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
.signin-demo { display: grid; gap: 8px; }
.signin-demo .btn { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 0; min-height: 0; padding: 8px 14px; font-size: 15px; text-align: left; }
.signin-demo .btn span { font-weight: 400; font-size: 13px; color: var(--ink-2); }
.signin .nowrap { white-space: nowrap; }
/* Phone: the whole page stays violet; the sheets peek above the panel, dates in full. */
@media (max-width: 820px) {
  .signin { display: block; padding: 0 16px; min-height: 0; }
  .signin-brand { position: static; display: inline-block; padding-top: 22px; }
  .signin-brand img { height: 36px; }
  .signin-intro { padding-top: 30px; }
  .signin-headline { font-size: 40px; margin-bottom: 12px; }
  .signin-lead { font-size: 16px; max-width: 30ch; }
  .signin-stage { margin-top: 26px; padding-top: 104px; }
  .signin-scene { top: 0; bottom: auto; left: 0; right: 0; width: auto; height: 220px; }
  .signin-gutter, .signin-sheet::before, .signin-sheet:nth-child(n+5) { display: none; }
  .signin-sheet { left: calc(var(--i) * 14px); right: calc((2 - var(--i)) * 14px); top: calc(var(--i) * 36px); height: 180px; padding: 9px 12px; }
  .signin-sheet b, .signin-sheet span { display: inline; }
  .signin-sheet span::before { content: " · "; }
  .signin-panel { --rim: 18px; padding: 24px 20px 18px; border-radius: 14px; }
  .signin-panel h2 { font-size: 24px; }
  .signin-route.staff { grid-template-columns: 1fr; }
  .signin-route.staff .btn { grid-column: 1; grid-row: auto; width: 100%; margin-top: 12px; }
  .signin-legal { position: static; padding: 22px 0 30px; }
  .signin-alt a, .signin-foot a, .signin-legal a, .signin-back { display: inline-block; padding: 10px 0; margin-top: -10px; margin-bottom: -10px; }
}
@media (prefers-reduced-transparency: reduce) { .signin-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff; } }
@media (prefers-contrast: more) {
  .signin-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff; border-color: var(--ink); }
  .signin-panel .in, .signin-panel .btn { border-color: var(--ink); }
}
@media (prefers-reduced-motion: reduce) { .signin-panel .btn, .signin-panel .in { transition: none; } .signin-panel .btn:active { transform: none; } }
.signin-sub strong, .signin-note strong { overflow-wrap: anywhere; } /* long email addresses wrap instead of running off a phone screen */

/* Second sign-in step: choose the authenticator app or a code by email; set up the app from a QR code. */
.signin-choices { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.signin-choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--control, #5f6a82); border-radius: 10px; background: #fff; cursor: pointer; min-height: 44px; }
.signin-choice input { margin: 3px 0 0; accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.signin-choice strong { display: block; font-size: 15px; }
.signin-choice small { display: block; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.signin-choice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.signin-doc { display: block; height: 96px; width: auto; margin: 0 0 10px; }
.app-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 10px; font-size: 15px; }
.app-qr { margin: 10px 0 6px; width: 184px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.app-qr svg { display: block; width: 100%; height: auto; }
.app-key summary { cursor: pointer; color: var(--purple-ink); font-size: 14px; }
.app-key code { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 15px; letter-spacing: .04em; word-break: break-all; }

/* Firm page buttons: white cards overlapping the bottom of the banner (like the dashboard figures), in the firm's colour. */
.app .page-head.has-actions { padding-bottom: 62px !important; margin-bottom: 0; }
.head-actions { --hc: var(--firm, var(--brand)); position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: -34px 18px 24px; }
.head-actions .btn { background: #fff; color: var(--hc); border: 0; border-radius: 14px; min-height: 46px; padding: 0 18px; font-weight: 700; text-decoration: none; box-shadow: 0 6px 20px rgba(9, 21, 43, .10); }
.head-actions .btn:hover { background: color-mix(in srgb, var(--hc) 7%, #ffffff); color: var(--hc); }
.head-actions .btn.primary { background: var(--hc); color: #fff; }
.head-actions .btn.primary:hover { background: color-mix(in srgb, var(--hc) 85%, #000000); color: #fff; }
.head-actions .btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.head-actions .icon-btn { width: 46px; height: 46px; border-radius: 14px; background: #fff; color: var(--hc); box-shadow: 0 6px 20px rgba(9, 21, 43, .10); }
.head-actions .icon-btn:hover { background: color-mix(in srgb, var(--hc) 7%, #ffffff); color: var(--hc); }
.head-actions .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
@media (max-width: 820px) { .head-actions { margin: -34px 12px 20px; gap: 10px; } .head-actions .btn { min-height: 42px; padding: 0 14px; } }

/* New Workspace / Edit Firm: branding found from the firm's website. */
.br-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 6px; padding-top: 16px; border-top: 1px solid #eef1f6; font-size: 16px; }
.br-title svg { width: 18px; height: 18px; color: var(--brand); }
.br-site { display: flex; align-items: flex-end; gap: 10px; }
.br-site .f { flex: 1; margin-bottom: 0; }
.br-site .btn { flex: none; min-height: 40px; }
#brStatus .notice { margin: 10px 0 0; }
.br-preview { margin-top: 12px; }
.br-preview.br-plain { background: var(--navy); }
@media (max-width: 560px) { .br-site { flex-direction: column; align-items: stretch; } }
