:root {
  color-scheme: light;
  --ink: #19243b;
  --muted: #748097;
  --soft: #f5f7fb;
  --line: #e7ebf2;
  --navy: #111b30;
  --blue: #5768e8;
  --blue-soft: #eef0ff;
  --green: #20856a;
  --green-soft: #e9f7f2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: var(--page-background); color: var(--ink); font-size: 14px; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 4; display: flex; width: 248px; flex-direction: column;
  padding: 27px 15px 16px; background: var(--navy); color: #eef1fa;
}
.brand { display: flex; align-items: center; justify-content: center; padding: 0; color: inherit; text-decoration: none; }
.brand-logo { display: block; width: min(100%, 176px); aspect-ratio: 1; border-radius: 7px; background: #fff; object-fit: contain; }
.workspace-label { margin: 41px 10px 10px; color: #8894af; font-size: 10px; font-weight: 700; letter-spacing: 1.15px; }
.workspace-switcher { display: flex; align-items: center; gap: 10px; padding: 10px 9px; border: 1px solid #2b3650; border-radius: 10px; background: #18243b; }
.workspace-avatar, .profile-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #e5e9ff; color: #4d5cce; font-size: 10px; font-weight: 800; }
.workspace-copy, .profile-copy { display: grid; min-width: 0; gap: 3px; }
.workspace-copy strong, .profile-copy strong { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.workspace-copy small, .profile-copy small { color: #9aa5bd; font-size: 10px; }
.switcher-mark { margin-left: auto; color: #9aa5bd; font-size: 16px; }
.primary-nav { display: grid; gap: 5px; margin-top: 28px; }
.nav-link { display: flex; width: 100%; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: #aab4c9; text-align: left; cursor: pointer; transition: background .16s ease, color .16s ease; }
.nav-link:hover { background: #1d2a43; color: white; }
.nav-link.is-active { background: #29365a; color: #fff; }
.nav-icon { width: 17px; color: #b5c0d5; font-size: 17px; line-height: 1; text-align: center; }
.nav-link.is-active .nav-icon { color: #9eabff; }
.nav-count { display: grid; min-width: 20px; height: 20px; place-items: center; margin-left: auto; border-radius: 6px; background: #344263; color: #dfe4f0; font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-rule { height: 1px; margin: 0 4px 18px; background: #2a3650; }
.demo-status { display: flex; align-items: center; gap: 9px; padding: 5px 8px 18px; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #35bf91; box-shadow: 0 0 0 3px rgb(53 191 145 / 13%); }
.demo-status span:last-child { display: grid; gap: 3px; }
.demo-status strong { font-size: 10px; font-weight: 600; }
.demo-status small { color: #94a0b8; font-size: 10px; }
.user-profile { display: flex; align-items: center; gap: 9px; padding: 13px 7px 2px; border-top: 1px solid #2a3650; }
.profile-avatar { width: 31px; height: 31px; border-radius: 50%; background: #d9e2f4; color: #465674; }
.profile-menu { margin-left: auto; color: #a1adc3; font-weight: 800; letter-spacing: 2px; }

.main-area { min-height: 100vh; margin-left: 248px; }
.topbar { display: flex; height: 70px; align-items: center; justify-content: space-between; padding: 0 44px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 88%); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #8993a8; font-size: 12px; }
.breadcrumbs strong { color: #43506a; font-weight: 600; }
.crumb-separator { color: #c2c9d6; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: 13px; }
.theme-control { display: flex; align-items: center; gap: 7px; color: #8a95a8; font-size: 10px; }
.theme-control select { min-height: 30px; padding: 0 25px 0 9px; border: 1px solid #e4e8ef; border-radius: 7px; background: #fff; color: #4f5c73; font-size: 10px; cursor: pointer; }
.theme-control select:focus-visible { outline: 3px solid rgb(87 104 232 / 22%); outline-offset: 1px; }
.demo-pill { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #d6f0e7; border-radius: 20px; background: #f1fbf7; color: #317a66; font-size: 10px; font-weight: 650; }
.demo-pill .status-dot { width: 6px; height: 6px; box-shadow: none; }
.help-button, .icon-button { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid #e4e8ef; border-radius: 50%; background: #fff; color: #7a8599; font-size: 12px; font-weight: 700; cursor: pointer; }
.help-button:hover, .icon-button:hover { border-color: #c8d0df; color: var(--blue); }
.help-button:focus-visible, .help-close:focus-visible { outline: 3px solid rgb(87 104 232 / 28%); outline-offset: 2px; }
.help-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 6; width: min(340px, calc(100vw - 28px)); padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 14px 34px rgb(27 39 64 / 16%); color: var(--ink); }
.help-panel[hidden] { display: none; }
.help-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-panel-heading h2 { margin: 0; }
.help-close { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.help-panel p { margin: 10px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-panel ul { margin: 0; padding-left: 18px; color: #56637b; font-size: 10px; line-height: 1.6; }
.help-panel li + li { margin-top: 5px; }
.help-guide-link { display: inline-block; margin-top: 11px; color: #4d5fbd; font-size: 11px; font-weight: 700; text-decoration: none; }

.notice-banner { display: flex; align-items: flex-start; gap: 11px; margin: 24px 44px 0; padding: 12px 15px; border: 1px solid #dbe4fb; border-radius: 9px; background: #f4f7ff; color: #40517a; }
.notice-icon { display: grid; width: 18px; height: 18px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #e0e7ff; color: #5668db; font-size: 11px; font-weight: 800; }
.notice-banner strong { display: block; font-size: 11px; font-weight: 700; }
.notice-banner p { margin: 4px 0 0; color: #6a7897; font-size: 10px; line-height: 1.5; }
.page-view { padding: 32px 44px 24px; }
.page-view[hidden] { display: none; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.eyebrow { margin: 0 0 8px; color: #8994a9; font-size: 9px; font-weight: 750; letter-spacing: 1.1px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: #1d2942; font-size: clamp(24px, 2.25vw, 31px); font-weight: 680; letter-spacing: -1.1px; line-height: 1.15; }
.page-subtitle { margin: 0; color: #7b869b; font-size: 12px; }
.button { display: inline-flex; align-items: center; gap: 18px; min-height: 39px; padding: 0 15px; border: 0; border-radius: 8px; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 5px 12px rgb(87 104 232 / 18%); }
.button-primary:hover { background: #4859d5; }

.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 2px 5px rgb(31 47 78 / 2%); }
.metric-card { min-height: 126px; padding: 16px 18px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 8px; font-size: 14px; }
.icon-indigo { background: #f0efff; color: #7372d6; }
.icon-blue { background: #edf5ff; color: #548ed5; }
.icon-teal { background: #e9f8f5; color: #39a28c; }
.metric-label { color: #8b95a8; font-size: 9px; font-weight: 750; letter-spacing: .8px; }
.metric-value { display: block; margin-top: 9px; color: #26334d; font-size: 25px; font-weight: 680; letter-spacing: -.8px; line-height: 1; }
.metric-foot { display: block; margin-top: 7px; color: #97a0b1; font-size: 10px; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(330px, .96fr); gap: 15px; margin-top: 17px; }
.panel { padding: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-heading .eyebrow { margin-bottom: 6px; }
h2 { margin-bottom: 0; color: #24314a; font-size: 15px; font-weight: 660; letter-spacing: -.25px; }
.matter-badge { display: inline-flex; align-items: center; padding: 6px 9px; border: 1px solid #ebe9ff; border-radius: 20px; background: #f6f5ff; color: #7069c2; font-size: 9px; font-weight: 650; white-space: nowrap; }
.matter-id-row { display: flex; align-items: center; gap: 11px; margin-top: 20px; }
.matter-id { color: #78849a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.client-matters-intro { margin: 9px 0 4px; color: #8b95a8; font-size: 9px; line-height: 1.5; }
.matter-list { display: grid; }
.matter-row { display: flex; width: 100%; align-items: center; gap: 10px; padding: 11px 2px; border: 0; border-top: 1px solid #f0f2f6; background: transparent; text-align: left; cursor: pointer; }
.matter-row:hover .matter-client-name, .matter-row:hover .matter-row-arrow { color: var(--blue); }
.matter-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: #f0f2ff; color: #6573d6; font-size: 9px; font-weight: 750; }
.matter-row-copy { display: grid; min-width: 0; gap: 3px; }
.matter-client-name { overflow: hidden; color: #45526a; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.matter-row-title { overflow: hidden; color: #7e899d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.matter-row-meta { color: #9aa3b3; font-size: 8px; }
.matter-row-arrow { margin-left: auto; color: #a2adbe; font-size: 15px; }
.matter-divider { height: 1px; margin: 16px 0 13px; background: #edf0f5; }
.matter-details { display: flex; gap: 40px; }
.matter-details > div { display: grid; gap: 6px; }
.detail-label { color: #96a0b1; font-size: 9px; }
.matter-details strong { color: #4b5870; font-size: 10px; font-weight: 620; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: #5869df; font-size: 10px; font-weight: 650; cursor: pointer; }
.text-button:hover { color: #3649c5; }
.client-matters-panel > .text-button { margin-top: 11px; }
.queue-heading { align-items: center; margin-bottom: 9px; }
.icon-button { width: 27px; height: 27px; border-radius: 7px; font-size: 13px; }
.recent-list { display: grid; }
.recent-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 0; border: 0; border-top: 1px solid #f0f2f6; background: transparent; text-align: left; cursor: pointer; }
.recent-item:hover .recent-title { color: var(--blue); }
.file-icon { display: grid; width: 30px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid #e6eaf1; border-radius: 6px; background: #fbfcfe; color: #6b7bc6; font-size: 11px; }
.recent-copy { display: grid; min-width: 0; gap: 4px; }
.recent-title { overflow: hidden; color: #45526a; font-size: 10px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { color: #929bad; font-size: 9px; }
.recent-status { margin-left: auto; color: #438c77; font-size: 9px; white-space: nowrap; }
.recent-status.is-reviewed { color: #6875d3; }
.queue-link { margin-top: 7px; }
.future-note { display: flex; align-items: center; gap: 12px; margin-top: 17px; padding: 13px 16px; border: 1px dashed #dfe3ec; border-radius: 10px; background: #fcfcfe; }
.future-note-icon { display: grid; width: 29px; height: 29px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: #f3f2ff; color: #7770c9; }
.future-note strong { display: block; color: #4a5670; font-size: 10px; font-weight: 650; }
.future-note p { margin: 4px 0 0; color: #8791a5; font-size: 9px; line-height: 1.4; }
.future-tag { margin-left: auto; padding: 5px 7px; border-radius: 5px; background: #f1f2f6; color: #858fa1; font-size: 8px; font-weight: 750; letter-spacing: .5px; white-space: nowrap; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; color: #a0a8b6; font-size: 9px; }

.documents-heading { align-items: flex-end; margin-bottom: 20px; }
.documents-heading .eyebrow { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .45px; }
.heading-dot { padding: 0 4px; color: #bec5d1; }
.documents-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.search-box { display: flex; width: min(410px, 100%); flex: 1 1 300px; height: 38px; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid #e4e8f0; border-radius: 8px; background: #fff; }
.search-box:focus-within { border-color: #9ba6f0; box-shadow: 0 0 0 3px rgb(87 104 232 / 9%); }
.search-icon { color: #8d98ad; font-size: 19px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #38465e; font-size: 10px; }
.search-box input::placeholder { color: #a0a9b7; }
kbd { padding: 3px 5px; border: 1px solid #e6eaf0; border-radius: 4px; background: #fafbfc; color: #929cad; font-family: inherit; font-size: 8px; white-space: nowrap; }
.toolbar-note { display: flex; align-items: center; gap: 8px; color: #8994a7; font-size: 10px; }
.toolbar-note .status-dot { width: 6px; height: 6px; box-shadow: none; }
.matter-select-label { display: flex; min-width: 190px; flex: 0 1 250px; }
.matter-select-label select { width: 100%; min-height: 38px; padding: 0 28px 0 10px; border: 1px solid #e4e8f0; border-radius: 8px; background: #fff; color: #59667d; font-size: 10px; }
.matter-select-label select:focus-visible { outline: 3px solid rgb(87 104 232 / 18%); outline-offset: 1px; }
.document-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(310px, .92fr); align-items: stretch; gap: 15px; }
.intake-disclosure { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid #eadcb9; border-radius: 9px; background: #fffaf0; color: #685630; font-size: 11px; line-height: 1.5; }
.intake-disclosure strong { flex: 0 0 auto; color: #4b3d22; }
.intake-layout { display: grid; grid-template-columns: minmax(260px, .82fr) minmax(340px, 1.18fr); align-items: start; gap: 15px; }
.intake-setup-panel h2, .intake-preview-panel h2 { margin: 0 0 16px; color: #26334d; font-size: 16px; font-weight: 650; }
.intake-field { display: grid; gap: 7px; margin: 16px 0; color: #58647b; font-size: 11px; font-weight: 600; }
.intake-field select { min-height: 38px; padding: 0 10px; border: 1px solid #dfe5ee; border-radius: 7px; background: #fff; color: #34415a; font: inherit; font-weight: 500; }
.intake-field select:focus-visible { outline: 3px solid rgb(87 104 232 / 22%); outline-offset: 1px; }
.intake-action { min-height: 38px; margin-top: 7px; }
.intake-action:disabled { cursor: not-allowed; opacity: .55; }
.intake-help, .intake-result { margin: 11px 0 0; color: #8490a4; font-size: 10px; line-height: 1.5; }
.intake-preview-panel .panel-heading { align-items: center; margin-bottom: 10px; }
.intake-preview-panel h2 { margin: 0; }
.intake-status { padding: 5px 8px; border-radius: 20px; background: #f0f3f8; color: #64718a; font-size: 9px; font-weight: 650; }
.intake-placeholder { margin: 15px 0; color: #7c879a; font-size: 11px; line-height: 1.6; }
.intake-metadata { display: grid; grid-template-columns: minmax(105px, .5fr) minmax(0, 1fr); margin: 10px 0 16px; font-size: 10px; }
.intake-metadata dt, .intake-metadata dd { margin: 0; padding: 8px 0; border-bottom: 1px solid #edf0f5; }
.intake-metadata dt { color: #8590a3; }
.intake-metadata dd { color: #3f4c64; font-weight: 600; }
.intake-caveat { margin: 10px 0 0; color: #8a7650; font-size: 10px; line-height: 1.5; }
.template-disclosure { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid #e8d5d2; border-radius: 9px; background: #fff6f4; color: #6c4b49; font-size: 11px; line-height: 1.5; }
.template-disclosure strong { flex: 0 0 auto; color: #553735; }
.template-layout { display: grid; grid-template-columns: minmax(245px, .72fr) minmax(360px, 1.28fr); align-items: start; gap: 15px; }
.template-record-panel h2, .template-mapping-panel h2 { margin: 0 0 14px; color: #26334d; font-size: 16px; font-weight: 650; }
.template-record-list { display: grid; grid-template-columns: minmax(80px, .55fr) minmax(0, 1fr); margin: 0; font-size: 10px; }
.template-record-list dt, .template-record-list dd { margin: 0; padding: 10px 0; border-bottom: 1px solid #edf0f5; }
.template-record-list dt { color: #8590a3; }
.template-record-list dd { color: #3f4c64; font-weight: 600; }
.template-state { display: inline-flex; padding: 4px 7px; border-radius: 10px; background: #f7eee4; color: #8b6740; font-size: 9px; }
.template-help { margin: 14px 0 0; color: #8490a4; font-size: 10px; line-height: 1.55; }
.template-mapping-panel .panel-heading { margin-bottom: 4px; }
.template-mapping-header, .template-mapping-row { display: grid; grid-template-columns: minmax(140px, .72fr) minmax(0, 1.28fr); gap: 12px; }
.template-mapping-header { padding: 10px 0; border-bottom: 1px solid #e7ebf2; color: #8994a7; font-size: 8px; font-weight: 750; letter-spacing: .7px; }
.template-mapping-row { align-items: start; padding: 11px 0; border-bottom: 1px solid #edf0f5; font-size: 10px; }
.template-field-name { color: #536079; font-weight: 600; }
.template-field-value { display: grid; gap: 4px; color: #36445e; }
.template-field-value strong { font-weight: 650; }
.template-field-value small { color: #929cad; font-size: 9px; line-height: 1.4; }
.document-list-panel { min-height: 430px; padding: 13px 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 13px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #7c879a; font-size: 9px; cursor: pointer; }
.filter-chip:hover { background: #f6f7fb; color: #4d5c75; }
.filter-chip.is-selected { border-color: #e3e6ff; background: #f1f2ff; color: #5968d6; font-weight: 650; }
.filter-chip span { color: inherit; opacity: .72; font-size: 8px; }
.list-header { display: flex; justify-content: space-between; padding: 10px 8px; border-top: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; color: #99a2b2; font-size: 8px; font-weight: 750; letter-spacing: .65px; }
.sort-mark { color: #6374dc; font-size: 11px; }
.document-list { display: grid; }
.document-row { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 8px; border: 0; border-bottom: 1px solid #f0f2f6; background: #fff; text-align: left; cursor: pointer; }
.document-row:hover { background: #fafbff; }
.document-row.is-selected { background: #f5f6ff; box-shadow: inset 2px 0 #6674e5; }
.document-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.doc-type-icon { display: grid; width: 33px; height: 37px; flex: 0 0 auto; place-items: center; border: 1px solid #e8ebf2; border-radius: 7px; background: #fcfcfe; color: #7080c6; font-size: 11px; }
.doc-type-icon.report { color: #c18a55; background: #fffaf4; }
.doc-type-icon.discovery { color: #5c9d88; background: #f3fbf8; }
.document-copy { display: grid; min-width: 0; gap: 5px; }
.document-title { overflow: hidden; color: #38465f; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.document-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; color: #98a1b1; font-size: 8px; }
.document-category { color: #77849a; }
.document-client { color: #929cad; }
.document-state { display: inline-flex; align-items: center; gap: 5px; color: #448b76; font-size: 8px; white-space: nowrap; }
.document-state span { width: 5px; height: 5px; border-radius: 50%; background: #47ac8c; }
.document-state.is-reviewed { color: #6270ce; }
.document-state.is-reviewed span { background: #7886e0; }
.empty-state { display: grid; justify-items: center; padding: 56px 15px; color: #7f8aa0; text-align: center; }
.empty-icon { display: grid; width: 37px; height: 37px; place-items: center; margin-bottom: 11px; border-radius: 50%; background: #f3f5fa; color: #8290a8; font-size: 21px; }
.empty-state strong { color: #4b5870; font-size: 11px; }
.empty-state p { margin: 6px 0 12px; font-size: 9px; }

.detail-panel { min-height: 430px; padding: 18px; }
.detail-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-type { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 9px; color: #858fa4; font-size: 9px; }
.detail-type::before { width: 6px; height: 6px; border-radius: 50%; background: #8b8ee0; content: ""; }
.detail-panel h2 { margin-bottom: 5px; font-size: 16px; line-height: 1.3; }
.detail-file-meta { color: #929cad; font-size: 9px; }
.detail-matter-meta { display: block; margin-top: 5px; color: #7f8ba1; font-size: 9px; line-height: 1.45; }
.preview-badge { padding: 5px 7px; border-radius: 5px; background: #f0faf6; color: #42836f; font-size: 8px; font-weight: 650; white-space: nowrap; }
.detail-rule { height: 1px; margin: 15px 0; background: #edf0f5; }
.section-label { display: flex; align-items: center; gap: 7px; margin: 0 0 9px; color: #53617a; font-size: 9px; font-weight: 700; }
.section-label span { display: grid; width: 17px; height: 17px; place-items: center; border-radius: 5px; background: #f0f2ff; color: #6976da; font-size: 9px; }
.summary-copy { margin: 0; color: #657189; font-size: 10px; line-height: 1.65; }
.source-box { padding: 11px 12px; border-left: 2px solid #dce2f3; border-radius: 0 6px 6px 0; background: #f8f9fc; color: #737e92; font-size: 9px; line-height: 1.65; }
.review-callout { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 9px 10px; border: 1px solid #f0e4cc; border-radius: 7px; background: #fffaf0; color: #90723f; font-size: 8px; line-height: 1.5; }
.review-callout span { font-weight: 800; }
.review-action-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.review-action-note { max-width: 190px; margin: 0; color: #929bad; font-size: 8px; line-height: 1.45; }
.review-toggle { min-height: 31px; padding: 0 10px; border: 1px solid #dfe3f0; border-radius: 7px; background: #fff; color: #5b68cf; font-size: 9px; font-weight: 650; cursor: pointer; }
.review-toggle:hover { border-color: #bfc7ed; background: #f6f7ff; }
.review-toggle.is-reviewed { border-color: #d9e8e2; background: #f1faf6; color: #3f806c; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

body[data-theme="ocean"] {
  --blue: #13838c;
  --blue-soft: #e5f5f6;
  --navy: #103247;
  --green: #257e6d;
  --green-soft: #e8f6f0;
}
body[data-theme="ocean"] .nav-link.is-active { background: #1c5364; }
body[data-theme="ocean"] .filter-chip.is-selected { border-color: #cce9e7; background: #e8f6f5; color: #187980; }
body[data-theme="ocean"] .filter-chip.is-selected span { color: #187980; }
body[data-theme="ocean"] .search-box:focus-within { border-color: #76c1c2; box-shadow: 0 0 0 3px rgb(19 131 140 / 10%); }
body[data-theme="ocean"] .document-row.is-selected { background: #eef8f8; box-shadow: inset 2px 0 #168b91; }
body[data-theme="ocean"] .text-button { color: #167e85; }

body[data-theme="midnight"] {
  color-scheme: dark;
  --ink: #e7edf7;
  --muted: #a0aec3;
  --soft: #182439;
  --line: #2d3b53;
  --navy: #0c1424;
  --blue: #9aa8ff;
  --blue-soft: #273252;
  --green: #78d6b3;
  --green-soft: #1b382f;
  background: #111a2b;
  color: #e7edf7;
}
body[data-theme="midnight"] .main-area { background: #111a2b; }
body[data-theme="midnight"] .topbar,
body[data-theme="midnight"] .metric-card,
body[data-theme="midnight"] .panel { border-color: #2b3950; background: #18253a; box-shadow: none; }
body[data-theme="midnight"] .topbar { background: #151f33; }
body[data-theme="midnight"] .notice-banner { border-color: #304362; background: #1a2b45; color: #c7d5f2; }
body[data-theme="midnight"] .notice-icon { background: #293c5b; color: #a8b5ff; }
body[data-theme="midnight"] .notice-banner p,
body[data-theme="midnight"] .client-matters-intro,
body[data-theme="midnight"] .matter-row-title,
body[data-theme="midnight"] .matter-row-meta,
body[data-theme="midnight"] .detail-matter-meta,
body[data-theme="midnight"] .page-subtitle,
body[data-theme="midnight"] .breadcrumbs,
body[data-theme="midnight"] .metric-foot,
body[data-theme="midnight"] .detail-file-meta,
body[data-theme="midnight"] .document-meta,
body[data-theme="midnight"] .document-client,
body[data-theme="midnight"] .recent-meta,
body[data-theme="midnight"] .toolbar-note { color: #9aa8bd; }
body[data-theme="midnight"] h1,
body[data-theme="midnight"] h2,
body[data-theme="midnight"] .matter-details strong,
body[data-theme="midnight"] .matter-client-name,
body[data-theme="midnight"] .recent-title,
body[data-theme="midnight"] .document-title,
body[data-theme="midnight"] .section-label,
body[data-theme="midnight"] .breadcrumbs strong { color: #e6edf7; }
body[data-theme="midnight"] .eyebrow,
body[data-theme="midnight"] .metric-label,
body[data-theme="midnight"] .detail-label,
body[data-theme="midnight"] .list-header { color: #95a3ba; }
body[data-theme="midnight"] .metric-value,
body[data-theme="midnight"] .summary-copy,
body[data-theme="midnight"] .source-box { color: #c2ccdc; }
body[data-theme="midnight"] .matter-badge { border-color: #3a3c63; background: #292a4a; color: #c1bdff; }
body[data-theme="midnight"] .demo-pill { border-color: #2c514b; background: #1b3834; color: #91d8bd; }
body[data-theme="midnight"] .future-note { border-color: #354158; background: #172236; }
body[data-theme="midnight"] .future-note strong { color: #d2dbea; }
body[data-theme="midnight"] .future-note p,
body[data-theme="midnight"] .page-footer { color: #94a1b6; }
body[data-theme="midnight"] .future-note-icon { background: #2b2a4e; color: #c0baff; }
body[data-theme="midnight"] .future-tag { background: #2b3548; color: #aeb9cc; }
body[data-theme="midnight"] .recent-item,
body[data-theme="midnight"] .matter-row,
body[data-theme="midnight"] .document-row { border-color: #2b3950; background: #18253a; }
body[data-theme="midnight"] .recent-item:hover,
body[data-theme="midnight"] .matter-row:hover,
body[data-theme="midnight"] .document-row:hover { background: #1d2b43; }
body[data-theme="midnight"] .document-row.is-selected { background: #243252; box-shadow: inset 2px 0 #9aa8ff; }
body[data-theme="midnight"] .file-icon,
body[data-theme="midnight"] .doc-type-icon { border-color: #33415a; background: #1d2b41; color: #b1bdff; }
body[data-theme="midnight"] .matter-avatar { background: #293453; color: #c2caff; }
body[data-theme="midnight"] .doc-type-icon.report { background: #382f2c; color: #e6b98d; }
body[data-theme="midnight"] .doc-type-icon.discovery { background: #213a3a; color: #9cdbc4; }
body[data-theme="midnight"] .search-box,
body[data-theme="midnight"] .theme-control select,
body[data-theme="midnight"] .matter-select-label select { border-color: #39465c; background: #18253a; color: #dbe3ef; }
body[data-theme="midnight"] .search-box input { color: #e4eaf4; }
body[data-theme="midnight"] .search-box input::placeholder { color: #8795aa; }
body[data-theme="midnight"] .filter-chip { color: #a2afc3; }
body[data-theme="midnight"] .filter-chip:hover { background: #202d43; color: #e3e9f3; }
body[data-theme="midnight"] .filter-chip.is-selected { border-color: #414c76; background: #293453; color: #c2caff; }
body[data-theme="midnight"] .filter-chip.is-selected span { color: #c2caff; }
body[data-theme="midnight"] .list-header { border-color: #2b3950; }
body[data-theme="midnight"] .detail-rule,
body[data-theme="midnight"] .matter-divider { background: #2b3950; }
body[data-theme="midnight"] .source-box { border-color: #4b5c78; background: #141f32; }
body[data-theme="midnight"] .review-callout { border-color: #5b4b30; background: #332b1f; color: #e5c98f; }
body[data-theme="midnight"] .preview-badge { background: #1b3834; color: #96d7bf; }
body[data-theme="midnight"] .review-action-note { color: #9aa8bd; }
body[data-theme="midnight"] .review-toggle { border-color: #46557a; background: #242f4b; color: #c4ccff; }
body[data-theme="midnight"] .review-toggle:hover { background: #2b3858; }
body[data-theme="midnight"] .review-toggle.is-reviewed { border-color: #2c514b; background: #1b3834; color: #9edec6; }
body[data-theme="midnight"] .button-primary { color: #10182a; box-shadow: none; }
body[data-theme="midnight"] .help-button,
body[data-theme="midnight"] .icon-button { border-color: #39465c; background: #1b2940; color: #b6c1d4; }
body[data-theme="midnight"] .help-panel { border-color: #39465c; background: #1b2940; color: #e4eaf4; }
body[data-theme="midnight"] .help-panel p,
body[data-theme="midnight"] .help-panel ul { color: #aab7cb; }
body[data-theme="midnight"] .help-close { border-color: #39465c; color: #b6c1d4; }
body[data-theme="midnight"] .empty-icon { background: #202d43; color: #a2afc3; }
body[data-theme="midnight"] .empty-state strong { color: #e0e7f1; }
body[data-theme="midnight"] .empty-state p { color: #a1aec1; }
body[data-theme="midnight"] .theme-control { color: #a4b0c4; }
body[data-theme="midnight"] .intake-disclosure { border-color: #594b31; background: #2e291f; color: #d8c79b; }
body[data-theme="midnight"] .intake-disclosure strong,
body[data-theme="midnight"] .intake-metadata dd { color: #e2d4ac; }
body[data-theme="midnight"] .intake-field { color: #aab7cb; }
body[data-theme="midnight"] .intake-field select { border-color: #39465c; background: #18253a; color: #dbe3ef; }
body[data-theme="midnight"] .intake-status { background: #25344b; color: #b6c1d4; }
body[data-theme="midnight"] .intake-metadata dt,
body[data-theme="midnight"] .intake-placeholder,
body[data-theme="midnight"] .intake-help,
body[data-theme="midnight"] .intake-result { color: #94a1b6; }
body[data-theme="midnight"] .intake-metadata dt,
body[data-theme="midnight"] .intake-metadata dd { border-color: #2b3950; }
body[data-theme="midnight"] .intake-caveat { color: #d8c79b; }
body[data-theme="midnight"] .template-disclosure { border-color: #624846; background: #302321; color: #dfbab5; }
body[data-theme="midnight"] .template-disclosure strong { color: #f0c9c4; }
body[data-theme="midnight"] .template-record-list dt,
body[data-theme="midnight"] .template-help,
body[data-theme="midnight"] .template-mapping-header,
body[data-theme="midnight"] .template-field-value small { color: #94a1b6; }
body[data-theme="midnight"] .template-record-list dd,
body[data-theme="midnight"] .template-field-value { color: #d6dfec; }
body[data-theme="midnight"] .template-record-list dt,
body[data-theme="midnight"] .template-record-list dd,
body[data-theme="midnight"] .template-mapping-header,
body[data-theme="midnight"] .template-mapping-row { border-color: #2b3950; }
body[data-theme="midnight"] .template-state { background: #433327; color: #e1bd84; }
body[data-theme="midnight"] .template-field-name { color: #aab7cb; }

@media (max-width: 1080px) {
  .sidebar { width: 215px; }
  .main-area { margin-left: 215px; }
  .topbar { padding: 0 28px; }
  .notice-banner { margin-right: 28px; margin-left: 28px; }
  .page-view { padding-right: 28px; padding-left: 28px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .document-layout { grid-template-columns: minmax(0, 1fr); }
  .intake-layout { grid-template-columns: minmax(0, 1fr); }
  .template-layout { grid-template-columns: minmax(0, 1fr); }
  .documents-toolbar { flex-wrap: wrap; }
  .detail-panel { min-height: initial; }
}
@media (max-width: 700px) {
  .sidebar { position: static; width: auto; height: auto; padding: 12px 14px; }
  .brand { justify-content: flex-start; padding: 0 2px; }
  .brand-logo { width: 122px; }
  .workspace-label, .workspace-switcher, .sidebar-bottom { display: none; }
  .primary-nav { grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .nav-link { padding: 8px 10px; }
  .main-area { margin-left: 0; }
  .topbar { height: 53px; padding: 0 16px; }
  .notice-banner { margin: 14px 14px 0; padding: 10px; }
  .notice-banner p { font-size: 9px; }
  .page-view { padding: 24px 14px 18px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .overview-heading .button { align-self: stretch; justify-content: space-between; }
  .metrics-grid { grid-template-columns: 1fr; gap: 9px; }
  .metric-card { display: grid; min-height: 88px; grid-template-columns: 1fr auto; align-content: center; padding: 13px 15px; }
  .metric-top { grid-column: 1; grid-row: 1; justify-content: flex-start; gap: 9px; }
  .metric-value { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0 4px 0 0; }
  .metric-foot { grid-column: 1; grid-row: 2; margin: 5px 0 0 38px; }
  .overview-grid { gap: 10px; margin-top: 11px; }
  .panel { padding: 14px; }
  .matter-details { gap: 20px; }
  .future-note { align-items: flex-start; flex-wrap: wrap; padding: 12px; }
  .future-note > div:nth-child(2) { flex: 1; }
  .future-tag { margin-left: 41px; }
  .page-footer { flex-direction: column; gap: 5px; }
  .documents-toolbar { align-items: flex-start; flex-direction: column; }
  .intake-disclosure { flex-direction: column; gap: 4px; margin-bottom: 12px; }
  .template-disclosure { flex-direction: column; gap: 4px; margin-bottom: 12px; }
  .template-mapping-header, .template-mapping-row { grid-template-columns: minmax(100px, .7fr) minmax(0, 1.3fr); gap: 8px; }
  .intake-field select { width: 100%; }
  .search-box { width: 100%; }
  .matter-select-label { width: 100%; }
  .filter-row { gap: 3px; }
  .filter-chip { padding: 0 7px; }
}

.intake-record-list { display: grid; gap: 9px; margin: 14px 0; }
.intake-record-row { padding: 12px; border: 1px solid var(--line, #e2e7ef); border-radius: 10px; background: var(--surface-soft, #f8f9fc); }
.intake-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.intake-record-heading strong { color: var(--ink, #17243a); font-size: 13px; }
.intake-record-meta, .intake-record-note { margin: 5px 0 0; color: var(--muted, #667085); font-size: 11px; }
.intake-record-note { color: var(--accent, #314d88); font-weight: 600; }
.intake-record-excerpt { margin: 8px 0; color: var(--ink, #344054); font-size: 12px; line-height: 1.5; }
.intake-record-state { display: inline-flex; color: var(--muted, #667085); font-size: 10px; font-weight: 650; }
.intake-record-state.is-added { color: var(--success, #16734a); }
.draft-preview-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.draft-preview-controls .template-help { flex: 1 1 220px; margin: 0; }
.draft-preview[hidden] { display: none; }
.draft-preview { display: grid; gap: 12px; margin-top: 16px; padding: 15px; border: 1px solid #d9e1f0; border-radius: 11px; background: #fbfcff; }
.draft-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.draft-preview-heading .eyebrow { margin: 0 0 5px; color: #5768e8; font-size: 8px; font-weight: 750; letter-spacing: .8px; }
.draft-preview-heading h3 { margin: 0; color: var(--ink); font-size: 15px; }
.draft-preview-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 20px; background: #f6efe3; color: #856234; font-size: 9px; font-weight: 700; }
.draft-preview-intro, .draft-preview-caveat { margin: 0; color: #69758a; font-size: 10px; line-height: 1.55; }
.draft-section-title { margin: 2px 0 -3px; color: #35435e; font-size: 11px; }
.draft-source-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.draft-source-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.draft-source-heading strong { color: #33415b; font-size: 10px; }
.draft-source-tag { color: #76839a; font-size: 8px; font-weight: 650; }
.draft-source-excerpt { margin: 9px 0; padding-left: 10px; border-left: 2px solid #c8d1ea; color: #3f4d66; font-size: 10px; line-height: 1.55; }
.draft-source-citation { margin: 0 0 8px; color: #69758a; font-size: 9px; }
.draft-source-warning { margin: 0 0 9px; color: #8a6230; font-size: 9px; line-height: 1.5; }
.draft-source-open { min-height: 30px; padding: 0 9px; font-size: 9px; }
.draft-blank-fields { padding: 12px; border: 1px dashed #cfd6e3; border-radius: 9px; background: #f7f8fb; }
.draft-blank-fields .draft-section-title { margin: 0 0 8px; }
.draft-blank-fields p { margin: 5px 0; color: #6b7689; font-size: 9px; line-height: 1.5; }
.draft-preview-caveat { padding-top: 2px; color: #85724d; }
body[data-theme="midnight"] .draft-preview { border-color: #39465c; background: #17243a; }
body[data-theme="midnight"] .draft-preview-heading h3,
body[data-theme="midnight"] .draft-section-title,
body[data-theme="midnight"] .draft-source-heading strong,
body[data-theme="midnight"] .draft-source-excerpt { color: #dbe3ef; }
body[data-theme="midnight"] .draft-preview-intro,
body[data-theme="midnight"] .draft-preview-caveat,
body[data-theme="midnight"] .draft-source-tag,
body[data-theme="midnight"] .draft-source-citation,
body[data-theme="midnight"] .draft-blank-fields p { color: #aab7cb; }
body[data-theme="midnight"] .draft-source-card,
body[data-theme="midnight"] .draft-blank-fields { border-color: #39465c; background: #1d2b42; }
body[data-theme="midnight"] .draft-preview-status { background: #433327; color: #e1bd84; }
body[data-theme="midnight"] .draft-source-warning { color: #e1bd84; }

/* Shared theme surfaces keep the selected palette consistent throughout the workspace. */
body[data-theme="soft"] {
  color-scheme: light;
  --page-background: #e9e6df;
  --surface: #f3f0e9;
  --surface-raised: #faf8f2;
  --surface-subtle: #eeebe3;
  --ink: #403d36;
  --muted: #716e66;
  --line: #d8d3c8;
  --navy: #353d4a;
  --blue: #65749a;
  --blue-soft: #e6e9f0;
  --green: #4f806e;
  --green-soft: #e5efe9;
  background: var(--page-background);
  color: var(--ink);
}
body[data-theme="classic"] {
  color-scheme: light;
  --page-background: #f1f3f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #f7f8fb;
  --ink: #19243b;
  --muted: #748097;
  --line: #e2e6ed;
  --navy: #111b30;
  background: var(--page-background);
  color: var(--ink);
}
body[data-theme="citrus"] {
  color-scheme: light;
  --page-background: #f0eadb;
  --surface: #f8f3e7;
  --surface-raised: #fdf9ef;
  --surface-subtle: #eee5ce;
  --ink: #463f32;
  --muted: #756b55;
  --line: #ded2b5;
  --navy: #365a43;
  --blue: #b96f25;
  --blue-soft: #f5e5b8;
  --green: #568052;
  --green-soft: #e5eedc;
  background: var(--page-background);
  color: var(--ink);
}
body[data-theme="ocean"] {
  color-scheme: light;
  --page-background: #e3edef;
  --surface: #f1f7f7;
  --surface-raised: #f8fbfb;
  --surface-subtle: #eaf2f3;
  --ink: #263b43;
  --muted: #657d83;
  --line: #cedcde;
  background: var(--page-background);
  color: var(--ink);
}
body[data-theme="midnight"] {
  --page-background: #111a2b;
  --surface: #18253a;
  --surface-raised: #1d2b42;
  --surface-subtle: #141f32;
}
body[data-theme] .main-area,
body[data-theme] .document-list-panel,
body[data-theme] .help-panel,
body[data-theme] .metric-card,
body[data-theme] .panel,
body[data-theme] .topbar,
body[data-theme] .search-box,
body[data-theme] .matter-select-label select,
body[data-theme] .intake-field select,
body[data-theme] .theme-control select,
body[data-theme] .document-row,
body[data-theme] .draft-source-card,
body[data-theme] .draft-blank-fields,
body[data-theme] .draft-preview,
body[data-theme] .review-toggle,
body[data-theme] .help-button,
body[data-theme] .icon-button,
body[data-theme] .button:not(.button-primary) {
  border-color: var(--line);
  background-color: var(--surface);
  color: var(--ink);
}
body[data-theme] .main-area { background-color: var(--page-background); }
body[data-theme] .document-row:hover,
body[data-theme] .recent-item:hover,
body[data-theme] .matter-row:hover { background-color: var(--surface-subtle); }
body[data-theme] .document-row.is-selected,
body[data-theme] .filter-chip.is-selected { background-color: var(--blue-soft); }
body[data-theme] h1,
body[data-theme] h2,
body[data-theme] .metric-value,
body[data-theme] .matter-client-name,
body[data-theme] .recent-title,
body[data-theme] .document-title,
body[data-theme] .draft-section-title,
body[data-theme] .draft-source-heading strong,
body[data-theme] .draft-source-excerpt { color: var(--ink); }
body[data-theme] .page-subtitle,
body[data-theme] .metric-foot,
body[data-theme] .recent-meta,
body[data-theme] .document-meta,
body[data-theme] .document-client,
body[data-theme] .draft-preview-intro,
body[data-theme] .draft-preview-caveat,
body[data-theme] .draft-source-tag,
body[data-theme] .draft-source-citation,
body[data-theme] .draft-blank-fields p { color: var(--muted); }
body[data-theme] .source-box,
body[data-theme] .draft-preview,
body[data-theme] .draft-blank-fields,
body[data-theme] .file-icon,
body[data-theme] .doc-type-icon { background-color: var(--surface-subtle); }
body[data-theme] .search-box input,
body[data-theme] .intake-field select,
body[data-theme] .theme-control select,
body[data-theme] .matter-select-label select { color: var(--ink); }
body[data-theme] .theme-control { color: var(--muted); }

@media (max-width: 620px) {
  .draft-preview { padding: 11px; }
  .draft-preview-heading, .draft-source-heading { align-items: flex-start; flex-direction: column; }
}
