    /* ---- Main content ---- */
    #main { flex: 1; min-width: 0; padding: 32px 44px; max-width: 900px; }
    /* ---- Shared layout primitives ----------------------------------------
       Three levels of heading, one box, one placeholder voice, one tab
       mechanic. Every view uses these; nothing defines its own. A new
       section is a .section-title plus a .card, whichever route it lands in.

       1. .page-title / .page-subtitle -- exactly one per view, says where you are
       2. .section-title               -- names the group directly below it
       3. .card + .card-head/.card-title/.card-subtitle -- one item in that group
    ------------------------------------------------------------------------ */
    .page-title { font-family: var(--font-title); font-size: var(--text-title); font-weight: 600; line-height: 1.15; color: var(--plum); margin: 0 0 4px; }
    .page-subtitle { font-size: var(--text-sm); color: var(--ink-2); margin: 0 0 20px; line-height: 1.5; }

    .section-title {
      font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700; color: var(--ink-2);
      text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
    }
    /* A section title that follows content needs air above it. Handled here
       so no call site has to remember a margin. */
    .card + .section-title, .tabpanel + .section-title, .section-body + .section-title { margin-top: 28px; }

    .card {
      background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
      box-shadow: var(--shadow-card); padding: 22px 26px; margin-bottom: 20px;
    }
    /* A card whose children are full-bleed rows rather than padded content. */
    .card-rows { padding: 0; }
    /* Rows inside a padded card line up with the card's own text. */
    .card:not(.card-rows) .activity-row { padding-left: 0; padding-right: 0; }
    .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
    .card-title { font-family: var(--font-sans); font-size: var(--text-md); font-weight: 700; color: var(--ink); margin: 0; }
    /* A rule's description is a sentence, not a name: a page of them in bold
       ruby read as aggressive (Kaycee, 2 Oct 2026). Black and regular weight,
       but it keeps the underline -- it still opens the rule, and a link must
       never rely on colour alone. Hover turns it ruby like any other link. */
    .card-title.rule-title { font-weight: 400; line-height: 1.45; }
    .rule-title .rh-link { color: var(--ink); text-decoration-color: rgba(0, 0, 0, 0.35); }
    .card-subtitle { font-size: var(--text-sm); color: var(--ink-2); margin-bottom: 14px; }

    .section-body { display: block; }
    /* All patients folds behind one row (Kaycee, 15 Oct 2026): closed by
       default so the page leads with Recent patients, and a search opens it.
       Inside, the list keeps its fixed window so a long practice can't push
       everything else off the page. */
    .all-patients > summary {
      list-style: none; display: flex; align-items: center; gap: var(--space-2);
      padding: var(--space-4) var(--space-6); cursor: pointer;
    }
    .all-patients > summary::-webkit-details-marker { display: none; }
    .all-patients > summary::before {
      content: "\203A"; display: inline-block; color: var(--ink-2); font-size: var(--text-lg);
      transition: transform var(--motion-fast);
    }
    .all-patients[open] > summary::before { transform: rotate(90deg); }
    .all-patients > summary:hover .card-title { color: var(--ruby); }
    .all-patients-count { margin-left: auto; font-size: var(--text-sm); color: var(--ink-2); }
    .all-patients-body { border-top: 1px solid var(--border); padding: var(--space-3) var(--space-6) var(--space-4); }
    .all-patients-sort {
      display: flex; align-items: center; gap: var(--space-2);
      font-size: var(--text-sm); color: var(--ink-2); margin-bottom: var(--space-3);
    }
    .all-patients-sort .row-input { width: auto; }
    #historyPatientList > .card {
      max-height: 440px; overflow-y: auto; margin-bottom: 0; box-shadow: none; border-radius: var(--radius-lg);
    }

    /* The one link treatment: ruby paired with an underline, never colour
       alone -- colourblind users and low-contrast displays lose a colour-only
       affordance. Reserved for names of objects you can open; nothing else
       borrows it. On a whole-row link the row is the click target and this is
       only the visual cue, so it is applied to a span, not a nested button. */
    .rh-link {
      color: var(--ruby);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
      text-decoration-color: rgba(163, 31, 61, 0.45);
      cursor: pointer;
    }
    button.rh-link { background: none; border: none; padding: 0; margin: 0; font: inherit; text-align: left; }
    .rh-link:hover, .history-row-link:hover .rh-link { color: var(--cherry); text-decoration-color: currentColor; }
    /* Keyboard focus is always visible. Some inputs drop their own outline for a
       border change; this ring comes back for them, and for buttons and rows. */
    :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
      outline: 2px solid var(--ruby); outline-offset: 2px;
    }
    .rh-link:focus-visible, .history-row-link:focus-visible {
      outline: 2px solid var(--ruby); outline-offset: 2px; border-radius: var(--radius-sm);
    }

    .empty-state { color: var(--ink-2); font-size: var(--text-sm); line-height: 1.6; }
    /* A first-time empty state may carry a title: what is missing, then what will appear. */
    .empty-state .empty-title { display: block; color: var(--ink); font-size: var(--text-md); font-weight: 700; }

    .tabpanel { display: none; }
    .tabpanel.active { display: block; }

    .btn {
      font-weight: 600; font-size: var(--text-sm); padding: 9px 16px; border-radius: var(--radius-md); border: 1px solid var(--border);
      background: var(--card); color: var(--ink);
    }
    .btn:hover:not(:disabled) { background: var(--border-soft); }
    .btn-primary { border: none; background: var(--ruby); color: var(--cream); }
    .btn-primary:hover:not(:disabled) { background: var(--ruby-hover); }
    /* Not btn-primary: ruby is this app's "go ahead" colour, and nothing here
       should read as encouraged. Garnet on --card is 11.7:1. */
    .btn-destructive { border-color: var(--garnet); color: var(--garnet); background: var(--card); }
    .btn-destructive:hover:not(:disabled) { background: rgba(107, 15, 30, 0.06); }
    .delete-claim { margin-top: 16px; }
    .delete-confirm-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
    .icon-btn {
      width: 26px; height: 26px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card);
      color: var(--ink-2); display: flex; align-items: center; justify-content: center; flex: none; padding: 0;
    }
    .icon-btn:hover:not(:disabled) { background: var(--border-soft); color: var(--garnet); }

    .status { margin-top: 10px; font-size: var(--text-sm); color: var(--ink-2); }
    .status.error { color: var(--garnet); font-weight: 600; }
    /* The one error pattern: what happened, what is safe, what to do, and a way
       to do it. Only the first line is garnet; the rest is ordinary reading. */
    .error-note { margin-top: 10px; font-size: var(--text-sm); line-height: 1.5; color: var(--ink-2); }
    .error-note .error-what { color: var(--garnet); font-weight: 600; }
    .error-note .btn { margin-top: 8px; }

