/* Roster Mapper's layout, scoped to .rm, for embedding in another page (an admin portal). A workbench:
 * header, then the rail (files and steps) beside the main pane, then a status bar that sticks to the bottom.
 * No fonts, and no colours of its own for text, buttons or inputs: those come from the page around it.
 * Lines and tints are the page's text colour, faded, so they suit a light or a dark page.
 * The page can set:
 *   --rm-accent  current step, header row, highlights (default: the browser's link colour)
 *   --rm-bg      its background, behind sticky table headers and the status bar (default: Canvas)
 *   --rm-max-width  the bench's width (default: none, the full width of its container)
 *   --rm-min-height its height, so the status bar sits at the bottom (default: 100vh)
 * Entity and result colours (provider, practice, billing; verified, warning, failed) carry meaning,
 * so they're fixed mid-tones, mixed with the background. */

.rm {
  --accent: var(--rm-accent, LinkText);
  --bg: var(--rm-bg, Canvas);
  --muted: color-mix(in srgb, currentColor 62%, transparent);
  --rule: color-mix(in srgb, currentColor 18%, transparent);
  --panel: color-mix(in srgb, currentColor 4%, var(--bg));
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --mapped: #2f8a55; --weak: #b7791f; --bad: #c2372f;
  --mapped-soft: color-mix(in srgb, var(--mapped) 14%, transparent);
  --weak-soft: color-mix(in srgb, var(--weak) 14%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 14%, transparent);
  --provider-ink: #3171b2; --practice-ink: #768d21; --billing-ink: #735eb5; --network-ink: #cb6120;
  --link: var(--rule); --link-lit: var(--muted);
  display: flex; flex-direction: column; min-height: var(--rm-min-height, 100vh); max-width: var(--rm-max-width, none); margin: 0 auto; padding: 0 16px;
}
.rm-bench { flex: 1; }
.rm, .rm * { box-sizing: border-box; }
.rm [hidden] { display: none !important; }
.rm :is(button, input, select, table) { font: inherit; }
.rm a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.rm code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.rm .muted { color: var(--muted); }
.rm .normal { font-weight: 400; }
.rm .small { font-size: 12px; }
.rm .hint { display: block; font-size: .85em; color: var(--muted); margin: .15rem 0 0; }
.rm .center { text-align: center; }
.rm h3 { font-size: 1em; margin: 20px 0 8px; }
.rm .warn { color: var(--weak); }
.rm-soon { font-size: .75em; font-weight: 400; border: 1px solid var(--rule); border-radius: 999px; padding: 0 .4em; color: var(--muted); vertical-align: 1px; }
.rm-badge { font-size: .85em; border: 1px solid var(--rule); border-radius: 999px; padding: 0 .6em; color: var(--muted); }
.rm .linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.rm .textlink { background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.rm .textlink:hover { color: inherit; }
.rm .tip { cursor: help; text-decoration: underline dotted var(--rule); text-underline-offset: 3px; }

/* Header */
.rm-top { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.rm-title { font-size: 1.1em; }
.rm-title a { color: inherit; text-decoration: none; }
.rm-title a:hover { color: var(--accent); }
.rm-top-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.rm-top .view-switch { margin: 0; }

/* The bench: rail and main pane side by side; one column on narrow screens */
.rm-bench { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 0; align-items: stretch; }
@media (max-width: 760px) { .rm-bench { grid-template-columns: minmax(0, 1fr); } }
.rm-main { padding: 1rem 0 1.5rem 1.5rem; min-width: 0; border-left: 1px solid var(--rule); }

/* Rail: new run, results, files, the open file's steps */
.rm-rail { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding: 1rem .75rem 1rem 0; font-size: 13px; }
@media (max-width: 760px) {
  .rm-rail { position: static; max-height: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .25rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
  .rm-rail > div { flex-basis: 100%; }
  .rm-rail :is(ul, ol) { display: flex; flex-wrap: wrap; }
  .rm-rail h4 { margin: .5rem 0 .2rem; }
  .rm-rail li small { display: none; }
  .rm-main { padding-left: 0; border-left: 0; }
}
.rm-rail h4 { margin: 1rem 0 .35rem; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rm-rail ul, .rm-rail ol { list-style: none; margin: 0; padding: 0; }
.rm-rail a { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-left: 2px solid transparent; border-radius: 0 4px 4px 0; color: inherit; text-decoration: none; cursor: pointer; }
.rm-rail a .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-rail .rail-new { margin-bottom: 2px; color: var(--accent); font-weight: 600; }
.rm-rail h4 span { font-weight: 400; letter-spacing: 0; }
.rm-rail a:hover { background: var(--panel); }
.rm-rail a[aria-current] { border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rm-rail a[aria-disabled] { pointer-events: none; opacity: .4; }
.rm-rail li small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.rm-rail li small.bad, .rm-rail li small .bad { color: var(--bad); }
.rm-rail li small .warn { color: var(--weak); }
.rm-rail li + li { margin-top: 2px; }
/* Status bar: progress and counts on the left, the step buttons on the right */
.rm-status { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; min-height: 2.75rem; padding: 6px 0; border-top: 1px solid var(--rule); background: var(--bg); font-size: 13px; }
.nav-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.rm-note { margin: 0 0 1rem; padding: .5rem .75rem; border-left: 3px solid var(--weak); background: var(--weak-soft); font-size: .9em; }
.rm-note[title] { cursor: help; }

/* How it works: one dialog for every step */
#how-dialog { max-width: 42rem; max-height: 85vh; padding: 1.25rem 1.5rem; border: 1px solid var(--rule); border-radius: .75rem; background: var(--bg); color: inherit; box-shadow: 0 10px 40px rgb(0 0 0 / .15); }
#how-dialog::backdrop { background: rgb(0 0 0 / .3); }
#how-dialog h2 { margin: 0 0 .75rem; font-size: 1.15em; }
#how-dialog section { padding: .4rem 0 .4rem .75rem; border-left: 3px solid transparent; }
#how-dialog section.on { border-color: var(--accent); }
#how-dialog h3 { margin: 0 0 .25rem; }
#how-dialog ul { margin: 0; padding-left: 1.1rem; }
#how-dialog li { margin-bottom: .25rem; }
#how-dialog form { text-align: right; margin-top: .75rem; }

/* Upload: the file and external sources on the left, the roster's settings on the right; the preview under both */
.step { margin-top: 0; }
.landing { max-width: 40rem; margin: 2rem auto 0; }
/* Sample rosters: cards to drag onto the drop zone */
.samples { margin: 1.25rem 0 0; }
.rm .samples-label { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 .5rem; }
.sample-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 8px; }
.sample-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); cursor: grab; user-select: none; font-size: 13px; transition: border-color .15s, transform .15s; }
.sample-card:hover, .sample-card:focus-visible { border-color: var(--accent); outline: none; transform: translateY(-1px); }
.sample-card:active { cursor: grabbing; }
.sample-card.dragging { opacity: .45; }
.sample-card b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sample-card small { grid-column: 2; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sample-ext { grid-row: span 2; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 600 10.5px ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.landing-options { display: flex; justify-content: center; align-items: center; gap: 10px 22px; flex-wrap: wrap; margin-top: 1.25rem; font-size: 13px; color: var(--muted); }
.landing-options .opt { display: inline-flex; align-items: center; gap: 8px; }
.rm .landing-options select { font-size: 13px; padding: 3px 6px; }
.landing-options .check { display: inline-flex; align-items: center; gap: 4px; color: inherit; cursor: pointer; }
.rm .landing-options .rm-button { font-size: 13px; padding: 3px 8px; }
.export-inputs { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.export-inputs label { display: inline-flex; align-items: center; gap: 6px; }
.export-inputs label span { font-size: 12.5px; color: var(--muted); }
.rm .export-inputs input { font-size: 13px; padding: 4px 8px; width: 12rem; }
.rm .theme { text-decoration: none; font-size: 15px; color: var(--muted); }
.rm fieldset { border: 0; margin: 0 0 1.5rem; padding: 0; min-width: 0; }
.rm legend { font-weight: 600; padding: 0; margin-bottom: .75rem; }
.rm fieldset.sources { margin-top: 2rem; }
.rm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.rm-field { display: grid; gap: .25rem; margin-bottom: .9rem; align-content: start; }
.rm-field :is(input, select) { width: 100%; }
.rm-check { display: grid; grid-template-columns: auto 1fr; gap: 0 .6rem; margin-bottom: .75rem; cursor: pointer; }
.rm-check[aria-disabled] { opacity: .55; cursor: not-allowed; }
.rm-button { display: inline-block; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.rm-button:hover { border-color: var(--accent); }
.filepick { display: inline-flex; align-items: center; gap: 8px; }
#drop { display: grid; place-items: center; gap: 4px; min-height: 14rem; padding: 2rem 1rem; text-align: center; border: 1.5px dashed var(--rule); border-radius: .75rem; background: var(--panel); cursor: pointer; }
#drop b { font-size: 1.1em; }
.drop-icon { color: var(--accent); }
#drop:hover, #drop.over { border-color: var(--accent); background: var(--accent-soft); }
#drop.target { border-color: var(--accent); }
#drop.loaded { min-height: 0; padding: .75rem 1rem; display: flex; justify-content: flex-start; text-align: left; gap: 10px; }
#drop.loaded .drop-icon { width: 18px; height: 18px; }
#drop.loaded b { font-size: 1em; }
#private-note { margin-top: .6rem; }
.sheets { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.sheets button { text-align: left; border-radius: 8px; }
.sheets button small { display: block; color: var(--muted); font-size: 12px; }
.sheets button.on { border-color: var(--accent); background: var(--accent-soft); }
.rm-caption { margin: 1.5rem 0 .4rem; font-size: .9em; }
#raw td { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
#raw td.rn { color: var(--muted); }
#raw tr:hover td { background: var(--panel); }
#raw tr.header td { background: var(--accent-soft); font-weight: 600; }

/* Tables */
.scroll { overflow: auto; border: 1px solid var(--rule); border-radius: 8px; }
.scroll.short { max-height: 360px; }
.scroll.tall { max-height: 560px; }
.rm table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rm :is(th, td) { padding: 6px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.rm th { color: var(--muted); font-weight: 400; background: var(--panel); position: sticky; top: 0; }
.rm tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }

/* Entity colours, shared by Map, Validate and Review: the ink, and the background tinted with it */
.rm :is(.fieldset, .cards, .entities) { --ink-kind: currentColor; --bg-kind: var(--panel); --line-kind: var(--rule); }
.rm .provider { --ink-kind: var(--provider-ink); }
.rm .practice { --ink-kind: var(--practice-ink); }
.rm .billing { --ink-kind: var(--billing-ink); }
.rm .network { --ink-kind: var(--network-ink); }
.rm :is(.fieldset, .cards, .entities):is(.provider, .practice, .billing, .network) {
  --bg-kind: color-mix(in srgb, var(--ink-kind) 9%, var(--bg)); --line-kind: color-mix(in srgb, var(--ink-kind) 28%, transparent);
}

/* Map: one table per entity in a two-column grid; one line of pills per field, one per candidate column */
.fieldsets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; align-items: start; }
@media (max-width: 760px) { .fieldsets { grid-template-columns: 1fr; } }
.fieldset { margin: 0 0 12px; }
.fieldset h3 { color: var(--ink-kind); margin: 8px 0 6px; }
.fieldset h3 .muted { font-weight: 400; font-size: 13px; }
.fieldset .scroll { border-color: var(--line-kind); }
.fieldset table { width: 100%; }
.fieldset td { padding: 4px 8px; font-size: 13px; }
.fieldset td:first-child { white-space: nowrap; width: 1%; background: var(--bg-kind); }
.fieldset td:last-child { width: 1%; text-align: right; }
.fieldset tr > td.cands { width: 100%; max-width: 0; text-align: left; } /* beats td:last-child above */
.fieldset td.cands .values { max-width: 100%; }
.fieldset td.cands .values.bad { color: var(--bad); }
.fieldset .ent { color: var(--ink-kind); opacity: .75; }
.fieldset b { font-weight: 600; }
.fieldset .values { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.fieldset tr.missing-required td, .fieldset tr.missing-required td b { color: var(--bad); }
.fieldset tr.empty td b { color: var(--muted); font-weight: 500; }
.fieldset tr:hover .pill.any, .fieldset tr.missing-required .pill.any, .fieldset tr.empty .pill.any { visibility: visible; }
.pills { display: flex; flex-wrap: nowrap; overflow: hidden; align-items: center; gap: 4px; }
.pills.open { flex-wrap: wrap; }
.pills .pill { flex-shrink: 0; }
.rm :is(.pill, .chip) { font-size: 12px; line-height: 18px; border: 1px solid var(--rule); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 0 8px; cursor: pointer; white-space: nowrap; }
.rm :is(.pill, .chip):hover { color: inherit; border-color: var(--muted); }
.pill .lt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; opacity: .6; margin-right: 5px; }
.pill .sc { font-size: 10px; font-variant-numeric: tabular-nums; opacity: .55; margin-left: 6px; }
.rm .pill.on { background: var(--bg-kind); border-color: var(--ink-kind); color: inherit; cursor: default; }
.pill .x { display: none; margin-left: 6px; color: var(--muted); cursor: pointer; }
.pill.on:hover .x { display: inline; }
.pill .x:hover { color: var(--bad); }
.rm .pill:is(.more, .any, .pen) { padding: 0 7px; }
.pill.any { visibility: hidden; }
.pill.hint { margin-left: -2px; }
.pill.value { cursor: pointer; }
.rm .pill.nodata, .rm .pill.nodata:hover, .rm .pill.on.nodata { font-style: italic; color: var(--weak); }
/* Map: the input for one value for every row, in place of the value pill while editing */
.rm .const { font-size: 12px; line-height: 18px; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed var(--ink-kind); border-radius: 0; padding: 0 2px; width: 12em; flex-shrink: 0; }
.const::placeholder { color: var(--muted); }
.const:hover { border-bottom-color: var(--muted); }
.const:focus { outline: none; border-bottom-color: var(--ink-kind); }
.rm .const.date, .rm select.const { width: auto; }
.editor { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.rm .colpick { font-size: 11px; color: var(--muted); background: transparent; border: 0; padding: 0; cursor: pointer; width: 6.5em; } /* a select sizes to its longest option */
.values .bad { color: var(--bad); margin-left: 6px; }
.others { margin: 6px 0 0; font-size: 13px; line-height: 1.9; }
.rm .pen { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; opacity: .7; }
.rm .pen:hover { opacity: 1; color: inherit; }
/* Map: columns not mapped */
details.unmapped { margin: 8px 0 0; }
details.unmapped summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.colgroups { display: grid; gap: 10px; }
.colgroup h4 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.rm .chips .chip { color: inherit; }
.chips .chip .col { margin-right: 5px; }
.rm .chip.fam { background: var(--panel); }
.rm .chip.suggest { border: 1px dashed var(--weak); background: var(--weak-soft); color: var(--weak); }
.chipwrap { display: inline-flex; align-items: center; }
/* Column letters: a small tag, so they don't read as part of the header */
.col { display: inline-block; min-width: 22px; margin-right: 8px; padding: 0 4px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--muted); font-size: 11px; text-align: center; vertical-align: 1px; }
.score { display: inline-block; border-radius: 4px; padding: 0 6px; border: 1px solid var(--rule); white-space: nowrap; }
.score.override { border-color: var(--accent); color: var(--accent); }
.score[title], .status[title] { cursor: help; }
.status { border-bottom: 1px dotted var(--muted); }
.sample { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px; margin: 0 4px 3px 0; }

/* Switches between views (Graph | Table, Results' tabs, sheet tabs) */
.view-switch { display: inline-flex; margin: 0 0 12px; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.rm .view-switch button { font-size: 13px; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 4px 12px; cursor: pointer; }
.rm .view-switch button + button { border-left: 1px solid var(--rule); }
.rm .view-switch button.on { background: var(--accent-soft); color: inherit; }
.rm .more { border: 0; background: none; font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px 0 0; text-decoration: underline; }

/* Checks on Review's cards: one mark per card, problem values highlighted with their result */
.mark { display: inline-block; width: 1.2em; font-weight: 700; cursor: help; }
.mark.ok { color: var(--mapped); }
.mark.suggest, .mark.warn { color: var(--weak); }
.mark.fail { color: var(--bad); }
.mark.skip { color: var(--muted); }
.v { border-radius: 3px; padding: 0 3px; margin: 0 -1px; cursor: help; }
.v.ok, .v.filled { background: var(--mapped-soft); color: var(--mapped); }
.v.suggest, .v.warn { background: var(--weak-soft); color: var(--weak); }
.v.fail { background: var(--bad-soft); color: var(--bad); }
.rm .drop { font-size: 11px; color: var(--bad); }
.rm .use { font-size: 12px; border: 1px solid var(--rule); background: transparent; color: inherit; border-radius: 4px; padding: 0 6px; cursor: pointer; }
.rm .use:hover { border-color: var(--accent); }

/* Review: the file's name, totals and actions; its sheets as tabs (× ignores one); the open sheet's
 * figures and Graph | Table; then the graph or table and the issues */
.file-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 10px; }
.file-head h2 { margin: 0; font-size: 1.2em; line-height: 1.3; overflow-wrap: anywhere; }
.file-head p { margin: 2px 0 0; }
.file-actions { display: flex; align-items: center; gap: 16px; }
.rm .file-actions .textlink { font-size: 13.5px; color: inherit; text-decoration-color: var(--rule); }
.rm .file-actions .textlink:hover { text-decoration-color: var(--accent); }
.rm .tabs { display: flex; gap: 2px; margin: 0 0 12px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.rm .tabs button { display: inline-flex; align-items: baseline; gap: 5px; flex-shrink: 0; margin-bottom: -1px; padding: 6px 12px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-size: 13px; white-space: nowrap; cursor: pointer; }
.rm .tabs button:hover { color: inherit; }
.rm .tabs button.on { border-bottom-color: var(--accent); color: inherit; font-weight: 600; }
.sheet-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 12px; }
.sheet-bar .view-switch { margin: 0 0 0 auto; }
.rm dl.stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 11.5px; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.15em; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stats .bad dd { color: var(--bad); }
.stats .warn dd { color: var(--weak); }
.stats :is(.provider, .practice, .billing) dt { color: var(--ink-kind); }
.issues-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.issues-head #bulk { font-weight: 400; }
.rm .sheet-tabs small { font-size: 11px; font-variant-numeric: tabular-nums; }
.rm .sheet-tabs .x { color: var(--muted); visibility: hidden; padding: 0 2px; }
.rm .sheet-tabs button:hover .x, .rm .sheet-tabs button.ignored .x { visibility: visible; }
.rm .sheet-tabs .x:hover { color: inherit; }
.rm .sheet-tabs button.ignored { text-decoration: line-through; opacity: .6; }
.rm input.fix { font-size: 13px; padding: 1px 6px; min-width: 16ch; }
/* A card's address, open to edit: line 1 and 2 full width, then city, state and ZIP */
.rm .addr-form { padding-top: 4px; }

/* Download: what the workbook will hold, to confirm */
#download-dialog { width: min(900px, 94vw); }
#download-dialog h4 { margin: 14px 0 6px; font-size: 13px; }
#download-dialog .scroll { max-height: 28vh; }
#download-dialog td { white-space: nowrap; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
#download-dialog td.num, #download-dialog th.num { text-align: right; font-variant-numeric: tabular-nums; }
#download-dialog tr.off td { color: var(--muted); text-decoration: line-through; }
#download-dialog tr.off td:first-child { text-decoration: none; }
#send-confirm { white-space: nowrap; }
#send-note { margin: 6px 0 0; text-align: right; }
#send-note.bad { color: var(--bad); }
.dialog-foot { position: sticky; bottom: -1.25rem; display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 14px 0 0; padding: 10px 0 1.25rem; background: var(--bg); border-top: 1px solid var(--rule); }
.addr-grid { display: grid; grid-template-columns: 1fr 4em 6em; gap: 4px 6px; margin-bottom: 6px; }
.addr-grid label { display: grid; gap: 1px; }
.addr-grid label span { font-size: 11px; color: var(--muted); }
.addr-grid label:is(.address_1, .address_2) { grid-column: 1 / -1; }
.rm .addr-grid input { width: 100%; min-width: 0; font-size: 12.5px; padding: 2px 5px; }
.rm .addr-grid input.wrong { border-color: var(--weak); }

/* Mapping and Raw data: dialogs over the file's page */
.rm dialog.rm-dialog { width: min(1180px, 94vw); max-height: 90vh; padding: 0 1.25rem 1.25rem; border: 1px solid var(--rule); border-radius: .75rem; background: var(--bg); color: inherit; box-shadow: 0 10px 40px rgb(0 0 0 / .15); }
.rm dialog.rm-dialog::backdrop { background: rgb(0 0 0 / .3); }
.dialog-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; margin-bottom: 8px; background: var(--bg); border-bottom: 1px solid var(--rule); }
.dialog-bar form { margin: 0; }
#raw-dialog .scroll { max-height: 70vh; }

/* Review: table of provider × location × billing, and the same links as a graph */
.chains th { font-weight: 600; font-size: 13px; }
.rm .chains th:is(.provider, .practice, .billing) { color: var(--ink-kind); background: color-mix(in srgb, var(--ink-kind) 9%, var(--bg)); }
.chains td { font-size: 13px; line-height: 1.4; }
.chains td b { display: block; font-weight: 600; }
.chains td > span { display: block; font-size: 12px; color: var(--muted); }
.chains td > b .mark { font-size: 13px; }
.graph { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 56px; max-height: 680px; overflow: auto; padding: 0 2px 12px; border-top: 1px solid var(--rule); }
#links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
#links path { fill: none; stroke: var(--link); stroke-width: 1; }
#links path.lit { stroke: var(--link-lit); stroke-width: 1.5; }
.graph.focus #links path:not(.lit) { opacity: .25; }
.entities { margin: 0; }
.entities h4 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 10px 0 8px; background: var(--bg); font-size: 13px; font-weight: 400; color: var(--ink-kind); }
.entities h4 span { color: var(--muted); }
.entities > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.entities > ul > li { background: var(--bg-kind); border: 1px solid var(--line-kind); border-radius: 5px; padding: 4px 8px; cursor: pointer; font-size: 12px; line-height: 1.35; }
.entities > ul > li > b { display: block; font-weight: 600; }
.entities > ul > li > span { display: block; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.entities > ul > li .links-line { display: none; }
.entities > ul > li .issues { color: var(--weak); }
.entities > ul > li dl { display: none; margin: 8px 0 0; font-size: 12px; }
.entities > ul > li.selected dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.entities > ul > li dt { color: var(--muted); }
.entities > ul > li dd { margin: 0; overflow-wrap: anywhere; }
.entities > ul > li.lit { border-color: var(--ink-kind); }
.entities > ul > li.selected { box-shadow: 0 0 0 1px var(--ink-kind); }
.graph.focus .entities > ul > li:not(.lit) { opacity: .45; }
/* One column on narrow screens: no lines, each card lists its connections instead. */
@media (max-width: 760px) {
  .graph { grid-template-columns: 1fr; max-height: none; overflow: visible; }
  #links { display: none; }
  .entities > ul > li .links-line { display: block; }
}

/* Review: validation inside the cards; problems under each card (in the graph, only on the pinned card) */
.rm .none { font-style: italic; color: var(--weak); }
.rm a.npi { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
.rm a.npi:hover { text-decoration-color: currentColor; }
.rm a.npi .arrow { display: inline-block; margin-left: 2px; font-size: .85em; opacity: 0; transition: opacity .15s; } /* inline-block: no underline under it */
.rm a.npi:hover .arrow, .rm a.npi:focus-visible .arrow { opacity: .7; }
.rm ul.fixes { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px solid var(--rule); font-size: 12px; color: inherit; }
.rm ul.fixes li, .rm ul.inline li { margin-bottom: 3px; }
.rm :is(ul.fixes, ul.inline) li.fail { color: var(--bad); }
.rm :is(ul.fixes, ul.inline) li.warn { color: var(--weak); }
.rm :is(ul.fixes, ul.inline) b { display: inline; }
.rm ul.fixes ul { list-style: none; padding-left: 10px; margin: 2px 0 0; }
.rm ul.inline { list-style: none; margin: 2px 0 4px; padding: 0; }
.entities > ul > li ul.fixes { display: none; }
.entities > ul > li.selected ul.fixes { display: block; }
#issues .use { margin-left: 4px; }
#issues :is(.ent-provider, .ent-practice, .ent-billing) { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
#issues .ent-provider { color: var(--provider-ink); }
#issues .ent-practice { color: var(--practice-ink); }
#issues .ent-billing { color: var(--billing-ink); }
.fieldset tr.flash td { background: var(--accent-soft); transition: background .3s; }
.entities > ul > li.flash { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .3s; }
#issues a[data-show] { color: inherit; }

/* Results: the workbook's tables, one tab at a time, with a filter */
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: 0 0 12px; }
.rm details { margin-top: 1rem; }
.rm details > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.rm table.results td.num, .rm table.results th.num { text-align: right; }
.rm table.results .bad { color: var(--bad); }
#results-filter { margin-left: auto; width: 14rem; }
.rm table.results td { font-size: 13px; }
.rm table.results td.long { min-width: 18rem; }
