:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5c6b7a;
  --line: #d5dde6;
  --paper: #f6f8fb;
  --card: #ffffff;
  --brand: #0f3d4c;
  --header-ink: #ffffff;
  --accent: #0f3d4c;
  --accent-ink: #ffffff;
  --notice: #fff6d8;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 var(--body, "Segoe UI", sans-serif); color: var(--ink); background: var(--paper); }
h1, h2, .app-name, .page-name, .company { font-family: var(--heading, "Segoe UI", sans-serif); }
.name-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.name-actions h1 { margin: 0; }
.name-actions .name-tools { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-left: auto; }
.name-actions [hidden] { display: none !important; }
.signature-preview { display: block; max-width: 16rem; max-height: 5rem; margin: 0.25rem 0 0; padding: 6px; background: #fff; border: 1px solid var(--line); object-fit: contain; }
.signature-panel form { display: grid; gap: 8px; max-width: 28rem; }
.signature-panel .muted { color: var(--muted); margin: 0; font-size: 0.9rem; }
#dialog-plate { display: none; position: fixed; inset: 0; z-index: 9100; background: rgba(23, 32, 51, 0.45); }
#dialog-plate.is-on { display: block; }
#practice-busy-plate { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(23, 32, 51, 0.45); }
#practice-busy-plate.is-on { display: block; }
dialog#practice-busy { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10000; margin: 0; width: min(24rem, calc(100vw - 2rem)); }
dialog.folder-pop,
dialog.report-pop,
dialog.letter-pop {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
dialog.folder-pop { z-index: 9200; }
dialog.report-pop { z-index: 9300; }
dialog.letter-pop { z-index: 9400; }
dialog.letter-pop#practice-busy { z-index: 10000; }
header { display: flex; flex-wrap: nowrap; gap: 16px; align-items: center; height: 5rem; min-height: 5rem; max-height: 5rem; padding: 0 20px; background: var(--brand); color: var(--header-ink); position: relative; z-index: 20; overflow: visible; }
body > header { position: sticky; top: 0; }
.brand { color: var(--header-ink); font-weight: 700; text-decoration: none; display: flex; gap: 12px; align-items: center; height: 5rem; min-width: 0; flex: 0 1 auto; }
.brand > span:not(.company) { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: white; color: var(--brand); flex: 0 0 auto; }
.brand img { height: 5rem; width: auto; max-width: 16rem; object-fit: contain; object-position: left center; padding: 6px 0; }
.company { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-name { margin: 0; flex: 1 1 auto; min-width: 0; display: grid; align-content: center; justify-items: center; text-align: center; line-height: 1.1; }
.page-name, .product-name { margin: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-name { font-size: 1.35rem; font-weight: 700; }
.product-name { font-size: 0.75rem; font-weight: 600; opacity: 0.85; }
nav > a[aria-current="page"] { background: color-mix(in srgb, white 16%, transparent); border-radius: 6px; padding: 4px 8px; }
nav { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; flex: 0 1 auto; min-width: 0; overflow: visible; }
nav > a, nav summary { color: var(--header-ink); background: transparent; border: 0; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
nav > a:hover, nav > a:focus, nav > a:visited, nav summary:hover, nav summary:focus { text-decoration: none; }
nav form { margin: 0; }
nav form button { background: var(--accent); color: var(--accent-ink); }
nav .menu { position: relative; }
nav .menu summary { list-style: none; }
nav .menu summary::-webkit-details-marker { display: none; }
nav .menu summary::after { content: " ▾"; font-size: 0.75em; }
nav .menu div { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; display: block; min-width: 220px; padding: 6px 0; background: white; border-radius: 8px; box-shadow: 0 8px 24px rgba(23, 32, 51, 0.18); }
nav .menu a { display: block; color: var(--ink); padding: 8px 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
nav .menu a:hover, nav .menu a:focus { background: var(--paper); text-decoration: none; }
nav .menu a:visited { text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 20px; }
h1 { margin: 0 0 12px; font-size: 1.5rem; }
.notice, #work-error { padding: 10px 12px; background: var(--notice); border-radius: 8px; }
main a { color: #6d28d9; text-decoration: none; }
main a:hover, main a:focus, main a:visited { color: #5b21b6; text-decoration: none; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: stretch; }
.grid > label:not(.colour) { display: flex; flex-direction: column; height: 100%; }
.grid > label:not(.colour) > :is(input, select, textarea):first-of-type { margin-top: auto; }
label.colour { display: grid; grid-template-rows: 1.4rem 2.8rem auto auto 1.2rem; align-items: start; align-content: start; }
input.table-search { display: block; width: min(24rem, 100%); margin: 0 0 12px; }
button.sort { padding: 0 0.15rem; background: transparent; color: var(--muted); font-weight: 700; line-height: 1; }
button.sort.on { color: var(--brand); }
.wide { grid-column: 1 / -1; }
fieldset, .setup-note { min-width: 0; margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
label { display: grid; gap: 4px; min-width: 0; font-size: 0.9rem; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: white; color: var(--ink); }
.show-password { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; }
.show-password input { width: auto; padding: 0; flex: 0 0 auto; }
button:not(.sort):not(.mail-tab):not(.mail-open):not(.pick-option):not(.person-open), .button { padding: 8px 12px; border: 0; border-radius: 6px; background: #000000; color: #ffffff; font: inherit; cursor: pointer; text-decoration: none; }
a.button:hover, a.button:focus, a.button:visited,
button:not(.sort):not(.mail-tab):not(.mail-open):not(.pick-option):not(.person-open):hover,
button:not(.sort):not(.mail-tab):not(.mail-open):not(.pick-option):not(.person-open):focus { background: #000000; color: #ffffff; }
main a.button, main a.button:hover, main a.button:focus, main a.button:visited { color: #ffffff; background: #000000; text-decoration: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.screen-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.screen-tools h1 { margin: 0; }
.actions.home-tools { margin: 0 0 0 auto; flex-wrap: nowrap; justify-content: flex-end; }
.home-tools span { white-space: nowrap; }
.home-tools button { width: auto; }
@media (display-mode: standalone) { .home-tools { display: none; } }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.selected { background: #e7eef3; }
.table-scroll { overflow-x: auto; }
body.list-page { height: 100dvh; height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
body.list-page main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; max-width: none; width: 100%; box-sizing: border-box; }
body.list-page main > :not(.table-scroll):not(.page-scroll) { flex: 0 0 auto; }
body.list-page .table-scroll,
body.list-page .page-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; }
body.list-page .page-scroll { margin-top: 0; padding-bottom: 1.5rem; }
body.list-page .table-scroll table { margin-top: 0; border-collapse: separate; border-spacing: 0; }
body.list-page .table-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -1px 0 var(--line); }
dialog.record-dialog,
dialog.folder-pop,
dialog.report-pop,
dialog.letter-pop,
dialog#practice-busy {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 10000;
  width: min(42rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 10px;
  padding: 20px;
  background: var(--card);
  color: var(--ink);
  opacity: 1;
  box-shadow: 0 12px 40px rgba(23, 32, 51, 0.35);
}
dialog.record-dialog { background: #ffffff; }
#roles-backdrop { display: none; }
#roles-backdrop.is-open { display: block !important; position: fixed; inset: 0; z-index: 9998; background: rgba(23, 32, 51, 0.45); }
#roles-pop { display: none; }
#roles-pop.is-open { display: block !important; position: fixed; z-index: 9999; top: 4.25rem; left: 50%; transform: translateX(-50%); width: min(26rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 5.5rem); overflow: auto; padding: 14px 16px; border-radius: 10px; background: #fff; color: #172033; box-shadow: 0 12px 40px rgba(23, 32, 51, 0.35); }
#roles-pop h2 { margin: 0 0 8px; font-size: 1.15rem; }
#roles-pop .role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 8px 0; }
#roles-pop .role-opt { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; }
#roles-pop .role-opt input { width: auto; padding: 0; flex: 0 0 auto; }
#logo-preview, #favicon-preview { grid-column: 1 / -1; max-height: 5rem; width: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
#favicon-preview { width: 64px; height: 64px; max-height: 64px; object-fit: contain; }
.record-head { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin: 0 0 18px; }
.record-freeze { display: block; position: sticky; top: 5rem; z-index: 12; background: var(--paper); margin-bottom: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.record-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.action-left { display: flex; align-items: center; justify-content: flex-start; gap: 8px; }
.action-left [hidden] { display: none !important; }
.action-left a.button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; width: auto; line-height: 1.2; box-sizing: border-box; }
.action-left button { display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 4px 8px; font-size: 0.875rem; line-height: 1.2; white-space: nowrap; box-sizing: border-box; }
.action-right { display: grid; grid-template-columns: repeat(3, max-content); gap: 8px; margin-left: auto; }
.action-right form { display: grid; }
.action-right button { display: inline-flex; align-items: center; justify-content: center; width: auto; white-space: nowrap; line-height: 1.2; box-sizing: border-box; }
.record-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -0.02em; }
.job-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 12px; width: 100%; }
.job-bar-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-self: start; }
.job-bar-start .back { margin: 0; }
.job-kind { margin: 0; justify-self: center; align-self: center; text-align: center; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.job-detail { min-width: 0; }
.job-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.job-top .back { margin: 0; }
#job-ita34 { display: grid; gap: 8px; max-width: 28rem; margin: 0 0 18px; }
.record-head p { margin: 4px 0 0; color: var(--muted); }
.record-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 0; }
.record-tools form { display: flex; gap: 8px; }
.job-bar .job-actions { justify-self: end; }
.job-actions { flex-direction: column; align-items: stretch; min-width: 14rem; }
.job-status { margin: 0; padding: 8px 12px; font-weight: 700; text-align: center; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.job-status.approved { background: #0f766e; color: #ffffff; border-color: #0f766e; }
.job-status.completed, .complete-note { background: #c2410c; color: #ffffff; border-color: #c2410c; }
.complete-note { display: inline-block; margin: 0; padding: 4px 10px; border-radius: 6px; font-weight: 700; }
.complete-note[hidden] { display: none; }
a.button.is-disabled { opacity: 0.45; pointer-events: none; }
.job-actions button { width: 100%; }
@media (max-width: 720px) {
  .job-bar { grid-template-columns: 1fr; }
  .job-kind { justify-self: start; text-align: left; }
  .job-bar .job-actions { justify-self: stretch; width: 100%; }
}
.job-party { margin: 0 0 22px; }
.job-party > h2 { margin: 0 0 10px; }
.job-services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.job-card, .job-card:hover, .job-card:focus, .job-card:visited { display: grid; gap: 4px; padding: 12px; color: #6d28d9; text-decoration: none; }
.job-card strong { font-size: 1.35rem; line-height: 1.1; }
.job-card small { color: var(--muted); font-weight: 600; }
dialog.folder-pop { width: min(52rem, calc(100vw - 2rem)); border: 0; border-radius: 12px; padding: 20px; background: var(--card); color: var(--ink); }
dialog.folder-pop::backdrop { background: rgba(23, 32, 51, 0.45); }
dialog.folder-pop header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
dialog.folder-pop h2 { margin: 0; }
dialog.folder-pop a, dialog.folder-pop a:hover, dialog.folder-pop a:focus, dialog.folder-pop a:visited { color: #6d28d9; text-decoration: none; }
dialog.report-pop { width: min(64rem, calc(100vw - 2rem)); height: min(92vh, 900px); border: 0; border-radius: 12px; padding: 16px 20px; background: var(--card); color: var(--ink); }
dialog.report-pop[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog.report-pop::backdrop { background: rgba(23, 32, 51, 0.45); }
dialog.report-pop header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
dialog.report-pop h2 { margin: 0; }
dialog.report-pop a, dialog.report-pop a:hover, dialog.report-pop a:focus, dialog.report-pop a:visited { color: #6d28d9; text-decoration: none; }
.sheet-wrap { flex: 1 1 auto; max-height: none; min-height: 12rem; overflow: auto; margin: 0 0 12px; }
.client-notes { margin: 12px 0 0; }
.client-notes h3 { margin: 0 0 6px; }
.client-notes ul { margin: 0; padding-left: 1.2rem; list-style: disc; }
.sheet-wrap table { width: 100%; border-collapse: collapse; }
.sheet-wrap th, .sheet-wrap td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sheet-wrap td.num, .sheet-wrap th.num { text-align: right; }
.sheet-wrap tr.line { cursor: pointer; }
.line-chat { flex: 0 0 auto; display: grid; gap: 8px; margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.line-chat[hidden] { display: none; }
.line-chat header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
.line-chat h2, .line-chat p { margin: 0; }
.line-chat a, .line-chat a:hover, .line-chat a:focus, .line-chat a:visited { color: #6d28d9; text-decoration: none; }
.line-chat textarea { width: 100%; }
.report-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.report-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-actions { display: flex; flex: 0 0 auto; flex-wrap: nowrap; align-items: center; gap: 8px; margin: 0 0 12px; overflow-x: auto; }
.report-actions button, .report-actions a.button { flex: 0 0 auto; white-space: nowrap; }
dialog.report-pop a#report-page,
dialog.report-pop a#report-page:hover,
dialog.report-pop a#report-page:focus,
dialog.report-pop a#report-page:visited { color: #ffffff; background: #000000; text-decoration: none; }
.report-actions p { margin: 0; }
dialog.report-pop a.button,
dialog.report-pop a.button:hover,
dialog.report-pop a.button:focus,
dialog.report-pop a.button:visited { color: #ffffff; background: #000000; text-decoration: none; }
.sheet-wrap a.gap { display: inline-block; padding: 4px 8px; white-space: normal; text-align: left; }
dialog.letter-pop#difference { width: min(42rem, calc(100vw - 2rem)); }
#difference-body, #difference-thread p { white-space: pre-wrap; }
.report-extra { display: grid; gap: 8px; margin-top: 12px; }
.report-extra[hidden] { display: none; }
.report-extra textarea, .report-extra input, .report-extra select { width: 100%; }
.report-extra h3 { margin: 0; font-size: 1rem; }
.report-extra p { margin: 0; }
.report-thread { display: grid; gap: 8px; max-height: 16rem; overflow: auto; }
.report-thread:empty { display: none; }
.report-thread p { margin: 0; padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; }
.report-thread p.you { background: #e7eef3; }
.report-thread p.draft { background: #f4efe4; }
.bo-issues { display: grid; gap: 8px; margin-top: 12px; }
.bo-issues h3 { margin: 0; font-size: 1rem; }
.bo-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bo-issues li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.bo-issues li span { flex: 1 1 auto; }
.bo-issues li a.button { flex: 0 0 auto; }
dialog.letter-pop { width: min(40rem, calc(100vw - 2rem)); max-height: min(92vh, 860px); overflow: auto; border: 0; border-radius: 12px; padding: 16px 20px; background: var(--card); color: var(--ink); }
dialog.sars-call { width: min(64rem, calc(100vw - 2rem)); }
dialog.sars-call[open] { overflow: hidden; }
dialog.sars-call .sars-scroll { max-height: min(28vh, 16rem); overflow: auto; }
dialog.sars-call .case-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.sars-call .sars-bar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; background: var(--brand); border-radius: 8px; }
dialog.sars-call .sars-bar a,
dialog.sars-call .sars-bar a:hover,
dialog.sars-call .sars-bar a:focus,
dialog.sars-call .sars-bar a:visited,
dialog.sars-call .sars-number,
dialog.sars-call .sars-bar button { color: #6d28d9; background: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; padding: 6px 10px; border-radius: 6px; width: auto; min-height: 0; white-space: nowrap; }
dialog.sars-call .sars-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
dialog.sars-call .letter-head, dialog.sars-call .letter-line { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.4fr) minmax(10rem, 1.2fr); gap: 8px; align-items: center; margin: 0 0 8px; }
dialog.sars-call .letter-head { font-weight: 700; }
#sars-action label { margin: 0 0 8px; }
#sars-saved-letters p { margin: 0 0 6px; }
dialog.sars-call .sheet { margin: 0; }
.record-dialog .yesno { display: flex; gap: 16px; align-items: center; grid-column: 1 / -1; }
.record-dialog .yesno span { font-weight: 700; }
.record-dialog .phone-row { display: flex; gap: 8px; align-items: center; }
.record-dialog .phone-row select { flex: 1 1 14rem; }
.record-dialog .phone-row input { flex: 1 1 16rem; min-width: 16ch; }
dialog.letter-pop[open] { display: flex; flex-direction: column; gap: 12px; }
dialog.sars-call.letter-pop[open] { overflow: hidden; }
dialog.letter-pop::backdrop { background: rgba(23, 32, 51, 0.45); }
dialog.letter-pop header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
dialog.sars-call header.sars-bar { justify-content: flex-start; overflow-x: auto; }
dialog.sars-view .sars-scroll { max-height: min(50vh, 28rem); }
dialog.sars-files .sars-scroll { max-height: min(36vh, 18rem); }
dialog.sars-files #sars-file-lines { max-height: 8rem; overflow: auto; }
dialog.sars-view .sars-scroll p { margin: 0 0 8px; white-space: pre-wrap; }
dialog.sars-view h3 { margin: 12px 0 8px; font-size: 1rem; }
dialog.letter-pop h2, dialog.letter-pop p { margin: 0; }
dialog.letter-pop a, dialog.letter-pop a:hover, dialog.letter-pop a:focus, dialog.letter-pop a:visited { color: #6d28d9; text-decoration: none; }
.letter-copy { white-space: pre-wrap; }
dialog.letter-pop textarea, dialog.letter-pop select, dialog.letter-pop input:not([type="radio"]) { width: 100%; }
dialog.letter-pop fieldset { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
dialog.letter-pop fieldset label { display: flex; gap: 8px; align-items: baseline; margin: 8px 0; }
dialog.letter-pop fieldset strong { font-weight: 600; overflow-wrap: anywhere; }
.submission-block { display: grid; gap: 8px; margin: 0; }
.submission-block h3 { margin: 12px 0 0; font-size: 1rem; }
.submission-line { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.submission-line span { color: var(--muted); font-size: 0.82rem; }
.file-line { display: flex; align-items: center; gap: 12px; white-space: nowrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-line .file-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-line .file-meta { flex: 0 0 auto; color: var(--muted); }
#papers-list { overflow-x: auto; }
#papers-nav { display: flex; gap: 12px; margin: 0 0 8px; }
#papers-add { max-width: 28rem; margin: 12px 0; }
.doc-panel { margin: 0 0 18px; }
.doc-panel > details > summary { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 11px 16px; font-family: var(--heading, "Segoe UI", sans-serif); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, white); border-bottom: 1px solid var(--line); cursor: pointer; list-style: none; }
.doc-panel > details > summary::-webkit-details-marker { display: none; }
.doc-panel > details > summary::after { content: "▾"; letter-spacing: 0; text-transform: none; font-size: 1rem; }
.doc-panel > details[open] > summary::after { content: "▴"; }
.doc-panel > details > summary,
.doc-panel > details > summary:hover,
.doc-panel > details > summary:focus { text-decoration: none; }
.doc-panel h3 { margin: 14px 0 6px; font-size: 0.95rem; }
.doc-list { display: grid; }
.doc-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.doc-row > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-links { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.doc-links a, .doc-links a:hover, .doc-links a:focus, .doc-links a:visited { color: #6d28d9; text-decoration: none; }
.doc-row form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-row .empty { margin: 0; }
.doc-board { display: flex; flex-direction: column; gap: 14px; }
.doc-block h3 { margin: 0 0 8px; }
.doc-slots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.client-jobs .client-job-list { display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 12px 16px; }
.client-jobs .client-job-list .button { text-align: left; white-space: normal; }
.doc-file { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 6px 0; }
.doc-file .doc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-name { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.doc-name input { flex: 1 1 16rem; }
.doc-folder { padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.doc-folder form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; margin: 0 0 18px; }
.half-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { min-width: 0; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px rgba(23, 32, 51, 0.05); }
#job-summary { margin: 0 0 18px; }
#job-summary h3 { margin: 16px 0 8px; font-size: 1rem; }
.panel.span { grid-column: 1 / -1; }
.panel h2 { margin: 0; padding: 11px 16px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, white); border-bottom: 1px solid var(--line); }
.panel h2.with-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel h2.with-action button { letter-spacing: 0; text-transform: none; font-size: 0.85rem; }
.panel h3 { margin: 12px 0 6px; font-size: 0.95rem; }
.panel .body { padding: 4px 16px 8px; }
.facts { display: grid; grid-template-columns: 1fr; }
.facts.cols { grid-template-columns: 1fr 1fr; column-gap: 28px; }
.fact { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.reg-row { display: grid; grid-template-columns: 14rem minmax(9rem, 12rem) minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.reg-row > span { font-weight: 700; }
.reg-row .fact { display: block; padding: 0; border: 0; }
.reg-row .fact > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.reg-number { display: grid; gap: 8px; }
.reg-number .fact { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; align-items: baseline; }
.reg-number .fact > span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.reg-number[hidden] { display: none !important; }
.facts .fact:last-child { border-bottom: 0; }
.fact span { color: var(--muted); font-size: 0.82rem; }
.fact strong { font-weight: 600; overflow-wrap: anywhere; }
.fact[data-field] strong { cursor: text; }
.fact.due-late span, .fact.due-late strong { color: #a32020; }
.fact.due-soon span, .fact.due-soon strong { color: #c56a00; }
.compliance-table { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(7.5rem, 1fr) minmax(7.5rem, 1fr); column-gap: 16px; align-items: baseline; }
.compliance-head { color: var(--muted); font-size: 0.82rem; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.compliance-job { padding: 9px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.compliance-job.due-late { color: #a32020; }
.compliance-job.due-soon { color: #c56a00; }
.compliance-table .fact { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); }
.compliance-table .fact > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fact[data-kind="built"] strong { cursor: default; }
.fact input, .fact textarea, .fact select { width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.fact .field-edit { display: flex; gap: 8px; align-items: center; }
.fact .field-edit input, .fact .field-edit textarea, .fact .field-edit select,
.fact .field-edit .phone-row, .fact .field-edit .pick, .fact .field-edit .yesno { flex: 1 1 auto; width: auto; min-width: 0; }
.fact .field-save { flex: 0 0 auto; padding: 4px 8px; font-size: 0.82rem; }
.fact .yesno { display: flex; gap: 16px; align-items: center; }
.fact .yesno label { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.fact .yesno input { width: auto; }
.fact:has(.phone-row) { grid-template-columns: 11rem minmax(20ch, 1fr); }
.fact .phone-row { display: grid; grid-template-columns: minmax(20ch, 1fr); gap: 8px; }
.fact .phone-row input[type="tel"] { min-width: 20ch; font-variant-numeric: tabular-nums; }
.fact .pick { display: grid; position: relative; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.fact .pick-list { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); max-height: 220px; overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.fact .pick-list button.pick-option { display: block; width: 100%; text-align: left; background: var(--paper); color: var(--ink); border: 0; border-radius: 0; padding: 8px; font-weight: 700; }
.fact .pick-list button.pick-option:hover, .fact .pick-list button.pick-option:focus { background: color-mix(in srgb, var(--brand) 8%, white); color: var(--ink); }
.record-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.record-edit .notice { margin: 0; }
.fact strong.mono { font-family: ui-monospace, Consolas, monospace; font-weight: 500; font-variant-numeric: tabular-nums; }
.empty { margin: 12px 0; color: var(--muted); }
.panel.span .body { overflow-x: auto; }
.mail-panel .body { overflow: visible; }
.mail-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; }
.mail-tabs { display: flex; gap: 16px; }
button.mail-tab, button.mail-open, button.person-open { font: inherit; font-weight: 700; background: none; border: 0; padding: 0 0 4px; color: #6d28d9; cursor: pointer; text-decoration: none; }
button.person-open { padding: 0; text-align: left; }
button.mail-tab.on { color: var(--brand); border-bottom: 2px solid var(--brand); }
button.mail-open { text-align: left; }
.mail-scroll { max-height: calc(2.25rem + 10 * 3rem + 8px); overflow: auto; }
.mail-scroll thead th { position: sticky; top: 0; background: var(--card); }
#mail-window { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(23, 32, 51, 0.45); }
#mail-window[hidden] { display: none; }
.mail-card { width: min(720px, 100%); max-height: min(80vh, 720px); overflow: auto; padding: 16px 18px; background: var(--card); border-radius: 12px; }
.mail-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mail-card h2 { margin: 0; font-size: 1.1rem; }
.mail-card pre { white-space: pre-wrap; font: inherit; margin: 12px 0 0; }
.mail-files { list-style: none; margin: 12px 0 0; padding: 0; }
.mail-files li + li { margin-top: 6px; }
.mail-files a, .mail-files a:visited, .mail-files a:hover, .mail-files a:focus { font-weight: 700; color: #6d28d9; text-decoration: none; }
.mail-part { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.mail-part:first-child { margin-top: 12px; padding-top: 0; border-top: 0; }
.mail-part h3 { margin: 0 0 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.mail-part p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
table.roles { width: 100%; background: transparent; }
table.roles th { padding: 10px 12px 8px 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
table.roles td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
table.roles tr:last-child td { border-bottom: 0; }
table.papers { width: 100%; }
table.papers td, table.papers th { text-align: left; padding: 8px 10px 8px 0; }
table.papers .file-name { display: flex; gap: 8px; align-items: center; }
table.papers input[name="name"] { min-width: 12rem; }
table.roles small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
ul.plain { list-style: none; margin: 8px 0; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
ul.plain span { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat, .stat:visited, .stat:hover { display: grid; gap: 4px; align-content: start; min-height: 7.5rem; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.stat span { color: #6d28d9; }
.stat strong { font-size: 2rem; line-height: 1; }
.stat small { color: var(--muted); }
#brand-status { margin: 0; }
.chat-log { display: grid; gap: 8px; margin: 12px 0; }
.chat-log p { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.chat-log .you { background: #e7eef3; }
@media (max-width: 800px) {
  header { gap: 8px; padding: 0 10px; }
  .app-name { font-size: 0.78rem; }
  .page-name { font-size: 1rem; }
  .product-name { font-size: 0.65rem; }
  .company { font-size: 0.8rem; }
  main { padding: 12px; }
  .screen-tools { flex-wrap: wrap; }
  .actions.home-tools { flex: 1 0 100%; margin-left: auto; justify-content: flex-end; }
  .grid, .stats, .sheet, .facts, .facts.cols, .fact, .job-services, .fact:has(.phone-row), .reg-row { grid-template-columns: 1fr; }
  .panel.span { grid-column: auto; }
  table { display: block; overflow-x: auto; }
}
dialog.letter-pop.share-view { width: min(64rem, calc(100vw - 2rem)); }
dialog.letter-pop.share-view iframe { width: 100%; height: min(60vh, 640px); border: 1px solid var(--line); border-radius: 8px; background: white; }
dialog#share-add, dialog#share-transfer { overflow: visible; }
dialog .pick { display: grid; position: relative; }
dialog .pick-list { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); max-height: 220px; overflow: auto; background: white; border: 1px solid var(--line); border-radius: 6px; }
dialog .pick-list button.pick-option { display: block; width: 100%; text-align: left; background: white; color: var(--ink); border: 0; border-radius: 0; padding: 8px; font-weight: 700; }
dialog .pick-list button.pick-option:hover, dialog .pick-list button.pick-option:focus { background: color-mix(in srgb, var(--brand) 8%, white); color: var(--ink); }
.yesno { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.yesno-item { display: flex; align-items: center; gap: 6px; }
.yesno-item input { width: auto; }

a.simple-mark { display: inline-flex; align-items: center; justify-content: center; align-self: center; flex: 0 0 9rem; width: 9rem; height: 3.2rem; min-width: 9rem; max-width: 9rem; max-height: 3.2rem; overflow: hidden; line-height: 0; text-decoration: none; }
a.simple-mark img { display: block; width: 9rem; height: 3.2rem; max-width: 9rem; max-height: 3.2rem; object-fit: contain; object-position: center; background: #fff; border-radius: 3px; }
header form { margin: 0; }
