:root {
  color-scheme: light;
  --canvas: #edf2f6;
  --surface: #fff;
  --ink: #163045;
  --subtle: #4d6275;
  --border: #d3dfe8;
  --accent: #00675e;
  --accent-dark: #004d47;
  --accent-surface: #e5f3ef;
  --nav: #102737;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, sans-serif; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(1.65rem, 2vw + 1rem, 2.25rem); letter-spacing: -.035em; line-height: 1.13; overflow-wrap: anywhere; }
h2 { font-size: 1.13rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
a { color: var(--accent); text-underline-offset: .2em; }
.muted, small { color: var(--subtle); }
:focus-visible { outline: 3px solid #087c72; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 2; top: 8px; left: 8px; padding: 10px 16px; border-radius: 6px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.6px; }
.mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: #35c9b4; color: #102737; font-size: 1.25rem; }
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
aside { align-self: start; position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; max-height: 100vh; overflow: auto; background: var(--nav); padding: 26px 18px 20px; color: #fff; }
aside .brand { margin-bottom: 15px; }
aside small, aside .nav-label, aside .workspace-name { color: #b9d1df; overflow-wrap: anywhere; }
aside nav { display: grid; gap: 4px; margin: 22px 0; }
aside > button, .sidebar-footer button, aside nav button { background: transparent; color: #e5f0f7; border-color: transparent; text-align: left; }
aside nav button:hover, aside > button:hover, .sidebar-footer button:hover { background: #203e50; }
aside nav button[aria-current] { background: #234856; box-shadow: inset 3px 0 #56ddc2; color: #fff; }
aside :focus-visible { outline-color: #6be1cb; }
.sidebar-footer { margin-top: auto; }
.nav-label { font-size: .83rem; font-weight: 650; }
main { width: 100%; min-width: 0; max-width: 1530px; margin: 0 auto; padding: clamp(20px, 3vw, 42px); }
header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 24px; }
header h1, header h2 { margin-bottom: 6px; }
.panel, .login { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 3px 10px #16304509; padding: clamp(16px, 2vw, 26px); margin-bottom: 18px; }
.login { max-width: min(100% - 28px, 456px); margin: max(30px, 10vh) auto; padding: clamp(22px, 5vw, 38px); border-top: 4px solid var(--accent); }
.login .brand { margin-bottom: 34px; }
.login form { grid-template-columns: 1fr; margin-top: 24px; }
button { color: var(--ink); background: var(--surface); border: 1px solid #adc0ce; border-radius: 8px; padding: 8px 13px; min-height: 42px; font: inherit; font-weight: 640; cursor: pointer; }
button:hover { background: #eff5f9; border-color: #87a2b2; }
button:disabled { opacity: .57; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
form, .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
label { display: grid; gap: 5px; min-width: 0; font-weight: 640; }
input, select, textarea { width: 100%; max-width: 100%; min-width: 0; min-height: 42px; font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #a9bdca; border-radius: 8px; background: var(--surface); }
input[type=file] { padding: 6px; }
input[type=checkbox], input[type=radio] { width: 18px; min-height: 18px; margin: 2px 0; accent-color: var(--accent); }
textarea { min-height: 76px; }
.wide, form > .actions, fieldset { grid-column: 1 / -1; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0; padding: 12px; min-width: 0; }
legend { font-weight: 650; }
.line { margin-bottom: 10px; }
.scroll { overflow: auto; max-width: 100%; margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td { overflow-wrap: anywhere; }
th { background: #e9f0f5; font-size: .84rem; white-space: nowrap; }
tbody tr:nth-child(even) { background: #f7fafd; }
tbody tr:last-child td { border-bottom: 0; }
.notice { color: #a12624; white-space: pre-wrap; }
.notice:empty { display: none; }
.success { color: var(--accent); }
.loading { padding: 28px; }
.metric { display: block; background: #f5f9fb; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
a.metric:hover { background: var(--accent-surface); border-color: #76b5aa; }
.metric strong { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-note { margin: 12px 0 0; }
.dashboard-graphs summary { width: fit-content; cursor: pointer; font-weight: 650; }
.dashboard-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 28px; margin-top: 16px; }
.dashboard-bars { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.dashboard-bars li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; }
.dashboard-bars strong { font-variant-numeric: tabular-nums; }
.dashboard-bars progress { grid-column: 1 / -1; width: 100%; height: 10px; accent-color: var(--accent); }
.search { max-width: 340px; margin-bottom: 12px; }
.list-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.list-search input { flex: 1 1 170px; width: auto; max-width: 360px; }
.list-search .notice { flex: 1 1 100%; }
.pager { justify-content: flex-end; margin-top: 14px; }
.pager label, .check { display: flex; align-items: center; gap: 8px; }
.pager select { width: auto; }
.buckets { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.buckets a { display: inline-flex; align-items: center; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--ink); }
.buckets a:hover { background: var(--accent-surface); }
.buckets a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.form-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); margin: 12px 0; }
.form-boxes > div { padding: 8px; border: 1px solid var(--border); }
.form-boxes p { margin: 0; min-height: 1.5em; }

@media screen and (max-width: 900px) {
  .layout { display: block; }
  aside { position: static; min-height: 0; max-height: none; padding: 14px 16px; }
  aside .brand { margin-bottom: 5px; }
  aside nav { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
  aside nav button { white-space: nowrap; }
  header { flex-wrap: wrap; }
  form, .grid, .form-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { justify-content: flex-start; }
}
@media screen and (max-width: 460px) {
  main { padding: 16px 12px; }
  .login { padding: 22px; }
  form, .form-boxes { grid-template-columns: 1fr; }
  .panel.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 10px; }
  .metric strong { font-size: 1.3rem; }
}
@media (forced-colors: active) {
  aside nav button[aria-current], .buckets a[aria-current] { outline: 2px solid ButtonText; outline-offset: -2px; }
}
@media print {
  @page billing-report { size: letter landscape; margin: .42in; }

  aside, .print-actions, .skip-link, button, #content > section:has(form) { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .panel { padding: 10px; box-shadow: none; }
  .claim-sheet { break-after: page; }
  .claim-sheet:last-child { break-after: auto; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .scroll { overflow: visible; border: 0; margin-top: 0; }
  #content:has(#report-output.wide-print-report:not([hidden])) { page: billing-report; }
  #report-output.wide-print-report { padding: 0; border: 0; }
  #report-output.wide-print-report table { table-layout: fixed; }
  #report-output.wide-print-report :is(th,td) { font-size: 9pt; padding: 4px; white-space: normal; overflow-wrap: anywhere; }
}
/* The internal claim preview and the preprinted stock use separate print layouts. */
.cms-page {
  max-width: 900px; margin: 14px auto; padding: 22px;
  border: 1px solid #b88989; background: #fff; font: 13px Arial, sans-serif;
}
.cms-page header { align-items: start; }
.cms-page header p { max-width: 40%; }
.cms-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-left: 1px solid #ad6464; border-top: 1px solid #ad6464;
}
.cms-cell { padding: 5px 7px; border-right: 1px solid #ad6464; border-bottom: 1px solid #ad6464; min-height: 40px; overflow-wrap: anywhere; }
.cms-cell small, .cms-cell strong { display: block; }
.cms-cell small, .cms-page th { color: #864444; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.cms-page td, .cms-page th { padding: 6px; border: 1px solid #ad6464; }
.cms-page tbody tr { background: #fff; }
.cms-page footer { margin-top: 12px; color: #646464; }
.paper-claim { display: none; }

@media screen and (max-width: 460px) {
  .cms-page { padding: 12px; }
  .cms-page header p { max-width: none; }
}
@media print {
  @page stock { size: letter; margin: 0; }

  main:has(.cms-page) > header { display: none; }
  .cms-page { break-before: page; margin: 0; border: 0; padding: 0; }
  .cms-page:first-of-type { break-before: auto; }
  .cms-page .scroll { border-radius: 0; }

  body.print-stock #content { padding: 0; margin: 0; width: 100%; max-width: none; }
  body.print-stock .cms-page { display: none; }
  body.print-stock .paper-claim { display: block; page: stock; width: 8.5in; height: 11in; break-after: page; font: 9px monospace; fill: #000; }
  body.print-stock .paper-claim:nth-last-child(2), body.print-stock .paper-calibration { break-after: auto; }
  body.print-stock:not(.print-calibration) .paper-calibration,
  body.print-calibration .paper-claim:not(.paper-calibration) { display: none; }
}

.official-cms { position: relative; width: min(100%, 816px); aspect-ratio: 612 / 792; margin: 1rem auto; background: white; }
.official-cms > img, .official-cms > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.official-cms text { font-family: Courier, monospace; fill: black; }
.claim-picker { display: grid; gap: 6px; min-width: 0; }
.claim-additional { border-block: 1px solid var(--border, #ccd8dd); padding: 10px 0; }
.claim-additional > .grid, .line details > .grid { margin-top: 12px; }
.claim-additional summary, .line summary { cursor: pointer; font-weight: 650; }
.claim-diagnoses { display: grid; gap: 12px; min-width: 0; }
.claim-diagnoses p:empty, .code-library-search p:empty { display: none; }
.claim-diagnoses [data-code-results] .scroll { max-height: 18rem; overflow: auto; }
.claim-diagnoses details .actions { margin-top: 8px; }
.claim-notes { list-style: none; padding: 0; }
.claim-notes li { border-bottom: 1px solid var(--border, #ccd8dd); }
.claim-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
