/* =====================================================================
   REVIEW THE REVIEWER — shared stylesheet for the form, the dashboard
   and the sign-in page. Colours come from the BLS palette; the result
   colours appear only inside the result chip.
   ===================================================================== */

:root {
  --blue-900: #3D3D8F;
  --blue-600: #6464A5;
  --blue-300: #8B8BBC;
  --magenta-900: #E5007E;
  --magenta-600: #EA3398;
  --pink-200: #F599CB;
  --white: #FFFFFF;

  --result-green: #2E7D5B;
  --result-amber: #B7791F;
  --result-red: #C0392B;

  /* Light mode (default) */
  --bg: #F4F4F7;
  --surface: var(--white);
  --surface-2: #F2F2F5;
  --tile: #F7F7FA;
  --field-bg: var(--white);
  --text: #1D1D35;
  --text-2: var(--blue-600);
  --title: var(--blue-900);
  --link: var(--blue-600);
  --line: rgba(139, 139, 188, .32);
  --track: #EEEEF4;
  --control-border: var(--blue-300);
  --control-border-active: var(--blue-600);
  --focus: var(--blue-600);
  --seg-text: var(--blue-600);
  --seg-selected-bg: var(--white);
  --seg-selected-text: var(--blue-900);
  --check-accent: var(--blue-900);
  --mismatch-bg: rgba(245, 153, 203, .17);
  --chip-green-bg: rgba(46, 125, 91, .12);
  --chip-amber-bg: rgba(183, 121, 31, .14);
  --chip-red-bg: rgba(192, 57, 43, .12);
  --shadow: 0 1px 3px rgba(61, 61, 143, .08);
  --shadow-raised: 0 1px 3px rgba(61, 61, 143, .08), 0 4px 14px rgba(61, 61, 143, .06);
  --shadow-dialog: 0 10px 40px rgba(29, 29, 53, .25);
  --backdrop: rgba(29, 29, 53, .35);

  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;
}

/* Dark mode: chosen in the header (Dark, or System when the computer is in dark mode) */
:root[data-theme="dark"] {
  --bg: #15151D;
  --surface: #1F1F2A;
  --surface-2: #292936;
  --tile: #262633;
  --field-bg: #191922;
  --text: #E8E8F0;
  --text-2: #9D9DCB;
  --title: #B3B3E6;
  --link: #9D9DCB;
  --line: rgba(139, 139, 188, .2);
  --track: #2A2A38;
  --control-border: var(--blue-600);
  --control-border-active: var(--blue-300);
  --focus: var(--blue-300);
  --seg-text: #A5A5CF;
  --seg-selected-bg: #3A3A4E;
  --seg-selected-text: var(--white);
  --check-accent: var(--blue-300);
  --mismatch-bg: rgba(245, 153, 203, .1);
  --chip-green-bg: rgba(46, 125, 91, .22);
  --chip-amber-bg: rgba(183, 121, 31, .22);
  --chip-red-bg: rgba(192, 57, 43, .22);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-raised: 0 0 0 1px rgba(255, 255, 255, .06), 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-dialog: 0 0 0 1px rgba(255, 255, 255, .08), 0 12px 40px rgba(0, 0, 0, .6);
  --backdrop: rgba(0, 0, 0, .55);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
}
input, select, textarea, button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1400px; }

/* Header */
.app-header { background: var(--blue-900); color: var(--white); }
.app-header .wrap {
  padding-top: 12px; padding-bottom: 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
}
.app-header h1 { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.app-subtitle { font-weight: 400; color: rgba(255, 255, 255, .85); }
.header-right { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }

/* Links and buttons in the header bar */
.app-nav { display: flex; align-items: center; gap: 4px; }
.app-nav a, .app-nav button {
  padding: 4px 11px;
  border: 0; border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, .88);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.app-nav a:hover, .app-nav button:hover { background: rgba(255, 255, 255, .12); color: var(--white); }
.app-nav a[aria-current="page"] { background: rgba(255, 255, 255, .2); color: var(--white); font-weight: 600; }
.app-nav form { display: flex; margin: 0; }
.app-nav :focus-visible { outline: 2px solid var(--white); outline-offset: 1px; }

/* Color mode selector (sun / moon / monitor), same radio pattern as the rubric controls */
.mode { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, .14); }
.mode label { position: relative; display: block; }
.mode input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mode-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 26px;
  border-radius: 6px;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.mode-icon svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.mode label:hover .mode-icon { color: var(--white); background: rgba(255, 255, 255, .1); }
.mode input:checked + .mode-icon { background: var(--white); color: var(--blue-900); }
.mode input:focus-visible + .mode-icon { outline: 2px solid var(--white); outline-offset: 1px; }

main { padding-bottom: 48px; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px 22px;
  margin-top: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--title); margin-bottom: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.card-head .card-title { margin-bottom: 0; }

/* Restored-draft notice */
.notice {
  margin-top: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px; color: var(--text-2);
}
.notice[hidden] { display: none; }

/* Form fields */
.fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-2); }

.input, .select, .textarea {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--control-border);
  border-radius: 7px;
  padding: 6px 10px;
  min-height: 34px;
  transition: border-color .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--control-border-active); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--control-border-active); }
.textarea { min-height: 72px; resize: vertical; line-height: 1.4; }
[aria-invalid="true"] { border-color: var(--title); box-shadow: 0 0 0 1px var(--title); }

.field-error { font-size: 12px; font-weight: 600; color: var(--title); }
.field-error[hidden] { display: none; }

.message {
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border-left: 3px solid var(--title);
  border-radius: 6px;
  padding: 8px 12px;
}
.message strong { color: var(--title); }
.message[hidden] { display: none; }
.message[data-kind="ok"] { border-left-color: var(--result-green); }
.message[data-kind="ok"] strong { color: var(--result-green); }

/* Sticky summary bar */
.summary {
  position: sticky; top: 0; z-index: 20;
  margin-top: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  padding: 10px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  font-size: 13px;
}
.stat { white-space: nowrap; }
.stat-label { color: var(--text-2); margin-right: 5px; }
.stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.summary .chip { margin-left: auto; }

/* Result chip: the only place where the result colors appear */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--result-green);
  background: var(--chip-green-bg);
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease;
}
.chip::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--result-green);
  transition: background-color .2s ease;
}
.chip[data-tone="amber"] { border-color: var(--result-amber); background: var(--chip-amber-bg); }
.chip[data-tone="amber"]::before { background: var(--result-amber); }
.chip[data-tone="red"] { border-color: var(--result-red); background: var(--chip-red-bg); }
.chip[data-tone="red"]::before { background: var(--result-red); }
.chip-sm { font-size: 11.5px; padding: 1px 9px 1px 7px; gap: 6px; }
.chip-sm::before { width: 7px; height: 7px; }

/* Rubric */
.group-card { padding: 0; overflow: hidden; }
.group-title { font-size: 15px; font-weight: 600; color: var(--title); padding: 16px 20px 6px; }
.param {
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(0, 1fr);
  gap: 8px 20px;
  padding: 14px 20px 14px 17px;
  border-left: 3px solid transparent;
  border-top: 1px solid var(--line);
}
.group-title + .param { border-top-color: transparent; }
.group-card > .param:first-child { border-top: 0; }
.param.is-mismatch {
  background: var(--mismatch-bg);
  border-left-color: var(--magenta-900);
}
.param-name { font-weight: 600; padding-top: 5px; }
.param-controls { min-width: 0; }

.mark-row { display: grid; grid-template-columns: 138px minmax(0, 1fr); align-items: center; gap: 12px; }
.mark-row + .mark-row { margin-top: 6px; }
.col-label { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* Segmented control built on native radio buttons (keyboard: Tab, then arrow keys) */
.seg {
  justify-self: start;
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  padding: 2px;
  background: var(--track);
  border-radius: 8px;
}
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: block;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  color: var(--seg-text);
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
/* Reserve the bold width so the control does not shift when a segment is selected */
.seg span::after {
  content: attr(data-label);
  display: block; height: 0; overflow: hidden; visibility: hidden;
  font-weight: 600;
}
.seg label:hover span { color: var(--seg-selected-text); }
.seg input:checked + span {
  background: var(--seg-selected-bg);
  border-color: var(--control-border-active);
  color: var(--seg-selected-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(61, 61, 143, .14);
}
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Notes */
.notes-toggle {
  margin-top: 8px;
  padding: 2px 0;
  background: none; border: 0;
  color: var(--link);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.notes-toggle:hover { color: var(--title); text-decoration: underline; }
.notes-toggle.has-notes { color: var(--title); font-weight: 600; }
.notes-wrap {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .2s ease, visibility 0s linear .2s;
}
.notes-wrap.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .2s ease, visibility 0s linear 0s;
}
.notes-inner { overflow: hidden; min-height: 0; }
.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 10px 2px 2px; }

/* Results */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { background: var(--tile); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.metric-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.metric-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.metric-value .chip { font-size: 13px; margin-top: 2px; }
.metric-hint { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

.subsection { margin-top: 22px; }
.subsection-title { font-size: 14px; font-weight: 600; }
.subsection-title .hint { font-weight: 400; margin-left: 6px; }

.top3 { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: top3; }
.top3 li {
  counter-increment: top3;
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.top3 li::before { content: counter(top3) "."; color: var(--text-2); font-weight: 600; }
.top3-name { font-weight: 600; }
.top3-marks { grid-column: 2; font-size: 13px; color: var(--text-2); }
.top3-points { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { margin: 8px 0 0; padding: 12px 0 2px; border-top: 1px solid var(--line); color: var(--text-2); }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--check-accent); cursor: pointer; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--title);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--control-border-active); }
.btn-primary { background: var(--blue-900); border-color: var(--blue-900); color: var(--white); }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-danger { color: var(--result-red); border-color: var(--result-red); }
.btn-danger:hover { background: var(--chip-red-bg); border-color: var(--result-red); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.actions .message { flex-basis: 100%; margin-top: 4px; }

/* Confirmation dialog */
dialog {
  border: 0; border-radius: 12px; padding: 22px 24px 18px;
  max-width: 420px; width: calc(100% - 32px);
  box-shadow: var(--shadow-dialog);
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: var(--backdrop); }
dialog h2 { font-size: 16px; font-weight: 600; color: var(--title); }
dialog p { margin: 8px 0 18px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* =====================================================================
   DASHBOARD
   ===================================================================== */

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.filters .field { min-width: 0; }
.filter-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.check-inline { min-height: 34px; }
.check-text { font-weight: 400; }
.result-split { margin-top: 10px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }

/* Data tables */
.table-wrap { overflow-x: auto; margin-top: 4px; border-radius: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
table.data thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  color: var(--title);
  font-size: 12px; font-weight: 600;
  border-bottom: 1px solid var(--line);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data tbody tr.is-clickable:hover { background: var(--tile); }
table.data tbody tr.is-flagged { border-left: 3px solid var(--magenta-900); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .wrap-cell { white-space: normal; min-width: 180px; }
.table-note { font-size: 12px; color: var(--text-2); margin-top: 10px; }

/* Percentage bar used in the per-parameter table */
.bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-track {
  width: 74px; height: 6px; border-radius: 3px;
  background: var(--track);
  overflow: hidden;
  flex: none;
}
/* display:block matters: an inline span would ignore the width set per row. */
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--blue-600); }
.bar-fill[data-tone="low"] { background: var(--magenta-900); }
.bar-value { font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--mismatch-bg);
  border: 1px solid var(--magenta-900);
  color: var(--text);
  font-size: 11.5px; font-weight: 600;
}
.muted { color: var(--text-2); }

/* Review detail */
dialog.detail { max-width: 980px; padding: 0; }
.detail-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.detail-body { padding: 18px 24px; max-height: 64vh; overflow-y: auto; }
.detail-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
}
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; }
.detail-item { min-width: 0; }
.detail-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.detail-value { margin-top: 1px; overflow-wrap: anywhere; }
.detail-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.detail-note { font-size: 12px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; }
tr.is-mismatch td { background: var(--mismatch-bg); }
tr.is-mismatch td:first-child { box-shadow: inset 3px 0 0 var(--magenta-900); }

/* Loading and empty states */
.state { padding: 28px 4px; text-align: center; color: var(--text-2); }

/* =====================================================================
   SIGN IN
   ===================================================================== */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  padding: 28px 28px 26px;
}
.login-card h1 { font-size: 18px; font-weight: 600; color: var(--title); }
.login-card .hint { display: block; margin-top: 6px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login-form .btn { width: 100%; }

/* =====================================================================
   NARROW SCREENS
   ===================================================================== */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .param { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .param-name { padding-top: 0; }
}
@media (max-width: 760px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: span 1; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .chip { margin-left: 0; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .card { padding: 16px; }
  .group-card { padding: 0; }
  .group-title { padding: 14px 16px 4px; }
  .param { padding: 12px 16px 12px 13px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .mark-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .mark-row + .mark-row { margin-top: 10px; }
  .notes-grid { grid-template-columns: minmax(0, 1fr); }
  .seg span { white-space: normal; }
  .detail-head, .detail-body, .detail-foot { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    animation-duration: 0.01ms !important;
  }
}

/* =====================================================================
   PHP version additions: password page, users, activity log, diagnostics
   ===================================================================== */

.offscreen { position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.login-card .message, .card > .message { margin: 14px 0 0; }
.narrow-card { max-width: 520px; margin-left: auto; margin-right: auto; }
.stack-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.inline-form .select { height: 30px; padding-top: 0; padding-bottom: 0; width: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.new-user { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px 16px; align-items: end; }
.temp-password {
  font: 600 16px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .04em; color: var(--title); user-select: all;
  background: var(--tile); border-radius: 6px; padding: 2px 8px;
}
.role { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.role[data-role="sistema"] { background: var(--blue-900); color: var(--white); }
.role[data-role="editor"] { background: rgba(229, 0, 126, .12); color: var(--magenta-900); }
:root[data-theme="dark"] .role[data-role="editor"] { color: var(--pink-200); }
tr.is-off td { color: var(--text-2); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.check-list li:first-child { border-top: 0; }
.check-mark { font-weight: 700; }
.check-mark[data-ok="1"] { color: var(--result-green); }
.check-mark[data-ok="0"] { color: var(--result-red); }
.check-mark[data-ok="w"] { color: var(--result-amber); }
.check-detail { grid-column: 2; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) {
  .new-user { grid-template-columns: minmax(0, 1fr); }
}
[hidden] { display: none !important; }
.app-nav { flex-wrap: wrap; }
.app-nav a, .app-nav button { white-space: nowrap; }
@media (max-width: 560px) {
  .app-header .wrap { padding-left: 16px; padding-right: 16px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
}
.table-wrap { position: relative; }

/* Floating confirmation (submit, delete) */
.toast-host {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--surface); color: var(--text); border-radius: var(--radius);
  border-left: 5px solid var(--result-green); box-shadow: var(--shadow-dialog);
  padding: 12px 12px 12px 16px; font-weight: 600;
  animation: toast-in .2s ease-out;
}
.toast[data-kind="error"] { border-left-color: var(--result-red); }
.toast-icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--result-green); color: var(--white); font-size: 14px;
}
.toast[data-kind="error"] .toast-icon { background: var(--result-red); }
.toast-text { flex: 1; min-width: 0; }
.toast-close { flex: none; border: 0; background: none; color: var(--text-2); font-size: 20px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px; }
.toast-close:hover { background: var(--surface-2); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Submit: confirmation and result */
dialog.submit-dialog { width: min(520px, calc(100vw - 32px)); }
.submit-summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 4px 0 20px; padding: 14px 16px; background: var(--tile); border-radius: 8px; }
.submit-summary dt { font-size: 12px; font-weight: 600; color: var(--text-2); align-self: center; }
.submit-summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.result-head { display: flex; align-items: center; gap: 12px; }
.result-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--white); background: var(--result-green);
}
#submit-result[data-kind="error"] .result-icon { background: var(--result-red); }
#submit-result[data-kind="error"] h2 { color: var(--result-red); }
#submit-result p { margin: 14px 0 20px; }

/* Triads */
.page-tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.page-tabs button {
  border: 0; background: none; padding: 10px 16px; font-weight: 600; color: var(--text-2); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0;
}
.page-tabs button:hover { color: var(--title); background: var(--surface-2); }
.page-tabs button[aria-selected="true"] { color: var(--title); border-bottom-color: var(--magenta-900); }
.triad-good { margin-top: 4px; }
.triad-row .param-controls { display: flex; flex-direction: column; gap: 8px; }
.triad-row .textarea { min-height: 44px; }
.stack-fields { display: flex; flex-direction: column; gap: 14px; }
.chip:not([data-tone]), .chip[data-tone=""] { color: var(--text-2); border-color: var(--line); }
