/* Shared look for the SyncMAX XER tools. Scoped to .xer-tool (the root of #xer-health and #xer-milestones).
   Uses only site tokens, so light and dark themes follow html[data-mode]. */
.xer-tool { display: grid; gap: 18px; min-width: 0; }
.xer-tool * { min-width: 0; }
.xer-tool .xer-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: clamp(16px, 2.4vw, 28px); }
.xer-tool .xer-small { font-size: .86rem; color: var(--ink-soft); }
.xer-tool .xer-mono { font-family: var(--f-mono); }
.xer-tool .vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.xer-tool button { font-family: inherit; }
.xer-tool .btn:focus-visible, .xer-tool button:focus-visible, .xer-tool select:focus-visible, .xer-tool input:focus-visible, .xer-tool a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* intake */
.xer-tool .xer-intake { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); align-items: stretch; }
.xer-tool .xer-start { display: grid; gap: 16px; align-content: start; }
.xer-tool .xer-start h3 { font-size: 1.15rem; }
.xer-tool .xer-drop { position: relative; display: grid; gap: 6px; justify-items: center; text-align: center; padding: 22px 18px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: 12px; background: var(--surface); transition: border-color .2s, background .2s; }
.xer-tool .xer-drop.is-drag { border-color: var(--amber); background: var(--amber-soft); }
.xer-tool .xer-drop:focus-within { border-color: var(--amber); }
.xer-tool .xer-drop svg { width: 34px; height: 34px; stroke: var(--brand); }
.xer-tool .xer-drop strong { font-size: 1rem; }
.xer-tool .xer-drop .xer-pick { margin-top: 4px; }
.xer-tool .xer-drop:focus-within .xer-pick { outline: 3px solid var(--amber); outline-offset: 2px; }
.xer-tool .xer-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.xer-tool .xer-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; font-size: .92rem; }
.xer-tool .xer-facts li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.xer-tool .xer-facts svg { width: 20px; height: 20px; stroke: var(--amber); margin-top: 2px; }
.xer-tool .xer-facts b { display: block; font-weight: 650; }
.xer-tool .xer-facts span { color: var(--ink-soft); font-size: .86rem; }
@media (max-width: 820px) { .xer-tool .xer-intake { grid-template-columns: 1fr; } }

/* status / alerts */
.xer-tool .xer-status:empty { display: none; }
.xer-tool .xer-alert { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: .93rem; }
.xer-tool .xer-alert + .xer-alert { margin-top: 8px; }
.xer-tool .xer-alert::before { font-family: var(--f-mono); font-weight: 700; font-size: .78rem; padding: 2px 7px; border-radius: 4px; background: var(--tint); color: var(--ink); }
.xer-tool .xer-alert.is-error { border-color: var(--crit); background: color-mix(in srgb, var(--crit) 9%, var(--paper)); }
.xer-tool .xer-alert.is-error::before { content: "ERROR"; background: var(--crit); color: #fff; }
.xer-tool .xer-alert.is-warn { border-color: var(--amber); background: var(--amber-soft); }
.xer-tool .xer-alert.is-warn::before { content: "NOTE"; background: var(--amber); color: #1A1406; }
.xer-tool .xer-alert.is-info::before { content: "INFO"; }
.xer-tool .xer-alert.is-ok::before { content: "OK"; background: var(--good); color: #fff; }

/* result header */
.xer-tool .xer-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 24px; align-items: start; }
.xer-tool .xer-badge { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 60%, transparent); color: var(--ink); }
.xer-tool .xer-head h3 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin-top: 10px; overflow-wrap: anywhere; }
.xer-tool .xer-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-family: var(--f-mono); font-size: .8rem; color: var(--ink-soft); }
.xer-tool .xer-meta b { color: var(--ink); font-weight: 600; }
.xer-tool .xer-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.xer-tool .xer-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.xer-tool .xer-field { display: grid; gap: 6px; }
.xer-tool .xer-field label { font-size: .84rem; font-weight: 650; }
.xer-tool .xer-field select, .xer-tool .xer-field input { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; max-width: 100%; }
.xer-tool .xer-field input[type=number] { width: 7em; }
.xer-tool .xer-field select { min-width: 14em; }
@media (max-width: 720px) { .xer-tool .xer-head { grid-template-columns: 1fr; } .xer-tool .xer-actions { justify-content: flex-start; } .xer-tool .xer-field select { min-width: 0; width: 100%; } .xer-tool .xer-field { width: 100%; } }

/* summary tiles */
.xer-tool .xer-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.xer-tool .xer-tile { position: relative; text-align: left; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px; display: grid; gap: 4px; align-content: start; cursor: pointer; transition: border-color .2s, transform .2s, box-shadow .2s; overflow: hidden; }
.xer-tool .xer-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.xer-tool .xer-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.xer-tool .xer-tile[aria-pressed="true"] { border-color: var(--brand); background: var(--tint); box-shadow: inset 0 0 0 1px var(--brand); }
.xer-tool .xer-tile .t-label { font-weight: 650; font-size: .92rem; line-height: 1.25; }
.xer-tool .xer-tile .t-num { font-family: var(--f-display); font-stretch: 112%; font-weight: 800; font-size: 2.2rem; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--brand); }
.xer-tool .xer-tile .t-of { font-size: .82rem; color: var(--ink-soft); font-family: var(--f-mono); }
.xer-tool .xer-tile .t-flag { justify-self: start; margin-top: 6px; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); }
.xer-tool .xer-tile.is-review::before { background: repeating-linear-gradient(180deg, var(--crit) 0 8px, color-mix(in srgb, var(--crit) 55%, transparent) 8px 12px); }
.xer-tool .xer-tile.is-review .t-num { color: var(--crit); }
.xer-tool .xer-tile.is-review .t-flag { border-color: var(--crit); color: var(--crit); }
.xer-tool .xer-tile.is-clear::before { background: var(--good); }
.xer-tool .xer-tile.is-clear .t-flag { border-color: var(--good); color: var(--good); }
.xer-tool .xer-tile.is-na { background: repeating-linear-gradient(135deg, var(--paper) 0 10px, var(--surface) 10px 20px); }
.xer-tool .xer-tile.is-na .t-num { color: var(--ink-soft); }
.xer-tool .xer-tile.is-info::before { background: var(--amber); }
.xer-tool .xer-tile.is-info .t-flag { border-color: var(--amber); }
@media (max-width: 520px) { .xer-tool .xer-tiles { grid-template-columns: 1fr 1fr; gap: 8px; } .xer-tool .xer-tile { padding: 12px 12px 10px 14px; } .xer-tool .xer-tile .t-num { font-size: 1.7rem; } .xer-tool .xer-tile .t-label { font-size: .84rem; } }

/* detail panel */
.xer-tool .xer-panel { display: grid; gap: 14px; }
.xer-tool .xer-panel h4 { font-family: var(--f-display); font-size: 1.2rem; font-stretch: 106%; }
.xer-tool .xer-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.xer-tool .xer-scope > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: .9rem; }
.xer-tool .xer-scope b { display: block; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; margin-bottom: 4px; }
@media (max-width: 720px) { .xer-tool .xer-scope { grid-template-columns: 1fr; } }
.xer-tool .xer-sub { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 6px; }
.xer-tool .xer-empty { padding: 16px; border-radius: 10px; border: 1px dashed var(--line); color: var(--ink-soft); font-size: .93rem; }

/* tables: scroll on wide screens, cards on phones */
.xer-tool .xer-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.xer-tool .xer-table table { min-width: 640px; font-size: .9rem; }
.xer-tool .xer-table th, .xer-tool .xer-table td { padding: 10px 14px; }
.xer-tool .xer-table td.code { font-family: var(--f-mono); font-weight: 600; color: var(--brand); white-space: nowrap; }
.xer-tool .xer-table td.val { font-family: var(--f-mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.xer-tool .xer-table td.why { color: var(--ink-soft); font-size: .86rem; min-width: 220px; }
.xer-tool .xer-table tbody tr:hover td { background: color-mix(in srgb, var(--tint) 55%, transparent); }
.xer-tool .xer-table th button { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.xer-tool .xer-table th button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 2px; }
.xer-tool .xer-table th button::after { content: "\2195"; opacity: .45; }
.xer-tool .xer-table th[aria-sort="ascending"] button::after { content: "\2191"; opacity: 1; color: var(--brand); }
.xer-tool .xer-table th[aria-sort="descending"] button::after { content: "\2193"; opacity: 1; color: var(--brand); }
.xer-tool .xer-sortbar { display: none; gap: 8px; flex-wrap: wrap; align-items: end; }
@media (max-width: 640px) {
  .xer-tool .xer-table { overflow: visible; border: 0; background: transparent; }
  .xer-tool .xer-table table, .xer-tool .xer-table tbody, .xer-tool .xer-table tr, .xer-tool .xer-table td { display: block; width: 100%; min-width: 0; }
  .xer-tool .xer-table thead { display: none; }
  .xer-tool .xer-table tr { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 10px 14px; margin-bottom: 10px; }
  .xer-tool .xer-table td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); gap: 10px; white-space: normal; overflow-wrap: anywhere; }
  .xer-tool .xer-table td::before { content: attr(data-label); overflow-wrap: anywhere; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding-top: 2px; }
  .xer-tool .xer-table td.why { min-width: 0; }
  .xer-tool .xer-table tbody tr:hover td { background: transparent; }
  .xer-tool .xer-sortbar { display: flex; }
}

/* disclosure, notes, footer */
.xer-tool details.xer-more { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.xer-tool details.xer-more > summary { cursor: pointer; padding: 10px 14px; font-weight: 650; font-size: .92rem; }
.xer-tool details.xer-more > div { padding: 0 14px 14px; display: grid; gap: 10px; }
.xer-tool .xer-disclaimer { border-left: 4px solid var(--amber); background: var(--amber-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; font-size: .93rem; }
.xer-tool .xer-disclaimer strong { color: var(--ink); }
.xer-tool .xer-method { display: grid; gap: 8px; font-size: .88rem; color: var(--ink-soft); }
.xer-tool .xer-method ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.xer-tool .xer-method code { font-family: var(--f-mono); font-size: .82rem; color: var(--ink); background: var(--tint); padding: 0 4px; border-radius: 3px; }
.xer-tool .xer-pill { display: inline-block; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .xer-tool .xer-tile, .xer-tool .xer-drop { transition: none; } .xer-tool .xer-tile:hover { transform: none; } }
.xer-tool .xer-results { display: grid; gap: 16px; }
.xer-tool .xer-results > p.xer-disclaimer { margin: 0; }
