/* C015/D1: last stylesheet. Semantic UI colors, without changing stored documents. */
:root {
  --a11y-focus:#082e28;
  --a11y-focus-gap:#ffffff;
}
/* Author display rules must not expose controls carrying the hidden attribute. */
[hidden]{display:none!important}
.sr-only {
  position:absolute!important;width:1px!important;height:1px!important;
  padding:0!important;margin:-1px!important;overflow:hidden!important;
  clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important;
}
/* Native date/time shadow fields may focus within the host without :focus-visible. */
/* A double ring retains a visible edge next to both light and dark controls. */
:focus-visible,
input:is([type="date"],[type="time"],[type="datetime-local"],[type="month"],[type="week"]):focus-within {
  outline:3px solid var(--a11y-focus)!important;
  outline-offset:2px!important;
  box-shadow:0 0 0 2px var(--a11y-focus-gap)!important;
}
/* The editor's inherited outline:none!important must not suppress keyboard focus.
   Inset ring cannot be clipped by the enclosing panel's overflow:hidden. */
.document-editor:focus-visible {
  outline:3px solid var(--a11y-focus)!important;
  outline-offset:-4px!important;
  box-shadow:inset 0 0 0 2px var(--a11y-focus-gap)!important;
}
/* CL01-C015D: D05 palette was audited only on the light scheme. Round 53 sets
   :root[data-theme="light"|"dark"] (navigation.js createVisualPreferences) and keeps
   its dark tokens in navigation.css; these overrides apply only to the light theme,
   or before the theme attribute exists when the system scheme is not dark. */
:root[data-theme="light"]{--muted:#505d52;--amber:#76521d;--rose:#873a32}
:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder{color:var(--muted);opacity:1}
:root[data-theme="light"] .nav-label,
:root[data-theme="light"] .study-label,
:root[data-theme="light"] .local-status,
:root[data-theme="light"] .eyebrow,
:root[data-theme="light"] .hero p,
:root[data-theme="light"] .stat-foot,
:root[data-theme="light"] th,
:root[data-theme="light"] .empty h3,
:root[data-theme="light"] .loading,
:root[data-theme="light"] .source-card .excerpt,
:root[data-theme="light"] .doc-footer,
:root[data-theme="light"] .doc-audit-note,
:root[data-theme="light"] .doc-inline-note,
:root[data-theme="light"] .message .sender,
:root[data-theme="light"] .fact p,
:root[data-theme="light"] .fact .source-line,
:root[data-theme="light"] .calendar-day.weekday,
:root[data-theme="light"] .calendar-day.muted,
:root[data-theme="light"] .notification p,
:root[data-theme="light"] .badge-outline{color:var(--muted);}
:root[data-theme="light"] .tag,
:root[data-theme="light"] .tag.neutral,
:root[data-theme="light"] .notice{color:#435b42}
:root[data-theme="light"] .tag.warn,
:root[data-theme="light"] .notice.warn{color:var(--amber)}
:root[data-theme="light"] .tag.error,
:root[data-theme="light"] .notice.error{color:var(--rose)}
:root[data-theme="light"] .calendar-event{color:#3e5937}
/* --muted is a foreground token, not a background token. */
:root[data-theme="light"] .med-notice{background:var(--soft);color:var(--ink)}
:root[data-theme="light"] .cap-suggestion small{opacity:1;color:var(--muted)}
@media not all and (prefers-color-scheme: dark) {
:root:not([data-theme]){--muted:#505d52;--amber:#76521d;--rose:#873a32}
:root:not([data-theme]) input::placeholder,
:root:not([data-theme]) textarea::placeholder{color:var(--muted);opacity:1}
:root:not([data-theme]) .nav-label,
:root:not([data-theme]) .study-label,
:root:not([data-theme]) .local-status,
:root:not([data-theme]) .eyebrow,
:root:not([data-theme]) .hero p,
:root:not([data-theme]) .stat-foot,
:root:not([data-theme]) th,
:root:not([data-theme]) .empty h3,
:root:not([data-theme]) .loading,
:root:not([data-theme]) .source-card .excerpt,
:root:not([data-theme]) .doc-footer,
:root:not([data-theme]) .doc-audit-note,
:root:not([data-theme]) .doc-inline-note,
:root:not([data-theme]) .message .sender,
:root:not([data-theme]) .fact p,
:root:not([data-theme]) .fact .source-line,
:root:not([data-theme]) .calendar-day.weekday,
:root:not([data-theme]) .calendar-day.muted,
:root:not([data-theme]) .notification p,
:root:not([data-theme]) .badge-outline{color:var(--muted);}
:root:not([data-theme]) .tag,
:root:not([data-theme]) .tag.neutral,
:root:not([data-theme]) .notice{color:#435b42}
:root:not([data-theme]) .tag.warn,
:root:not([data-theme]) .notice.warn{color:var(--amber)}
:root:not([data-theme]) .tag.error,
:root:not([data-theme]) .notice.error{color:var(--rose)}
:root:not([data-theme]) .calendar-event{color:#3e5937}
/* --muted is a foreground token, not a background token. */
:root:not([data-theme]) .med-notice{background:var(--soft);color:var(--ink)}
:root:not([data-theme]) .cap-suggestion small{opacity:1;color:var(--muted)}
}
.a11y-field-error{display:block;color:var(--rose);font-size:12px;margin:-8px 0 15px}
[aria-invalid="true"]{border-color:var(--rose)!important}
/* CL01-C015D: off-screen sidebar exclusion moved to accessibility.js syncMenu() (inert, geometric). */
@media(forced-colors:active){
  :focus-visible,.document-editor:focus-visible,input:is([type="date"],[type="time"],[type="datetime-local"],[type="month"],[type="week"]):focus-within{outline:3px solid Highlight!important;box-shadow:none!important}
  .a11y-field-error{color:CanvasText}
}

/* C015/D2: scoped reflow, motion and pointer-target layer. Load AFTER other UI CSS.
   Does not hide overflow to turn a failed layout into an apparent pass. */
body { overflow-wrap: anywhere; }
.workspace, #main, .page, .grid > *, .bench > *, .settings-layout > *,
.page-header > *, .section-top > *, .between > *, .hero > *,
.topbar > *, .top-actions > *, .breadcrumbs, .sidebar-foot > * {
  min-inline-size: 0;
}
.page, .modal, .modal-body, .access-card, .table-wrap, .panel, .field,
input, select, textarea { max-inline-size: 100%; }
.field, input, select, textarea { min-inline-size: 0; }
.topbar { height: auto; min-height: 73px; padding-block: 12px; flex-wrap: wrap; }
.top-actions, .breadcrumbs, .page-header, .section-top, .between,
.document-toolbar, .settings-nav, .panel-head, .cap-tabs { flex-wrap: wrap; }
.settings-nav { overflow: visible; }
.sidebar { max-inline-size: 100%; overflow-y: auto; }
.sidebar nav { min-block-size: 0; }
.sidebar .brand, .sidebar .new, .sidebar-foot { flex-shrink: 0; }
.nav-link, .study-label { white-space: normal; }
button, .btn { white-space: normal; overflow-wrap: anywhere; max-inline-size: 100%; }
/* 36 CSS px also leave room for a 24 px square in rounded targets. */
button, .btn, [role="button"], [role="tab"], summary,
a.row-link, a.linkish, a.nav-link, a.sidebar-foot, a.brand,
input:not([type="hidden"]), select, textarea {
  min-inline-size: 36px; min-block-size: 36px;
}
button.icon, .document-toolbar button { min-inline-size: 36px; min-block-size: 36px; height: auto; }
a.row-link, a.linkish { display: inline-flex; align-items: center; }
summary { cursor: pointer; padding-block: 6px; }
label.check { min-block-size: 36px; gap: 8px; }
input[type="checkbox"], input[type="radio"] {
  inline-size: 36px; block-size: 36px; min-inline-size: 36px; flex: 0 0 36px;
}
.actions { gap: 8px; }
pre, .code { white-space: pre-wrap; overflow-wrap: anywhere; max-inline-size: 100%; }
img, video, canvas, iframe { max-inline-size: 100%; }
/* Simple tables retain native table/header semantics; text and controls wrap. */
table { max-inline-size: 100%; }
caption { text-align: start; padding: 10px 14px; font-weight: 600; color: var(--ink); }
th, td { overflow-wrap: anywhere; }
.keyboard-help kbd { white-space: normal; }
.keyboard-help .check { margin-block: 16px; }
@media (max-width: 1000px) {
  .top-actions { gap: 8px; }
  .hero { gap: 12px; }
  .hero-art { display: none; } /* Decorative, already aria-hidden. */
}
@media (max-width: 850px) {
  .topbar { min-height: 63px; }
  .page-header, .section-top { align-items: flex-start; }
  .doc-select { width: 100%; max-width: 100%; }
  .doc-header, .encounter-head, .document-toolbar { flex-wrap: wrap; }
  .table-wrap > table, .card > table { table-layout: fixed; }
  th, td { padding: 8px 6px; }
  td .actions { gap: 6px; }
  /* Source measurements retain a labelled, focusable local scrolling region.
     This is an explicit 2D-data exception, NOT a claim of full no-scroll coverage. */
  .measurement-table table { table-layout: auto; }
}
@media (max-width: 520px) {
  .page-header { flex-direction: column; }
  .page { padding-inline: 12px; }
  .card-pad, .modal-body, .access-card { padding: 14px; }
  .grid.four { grid-template-columns: minmax(0, 1fr); }
  .modal-header, .modal-footer { gap: 8px; flex-wrap: wrap; }
  .access-card h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Patient directory titles are stand-alone links, not links embedded in prose. */
a.row-title { display: inline-flex; align-items: center; min-inline-size: 36px; min-block-size: 36px; }
