
/* RRG workspace: midnight surfaces, precise dividers, and an emerald action layer. */
:root {
  color-scheme: dark;
  --ink: #edf3fa;
  --muted: #a3b1c3;
  --line: #2b394b;
  --green: #6ce3bd;
  --dark: #09111c;
  --light: #122e2a;
  --bg: #0b121d;
  --surface: #131e2c;
  --surface-raised: #1b293b;
  --field: #0d1724;
  --accent-fill: #52d6ad;
  --amber: #f1cd8b;
  --blue: #a6c9ff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px 'DM Sans', Arial, sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); text-underline-offset: 3px; }
button { cursor: pointer; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 6px; }
button { min-height: 38px; padding: 9px 14px; background: var(--surface-raised); color: var(--ink); font-size: 12px; font-weight: 600; transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover { background: #25364b; border-color: #4c6078; }
button:active { background: #152337; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { background: var(--field); color: var(--ink); padding: 11px 13px; max-width: 100%; }
input::placeholder, textarea::placeholder { color: #8799af; opacity: 1; }
input:not([type=checkbox]):not([type=file]), select, textarea { min-height: 42px; }
input:hover, select:hover, textarea:hover { border-color: #4a5e76; }
input[type=checkbox] { accent-color: var(--accent-fill); }
input::file-selector-button { padding: 8px 11px; margin-right: 12px; background: var(--surface-raised); color: var(--ink); border: 1px solid #4a5e76; border-radius: 4px; cursor: pointer; }
select { width: auto; }
option { background: var(--field); color: var(--ink); }
textarea { resize: vertical; }
.primary { background: var(--accent-fill); color: #06241c; border-color: var(--accent-fill); font-weight: 700; }
.primary:hover { background: #79e8c5; border-color: #79e8c5; box-shadow: 0 0 0 3px #52d6ad12; }
.primary:active { background: #38bd95; }
::selection { background: #6ce3bd40; color: #fff; }

/* Application frame */
.app { display: flex; min-height: 100vh; }
aside { width: 246px; background: #090f19; border-right: 1px solid #253145; padding: 30px 19px 21px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #f1f7fc; font: 800 29px Manrope, Arial, sans-serif; letter-spacing: -.6px; }
.mark { display: grid; place-items: center; background: #12382e; border: 1px solid #34785f; color: #88f1cf; border-radius: 8px; width: 44px; height: 46px; font-size: 29px; box-shadow: inset 0 1px #ffffff0b; }
.brand-sub { display: block; color: #a4b4c8; font: 600 6.6px Arial, sans-serif; letter-spacing: 1.2px; margin-top: 4px; }
.workspace-label { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: #a0aec1; margin: 39px 0 12px; }
aside select { background-color: #131e2b; border-color: #344359; font-size: 12px; font-weight: 600; }
.scope { font-size: 11px; color: #96a7bd; margin: 10px 3px 27px; }
nav { display: flex; flex-direction: column; gap: 5px; }
nav a { position: relative; padding: 11px 13px; min-height: 44px; border: 1px solid transparent; border-radius: 6px; text-decoration: none; color: #acbacd; display: flex; gap: 12px; align-items: center; font-size: 12px; font-weight: 500; transition: background .15s, color .15s; }
nav a:hover { background: #162130; color: #f3f7fc; }
nav a.active { background: #15332e; border-color: #285548; color: #87efcc; font-weight: 700; box-shadow: inset 3px 0 #6ce3bd; }
.nav-icon { font-size: 18px; width: 20px; text-align: center; line-height: 1; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 21px; border-top: 1px solid #253145; font-size: 12px; min-height: 76px; }
nav + .sidebar-bottom { margin-top: auto; }
.avatar { border: 1px solid #3c5262; border-radius: 9px; background: #1d303a; padding: 10px; color: #c2e8df; font-size: 11px; font-weight: 700; }
.sidebar-bottom small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.demo-pill { margin-left: auto; font-size: 8px; letter-spacing: .6px; border: 1px solid #4d4533; padding: 3px 5px; border-radius: 3px; color: var(--amber); background: #29251b; }
.shell { margin-left: 246px; flex: 1; min-width: 0; }
header { min-height: 72px; border-bottom: 1px solid #253145; background: #0f1825; padding: 16px 38px; display: flex; align-items: center; justify-content: space-between; gap: 15px; font-size: 12px; }
.breadcrumb { color: #96a6bb; white-space: nowrap; }
.breadcrumb span { margin: 0 12px; color: #62758d; }
.breadcrumb strong { color: #d8e2ef; font-weight: 500; }
.header-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; color: #b0bdd0; font-size: 11px; }
.header-right button { min-height: 30px; padding: 4px 9px; font-size: 11px; }
.dot { height: 6px; width: 6px; background: #72e3be; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px #72e3be10; }
.divider { height: 15px; width: 1px; background: #344359; margin: 0 9px; }
.demo-banner { background: #231f17; border-bottom: 1px solid #443b28; color: #cfbc92; padding: 10px 38px; display: flex; align-items: center; gap: 13px; font-size: 11px; line-height: 1.6; }
.demo-banner > span { font-size: 9px; letter-spacing: .8px; font-weight: 700; white-space: nowrap; }
.demo-banner > span:first-child { color: #f1d293; border: 1px solid #655332; padding: 3px 6px; border-radius: 3px; }
.demo-banner #mode-disclosure { font-weight: 400; font-size: 11px; white-space: normal; letter-spacing: 0; }
.demo-banner button { margin-left: auto; white-space: nowrap; min-height: 30px; background: transparent; border: 1px solid transparent; padding: 3px 6px; color: #f1d293; font-size: 11px; }
.demo-banner button:hover { background: #3a3020; border-color: #655332; }
.cloud-status { padding: 9px 38px; background: #131f2c; color: #b1bdce; font-size: 11px; border-bottom: 1px solid var(--line); line-height: 1.6; }
.cloud-status.connected { background: #112c25; color: #9be4c6; border-color: #285247; }
.cloud-status.error { background: #37211d; color: #f5b59f; border-color: #694139; }
.cloud-status.saving { background: #30291b; color: #eed29b; border-color: #5d5033; }
.cloud-saving main, .cloud-saving aside, .cloud-saving dialog form { pointer-events: none; opacity: .72; }
main { padding: 34px 38px; max-width: 1660px; margin: auto; }
footer { font-size: 10px; color: #93a3b8; padding: 0 38px 25px; display: flex; justify-content: space-between; gap: 15px; line-height: 1.7; }

/* Typography and overview */
h1 { font: 800 29px/1.25 Manrope, Arial, sans-serif; letter-spacing: -.9px; margin: 0 0 9px; color: #f2f6fc; }
h2 { font: 700 16px/1.45 Manrope, Arial, sans-serif; margin: 0; color: #eef3fa; letter-spacing: -.25px; }
h3 { font-size: 14px; margin: 0 0 10px; color: #eaf1fa; }
.sub { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0; }
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.page-top > div { min-width: 0; }
.page-top > button { flex-shrink: 0; }
.eyebrow { font-size: 10px; letter-spacing: 1.6px; color: var(--green); font-weight: 700; margin-bottom: 10px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 24px; }
.metric, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 18px #00000012; }
.metric { padding: 21px; border-top-color: #3a4d62; background: linear-gradient(120deg, #172536, #131e2c 65%); }
.metric:first-child { border-top-color: #53b696; background: linear-gradient(120deg, #17322f, #13232c 65%); }
.metric-name { font-size: 11px; color: #b4c1d1; display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.metric-icon { color: #8ca6bb; font-size: 14px; }
.metric:first-child .metric-icon { color: var(--green); }
.metric strong { font: 700 30px/1.3 Manrope, Arial, sans-serif; display: block; margin: 14px 0 9px; letter-spacing: -.9px; color: #f5f8fc; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { font-size: 10px; color: #a7b5c6; line-height: 1.7; }
.metric small b { color: #86e5c4; font-weight: 500; }
.grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; margin-bottom: 24px; }
.panel { padding: 24px; min-width: 0; }
.panel-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 12px; }
.panel-top .sub { margin-top: 6px; }
.legend { font-size: 10px; color: #b1bfd1; display: flex; gap: 14px; flex-shrink: 0; }
.legend b { display: inline-block; width: 7px; height: 7px; background: #5bd7af; border-radius: 2px; margin-right: 5px; }
.legend .pale { background: #426778; }
.chart { height: 190px; display: flex; align-items: end; justify-content: space-around; gap: 16px; padding: 13px 10px 24px; border-bottom: 1px solid #344459; background: repeating-linear-gradient(to top, transparent, transparent 44px, #2c3e4f70 44px, #2c3e4f70 45px); }
.bar-group { width: 50px; height: 100%; display: flex; align-items: end; gap: 5px; position: relative; }
.bar { background: linear-gradient(0deg, #2a997c, #69ddba); border-radius: 3px 3px 0 0; width: 50%; }
.bar.pale { background: #355666; border-top: 1px solid #648c9e; }
.bar-group label { position: absolute; bottom: -21px; width: 100%; text-align: center; font-size: 10px; color: #a7b8cc; }
.chart-note { display: flex; justify-content: space-between; gap: 14px; margin-top: 22px; font-size: 10px; color: var(--muted); }
.chart-note strong { color: #8cddc4; font-weight: 500; }
.queue-item { display: flex; gap: 12px; align-items: center; padding: 17px 0; border-bottom: 1px solid #2b394b; }
.queue-item:last-child { border: 0; padding-bottom: 0; }
.queue-icon { background: #342d1d; color: #f1cd8b; border: 1px solid #5c4a2d; border-radius: 6px; width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; font-size: 16px; }
.queue-icon.green { background: #16392f; color: #8be5c5; border-color: #2b6250; }
.queue-item strong { font-size: 12px; }
.queue-item small { display: block; font-size: 10px; color: #a4b3c6; margin-top: 4px; line-height: 1.6; }
.queue-item button { margin-left: auto; min-height: 33px; padding: 6px 10px; font-size: 11px; }
.text-btn { border: 1px solid transparent; background: transparent; color: #80e8c6; font-size: 11px; padding: 5px 7px; min-height: 30px; }
.text-btn:hover { background: #1e3a34; border-color: #315e50; color: #a7f6dd; }

/* Workbenches and data tables */
.table-wrap { overflow: auto; scrollbar-width: thin; scrollbar-color: #4a5e75 #111a27; }
table { border-collapse: collapse; width: 100%; font-size: 12px; white-space: nowrap; text-align: left; }
th { font-size: 10px; color: #aebdd0; font-weight: 600; letter-spacing: .45px; text-transform: uppercase; text-align: left; padding: 13px; background: #0e1825; border-top: 1px solid #2b394b; border-bottom: 1px solid #344459; }
td { padding: 16px 13px; border-bottom: 1px solid #263548; color: #d7e1ed; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #19283a; }
.customer { display: flex; align-items: center; gap: 10px; }
.customer-logo { width: 31px; height: 31px; flex-shrink: 0; display: grid; place-items: center; border-radius: 6px; background: #24383d; border: 1px solid #3b5557; color: #b4dfd1; font-size: 10px; font-weight: 700; }
.customer small { display: block; color: #a0b0c4; font-size: 10px; margin-top: 4px; }
.pill { border: 1px solid #35644f; border-radius: 4px; padding: 4px 7px; background: #17382b; color: #a5e6bf; font-size: 10px; font-weight: 500; line-height: 1.5; display: inline-block; }
.pill.amber { background: #362c1b; border-color: #65512d; color: #f1cd8b; }
.pill.blue { background: #1b2d49; border-color: #3c587e; color: #b0ceff; }
.pill.gray { background: #253040; border-color: #45546b; color: #c2cedf; }
.amount { font-weight: 600; font-variant-numeric: tabular-nums; color: #f1f6fc; }
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; align-items: center; }
.toolbar input { flex: 1; min-width: 120px; padding: 11px 14px; }
.toolbar select { font-size: 12px; }
.notice { padding: 15px 17px; background: #122d29; border: 1px solid #2b5147; border-radius: 6px; color: #b9d7cd; font-size: 12px; line-height: 1.8; margin-bottom: 22px; }
.notice strong { color: #d3f4e8; }
.notice a { color: #8ce8c8; }
.match { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1.1fr); align-items: center; gap: 16px; margin: 18px 0; padding: 22px; border: 1px solid #344459; border-radius: 7px; background: #0f1a28; }
.match p { margin: 6px 0; color: var(--muted); font-size: 12px; }
.match-arrow { text-align: center; color: #7ab7a6; font-size: 24px; }
.match strong { font: 700 20px Manrope, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.match-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; }
.match-controls .pill { margin-right: auto; }
.workflow { display: grid; grid-template-columns: 40px 1fr auto; gap: 15px; padding: 24px 0; border-bottom: 1px solid var(--line); align-items: center; }
.step { height: 36px; width: 36px; background: #17332d; border: 1px solid #335c4d; border-radius: 6px; display: grid; place-items: center; color: #93e8c8; font-size: 12px; font-weight: 700; }
.workflow p { font-size: 12px; color: var(--muted); line-height: 1.7; }
.switch { background: #1f2c3d; color: #c0cddd; min-width: 100px; }
.switch.on { background: #17392d; color: #9ce4bf; border-color: #3a7258; }
.switch.on:hover { background: #21513d; }
.flow-labels { display: flex; flex-wrap: wrap; gap: 7px; }
.flow-labels span { font-size: 10px; background: #0f1a27; border: 1px solid #344459; border-radius: 4px; padding: 5px 8px; color: #b9c7d9; }
.aging { display: flex; flex-direction: column; gap: 20px; }
.aging-row { display: grid; grid-template-columns: 65px minmax(0, 1fr) 75px; gap: 15px; font-size: 11px; align-items: center; color: #bbc8d8; }
.aging-row strong { text-align: right; color: #e4edf7; font-variant-numeric: tabular-nums; }
.track { height: 10px; background: #26364a; border-radius: 3px; overflow: hidden; }
.track div { height: 100%; background: linear-gradient(90deg, #2c9d7d, #72dfb9); border-radius: 3px; }
.empty { text-align: center; padding: 35px; color: var(--muted); line-height: 1.8; }
.audit { margin-top: 20px; border-left: 2px solid #3e7664; padding-left: 16px; font-size: 12px; color: #afc0cc; line-height: 1.8; }
.audit div { margin-bottom: 9px; }

/* Detail dialogs and forms */
dialog { border: 1px solid #44556d; padding: 0; border-radius: 10px; width: min(640px, 94vw); max-height: 90dvh; background: #131e2c; color: var(--ink); box-shadow: 0 28px 100px #000a, 0 0 0 1px #0002; }
dialog::backdrop { background: #030811bd; backdrop-filter: blur(5px); }
.modal-head { padding: 23px 27px; border-bottom: 1px solid #344459; background: #172334; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.modal-head .eyebrow { margin-bottom: 6px; }
.modal-head button { flex-shrink: 0; min-width: 36px; padding: 7px; }
.modal-body { padding: 24px 27px; }
.modal-body .sub { margin: 9px 0 20px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin: 22px 0; }
.details-grid small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.details-grid strong { color: #f0f5fc; }
.details-grid select { width: 100%; }
.modal-body textarea { width: 100%; padding: 12px; min-height: 105px; line-height: 1.7; }
.modal-body label { display: block; font-size: 12px; margin-bottom: 8px; color: #cbd7e5; }
.modal-body input:not([type=checkbox]):not([type=file]) { width: 100%; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
#toast { position: fixed; right: 25px; bottom: 25px; max-width: min(420px, calc(100vw - 36px)); background: #173c31; border: 1px solid #4e987b; color: #e5fff4; padding: 14px 20px; border-radius: 7px; font-size: 12px; box-shadow: 0 8px 35px #0005; opacity: 0; transform: translateY(20px); transition: .2s; pointer-events: none; z-index: 9; }
#toast.visible { opacity: 1; transform: translateY(0); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* Client profiles and import workbench */
.client-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.3fr); gap: 24px; }
.client-grid label:not(.dropzone) { display: block; font-size: 12px; margin-bottom: 8px; }
.client-grid input:not([type=checkbox]):not([type=file]) { width: 100%; padding: 12px; margin-bottom: 15px; }
.client-grid select { width: 100%; }
.checkline { display: flex !important; align-items: flex-start; gap: 9px; margin: 15px 0 !important; color: #b5c7c7; line-height: 1.7; }
.checkline input { margin-top: 4px; flex-shrink: 0; }
.client-list { margin-top: 26px; display: grid; gap: 10px; }
.client-card { display: flex; text-align: left; align-items: center; gap: 11px; width: 100%; padding: 14px 12px; font-size: 12px; background: #111b29; }
.client-card small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 5px; }
.client-card > span:last-child { margin-left: auto; font-size: 10px; white-space: nowrap; color: #8ee5c8; }
.client-card.selected { border-color: #3c806b; background: #19332f; box-shadow: inset 3px 0 #6ce3bd; }
.client-card strong { overflow-wrap: anywhere; }
.template-links { display: flex; align-items: center; gap: 15px; margin: 14px 0; }
.template-links a, .notice a { font-size: 11px; color: #90e9cd; }
.schema-box { background: #0f1926; border: 1px solid #344459; border-radius: 6px; padding: 15px; font-size: 11px; color: #aebed0; line-height: 1.9; margin: 18px 0; }
.schema-box p { margin: 7px 0; }
.schema-box code { font-size: 10px; padding: 3px 5px; background: #203247; color: #bdd1e8; border-radius: 3px; display: inline-block; margin: 2px; }
.schema-box summary { cursor: pointer; color: #93e5cb; margin-top: 8px; }
.dropzone { display: flex; align-items: center; text-align: center; flex-direction: column; gap: 10px; padding: 26px 16px; border: 1px dashed #528371; border-radius: 7px; background: #10251f; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover { border-color: #85d9b9; background: #17352b; }
.dropzone > span { font-size: 11px; color: #adc9bf; }
.dropzone > .upload-icon { font-size: 26px; color: #7ee5c1; }
.dropzone input { font-size: 11px; max-width: 100%; margin-top: 8px; padding: 8px; background: #0c1b18; }
.error-box { background: #35221f; border: 1px solid #795047; color: #ffbfae; padding: 15px; border-radius: 6px; margin-top: 18px; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.error-box ul { padding-left: 20px; }
.form-error { font-size: 12px; color: #ffb59f; margin: 10px 0; }
#import-result { margin-top: 22px; }
.profile-summary { border: 1px solid #345448; background: #132920; border-radius: 7px; padding: 18px; }
.profile-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-summary h3 { font-size: 16px; overflow-wrap: anywhere; margin-bottom: 8px; }
.profile-summary-head button { white-space: nowrap; }
.profile-contact { display: grid; gap: 6px; margin: 12px 0; font-size: 12px; }
.profile-contact span { font-size: 11px; color: #adc1b9; overflow-wrap: anywhere; line-height: 1.7; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-details { margin-top: 18px; border-top: 1px solid #345448; padding-top: 14px; }
.profile-details summary { cursor: pointer; color: #91e6c4; font-size: 12px; }
.profile-details dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin: 18px 0 0; }
.profile-details dt { font-size: 10px; color: #a6bcb2; margin-bottom: 6px; }
.profile-details dd { font-size: 12px; margin: 0; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.unset { color: #a3b3bd; }
.profile-footnote { margin-top: 18px; font-size: 10px; }
.profile-dialog { width: min(760px, 94vw); max-height: 90dvh; }
.profile-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.wide { grid-column: 1 / -1; }
.profile-form-grid label { font-size: 12px; font-weight: 500; }
.profile-form-grid input, .profile-form-grid select { width: 100%; padding: 11px; min-width: 0; }
.profile-form-grid textarea { min-height: 90px; }
.profile-section { border-top: 1px solid #344459; padding-top: 20px; margin: 8px 0 0; }
.profile-section span { font: 400 10px 'DM Sans', Arial, sans-serif; color: var(--muted); margin-left: 10px; }
.required { color: #8ce6c5; }

/* Reference research and expanded reporting share the workspace action layer. */
.reference-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.reference-toolbar label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.reference-toolbar input { min-width: min(270px, 100%); font-size: 12px; }
.reference-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.reference-card { margin-top: 18px; padding: 20px; border: 1px solid #344459; border-radius: 7px; background: #0f1a28; }
.reference-card h3 { margin-bottom: 5px; font-size: 15px; overflow-wrap: anywhere; }
.reference-card .reference-toolbar button { border-color: #3b6c5c; color: #9ae9cb; background: #17352d; }
.reference-card .reference-toolbar button:hover { border-color: #64b294; background: #214c3e; }
.reference-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 12px; font-size: 11px; color: #b7c7d9; }
.reference-meta span { padding-left: 10px; border-left: 2px solid #3b7061; }
.notes-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; color: #bdcedd; line-height: 1.8; padding: 13px 15px; border: 1px solid #2b3b4e; border-radius: 5px; background: #0a1420; max-height: 190px; overflow: auto; margin: 14px 0 0; }
.reference-warning { padding: 12px 14px; background: #362c1b; border: 1px solid #65512d; border-radius: 5px; color: #f1cd8b; font-size: 12px; line-height: 1.7; }
#reference-note { min-height: 180px; }
#main .report-field input, #main .report-field select { background: var(--field); color: var(--ink); border-color: #344459; border-radius: 6px; }
#main .report-tabs button[aria-pressed="true"] { background: #17392e; color: #9ae9cb; border-color: #3c806b; box-shadow: inset 0 -2px #6ce3bd; }
#main .report-definitions summary { color: #cbd8e8; }
#main .report-definitions summary:hover { color: #8ce8c8; }
#main .report-group strong { color: #d7e3f0; }
@media (max-width: 700px) {
  .reference-toolbar { align-items: flex-start; gap: 12px; }
  .reference-toolbar label { width: 100%; flex-wrap: wrap; gap: 7px; }
  .reference-toolbar input { width: 100%; min-width: 0; }
  .reference-card { padding: 16px; }
  .reference-meta { gap: 10px; flex-direction: column; }
  .reference-card .reference-toolbar button { min-height: 42px; }
  #reference-note { min-height: 150px; }
}

/* Responsive layout keeps workbenches usable without shrinking financial data. */
@media (min-width: 1500px) {
  main { padding-top: 42px; }
  .chart { height: 220px; }
}
@media (max-width: 1250px) {
  .client-grid { grid-template-columns: 1fr; }
  .metric { padding: 18px; }
  .metric strong { font-size: 27px; }
}
@media (max-width: 1100px) {
  aside { width: 216px; padding: 25px 15px; }
  .shell { margin-left: 216px; }
  main { padding: 27px; }
  .metrics { gap: 10px; }
  .metric { padding: 16px; }
  .metric strong { font-size: 25px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .demo-banner, .cloud-status { padding-left: 27px; padding-right: 27px; }
  header { padding-left: 27px; padding-right: 27px; }
  .demo-banner { flex-wrap: wrap; gap: 7px 12px; }
  .demo-banner #mode-disclosure { flex-basis: 70%; flex-grow: 1; }
  footer { padding-left: 27px; padding-right: 27px; }
}
@media (max-width: 850px) and (min-width: 701px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { flex-wrap: wrap; }
  .toolbar input { flex-basis: 100%; }
  .match { grid-template-columns: minmax(0, 1fr); }
  .match-arrow { display: none; }
  .page-top { align-items: flex-start; }
}
@media (max-width: 700px) {
  .app { display: block; }
  aside { position: static; width: auto; padding: 18px 18px 10px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 17px 14px; overflow: visible; border-right: 0; border-bottom: 1px solid #344459; }
  .brand { font-size: 24px; gap: 9px; }
  .brand-sub { font-size: 5.5px; letter-spacing: .6px; }
  .mark { width: 37px; height: 39px; font-size: 25px; border-radius: 6px; flex-shrink: 0; }
  .workspace-label, .scope, .sidebar-bottom { display: none; }
  aside select { font-size: 11px; padding: 10px 8px; width: 100%; align-self: center; }
  nav { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 4px; overflow: auto; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: #3c5368 transparent; }
  nav a { flex-shrink: 0; min-height: 42px; padding: 9px 12px; font-size: 11px; gap: 6px; white-space: nowrap; }
  nav a.active { box-shadow: inset 0 -2px #6ce3bd; }
  .nav-icon { display: none; }
  .shell { margin-left: 0; }
  header { min-height: 48px; padding: 8px 18px; }
  .header-right { gap: 6px; font-size: 10px; justify-content: flex-start; }
  .header-right button { font-size: 10px; }
  .breadcrumb { display: none; }
  .divider { margin: 0 4px; }
  .demo-banner { padding: 11px 18px; font-size: 10px; gap: 7px; }
  .demo-banner > span { margin-right: 6px; }
  .demo-banner #mode-disclosure { flex-basis: 100%; font-size: 10px; order: 2; }
  .demo-banner button { margin-left: auto; font-size: 10px; }
  .cloud-status { padding: 9px 18px; font-size: 10px; }
  main { padding: 26px 18px; }
  .page-top { align-items: flex-start; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
  h1 { font-size: 25px; letter-spacing: -.7px; }
  h2 { font-size: 15px; }
  .page-top > button { font-size: 11px; padding: 9px 12px; min-height: 40px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { padding: 17px 14px; }
  .metric strong { font-size: 26px; }
  .metric small { font-size: 10px; }
  .metric-name { font-size: 10px; }
  .panel { padding: 18px; }
  .panel-top { flex-wrap: wrap; }
  .panel-top .text-btn { margin-left: -7px; }
  .chart { gap: 8px; height: 180px; padding-left: 5px; padding-right: 5px; }
  .chart-note { flex-wrap: wrap; gap: 5px; }
  .legend { font-size: 10px; }
  .queue-item { gap: 9px; }
  .queue-icon { width: 33px; height: 33px; }
  .queue-item strong { font-size: 11px; }
  .queue-item button { min-height: 38px; padding: 6px 9px; }
  .match { grid-template-columns: minmax(0, 1fr); padding: 17px; gap: 20px; }
  .match-arrow { display: none; }
  .match-controls { flex-wrap: wrap; }
  .toolbar { flex-wrap: wrap; gap: 10px; }
  .toolbar input { flex-basis: 100%; }
  .toolbar select { flex: 1; min-width: 0; max-width: 100%; font-size: 11px; padding: 10px; }
  .workflow { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .workflow > button { grid-column: 2; width: 110px; }
  .step { width: 30px; height: 30px; }
  .aging-row { grid-template-columns: 60px minmax(0, 1fr) 70px; gap: 10px; }
  .details-grid { gap: 15px; }
  .modal-body, .modal-head { padding: 20px; }
  dialog, .profile-dialog { max-height: 94dvh; }
  .modal-actions button { min-height: 42px; }
  footer { padding: 0 18px 20px; display: block; line-height: 1.9; }
  footer span { display: block; margin-top: 4px; }
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .template-links { flex-wrap: wrap; gap: 10px; }
  .profile-form-grid, .profile-details dl { grid-template-columns: minmax(0, 1fr); }
  .profile-summary-head { align-items: flex-start; }
  .profile-summary-head button { padding: 3px 5px; }
  #toast { bottom: 18px; right: 18px; }
}
@media (max-width: 380px) {
  aside { padding-left: 14px; padding-right: 14px; gap: 15px 10px; }
  main { padding-left: 14px; padding-right: 14px; }
  .brand { gap: 7px; font-size: 22px; }
  .brand-sub { font-size: 5px; }
  .metric strong { font-size: 21px; }
  .metric { padding: 15px 12px; }
  .panel { padding: 15px; }
  .details-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
/* Research queue controls remain readable as the workspace narrows. */
.research-filters { flex: 1 1 620px; display: grid; grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) minmax(140px, 1fr); }
.research-filters label { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.research-filters input, .research-filters select { width: 100%; min-width: 0; }
@media (max-width: 700px) { .research-filters { grid-template-columns: 1fr; flex-basis: 100%; width: 100%; } }

/* The switch stays outside the cloud controls, which the app rebuilds. */
header { flex-wrap: wrap; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; min-width: 0; margin-left: auto; }
.theme-switch { display: inline-flex; align-items: center; flex-shrink: 0; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--field); }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; min-width: 65px; padding: 5px 9px; border-color: transparent; background: transparent; color: var(--muted); font-size: 11px; }
.theme-switch button span { font-size: 15px; line-height: 1; }
.theme-switch button:hover { background: var(--surface-raised); color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: #1b3c33; border-color: #396e59; color: #9aefcf; box-shadow: 0 1px 3px #0002; }
.theme-switch button:focus-visible { position: relative; outline-offset: 2px; z-index: 1; }
@media (max-width: 700px) {
  .header-actions { width: 100%; gap: 8px 12px; justify-content: space-between; }
  .header-actions .header-right { flex: 1 1 150px; }
  .theme-switch { margin-left: auto; }
  .theme-switch button { min-height: 36px; }
}

/* Daylight palette. Dark declarations above remain the original defaults. */
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #192d40;
  --muted: #586c7e;
  --line: #d1dce4;
  --green: #116c50;
  --dark: #e7eef3;
  --light: #e3f4eb;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-raised: #eaf0f4;
  --field: #ffffff;
  --accent-fill: #147954;
  --amber: #865a10;
  --blue: #295f9d;
}
html[data-theme="light"] button:hover { background: #e0e9ee; border-color: #8da3b2; }
html[data-theme="light"] button:active { background: #d7e2e8; }
html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color: #6b7d8d; }
html[data-theme="light"] input:hover, html[data-theme="light"] select:hover, html[data-theme="light"] textarea:hover { border-color: #8da3b2; }
html[data-theme="light"] input::file-selector-button { border-color: #b6c7d1; }
html[data-theme="light"] .primary { color: #ffffff; }
html[data-theme="light"] .primary:hover { background: #106442; border-color: #106442; box-shadow: 0 0 0 3px #14795418; }
html[data-theme="light"] .primary:active { background: #0d5538; }
html[data-theme="light"] ::selection { background: #bce9d7; color: #143d2f; }
html[data-theme="light"] aside { background: #f9fbfc; border-color: #d1dce4; }
html[data-theme="light"] .brand { color: #16372e; }
html[data-theme="light"] .mark { background: #e1f3e9; border-color: #a1cdb6; color: #116c50; box-shadow: inset 0 1px #ffffff; }
html[data-theme="light"] .brand-sub, html[data-theme="light"] .workspace-label, html[data-theme="light"] .scope { color: #5b7081; }
html[data-theme="light"] aside select { background: #ffffff; border-color: #c4d3dd; }
html[data-theme="light"] nav a { color: #526879; }
html[data-theme="light"] nav a:hover { background: #eaf0f4; color: #203c4d; }
html[data-theme="light"] nav a.active { background: #e1f2e9; border-color: #b4d9c6; color: #0e6446; box-shadow: inset 3px 0 #238b65; }
html[data-theme="light"] .sidebar-bottom { border-color: #d1dce4; }
html[data-theme="light"] .avatar { background: #e5f0ee; border-color: #bdd4cc; color: #386452; }
html[data-theme="light"] .demo-pill { background: #fff5df; border-color: #e9d3a6; }
html[data-theme="light"] header { background: #ffffff; border-color: #d1dce4; }
html[data-theme="light"] .breadcrumb { color: #607588; }
html[data-theme="light"] .breadcrumb span { color: #8a9baa; }
html[data-theme="light"] .breadcrumb strong { color: #263f54; }
html[data-theme="light"] .header-right { color: #566c7e; }
html[data-theme="light"] .dot { background: #21855f; box-shadow: 0 0 0 3px #21855f12; }
html[data-theme="light"] .divider { background: #cddae3; }
html[data-theme="light"] .demo-banner { background: #fff8e9; color: #765f30; border-color: #eadab7; }
html[data-theme="light"] .demo-banner > span:first-child { color: #855c15; border-color: #e0c38d; }
html[data-theme="light"] .demo-banner button { color: #855c15; }
html[data-theme="light"] .demo-banner button:hover { background: #f6e9ca; border-color: #d8bd87; }
html[data-theme="light"] .cloud-status { background: #eaf0f5; color: #52697c; }
html[data-theme="light"] .cloud-status.connected { background: #e8f6ed; color: #216344; border-color: #b8dbc7; }
html[data-theme="light"] .cloud-status.error { background: #fff0eb; color: #9b3c27; border-color: #e7bcaf; }
html[data-theme="light"] .cloud-status.saving { background: #fff5df; color: #805d1c; border-color: #e4d0a8; }
html[data-theme="light"] footer { color: #627789; }
html[data-theme="light"] h1, html[data-theme="light"] h2, html[data-theme="light"] h3 { color: #192f43; }
html[data-theme="light"] .metric, html[data-theme="light"] .panel { box-shadow: 0 4px 16px #1d3c4c06; }
html[data-theme="light"] .metric { border-top-color: #bdcfdc; background: linear-gradient(120deg, #f5f9fc, #ffffff 65%); }
html[data-theme="light"] .metric:first-child { border-top-color: #5aa380; background: linear-gradient(120deg, #e8f5ed, #fcfffd 65%); }
html[data-theme="light"] .metric-name { color: #51697b; }
html[data-theme="light"] .metric-icon { color: #6a8395; }
html[data-theme="light"] .metric:first-child .metric-icon { color: var(--green); }
html[data-theme="light"] .metric strong { color: #193349; }
html[data-theme="light"] .metric small { color: #5c7183; }
html[data-theme="light"] .metric small b, html[data-theme="light"] .chart-note strong { color: #247552; }
html[data-theme="light"] .legend { color: #536c80; }
html[data-theme="light"] .legend b { background: #258c66; }
html[data-theme="light"] .legend .pale { background: #8daebe; }
html[data-theme="light"] .chart { border-color: #c6d6e0; background: repeating-linear-gradient(to top, transparent, transparent 44px, #d9e3ea 44px, #d9e3ea 45px); }
html[data-theme="light"] .bar { background: linear-gradient(0deg, #24875f, #6ebd98); }
html[data-theme="light"] .bar.pale { background: #9bbbc9; border-color: #7d9dab; }
html[data-theme="light"] .bar-group label { color: #5e7587; }
html[data-theme="light"] .queue-item { border-color: #d1dce4; }
html[data-theme="light"] .queue-icon { background: #fff3dc; color: #916113; border-color: #e7ce9d; }
html[data-theme="light"] .queue-icon.green { background: #e6f5ed; color: #247552; border-color: #b9d9c8; }
html[data-theme="light"] .queue-item small { color: #5c7386; }
html[data-theme="light"] .text-btn { color: #126b4e; }
html[data-theme="light"] .text-btn:hover { background: #e2f3ea; border-color: #b1d5c2; color: #0d573e; }
html[data-theme="light"] .table-wrap { scrollbar-color: #a8bdca #eef3f7; }
html[data-theme="light"] th { background: #f0f5f8; color: #506a80; border-color: #d1dce4; }
html[data-theme="light"] td { color: #314b60; border-color: #dbe4eb; }
html[data-theme="light"] tbody tr:hover td { background: #f2f7fa; }
html[data-theme="light"] .customer-logo { background: #e3efea; border-color: #b8d2c6; color: #38674f; }
html[data-theme="light"] .customer small { color: #5d7487; }
html[data-theme="light"] .pill { background: #e7f5ea; border-color: #b8d7c2; color: #2a6541; }
html[data-theme="light"] .pill.amber { background: #fff3db; border-color: #e4ce9f; color: #815b14; }
html[data-theme="light"] .pill.blue { background: #eaf2ff; border-color: #bfd2ee; color: #315f98; }
html[data-theme="light"] .pill.gray { background: #edf1f5; border-color: #cdd8e2; color: #52677d; }
html[data-theme="light"] .amount { color: #203e54; }
html[data-theme="light"] .notice { background: #ecf7f1; border-color: #bcd9c9; color: #406550; }
html[data-theme="light"] .notice strong { color: #23583e; }
html[data-theme="light"] .notice a, html[data-theme="light"] .template-links a { color: #126b4e; }
html[data-theme="light"] .match { background: #f7fafc; border-color: #cedde6; }
html[data-theme="light"] .match-arrow { color: #3b836b; }
html[data-theme="light"] .step { background: #e2f1e9; border-color: #b6d3c2; color: #326d50; }
html[data-theme="light"] .switch { background: #eaf0f4; color: #526b80; }
html[data-theme="light"] .switch.on { background: #e4f3e9; color: #286543; border-color: #acd0b9; }
html[data-theme="light"] .switch.on:hover { background: #d4ebdf; }
html[data-theme="light"] .flow-labels span { background: #f0f5f8; color: #516e83; border-color: #cad9e2; }
html[data-theme="light"] .aging-row { color: #526e82; }
html[data-theme="light"] .aging-row strong { color: #2a485d; }
html[data-theme="light"] .track { background: #e4edf1; }
html[data-theme="light"] .track div { background: linear-gradient(90deg, #24875f, #76bd9a); }
html[data-theme="light"] .audit { color: #516d7f; border-color: #85b7a2; }
html[data-theme="light"] dialog { background: #ffffff; border-color: #b6cbd8; box-shadow: 0 28px 100px #17334138, 0 0 0 1px #17334108; }
html[data-theme="light"] dialog::backdrop { background: #17334765; }
html[data-theme="light"] .modal-head { background: #f1f6f9; border-color: #d0dce5; }
html[data-theme="light"] .details-grid strong { color: #233f53; }
html[data-theme="light"] .modal-body label { color: #3e5a70; }
html[data-theme="light"] #toast { background: #e4f5eb; border-color: #91bfa8; color: #204f39; box-shadow: 0 8px 35px #14332421; }
html[data-theme="light"] .checkline { color: #4f6b60; }
html[data-theme="light"] .client-card { background: #f8fbfd; }
html[data-theme="light"] .client-card:hover { background: #edf5f7; }
html[data-theme="light"] .client-card > span:last-child { color: #2b7658; }
html[data-theme="light"] .client-card.selected { background: #e8f5ed; border-color: #9ec9b4; box-shadow: inset 3px 0 #2d8d64; }
html[data-theme="light"] .schema-box { background: #f2f7fa; border-color: #cbdbe5; color: #536f85; }
html[data-theme="light"] .schema-box code { background: #e4edf4; color: #375c7d; }
html[data-theme="light"] .schema-box summary { color: #296e53; }
html[data-theme="light"] .dropzone { background: #f0faf4; border-color: #87bca2; }
html[data-theme="light"] .dropzone:hover { background: #e5f5eb; border-color: #4b926c; }
html[data-theme="light"] .dropzone > span { color: #536f61; }
html[data-theme="light"] .dropzone > .upload-icon { color: #2d825b; }
html[data-theme="light"] .dropzone input { background: #ffffff; }
html[data-theme="light"] .error-box { background: #fff0eb; border-color: #e3b6a7; color: #98432c; }
html[data-theme="light"] .form-error { color: #a1402c; }
html[data-theme="light"] .profile-summary { background: #edf7f1; border-color: #b5d6c3; }
html[data-theme="light"] .profile-contact span { color: #536f61; }
html[data-theme="light"] .profile-details { border-color: #c2dbce; }
html[data-theme="light"] .profile-details summary { color: #296e53; }
html[data-theme="light"] .profile-details dt { color: #597666; }
html[data-theme="light"] .unset { color: #627a87; }
html[data-theme="light"] .profile-section { border-color: #d0dee6; }
html[data-theme="light"] .required { color: #1a7450; }
html[data-theme="light"] .reference-card { background: #f8fbfd; border-color: #d0dde6; }
html[data-theme="light"] .reference-card .reference-toolbar button { background: #e4f3eb; color: #276b4e; border-color: #b4d5c3; }
html[data-theme="light"] .reference-card .reference-toolbar button:hover { background: #d4ebdf; border-color: #8ebda5; }
html[data-theme="light"] .reference-meta { color: #557187; }
html[data-theme="light"] .reference-meta span { border-color: #76aa92; }
html[data-theme="light"] .notes-preview { background: #ffffff; color: #456177; border-color: #d3e0e9; }
html[data-theme="light"] .reference-warning { background: #fff4de; color: #815b14; border-color: #e4ce9f; }
html[data-theme="light"] #main .report-field input, html[data-theme="light"] #main .report-field select { border-color: #c4d5e0; }
html[data-theme="light"] #main .report-tabs button[aria-pressed="true"] { background: #e1f2e9; color: #176346; border-color: #9ec9b4; box-shadow: inset 0 -2px #2d8d64; }
html[data-theme="light"] #main .report-definitions summary { color: #3d5a71; }
html[data-theme="light"] #main .report-definitions summary:hover { color: #176c4b; }
html[data-theme="light"] #main .report-group strong { color: #38576f; }
html[data-theme="light"] .theme-switch { background: #f0f5f8; }
html[data-theme="light"] .theme-switch button:hover { background: #e1eaf0; color: #2d485e; border-color: transparent; }
html[data-theme="light"] .theme-switch button[aria-pressed="true"] { background: #ffffff; border-color: #b8cdd8; color: #155e43; box-shadow: 0 1px 3px #17334114; }
@media (max-width: 700px) {
  html[data-theme="light"] nav { scrollbar-color: #a8bdca transparent; }
  html[data-theme="light"] nav a.active { box-shadow: inset 0 -2px #238b65; }
}

.brand{font-size:25px}.brand-sub{font:600 9px/1.35 Arial,sans-serif;letter-spacing:.2px}.sample-tour{border:1px solid var(--line);border-radius:14px;padding:20px;background:var(--surface);margin:0 0 22px}.sample-tour-top{display:flex;gap:16px;justify-content:space-between;align-items:center}.sample-tour h2{margin:6px 0 8px;font-size:20px}.sample-tour p{max-width:720px}.sample-tour-links{display:flex;flex-wrap:wrap;gap:9px;margin-top:16px}.sample-tour-links a{padding:9px 12px;border:1px solid var(--line);border-radius:8px;font-size:12px;color:var(--ink);text-decoration:none}.sample-tour-links a:hover{border-color:var(--green);color:var(--green)}@media(max-width:650px){.sample-tour-top{display:block}.header-right{display:none}}
