/* Largada: editorial instrument panel.
   One accent (signal orange) for the primary action and the countdown;
   muted status colours; hairline rules; IBM Plex Sans / Mono. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------- tokens */
/* Light by default; dark follows the system unless the user picked a theme
   (data-theme on <html>, set from the "largada_theme" cookie). */
:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #fbfaf7;
  --field: #ffffff;
  --hover: #eeece6;
  --ink: #16181d;
  --ink-2: #464950;
  --ink-3: #6b6e75;
  --line: #e2dfd7;
  --line-strong: #c9c5ba;
  --accent: #d9480f;
  --accent-strong: #b53a0a;
  --on-accent: #ffffff;
  --accent-soft: #fbeee7;
  --ok: #2f7d4f;
  --warn: #9a5d06;
  --bad: #b42318;
  --shadow: 0 1px 2px rgba(22, 24, 29, 0.05);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 4px;
  --radius-lg: 6px;
  --control-h: 36px;
  --control-h-sm: 28px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121316;
    --surface: #17181c;
    --field: #1c1e22;
    --hover: #22242a;
    --ink: #ebe9e4;
    --ink-2: #bbb8b0;
    --ink-3: #8f8c85;
    --line: #2a2c31;
    --line-strong: #3c3f46;
    --accent: #f0672e;
    --accent-strong: #ff7d47;
    --on-accent: #16181d;
    --accent-soft: #2a1d17;
    --ok: #5fb487;
    --warn: #d6a142;
    --bad: #f07a6a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121316;
  --surface: #17181c;
  --field: #1c1e22;
  --hover: #22242a;
  --ink: #ebe9e4;
  --ink-2: #bbb8b0;
  --ink-3: #8f8c85;
  --line: #2a2c31;
  --line-strong: #3c3f46;
  --accent: #f0672e;
  --accent-strong: #ff7d47;
  --on-accent: #16181d;
  --accent-soft: #2a1d17;
  --ok: #5fb487;
  --warn: #d6a142;
  --bad: #f07a6a;
  --shadow: none;
}

/* --------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code, .mono, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: 10px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
[hidden] { display: none !important; }

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

/* Small-caps style section labels. */
.label, .eyebrow, th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------- layout */
.shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
}

.brand {
  display: block;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.brand-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-3);
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13.5px;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
  background: var(--hover);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 10px;
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.server-clock { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.current-user { font-size: 12.5px; color: var(--ink-2); text-decoration: none; overflow-wrap: anywhere; }
.current-user:hover { color: var(--ink); text-decoration: underline; }
.sidebar-foot .foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* theme switch: auto / claro / escuro */
.theme-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.theme-switch button {
  appearance: none; border: 0; background: none; color: var(--ink-3);
  font: inherit; font-size: 11.5px; padding: 3px 8px; cursor: pointer;
}
.theme-switch button + button { border-left: 1px solid var(--line-strong); }
.theme-switch button:hover { color: var(--ink); background: var(--hover); }
.theme-switch button[aria-pressed="true"] { color: var(--ink); background: var(--hover); font-weight: 500; }

.main {
  width: 100%;
  max-width: 1200px;
  padding: 26px 40px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.page-head .eyebrow { margin: 0 0 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.section { margin-top: 30px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}
.section-head .label { margin: 0; }
.section-note { font-size: 12.5px; color: var(--ink-3); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 36px;
}
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 0 36px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

/* --------------------------------------------------------- instrument */
.instrument {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 18px 40px;
  align-items: end;
}
.countdown {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}
.countdown[data-past] { color: var(--ink-2); }
.countdown-caption { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.instrument .meta { align-self: stretch; }

/* key/value lists */
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 18px;
  margin: 0;
  font-size: 13.5px;
}
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
}
.figures > div {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
}
.figures dt { font-size: 11.5px; color: var(--ink-3); }
.figures dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* live block: 10 figures in full rows (5 per row; 2 in a narrow column) */
.live-figures { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main .live-figures, .grid-2 .live-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* readiness checklist */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 2px 14px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.checks .check-label { color: var(--ink-3); font-size: 12.5px; }
.checks .check-value { overflow-wrap: anywhere; }
.checks .check-note { grid-column: 2 / 4; font-size: 12.5px; color: var(--ink-3); }

/* ------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 8px 10px 6px 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { padding-right: 12px; }
td:last-child, th:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.mono { font-size: 12.5px; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
td.actions form { display: inline; }
.row-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: 6px; }
.row-actions form { display: inline-flex; }
tbody tr:hover td { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.cell-title { font-weight: 500; }
.cell-sub { display: block; font-size: 12px; color: var(--ink-3); }
.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  padding: 22px 0;
  color: var(--ink-3);
  font-size: 13.5px;
}

/* ------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 12px;
  line-height: 19px;
  color: var(--ink-2);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-active { color: var(--accent); }
.tone-muted, .tone-neutral { color: var(--ink-3); }
.badge.tone-ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.tone-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.tone-bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.badge.tone-active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ------------------------------------------------------------ notices */
.banner {
  margin: -26px -40px 22px;
  padding: 7px 40px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.banner + .banner { margin-top: -22px; }
.banner-sim { color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, var(--bg)); }
.banner-critical { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }

.notice {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-left: 2px solid var(--line-strong);
  background: var(--surface);
  font-size: 13.5px;
}
.notice-ok { border-left-color: var(--ok); }
.notice-warn { border-left-color: var(--warn); }
.notice-bad { border-left-color: var(--bad); }

/* -------------------------------------------------------------- forms */
form { margin: 0; }
.form { max-width: 760px; }
.form-narrow { max-width: 440px; }
.participants { display: grid; gap: 8px; margin-top: 10px; }
.participant {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.participant.is-selected { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.participant.has-error { border-color: var(--bad); }
.participant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
}
.participant-check { gap: 10px; }
.participant-check .mono { font-size: 12px; }
.participant-body {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}
.participant-input, .participant-preview { display: grid; gap: 5px; }
.participant textarea { min-height: 78px; }
.participant .field-error { margin-top: -4px; }
.participant .segmented { justify-self: start; }
pre.preview[data-empty]::before { content: "nada a enviar ainda"; color: var(--ink-3); font-style: italic; }
.when-summary { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin: -4px 0 12px; min-height: 1.4em; }
.secret-value { user-select: all; overflow-wrap: anywhere; font-size: 15px; }
.field { display: grid; gap: 5px; margin-bottom: 16px; align-content: start; }
.field > label, .field-label, legend {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.table-wrap + p, .pagination + p { margin-top: 12px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hint { font-size: 12px; color: var(--ink-3); }
.field-error { font-size: 12.5px; color: var(--bad); }
fieldset { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }

input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="time"], input[type="url"], select, textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  box-shadow: var(--shadow);
}
input[type="date"], input[type="time"] { height: var(--control-h); padding-top: 0; padding-bottom: 0; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input[disabled], select[disabled], textarea[disabled] { opacity: 0.6; cursor: not-allowed; }
input.mono, textarea.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
textarea { min-height: 150px; line-height: 1.5; resize: vertical; }
select { padding-right: 28px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

.input-unit { position: relative; display: flex; align-items: stretch; }
.input-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-unit .unit {
  display: flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface);
}

.choices { display: grid; gap: 6px; }
.choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
}
.choice input { margin-top: 3px; }
.choice-title { font-weight: 500; }
.choice-help { grid-column: 2; font-size: 12.5px; color: var(--ink-3); }
.choice:has(input:checked) { border-color: var(--accent); }
.choice:hover { border-color: var(--line-strong); }

.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--line-strong); }
.segmented label:has(input:checked) { background: var(--hover); font-weight: 500; }

details.advanced {
  margin: 4px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
details.advanced > summary {
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after { content: "mostrar"; font-size: 12px; color: var(--ink-3); }
details.advanced[open] > summary::after { content: "ocultar"; }
.params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  padding: 6px 0 4px;
}

.counter { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); }
pre.preview {
  margin: 0;
  padding: 10px 12px;
  min-height: 42px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  min-height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: var(--bad); }
.btn-small { min-height: var(--control-h-sm); padding: 0 10px; font-size: 12.5px; }
.btn:focus-visible { outline-offset: 2px; }
.btn-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.btn-link:hover { background: none; color: var(--ink); }
.btn.is-armed { background: var(--bad); border-color: var(--bad); color: #ffffff; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
/* Submitting: label hidden behind a spinner, clicks ignored (see app.js). */
.btn.is-loading { color: transparent !important; pointer-events: none; opacity: 1; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-3);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.is-loading::after { border-color: var(--on-accent); border-right-color: transparent; }
.btn-danger.is-loading::after { border-color: var(--bad); border-right-color: transparent; }
.btn-link.is-loading::after { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
form[aria-busy="true"] { cursor: progress; }
.btn[aria-disabled="true"] { pointer-events: none; opacity: 0.55; }

/* password with show/hide toggle (built by app.js) */
.password-field { position: relative; display: block; }
.password-field input { padding-right: 42px; }
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 38px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.password-toggle:hover { color: var(--ink); }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle .icon-hide { display: none; }
.password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: inline; }

/* pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0 0;
  margin-top: 2px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
}
.pagination .pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pagination .pages a, .pagination .pages span {
  min-width: 30px;
  height: var(--control-h-sm);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pagination .pages a:hover { background: var(--hover); color: var(--ink); }
.pagination .pages [aria-current="page"] { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.pagination .pages .gap { border: 0; min-width: 16px; }
.pagination .pages .disabled { opacity: 0.45; }

/* ------------------------------------------------------ popover menu */
details.popover { position: relative; display: inline-block; }
details.popover > summary { list-style: none; }
details.popover > summary::-webkit-details-marker { display: none; }
details.popover[open] > summary { background: var(--hover); }
.popover-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
  white-space: normal;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.popover-panel label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.popover-panel .btn { justify-self: end; }
.add-lane { margin-left: 4px; font-family: var(--sans); color: var(--ink-3); }

/* ------------------------------------------------- groups by account */
.legend-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -6px 0 6px; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input[type="search"] { width: 220px; }
.account-block { padding: 22px 0 8px; border-top: 1px solid var(--line-strong); }
.account-block:first-of-type { border-top: 0; padding-top: 6px; }
.account-block + .account-block { margin-top: 18px; }
.account-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.account-head h2 { font-size: 16px; }
.account-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.groups-table { table-layout: fixed; min-width: 860px; }
.groups-table .c-group { width: 31%; }
.groups-table .c-members { width: 8%; }
.groups-table .c-role { width: 12%; }
.groups-table .c-state { width: 10%; }
.groups-table .c-target { width: 10%; }
.groups-table .c-actions { width: 29%; }
.groups-table td { overflow-wrap: anywhere; }
.groups-table tr.is-target td:first-child { box-shadow: inset 2px 0 0 var(--accent); padding-left: 10px; }
.groups-table td:first-child { padding-left: 10px; }
.groups-table th:first-child { padding-left: 10px; }
.btn-primary-soft { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); color: var(--accent-strong); }
.btn-primary-soft:hover { background: var(--accent-soft); }

/* -------------------------------------------------------------- steps */
.steps { display: flex; gap: 0; margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  flex: 1;
  padding: 8px 0 0;
  border-top: 2px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
}
.steps li::before { content: counter(step) "  "; font-family: var(--mono); }
.steps li + li { margin-left: 6px; }
.steps li[data-state="done"] { border-top-color: var(--ink-3); color: var(--ink-2); }
.steps li[data-state="current"] { border-top-color: var(--accent); color: var(--ink); font-weight: 500; }

/* -------------------------------------------------------------- misc */
.live[data-state="idle"] .live-figures { opacity: 0.55; }
.prose { max-width: 720px; }
.prose ol, .prose ul { padding-left: 20px; margin: 0 0 12px; }
.prose li + li { margin-top: 6px; }
.timeline-bar { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form input[type="text"] { width: 180px; min-height: 26px; padding: 2px 8px; font-size: 13px; }
details.inline > summary { cursor: pointer; display: inline; color: var(--ink-2); text-decoration: underline;
  text-decoration-color: var(--line-strong); text-underline-offset: 3px; font-size: 13px; }
details.inline[open] > summary { margin-right: 6px; }
.log { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 12.5px; }
.log li { padding: 3px 0; border-bottom: 1px solid var(--line); }

/* ----------------------------------------------------------- bare page */
.bare {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.bare-card {
  width: 100%;
  max-width: 380px;
}
.bare-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.bare-card .brand { padding: 0; }
.bare-card h1 { font-size: 20px; margin-bottom: 18px; }
.bare-card .btn-primary { width: 100%; min-height: 36px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .grid-main, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 22px 24px 56px; }
  .banner { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .brand { padding: 0; font-size: 15px; }
  .brand-sub { display: none; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: 2px;
    margin: 0 -16px;
    padding: 0 12px 6px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 8px; white-space: nowrap; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot {
    margin: 0 0 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .sidebar-foot .server-clock, .sidebar-foot .current-user { display: none; }
  .section-head { flex-wrap: wrap; }
  /* groups: one card per row on narrow screens */
  .groups-table { min-width: 0; table-layout: auto; }
  .groups-table colgroup, .groups-table thead { display: none; }
  .groups-table, .groups-table tbody, .groups-table tr, .groups-table td { display: block; width: 100%; }
  .groups-table tr {
    display: grid;
    grid-template-columns: repeat(3, auto) 1fr;
    gap: 6px 10px;
    align-items: center;
    padding: 10px 0 12px 10px;
    border-bottom: 1px solid var(--line);
  }
  .groups-table td { padding: 0; border: 0; width: auto; }
  .groups-table td:first-child,
  .groups-table tr.is-target td:first-child { grid-column: 1 / -1; padding-left: 0; box-shadow: none; }
  .groups-table tr.is-target { box-shadow: inset 2px 0 0 var(--accent); }
  .groups-table td.num::after { content: " membros"; font-family: var(--sans); color: var(--ink-3); }
  .groups-table td.actions { grid-column: 1 / -1; text-align: left; }
  .groups-table .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .search-form { flex: 1 1 100%; }
  .search-form input[type="search"] { width: auto; flex: 1; }
  .main { padding: 18px 16px 48px; }
  .banner { margin: -18px -16px 18px; padding: 7px 16px; }
  .instrument { grid-template-columns: minmax(0, 1fr); }
  .countdown { font-size: 34px; }
  .field-row, .params { grid-template-columns: minmax(0, 1fr); }
  .live-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checks li { grid-template-columns: 84px minmax(0, 1fr); }
  .checks li .badge { grid-column: 2; justify-self: start; }
  .checks .check-note { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
