:root {
      color-scheme: light;
      --bg: #eef3f4;
      --panel: #ffffff;
      --ink: #101820;
      --muted: #58636b;
      --line: #d7dee0;
      --line-strong: #aebbc0;
      --surface: #f7faf9;
      --good: #08704f;
      --bad: #b02a37;
      --warn: #8a5a00;
      --accent: #007c89;
      --accent-dark: #004d56;
      --accent-soft: #e6f4f5;
      --brand-silver: #c7cdd1;
      --brand-black: #101820;
      --soft-good: #e5f4ee;
      --soft-bad: #fff0f1;
      --soft-warn: #fff7e6;
      font-family: Arial, Helvetica, sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        linear-gradient(180deg, #ffffff 0%, var(--bg) 260px, #f8faf9 100%);
      color: var(--ink);
      font-size: 15px;
    }

    main {
      width: min(1240px, calc(100% - 32px));
      margin: 0 auto;
      padding: 22px 0 34px;
    }

    header {
      border: 1px solid var(--line);
      border-top: 4px solid var(--accent);
      border-radius: 8px;
      background: #ffffff;
      box-shadow: 0 10px 28px rgba(16, 24, 32, 0.06);
      padding: 18px 20px;
      margin-bottom: 16px;
    }

    h1 {
      margin: 0 0 6px;
      font-size: clamp(25px, 3vw, 34px);
      line-height: 1.1;
      letter-spacing: 0;
      color: var(--brand-black);
    }

    h2 {
      margin: 0 0 12px;
      font-size: 15px;
      line-height: 1.2;
      letter-spacing: 0;
    }

    p {
      margin: 0;
      color: var(--muted);
      line-height: 1.5;
    }

    a {
      color: var(--accent);
    }

    .grid {
      display: grid;
      grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
      gap: 16px;
      align-items: start;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      box-shadow: 0 8px 24px rgba(16, 24, 32, 0.05);
    }

    label {
      display: block;
      font-weight: 700;
      margin-bottom: 7px;
    }

    input,
    textarea,
    select {
      width: 100%;
      border: 1px solid var(--line-strong);
      border-radius: 6px;
      color: var(--ink);
      background: #fff;
      font: inherit;
      padding: 11px 12px;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    input:focus,
    textarea:focus,
    select:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.14);
      outline: none;
    }

    input::placeholder,
    textarea::placeholder {
      color: #6a767d;
      opacity: 1;
    }

    .insurance-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .insurance-grid select {
      background: linear-gradient(180deg, #fff 0%, #f6faf9 100%);
      font-weight: 700;
    }

    .field-help {
      font-size: 13px;
      margin-top: 7px;
    }

    textarea {
      min-height: 230px;
      resize: vertical;
      line-height: 1.45;
    }

    .field {
      margin-bottom: 16px;
    }

    @media (max-width: 720px) {
      .insurance-grid {
        grid-template-columns: 1fr;
      }
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 12px;
    }

    button {
      border: 0;
      border-radius: 6px;
      cursor: pointer;
      font: inherit;
      font-weight: 700;
      min-height: 42px;
      padding: 10px 14px;
    }

    .primary {
      background: var(--accent);
      color: #fff;
    }

    .primary:hover {
      background: var(--accent-dark);
    }

    .danger {
      background: #a83232;
      color: #fff;
    }

    .danger:hover {
      background: #832525;
    }

    .secondary,
    .icon-button {
      background: #edf1f1;
      color: var(--ink);
    }

    .secondary:hover,
    .icon-button:hover {
      background: #dfe7e7;
    }

    .cpt-category-filter {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 8px;
    }

    .cpt-category-filter button {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f7faf9;
      color: #344448;
      font-size: 13px;
      font-weight: 700;
      min-height: 34px;
      padding: 7px 10px;
      transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .cpt-category-filter button:hover,
    .cpt-category-filter button:focus-visible,
    .cpt-category-filter button.active {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.11);
      outline: none;
    }

    .cpt-category-filter button.active {
      background: var(--accent-soft);
      color: var(--accent-dark);
    }

    .picker {
      display: grid;
      grid-template-columns: 1fr auto auto;
      gap: 8px;
      align-items: start;
      position: relative;
    }

    .combo {
      position: relative;
    }

    .cpt-menu {
      position: absolute;
      z-index: 20;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      max-height: 280px;
      overflow: auto;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      background: #fff;
      box-shadow: 0 14px 34px rgba(16, 24, 32, 0.14);
      padding: 6px;
    }

    .cpt-menu[hidden] {
      display: none;
    }

    .cpt-option {
      width: 100%;
      display: grid;
      gap: 2px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: var(--ink);
      text-align: left;
      padding: 8px 9px;
      min-height: auto;
      font-weight: 400;
    }

    .cpt-option:hover,
    .cpt-option.active {
      background: var(--accent-soft);
    }

    .cpt-option strong {
      font-size: 14px;
      line-height: 1.2;
    }

    .cpt-option span {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .cpt-option span b {
      color: #344448;
      font-weight: 700;
    }

    .cpt-empty {
      color: var(--muted);
      font-size: 13px;
      padding: 10px;
    }

    .selected-cpts {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }

    .selected-cpt {
      display: inline-grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 6px;
      align-items: center;
      max-width: 100%;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--surface);
      padding: 6px 7px 6px 9px;
    }

    .selected-cpt strong {
      display: block;
      font-size: 14px;
      margin-bottom: 1px;
    }

    .selected-cpt span {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .icon-button {
      min-height: 30px;
      width: 30px;
      padding: 0;
    }

    .summary {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
      margin-bottom: 12px;
    }

    .metric {
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      display: grid;
      justify-items: center;
      min-height: 64px;
      padding: 10px;
      background: var(--surface);
      color: var(--ink);
      text-align: center;
      width: 100%;
    }

    button.metric {
      cursor: pointer;
      font-weight: 700;
      min-height: auto;
    }

    .metric-filter {
      min-height: 64px;
      padding: 12px 10px;
      position: relative;
      transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    button.metric-filter span {
      color: inherit;
      font-size: 15px;
      line-height: 1.2;
    }

    .metric-filter:hover {
      transform: translateY(-1px);
    }

    .covered-filter {
      background: #e8f5ef;
      border-color: #9bcfbb;
      color: #07593f;
    }

    .denied-filter {
      background: #fff1f2;
      border-color: #e5a8af;
      color: #8f1f2d;
    }

    button.metric:hover,
    button.metric:focus-visible {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.13);
      outline: none;
    }

    .covered-filter:hover,
    .covered-filter:focus-visible,
    .covered-filter.active {
      border-color: var(--good);
      box-shadow: 0 0 0 3px rgba(20, 108, 67, 0.15);
    }

    .covered-filter.active {
      background: #d7eee4;
    }

    .denied-filter:hover,
    .denied-filter:focus-visible,
    .denied-filter.active {
      border-color: var(--bad);
      box-shadow: 0 0 0 3px rgba(176, 42, 55, 0.13);
    }

    .denied-filter.active {
      background: #f8dfe2;
    }

    .prior-auth-metric {
      gap: 3px;
      overflow: hidden;
    }

    .prior-auth-metric.pa-required {
      background: #fff8d7;
      border-color: #dfbd34;
      color: #5f4600;
    }

    .prior-auth-metric.not-covered {
      background: var(--soft-bad);
      border-color: #f1c2c8;
      color: var(--bad);
    }

    .prior-auth-metric.no-pa {
      background: #eef4f4;
      border-color: var(--line);
      color: #2f4448;
    }

    .prior-auth-metric.active {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.13);
    }

    .prior-auth-metric .metric-label {
      color: inherit;
      font-size: 13px;
      font-weight: 700;
      line-height: 1.1;
    }

    .metric strong {
      display: block;
      font-size: 24px;
      line-height: 1;
      margin-bottom: 4px;
    }

    .metric span {
      color: var(--muted);
      font-size: 13px;
    }

    .prior-auth-metric .metric-status {
      color: inherit;
      font-size: 15px;
      line-height: 1.15;
      margin-bottom: 0;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .prior-auth-metric .metric-action {
      color: inherit;
      font-size: 13px;
      font-weight: 700;
      line-height: 1.15;
      opacity: 0.8;
    }

    .table-wrap {
      max-width: 100%;
      overflow-x: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      -webkit-overflow-scrolling: touch;
    }

    .table-wrap[hidden] {
      display: none;
    }

    .mue-wrap {
      margin-top: 12px;
    }

    .mue-table-wrap {
      border-radius: 8px;
    }

    .mue-table {
      min-width: 520px;
    }

    .diagnosis-summary {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      margin-bottom: 12px;
      padding: 12px;
    }

    .diagnosis-summary.good {
      background: var(--soft-good);
      border-color: #b9dfca;
    }

    .diagnosis-summary.bad {
      background: var(--soft-bad);
      border-color: #f1c2c8;
    }

    .diagnosis-summary.warn {
      background: var(--soft-warn);
      border-color: #efd58e;
    }

    .diagnosis-summary.stacked {
      display: grid;
      gap: 12px;
      border: 0;
      background: transparent;
      padding: 0;
    }

    .diagnosis-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      padding: 12px;
    }

    .diagnosis-card.good {
      background: var(--soft-good);
      border-color: #b9dfca;
    }

    .diagnosis-card.bad {
      background: var(--soft-bad);
      border-color: #f1c2c8;
    }

    .diagnosis-card.warn {
      background: var(--soft-warn);
      border-color: #efd58e;
    }

    .diagnosis-summary strong {
      display: block;
      margin-bottom: 6px;
    }

    .diagnosis-summary ul {
      display: grid;
      gap: 8px;
      list-style: none;
      margin: 8px 0 0;
      padding: 0;
    }

    .diagnosis-summary li {
      border-top: 1px solid rgba(16, 24, 32, 0.12);
      padding-top: 8px;
    }

    .diagnosis-summary code {
      font-family: Consolas, "Courier New", monospace;
      font-weight: 700;
    }

    .prior-auth-notes {
      border-top: 1px solid rgba(16, 24, 32, 0.14);
      margin-top: 16px;
      padding-top: 14px;
    }

    .prior-auth-notes > strong {
      margin-bottom: 4px;
    }

    .prior-auth-notes > .muted {
      max-width: 920px;
    }

    .prior-auth-note-grid {
      display: grid;
      gap: 12px 14px;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      margin-top: 14px;
      align-items: start;
    }

    .prior-auth-note-grid > div {
      min-width: 0;
      height: 100%;
      border: 1px solid rgba(16, 24, 32, 0.1);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.54);
      padding: 11px 12px;
    }

    .prior-auth-note-grid > div > strong {
      margin-bottom: 7px;
      line-height: 1.25;
    }

    .prior-auth-note-grid ul {
      display: grid;
      gap: 6px;
      list-style: disc;
      margin: 0;
      padding-left: 18px;
    }

    .prior-auth-note-grid li {
      border-top: 0;
      padding-top: 0;
      margin-top: 0;
      line-height: 1.42;
    }

    .diagnosis-section {
      margin-top: 12px;
    }

    .diagnosis-section-title {
      display: block;
    }

    .cpt-diagnosis-section {
      border: 1px solid #9bcfbb;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.58);
      margin-top: 14px;
      overflow: hidden;
    }

    .cpt-diagnosis-section + .cpt-diagnosis-section {
      margin-top: 16px;
    }

    .cpt-diagnosis-section .diagnosis-section-title {
      background: #d7eee4;
      border-bottom: 1px solid #9bcfbb;
      color: #123f32;
      margin: 0;
      padding: 10px 12px;
    }

    .cpt-diagnosis-section.neutral {
      border-color: var(--line);
      background: #fff;
    }

    .cpt-diagnosis-section.neutral .diagnosis-section-title {
      background: var(--surface);
      border-bottom-color: var(--line);
      color: var(--ink);
    }

    .cpt-diagnosis-section.bad {
      border-color: #e1a9b0;
      background: rgba(255, 255, 255, 0.62);
    }

    .cpt-diagnosis-section.bad .diagnosis-section-title {
      background: #f8dfe2;
      border-bottom-color: #e1a9b0;
      color: #74242e;
    }

    .cpt-diagnosis-section.warn {
      border-color: #efd58e;
      background: rgba(255, 255, 255, 0.62);
    }

    .cpt-diagnosis-section.warn .diagnosis-section-title {
      background: #ffedc2;
      border-bottom-color: #efd58e;
      color: #6d5200;
    }

    .cpt-diagnosis-section ul {
      margin: 0;
      padding: 4px 12px 12px;
    }

    .summary-links {
      display: grid;
      gap: 10px;
      margin-top: 10px;
      font-size: 14px;
    }

    .review-group ul {
      margin-top: 6px;
    }

    table {
      width: 100%;
      min-width: 780px;
      border-collapse: collapse;
      font-size: 14px;
    }

    th,
    td {
      border-bottom: 1px solid var(--line);
      padding: 10px 8px;
      text-align: left;
      vertical-align: top;
    }

    tbody tr:last-child td {
      border-bottom: 0;
    }

    th {
      color: #344448;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0;
      background: var(--surface);
      position: sticky;
      top: 0;
      z-index: 1;
    }

    .article-row td {
      background: #e9f2f1;
      color: #253638;
      font-weight: 700;
      padding-top: 12px;
      padding-bottom: 12px;
    }

    .policy-reference {
      margin-top: 16px;
    }

    .policy-list {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 10px;
      margin-top: 12px;
    }

    .frequency-list {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 10px;
      margin-top: 12px;
    }

    .policy-item {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      padding: 12px;
    }

    .policy-item strong {
      display: block;
      margin-bottom: 4px;
    }

    .policy-item p {
      margin-bottom: 6px;
    }

    .policy-links {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      font-size: 14px;
    }

    .policy-icd-search {
      border-top: 1px solid var(--line);
      margin-top: 14px;
      padding-top: 14px;
    }

    .policy-icd-results {
      margin-top: 10px;
    }

    .policy-icd-count {
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 8px;
    }

    .policy-icd-list {
      display: grid;
      gap: 8px;
    }

    .policy-icd-match {
      display: grid;
      grid-template-columns: 96px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      padding: 9px 10px;
    }

    .policy-icd-match code {
      font-family: Consolas, "Courier New", monospace;
      font-weight: 700;
    }

    .policy-icd-match strong,
    .policy-icd-match span {
      display: block;
    }

    .policy-icd-match span {
      color: var(--muted);
      font-size: 13px;
      margin-top: 2px;
    }

    .frequency-item ul {
      display: grid;
      gap: 6px;
      margin: 8px 0 10px;
      padding-left: 18px;
    }

    .frequency-item li {
      line-height: 1.4;
    }

    .status {
      display: inline-block;
      border: 1px solid transparent;
      border-radius: 6px;
      font-weight: 700;
      padding: 4px 8px;
      white-space: nowrap;
    }

    .covered {
      background: var(--soft-good);
      border-color: #b9dfca;
      color: var(--good);
    }

    .denied {
      background: var(--soft-bad);
      border-color: #f1c2c8;
      color: var(--bad);
    }

    .warning {
      background: var(--soft-warn);
      border-color: #f0d89b;
      color: var(--warn);
    }

    .pa-required {
      background: #fff2a8;
      border-color: #e2c02d;
      color: #6d5200;
    }

    .not-covered {
      background: var(--soft-bad);
      border-color: #f1c2c8;
      color: var(--bad);
    }

    .no-pa {
      background: #eef4f4;
      border-color: var(--line);
      color: #2f4448;
    }

    .muted {
      color: var(--muted);
      font-size: 13px;
    }

    .empty {
      color: var(--muted);
      padding: 22px 8px;
      text-align: center;
    }

    @media (max-width: 820px) {
      .grid,
      .summary {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 1040px) and (min-width: 821px) {
      .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 500px) {
      main {
        width: min(100% - 20px, 1240px);
        padding-top: 18px;
      }

      .panel {
        padding: 12px;
      }

      .picker {
        grid-template-columns: 1fr;
      }

      .actions button {
        flex: 1 1 120px;
      }

      table,
      .mue-table {
        min-width: 0;
      }

      th,
      td {
        padding: 9px 7px;
        overflow-wrap: anywhere;
      }
    }

    /* Site footer with policy-data review date and disclaimer. */
    .site-footer {
      margin-top: 20px;
      padding: 14px 16px;
      border: 1px solid var(--line);
      border-top: 3px solid var(--brand-silver);
      border-radius: 8px;
      background: var(--surface);
    }

    .site-footer p {
      font-size: 13px;
    }

    .site-footer p + p {
      margin-top: 6px;
    }

    .site-footer strong {
      color: var(--ink);
    }

    /* Non-color cues: convey status with a symbol as well as color (accessibility). */
    .status::before {
      margin-right: 5px;
      font-weight: 700;
    }

    .status.covered::before,
    .status.no-pa::before {
      content: "\2713";
    }

    .status.denied::before,
    .status.not-covered::before {
      content: "\2715";
    }

    .status.warning::before,
    .status.pa-required::before {
      content: "\26A0";
    }

    .covered-filter span::before {
      content: "\2713\00a0";
    }

    .denied-filter span::before {
      content: "\2715\00a0";
    }

    /* Respect users who prefer reduced motion. */
    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
      }

      .metric-filter:hover {
        transform: none;
      }
    }

    /* Results panel header with the Print / Save-as-PDF action. */
    .results-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .results-head h2 {
      margin: 0;
    }

    #print-results {
      min-height: 34px;
      padding: 7px 12px;
      font-size: 13px;
      white-space: nowrap;
    }

    /* Prior authorization, grouped by status (most actionable first). */
    .pa-overview {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 4px 0 14px;
    }

    .pa-chip {
      font-size: 13px;
    }

    .pa-groups {
      display: grid;
      gap: 12px;
    }

    .pa-group {
      border: 1px solid var(--line);
      border-left: 4px solid var(--line-strong);
      border-radius: 8px;
      background: #fff;
      padding: 10px 12px;
    }

    .pa-group-not-covered {
      border-left-color: var(--bad);
    }

    .pa-group-pa-required {
      border-left-color: #dfbd34;
    }

    .pa-group-no-pa {
      border-left-color: var(--accent);
    }

    .pa-group-head {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }

    .pa-group-count {
      color: var(--muted);
      font-size: 13px;
      font-weight: 700;
    }

    .pa-group-list {
      list-style: none;
      margin: 0;
      padding: 0;
      display: grid;
      gap: 8px;
    }

    .pa-group-list > li {
      border-top: 1px solid rgba(16, 24, 32, 0.1);
      padding-top: 8px;
    }

    .pa-group-list > li:first-child {
      border-top: 0;
      padding-top: 0;
    }

    .pa-code {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: baseline;
    }

    .pa-code code {
      font-family: Consolas, "Courier New", monospace;
      font-weight: 700;
    }

    .pa-desc {
      font-size: 14px;
    }

    .pa-note {
      margin-top: 4px;
    }

    .pa-src {
      margin-top: 4px;
      font-size: 13px;
    }

    /* Print-only summary header (hidden on screen). */
    .print-header {
      display: none;
    }

    .print-header h2 {
      margin: 0 0 6px;
      font-size: 18px;
      color: var(--brand-black);
    }

    .print-header p {
      margin: 2px 0;
      font-size: 12px;
      color: #000;
    }

    /* Print / Save as PDF layout: keep the results, drop the input chrome. */
    @media print {
      body {
        background: #fff !important;
        color: #000;
        font-size: 11.5px;
      }

      main {
        width: 100%;
        margin: 0;
        padding: 0;
      }

      .grid {
        display: block;
      }

      header,
      form#checker-form,
      .summary,
      .site-footer,
      #print-results,
      .policy-icd-search,
      .cpt-menu {
        display: none !important;
      }

      .print-header {
        display: block !important;
        border-bottom: 2px solid var(--accent);
        padding-bottom: 8px;
        margin-bottom: 12px;
      }

      .panel {
        box-shadow: none !important;
        border: 1px solid #bbb;
        margin-bottom: 10px;
      }

      a {
        color: #000;
        text-decoration: none;
      }

      .pa-group,
      .pa-group-list > li,
      .diagnosis-card,
      .prior-auth-notes,
      .prior-auth-note-grid > div,
      .policy-item,
      .cpt-diagnosis-section {
        break-inside: avoid;
        page-break-inside: avoid;
      }
    }
