/* portuno panel — components and layout. Tokens only (design/tokens.css is
   imported before this file); no raw colours (TestStylesheetUsesTokens).
   Geometry follows design/state-geometry.md: every state of an element fits
   its rest state's box, or it is an overlay. Comments name the row. */

/* ---- fonts (self-hosted, metric-matched fallbacks in tokens.css) ---- */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-5.3.0-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  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: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-5.3.0-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  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;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scrollbar-gutter: stable; /* global mechanics: sheets lock scroll without a jump */
  background: var(--color-bg); color: var(--color-text-primary);
  font-family: var(--font-sans); font-size: var(--text-body-size); line-height: var(--text-body-line);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
html.dialog-open { overflow: hidden; }
body { margin: 0; min-height: 100vh; background: var(--color-bg); }
body.bars-1 { padding-top: var(--h-banner); }
body.bars-2 { padding-top: calc(var(--h-banner) * 2); }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg.icon { width: 24px; height: 24px; flex: none; display: block; }
.mono { font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); font-size: var(--text-mono-size); line-height: var(--text-mono-line); }
.num, .tabular { font-feature-settings: var(--font-feature-tabular); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-toast); padding: var(--space-2) var(--space-4); background: var(--color-cta); color: var(--color-text-on-cta); border-radius: var(--radius-pill); }
.skip:focus { top: var(--space-2); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.link { color: var(--color-accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.js .no-js-only { display: none !important; }
.is-hidden { visibility: hidden; }
@media (min-width: 1024px) { .phone-only { display: none !important; } }
@media (max-width: 1023.98px) { .desktop-only { display: none !important; } }

/* ---- type ---- */
.title { font-size: var(--text-title-size); line-height: var(--text-title-line); font-weight: var(--text-title-weight); letter-spacing: var(--text-title-tracking); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption { min-height: var(--text-body-line); color: var(--color-text-secondary); }
.body { color: var(--color-text-secondary); }
.body strong { color: var(--color-text-primary); font-weight: var(--text-body-strong-weight); }
.wordmark { font-size: var(--text-h2-size); line-height: var(--text-h2-line); font-weight: 600; letter-spacing: var(--text-h2-tracking); text-decoration: none; color: var(--color-text-primary); }

/* ---- A. chrome: fixed 40-px bars ---- */
.bars { position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-banner); }
.bar { height: var(--h-banner); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2) 0 var(--space-4); background: var(--color-surface-1); }
.bar-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-label-size); line-height: var(--text-label-line); }
.bar-warn { box-shadow: inset 4px 0 0 var(--color-warn); }
.bar-danger { box-shadow: inset 4px 0 0 var(--color-danger); }
.bar-info { box-shadow: inset 4px 0 0 var(--color-accent); }
.bar-impersonation { background: var(--color-impersonation); color: var(--color-text-on-cta); }
.bar-form { display: contents; }
.bar-pill { flex: none; height: 32px; display: inline-flex; align-items: center; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 0; background: var(--color-surface-2); color: var(--color-text-primary); font-size: var(--text-label-size); font-weight: var(--text-label-weight); text-decoration: none; }
.bar-impersonation .bar-pill { background: var(--color-text-on-cta); color: var(--color-impersonation); }
/* the impersonation's end time: its own box, never ellipsized; the sentence gives way */
.bar-time { flex: none; white-space: nowrap; font-size: var(--text-label-size); line-height: var(--text-label-line); font-weight: var(--text-label-weight); font-variant-numeric: tabular-nums; }

/* ---- A. shell: rail (desktop), content, bottom pill (phone) ---- */
.shell { min-height: 100vh; }
.content { min-width: 0; padding: 0 var(--gutter) calc(var(--h-tabbar) + var(--space-8)); }
.main { max-width: var(--maxw-content); margin: 0 auto; min-height: calc(100vh - var(--h-tabbar)); }
.rail { display: none; }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--w-rail) minmax(0, 1fr); }
  .content { padding: 0 var(--gutter-desktop) var(--space-12); }
  .main { min-height: 100vh; }
  .rail { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: var(--space-6) var(--space-3); gap: var(--space-1); }
  .bars-1 .rail { top: var(--h-banner); height: calc(100vh - var(--h-banner)); }
  .bars-2 .rail { top: calc(var(--h-banner) * 2); height: calc(100vh - var(--h-banner) * 2); }
  .pill { display: none !important; }
}
.rail-wordmark { display: block; padding: 0 var(--space-3); height: var(--h-control); line-height: var(--h-control); margin-bottom: var(--space-4); }
.rail-list { display: flex; flex-direction: column; gap: var(--space-1); }
.rail-group { height: 32px; padding: var(--space-3) var(--space-3) 0; font-size: var(--text-caption-size); line-height: var(--text-caption-line); color: var(--color-text-secondary); }
.rail-item { position: relative; display: flex; align-items: center; gap: var(--space-3); width: 100%; height: var(--h-row); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-field); background: transparent; color: var(--color-text-secondary); text-decoration: none; text-align: left; transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); }
.rail-item:hover { background: var(--color-surface-1); color: var(--color-text-primary); }
.rail-item.is-active { background: var(--color-surface-2); color: var(--color-text-primary); }
.rail-item.is-active::before { content: ""; position: absolute; left: 0; top: var(--space-4); bottom: var(--space-4); width: 2px; border-radius: 2px; background: var(--color-accent); }
.rail-foot { margin-top: auto; padding: var(--space-3) var(--space-3) 0; }
.rail-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-role { height: var(--text-caption-line); font-size: var(--text-caption-size); line-height: var(--text-caption-line); color: var(--color-text-secondary); margin-bottom: var(--space-2); }
.rail-logout .rail-item { padding: 0; }

.pill { position: fixed; left: var(--gutter); right: var(--gutter); bottom: var(--gutter); height: var(--h-tabbar); z-index: var(--z-tabbar); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px; border-radius: var(--radius-pill); background: var(--color-surface-1); box-shadow: var(--shadow-popover); }
.pill-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--radius-pill); color: var(--color-text-secondary); text-decoration: none; transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); }
.pill-item.is-active { background: var(--color-surface-3); color: var(--color-text-primary); }
.pill-label { font-size: var(--text-caption-size); line-height: var(--text-caption-line); }

/* ---- A. top bar: 56 px, both 44-px slots always reserved ---- */
.topbar { height: var(--h-topbar); display: flex; align-items: center; justify-content: space-between; }
.slot { width: var(--h-control); height: var(--h-control); flex: none; display: flex; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.page-titles { min-width: 0; }

/* ---- auth layout: a 440-px card on the canvas ---- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: var(--space-8) var(--gutter) var(--space-12); }
.auth > .wordmark { margin-bottom: var(--space-8); }
.auth-main { width: 100%; max-width: 440px; }
.auth-card { display: flex; flex-direction: column; gap: var(--space-3); }
@media (min-width: 1024px) {
  .auth { justify-content: center; }
  .auth-card { background: var(--color-surface-1); border-radius: var(--radius-card); padding: var(--space-8); }
}
.form { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-4); }
.form-error { min-height: 0; color: var(--color-danger); font-size: var(--text-caption-size); line-height: var(--text-caption-line); }
.form-error:empty { display: none; }
.cta-row { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-3); }
@media (max-width: 1023.98px) {
  .auth .cta-row { position: sticky; bottom: 0; padding-bottom: var(--space-4); background: var(--color-bg); }
}
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-6); min-height: var(--h-control); align-items: center; }
.auth-links:empty { display: none; }
.terms { margin-top: var(--space-1); }
.privacy-short { height: 40px; overflow: hidden; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; } /* reserved 40 px for B5's short notice */
.icon-disc { width: var(--w-icon-disc); height: var(--w-icon-disc); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-2); }
.icon-disc-danger { color: var(--color-danger); }
.resend { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-top: var(--space-3); }
.resend .btn { min-width: 200px; }
.countdown { height: var(--h-field-help); padding-left: 0; }

/* ---- C. fields: 56-px box, floating label, reserved helper line, 44-px trailing slot ---- */
.field { position: relative; }
.field-box { position: relative; height: var(--h-field); border-radius: var(--radius-field); background: var(--color-field); transition: background-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out); }
.field-box:hover { background: var(--color-field-hover); }
.field-box:focus-within { box-shadow: var(--focus-ring); }
.field.is-error .field-box { box-shadow: inset 0 0 0 1px var(--color-danger); }
.field.is-error .field-box:focus-within { box-shadow: inset 0 0 0 1px var(--color-danger), var(--focus-ring); }
.field-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 26px 56px 8px var(--space-4); border: 0; border-radius: inherit; background: transparent; color: var(--color-text-primary); font-size: var(--text-body-size); line-height: var(--text-body-line); appearance: none; -webkit-appearance: none; }
.field-input:focus-visible { box-shadow: none; }
.field-input.mono { font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); }
.field-input.num { text-align: right; font-feature-settings: var(--font-feature-tabular); }
.field-input.upper { text-transform: uppercase; }
.field-input:-webkit-autofill { -webkit-text-fill-color: var(--color-text-primary); transition: background-color 600000s 0s; }
.field-label { position: absolute; left: var(--space-4); right: 56px; top: 17px; color: var(--color-text-secondary); font-size: var(--text-body-size); line-height: var(--text-body-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transform-origin: left top; transition: transform var(--motion-fast) var(--ease-out); }
.field-input:focus + .field-label, .field-input:not(:placeholder-shown) + .field-label, .field-label.is-floating { transform: translateY(-10px) scale(0.8667); }
.field-trailing { position: absolute; right: 6px; top: 6px; width: var(--h-control); height: var(--h-control); display: flex; align-items: center; justify-content: center; color: var(--color-text-secondary); pointer-events: none; }
.field-trailing > * { pointer-events: auto; }
.field-unit { font-size: var(--text-label-size); }
.field.is-disabled .field-box, .field.is-readonly .field-box { opacity: 0.4; }
.field-help { height: var(--h-field-help); padding: 2px var(--space-4) 0; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--text-caption-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field.is-error .field-help, .check-row.is-error + .field-help, .field-help.is-error { color: var(--color-danger); }
.field-help.help-2, .field.help-2 .field-help { height: 40px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* the site mode's explanation only: 3 lines (design/site-mode-control.md §3) */
.field-help.help-3 { height: 60px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.field-help-count { display: flex; gap: var(--space-2); }
.help-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.help-count { flex: none; font-feature-settings: var(--font-feature-tabular); }
/* textarea: 4 rows, fixed, internal scroll */
.area-box { height: 112px; }
.field-area textarea.field-input { resize: none; overflow-y: auto; padding-top: 24px; padding-right: var(--space-4); }
/* select: the list is a popover; the field never grows */
.field-select .field-input { padding-right: 56px; cursor: pointer; }
.field-select option { background: var(--color-surface-1); color: var(--color-text-primary); }
/* the type-ahead of a long select (portal.js initComboboxes): the button takes the select's box and shows the
   chosen option on one line; the list is a popover under the field, never in flow */
.combo-btn { display: block; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.combo-btn:disabled { cursor: not-allowed; }
.combo-pop { left: 0; right: 0; top: calc(var(--h-field) + 4px); padding: var(--space-2); }
.combo-pop .search-input { height: 40px; padding: 0 var(--space-3); }
.combo-pop [role="listbox"] { list-style: none; margin: var(--space-2) 0 0; padding: 0; max-height: 264px; overflow-y: auto; }
.combo-option { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border-radius: 8px; color: var(--color-text-primary); font-size: var(--text-label-size); cursor: pointer; }
.combo-option:hover, .combo-option.is-active { background: var(--color-surface-3); }
.combo-option[aria-selected="true"] { color: var(--color-accent); }
/* password eye: the value is mono in both states, so its width is stable */
.field-eye { color: var(--color-text-secondary); }
.field-eye[aria-pressed="true"] { color: var(--color-text-primary); }

/* chip field: 56-px input row + 40-px strip in one fixed 96-px box */
.chip-box { height: 96px; border-radius: var(--radius-field); background: var(--color-field); }
.chip-box:focus-within { box-shadow: var(--focus-ring); }
.chipfield.is-error .chip-box { box-shadow: inset 0 0 0 1px var(--color-danger); }
.chip-box .field-box, .chip-box .field-box:hover { background: transparent; box-shadow: none; }
.chip-strip { height: 40px; display: flex; gap: var(--space-2); align-items: flex-start; padding: 0 var(--space-3); overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: thin; }
.chip { flex: none; height: 32px; display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-1) 0 var(--space-3); border-radius: var(--radius-chip); background: var(--color-surface-2); color: var(--color-text-primary); text-decoration: none; font-size: var(--text-label-size); }
.chip.is-invalid { box-shadow: inset 0 0 0 1px var(--color-danger); }
.chip-x { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; border-radius: 6px; background: transparent; color: var(--color-text-secondary); }
.chip-x .icon { width: 16px; height: 16px; }
.chipfield.is-disabled .chip-box { opacity: 0.4; }

/* six-digit code: six 48 × 56 boxes, 8-px gaps, one real input */
.code { position: relative; width: calc(48px * 6 + var(--space-2) * 5); height: var(--h-field); }
.code-boxes { display: grid; grid-template-columns: repeat(6, 48px); gap: var(--space-2); height: 100%; }
.code-box { display: flex; align-items: center; justify-content: center; border-radius: var(--radius-field); background: var(--color-field); font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); font-size: var(--text-h2-size); transition: box-shadow var(--motion-fast) var(--ease-out), opacity var(--motion-fast) var(--ease-out); }
.code-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); font-family: var(--font-mono); font-size: var(--text-h2-size); letter-spacing: 0.5em; }
.js .code-input { background: transparent; color: transparent; caret-color: transparent; letter-spacing: 0; z-index: 1; }
.js .code-input::selection { background: transparent; }
.no-js .code-boxes { visibility: hidden; }
.code:focus-within .code-box.is-current { box-shadow: var(--focus-ring); }
.code-input:focus-visible { box-shadow: none; }
.code.is-error .code-box { box-shadow: inset 0 0 0 1px var(--color-danger); }
.code.is-verifying .code-box { opacity: 0.5; }
.code-help { padding-left: 0; color: var(--color-danger); }

/* ---- B. buttons: the spinner overlays the hidden label; the box never changes ---- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; height: var(--h-button); min-width: 120px; padding: 0 var(--space-6); border: 0; border-radius: var(--radius-pill); font-size: var(--text-body-size); line-height: var(--text-body-line); font-weight: var(--text-body-strong-weight); text-decoration: none; white-space: nowrap; user-select: none; transition: background-color var(--motion-fast) var(--ease-out), opacity var(--motion-fast) var(--ease-out); }
.btn-primary { height: var(--h-cta); min-width: 200px; background: var(--color-cta); color: var(--color-text-on-cta); }
.btn-primary:hover { background: var(--color-cta-hover); }
.btn-primary:active { background: var(--color-cta-pressed); }
.btn-compact { height: var(--h-button); min-width: 0; }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text-primary); }
.btn-secondary:hover { background: var(--color-surface-3); }
.btn-tertiary { background: transparent; color: var(--color-text-primary); }
.btn-tertiary:hover { background: var(--color-surface-2); }
.btn-danger { background: transparent; color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-soft); }
.btn[disabled], .btn.is-disabled { opacity: 0.4; cursor: not-allowed; }
.cta-row .btn-primary, .auth .btn-primary { width: 100%; }
/* The label fades to opacity 0 (not visibility: hidden) so it keeps its box
   AND the button keeps its accessible name while loading. */
.btn-label { transition: opacity 0s; }
.spinner { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; visibility: hidden; transition: visibility 0s; animation: spin 0.8s linear infinite; }
.btn.htmx-request .btn-label, .btn[aria-busy="true"] .btn-label { opacity: 0; transition-delay: 300ms; }
.btn.htmx-request .spinner, .btn[aria-busy="true"] .spinner { visibility: visible; transition-delay: 300ms; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-icon { position: relative; width: var(--h-control); height: var(--h-control); flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-text-primary); text-decoration: none; transition: background-color var(--motion-fast) var(--ease-out); }
.btn-icon:hover { background: var(--color-surface-2); }
.btn-icon.is-active { background: var(--color-accent-soft); }
.btn-icon.is-disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon.is-disabled:hover { background: transparent; }
/* copy: the check replaces the icon for 1.5 s; the box never changes */
.copy .icon-check { display: none; }
.copy.is-copied .icon-copy { display: none; }
.copy.is-copied .icon-check { display: block; color: var(--color-ok); }

/* switch: 52 × 32; loading pulses the knob */
.switch-form { display: inline-flex; }
.switch { position: relative; width: var(--w-switch); height: var(--h-switch); flex: none; padding: 0; border: 0; border-radius: var(--radius-pill); background: var(--color-surface-3); transition: background-color var(--motion-fast) var(--ease-out); }
.switch .knob { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--color-text-primary); transition: transform var(--motion-fast) var(--ease-out); }
.switch[aria-checked="true"] { background: var(--color-accent); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
.switch[disabled] { opacity: 0.4; cursor: not-allowed; }
.htmx-request .switch .knob, .switch[aria-busy="true"] .knob, .switch.htmx-request .knob { animation: pulse 0.9s var(--ease-inout) infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.state-text { color: var(--color-text-secondary); font-size: var(--text-label-size); }

/* segmented control: equal cells; selected = surface-3 inside the same cell */
.segmented-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg-legend { padding: 0 0 var(--space-2); font-size: var(--text-label-size); line-height: var(--text-label-line); color: var(--color-text-secondary); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: var(--h-control); padding: 4px; border-radius: var(--radius-field); background: var(--color-surface-2); }
.seg-cell { position: relative; display: flex; }
.seg-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-label { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--color-text-secondary); font-size: var(--text-label-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); }
.seg-input:checked + .seg-label { background: var(--color-surface-3); color: var(--color-text-primary); }
.seg-input:focus-visible + .seg-label { box-shadow: var(--focus-ring); }
.seg-input:disabled + .seg-label { opacity: 0.4; }
.seg-input:disabled { cursor: not-allowed; }
/* stacked (design/site-mode-control.md): one 44-px row per option, the
   whole width for a long name; 3 options = 140 px, fixed whatever is chosen */
.segmented.is-stacked { grid-auto-flow: row; grid-auto-rows: var(--h-control); height: auto; }
.segmented.is-stacked .seg-label { justify-content: flex-start; padding: 0 var(--space-3); }
.seg-input:not(:disabled):hover + .seg-label { color: var(--color-text-primary); }

/* checkbox: 24 × 24 inside a 44-px row */
.check-row { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: var(--h-control); cursor: pointer; }
.check-input { position: absolute; left: 0; top: 50%; width: 24px; height: 24px; margin: -12px 0 0; opacity: 0; cursor: pointer; }
.check-box { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--color-field); box-shadow: inset 0 0 0 1.5px var(--color-text-tertiary); color: var(--color-text-on-accent); transition: background-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out); }
.check-box .icon { width: 16px; height: 16px; visibility: hidden; }
.check-input:checked + .check-box { background: var(--color-accent); box-shadow: none; }
.check-input:checked + .check-box .icon { visibility: visible; }
.check-input:focus-visible + .check-box { box-shadow: var(--focus-ring); }
.check-input:disabled + .check-box { opacity: 0.4; }
.check-row.is-error .check-box { box-shadow: inset 0 0 0 1.5px var(--color-danger); }
.check-label { min-width: 0; }

/* ---- E. status: badge (24 px, min-width 96) and dot (always rendered) ---- */
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 24px; min-width: 96px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); font-size: var(--text-label-size); line-height: var(--text-label-line); font-weight: var(--text-label-weight); white-space: nowrap; }
.badge-ok { background: var(--color-ok-soft); }
.badge-warn { background: var(--color-warn-soft); }
.badge-danger { background: var(--color-danger-soft); }
.badge-accent { background: var(--color-accent-soft); }
.dot { display: inline-block; flex: none; width: var(--size-status-dot); height: var(--size-status-dot); border-radius: 50%; background: var(--color-neutral); }
.dot-ok { background: var(--color-ok); }
.dot-warn { background: var(--color-warn); }
.dot-danger { background: var(--color-danger); }
.dot-accent { background: var(--color-accent); }
.dot.pulse { animation: pulse 1.4s var(--ease-inout) infinite; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--space-2); border-radius: 6px; background: var(--color-surface-2); font-size: var(--text-label-size); line-height: var(--text-label-line); font-weight: var(--text-label-weight); }
.tone-warn { color: var(--color-warn); }
.tone-danger { color: var(--color-danger); }

/* ---- cards ---- */
.card { background: var(--color-surface-1); border-radius: var(--radius-card); padding: var(--space-4); }
.card + .card, .plate + .card, .quick + .card, .card + .home-grid, .plate + .home-grid, .quick + .home-grid { margin-top: var(--space-4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.card-title { font-size: var(--text-body-size); line-height: 28px; font-weight: var(--text-body-strong-weight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { height: var(--h-control); display: flex; align-items: center; }
.card-empty { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--space-3); flex: 1; }
.count-badge { flex: none; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--color-surface-2); font-size: var(--text-label-size); line-height: 24px; font-feature-settings: var(--font-feature-tabular); }
.kv-row { height: var(--h-row); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.kv-key { color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-value { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-rows .kv-value { width: 120px; flex: none; text-align: right; } /* E. node health: value cell 120 px */

/* E. the address plate: fixed 136 px; only the dot's colour and the caption's text change */
.plate { height: 136px; display: flex; flex-direction: column; justify-content: space-between; padding: var(--space-4); border-radius: var(--radius-card); background: var(--color-surface-1); }
.plate-title { height: 22px; color: var(--color-text-secondary); font-size: var(--text-label-size); line-height: 22px; }
.plate-line { height: var(--h-control); display: flex; align-items: center; gap: var(--space-3); }
.plate-ip { flex: 1; min-width: 0; font-size: 24px; line-height: var(--text-display-line); font-weight: var(--text-display-weight); letter-spacing: var(--text-display-tracking); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 400px) { .plate-ip { font-size: var(--text-display-size); } }
.plate-skeleton { flex: 1; height: var(--text-display-line); }
.plate-caption { height: 22px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-danger .plate-caption { color: var(--color-danger); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-top: var(--space-4); }
.quick .btn { width: 100%; }
.start-list { display: flex; flex-direction: column; }
.start-list li { height: var(--h-row); display: flex; align-items: center; gap: var(--space-3); }
.start-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-2); font-size: var(--text-label-size); font-feature-settings: var(--font-feature-tabular); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.home-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.home-col .card + .card { margin-top: 0; }
@media (min-width: 1024px) { .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* fixed card heights: polling, a stale poll and every state land in the same boxes */
.health-card { height: 252px; }
.health-rows { height: 188px; }
.health-caption { position: relative; height: var(--h-field-help); display: flex; gap: var(--space-3); align-items: center; font-size: var(--text-caption-size); line-height: var(--text-caption-line); color: var(--color-warn); }
.health-stale { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refused { flex: none; position: relative; }
.refused > summary { list-style: none; cursor: pointer; }
.refused > summary::-webkit-details-marker { display: none; }
.refused-pre { position: absolute; right: 0; bottom: calc(100% + var(--space-2)); width: min(480px, 80vw); height: 240px; overflow: auto; margin: 0; padding: var(--space-3); white-space: pre; color: var(--color-text-primary); }
.gauge { height: 128px; display: flex; flex-direction: column; }
.gauge-bar { height: 8px; margin-top: var(--space-3); border-radius: 4px; background: var(--color-surface-2); overflow: hidden; }
.gauge-fill { display: block; height: 100%; border-radius: 4px; background: var(--color-accent); }
.gauge-warn .gauge-fill { background: var(--color-warn); }
.gauge-danger .gauge-fill { background: var(--color-danger); }
.gauge-caption { height: 20px; margin-top: var(--space-3); display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-caption-size); line-height: 20px; color: var(--color-text-secondary); font-feature-settings: var(--font-feature-tabular); }
.gauge-used { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge-day { flex: none; }
.gauge-plan { height: 20px; font-size: var(--text-caption-size); line-height: 20px; }
.names-card { height: 280px; display: flex; flex-direction: column; }
.activity-card { height: 312px; display: flex; flex-direction: column; }
.kv-list, .activity-list { flex: 1; min-height: 0; }
.activity-row { height: 40px; display: flex; align-items: center; gap: var(--space-3); }
.activity-when { flex: none; color: var(--color-text-secondary); font-size: var(--text-caption-size); }
.activity-what { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-actor { color: var(--color-text-secondary); }

/* ---- D. the table ---- */
.table-region { position: relative; }
.toolbar { height: var(--h-topbar); display: flex; align-items: center; gap: var(--space-3); }
.search { position: relative; flex: 1; min-width: 0; height: var(--h-control); }
.toolbar .search { max-width: 420px; }
.search-icon { position: absolute; left: 10px; top: 10px; color: var(--color-text-secondary); pointer-events: none; }
.search-input { width: 100%; height: 100%; padding: 0 var(--h-control) 0 42px; border: 0; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); appearance: none; -webkit-appearance: none; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--color-text-tertiary); }
.search-input:focus-visible { box-shadow: var(--focus-ring); }
.search-clear { position: absolute; right: 0; top: 0; width: var(--h-control); height: var(--h-control); display: flex; }
.count { flex: none; color: var(--color-text-secondary); font-size: var(--text-label-size); white-space: nowrap; font-feature-settings: var(--font-feature-tabular); }
.toolbar-action { margin-left: auto; flex: none; }
.chips-row { height: var(--h-control); display: flex; align-items: center; gap: var(--space-2); overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; }
.chip-filter { max-width: 280px; }
.chip-filter .chip-text { overflow: hidden; text-overflow: ellipsis; }
.chip-filter .chip-x { pointer-events: none; }
.chips-clear { flex: none; font-size: var(--text-label-size); }
.table-wrap { position: relative; }
.table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.th { position: sticky; top: 0; z-index: 2; height: var(--h-control); padding: 0; background: var(--color-bg); border-bottom: 1px solid var(--color-line); color: var(--color-text-secondary); font-size: var(--text-label-size); line-height: var(--text-label-line); font-weight: var(--text-label-weight); text-align: left; }
.bars-1 .th { top: var(--h-banner); }
.bars-2 .th { top: calc(var(--h-banner) * 2); }
.th-btn { display: flex; align-items: center; gap: var(--space-1); width: 100%; height: var(--h-control); padding: 0 var(--space-2); color: inherit; text-decoration: none; border-radius: 8px; }
a.th-btn:hover { color: var(--color-text-primary); background: var(--color-surface-1); }
.th-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-icon { width: var(--h-filter-icon); height: var(--h-filter-icon); flex: none; display: flex; align-items: center; justify-content: center; color: var(--color-accent); }
.th-icon .icon { width: 12px; height: 12px; }
.al-right, .al-right .th-btn { text-align: right; justify-content: flex-end; }
.al-center, .al-center .th-btn { text-align: center; justify-content: center; }
.row { height: var(--h-row); transition: background-color var(--motion-fast) var(--ease-out); }
.table.dense .row { height: var(--h-row-dense); }
.row:hover { background: var(--color-surface-2); }
.row.is-selected { background: var(--color-accent-soft); }
.td { height: var(--h-row); padding: 0 var(--space-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table.dense .td { height: var(--h-row-dense); }
.row.is-disabled .td { color: var(--color-text-secondary); }
.td.mono { font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); font-size: var(--text-mono-size); }
.td.al-right { font-feature-settings: var(--font-feature-tabular); }
.cell-text { display: block; overflow: hidden; text-overflow: ellipsis; }
.td-actions { position: relative; overflow: visible; padding: 0 var(--space-2); text-align: right; }
.actions-slot { display: inline-flex; justify-content: flex-end; align-items: center; width: 100%; }
.row-spinner { position: absolute; right: 26px; left: auto; top: 0; bottom: 0; margin: auto 0; animation: spin 0.8s linear infinite; }
.row.htmx-request .actions-slot { visibility: hidden; }
.row.htmx-request .row-spinner, .card-row.htmx-request .row-spinner { visibility: visible; }
.row-empty .td, .row-empty td { height: auto; padding: 0; white-space: normal; }
.pagination { height: var(--h-control); display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
.page-of { min-width: 120px; text-align: center; color: var(--color-text-secondary); font-size: var(--text-label-size); font-feature-settings: var(--font-feature-tabular); }
/* fixed column widths (Column.Width): never auto */
.cw-p18 { width: 18%; } .cw-p20 { width: 20%; } .cw-p22 { width: 22%; } .cw-p24 { width: 24%; } .cw-p30 { width: 30%; } .cw-p40 { width: 40%; } .cw-p50 { width: 50%; }
.cw-rest { width: auto; } /* shares what the fixed columns leave (table-layout: fixed: never content-driven) */
.cw-72 { width: 72px; } .cw-80 { width: 80px; } .cw-96 { width: 96px; } .cw-112 { width: 112px; } .cw-120 { width: 120px; } .cw-140 { width: 140px; } .cw-160 { width: 160px; } .cw-176 { width: 176px; } .cw-200 { width: 200px; }

/* D. popovers: overlays anchored to their trigger; the table never moves */
.popover { position: absolute; z-index: var(--z-popover); background: var(--color-surface-1); border-radius: var(--radius-field); box-shadow: var(--shadow-popover); }
.filter-pop { top: calc(100% + var(--space-1)); left: 0; width: 280px; max-height: 360px; display: flex; flex-direction: column; padding: var(--space-2); color: var(--color-text-primary); font-weight: var(--text-body-weight); text-align: left; }
.al-right .filter-pop { left: auto; right: 0; }
.pop-close { position: absolute; top: var(--space-2); right: var(--space-2); }
.pop-sort { display: flex; flex-direction: column; padding-right: 48px; }
.pop-item { display: flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-2); border-radius: 8px; color: var(--color-text-primary); text-decoration: none; font-size: var(--text-body-size); }
.pop-item:hover { background: var(--color-surface-2); }
.pop-item.is-active { color: var(--color-accent); }
.pop-item .icon { width: 16px; height: 16px; }
.pop-filter { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pop-search { flex: none; margin-top: var(--space-2); }
.pop-actions { flex: none; height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-2); font-size: var(--text-label-size); }
.pop-list { flex: 1; min-height: 0; overflow-y: auto; }
.pop-check { min-height: 40px; padding: 0 var(--space-2); }
.pop-check .check-input { left: var(--space-2); }
.pop-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-body-size); }
.pop-count { flex: none; color: var(--color-text-secondary); font-size: var(--text-label-size); font-feature-settings: var(--font-feature-tabular); }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { top: calc(100% + var(--space-1)); right: 0; min-width: 200px; padding: var(--space-2); display: flex; flex-direction: column; text-align: left; }
.menu-pop form { display: contents; }
.menu-item { display: flex; align-items: center; height: var(--h-control); padding: 0 var(--space-3); border: 0; border-radius: 8px; background: transparent; color: var(--color-text-primary); text-decoration: none; text-align: left; font-size: var(--text-body-size); white-space: nowrap; }
.menu-item:hover { background: var(--color-surface-2); }
.menu-danger { margin-top: var(--space-3); color: var(--color-danger); }
/* phone: the filter sheet (70 vh) */
.sheet-scrim { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--color-overlay); }
.filter-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet); height: 70vh; display: flex; flex-direction: column; border-radius: var(--radius-card) var(--radius-card) 0 0; }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--gutter) var(--space-8); }
.sheet-section + .sheet-section { margin-top: var(--space-6); }
.sheet-section-title { height: 40px; line-height: 40px; font-size: var(--text-label-size); color: var(--color-text-secondary); }
.sheet-section .pop-list { max-height: 240px; }

/* D. phone cards: the same data, fixed height per table */
.cards { display: flex; flex-direction: column; gap: var(--space-2); }
.card-row { position: relative; border-radius: var(--radius-card); background: var(--color-surface-1); }
.card-row.is-disabled { color: var(--color-text-secondary); }
.card-row .row-spinner { right: 30px; }
.card-row.htmx-request .mcard-switch { visibility: hidden; }
.card-empty { border-radius: var(--radius-card); background: var(--color-surface-1); }
.mcard { position: relative; height: 104px; padding: var(--space-4) calc(var(--w-switch) + var(--space-8)) var(--space-4) var(--space-4); display: flex; flex-direction: column; }
.mcard-line { height: 24px; display: flex; align-items: center; gap: var(--space-2); min-width: 0; white-space: nowrap; overflow: hidden; }
.mcard-line > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mcard-line > .tag { flex: none; }
.mcard-label { font-weight: var(--text-body-strong-weight); }
.mcard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); }
.mcard-switch { position: absolute; right: var(--space-4); top: 0; bottom: 0; display: flex; align-items: center; }

/* D. empty state: fixed min-height in the table body */
.empty { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center; }
@media (min-width: 1024px) { .table .empty { min-height: 320px; } }
.empty-title { font-size: var(--text-h2-size); line-height: var(--text-h2-line); font-weight: var(--text-h2-weight); letter-spacing: var(--text-h2-tracking); }
.empty-body { max-width: 440px; color: var(--color-text-secondary); white-space: normal; }
.empty-action { display: flex; flex-direction: column; align-items: center; margin-top: var(--space-2); }
.empty-action .field-help { padding: 2px 0 0; }
.empty-link { text-align: center; height: var(--h-field-help); font-size: var(--text-caption-size); }
.empty-help { margin-top: var(--space-2); font-size: var(--text-label-size); line-height: var(--text-label-line); }
.notice-help { margin-top: var(--space-1); }
.empty-help .link, .recipe-guide .link, .notice-help .link { display: inline-flex; align-items: center; min-height: var(--h-control); }

/* skeletons: the same boxes as the loaded layout */
.skeleton { display: block; border-radius: 8px; background: var(--color-surface-2); animation: shimmer var(--motion-skeleton) var(--ease-inout) infinite; }
.skeleton-row { height: calc(var(--h-row) - var(--space-4)); margin: var(--space-2) 0; }
@keyframes shimmer { 50% { opacity: 0.5; } }

/* ---- F. dialogs and sheets: <dialog>, fixed height per dialog, footer pinned ---- */
.sheet-host:empty { display: none; }
dialog.dialog { padding: 0; border: 0; color: var(--color-text-primary); background: var(--color-surface-1); box-shadow: var(--shadow-dialog); }
dialog.dialog[open] { display: flex; flex-direction: column; }
dialog.dialog::backdrop { background: var(--color-overlay); }
dialog.dialog[open]:not(:modal) { position: fixed; inset: 0; z-index: var(--z-dialog); margin: auto; }
.dialog-head { flex: none; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-3) 0 var(--space-6); }
.dialog-title { min-width: 0; font-size: var(--text-h2-size); line-height: var(--text-h2-line); font-weight: var(--text-h2-weight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--space-6); }
.dialog-foot { flex: none; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-6); }
.dialog-foot .btn { min-width: 0; }
.consequence { color: var(--color-text-secondary); height: 44px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.more-list { display: flex; flex-direction: column; }
.more-list form { display: contents; }
/* phone: a full-width sheet from the bottom, 92 vh */
dialog.dialog { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: var(--radius-card) var(--radius-card) 0 0; }
dialog.dialog-mapping { height: 92vh; }
dialog.dialog-confirm { height: 320px; }
dialog.dialog-more { height: 360px; }
@media (min-width: 1024px) {
  dialog.dialog { width: var(--w-dialog); max-width: calc(100vw - var(--space-8)); max-height: calc(100vh - var(--space-8)); margin: auto; border-radius: var(--radius-card); }
  dialog.dialog-mapping { height: 720px; }
  dialog.dialog-side { width: var(--w-sheet-side); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: var(--radius-card) 0 0 var(--radius-card); }
}
@media (min-width: 1024px) { dialog.dialog-more { height: 360px; } }

/* ---- mappings group (B1 PR 6): the mapping dialog, the names screen, the
   table's loading rows and the fresh row. Geometry rows in
   docs/notes/b1-portal.md, "mappings group". ---- */
.dialog-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mapping-body, .name-body { display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-1); padding-bottom: var(--space-4); }
.mapping-body > .segmented-field { margin-bottom: var(--space-4); }
/* F. port pair: both boxes always rendered in a 2-column grid; one shared 40-px slot */
.port-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.port-pair .field-help { padding-left: var(--space-4); }
.field-help.tone-warn { color: var(--color-warn); }
.field-help.tone-danger { color: var(--color-danger); }
/* chip field badge: a reserved box at the input row's trailing edge */
.chipfield.has-badge .field-input { padding-right: 136px; }
.chip-badge { position: absolute; right: var(--space-3); top: 16px; min-width: 0; }
.chip-badge.is-hidden { visibility: hidden; }
/* toggle (a switch inside a form): 52 × 32 in a 44-px row */
.toggle-row { height: var(--h-control); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-1) 0 var(--space-4); margin-bottom: var(--space-2); }
.toggle-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle { position: relative; width: var(--w-switch); height: var(--h-switch); flex: none; }
.toggle-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.toggle-bg { position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--color-surface-3); transition: background-color var(--motion-fast) var(--ease-out); }
.toggle-bg .knob { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--color-text-primary); transition: transform var(--motion-fast) var(--ease-out); }
.toggle-input:checked + .toggle-bg { background: var(--color-accent); }
.toggle-input:checked + .toggle-bg .knob { transform: translateX(20px); }
.toggle-input:focus-visible + .toggle-bg { box-shadow: var(--focus-ring); }
/* disclosure: the body's box is always laid out; closed = hidden in place */
.disclosure-btn { width: 100%; height: var(--h-control); display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-field); background: transparent; color: var(--color-text-secondary); font-size: var(--text-label-size); text-align: left; }
.disclosure-btn:hover { background: var(--color-surface-2); color: var(--color-text-primary); }
.disclosure-btn .icon { width: 20px; height: 20px; transition: transform var(--motion-fast) var(--ease-out); transform: rotate(-90deg); }
.disclosure.is-open .disclosure-btn .icon { transform: none; }
.disclosure-body { padding-top: var(--space-2); }
.js .disclosure:not(.is-open) .disclosure-body { visibility: hidden; }
.draft-caption { flex: 1; min-width: 0; text-align: center; color: var(--color-text-secondary); font-size: var(--text-caption-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.dialog-name { height: 92vh; }
@media (min-width: 1024px) { dialog.dialog-name { height: 400px; } }
/* D. the table's loading state: 8 skeleton rows over the body past 300 ms */
.table-loading { position: absolute; left: 0; right: 0; top: var(--h-control); bottom: 0; z-index: 1; overflow: hidden; background: var(--color-bg); visibility: hidden; transition: visibility 0s; }
.table-region.htmx-request .table-loading { visibility: visible; transition-delay: 300ms; }
/* the row that just landed fades in once */
.row.is-fresh, .card-row.is-fresh { animation: fresh-in var(--motion-fast) var(--ease-out); }
@keyframes fresh-in { from { opacity: 0; } }
/* the mapping card on phone: the kebab beside the switch, both centred in the reserved right column */
.card-row .mcard { padding-right: calc(var(--w-switch) + var(--h-control) + var(--space-8)); }
.mcard-menu { position: absolute; right: calc(var(--w-switch) + var(--space-4) + var(--space-1)); top: 0; bottom: 0; display: flex; align-items: center; }
.card-row.htmx-request .mcard-menu { visibility: hidden; }
/* names: the title line's quota badge, the reason line, the copy-in-cell, the CNAME card */
.title-line { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.quota-line { height: var(--h-field-help); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--h-field-help); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* audit: the window line under the range (reserved 24 px, always rendered: a 24-px target for "Cargar más"); the sentence ellipsizes, the link and the spinner slot never shrink */
.audit-window { display: flex; align-items: center; gap: var(--space-2); height: var(--space-6); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--h-field-help); }
.audit-window-text { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-more { flex: none; display: inline-flex; align-items: center; height: var(--space-6); white-space: nowrap; }
.audit-window .audit-window-busy { position: static; flex: none; width: 14px; height: 14px; margin: 0; }
.audit-window.htmx-request .audit-window-busy { visibility: visible; transition-delay: 300ms; }
.audit-window.htmx-request .audit-more { opacity: 0.6; }
.totp-recovery { color: var(--color-text-secondary); font-size: var(--text-label-size); text-align: center; }
.cell-copy { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.cell-copy .cell-text { flex: 1; min-width: 0; }
.cell-copy .btn-icon { width: 36px; height: 36px; }
.cname-card { margin-top: var(--space-6); height: 136px; display: flex; flex-direction: column; gap: var(--space-2); }
.cname-body { flex: 1; min-width: 0; color: var(--color-text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 22px; max-height: 66px; }
.cname-row { display: flex; align-items: flex-start; gap: var(--space-3); }
.ncard { position: relative; height: 80px; padding: var(--space-3) 64px var(--space-3) var(--space-4); display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); }
.ncard-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ncard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ncard-menu { position: absolute; right: var(--space-2); top: 0; bottom: 0; display: flex; align-items: center; }
@media (prefers-reduced-motion: reduce) { .row.is-fresh, .card-row.is-fresh { animation: none; } }

/* ---- Sitios and Equipos (portal-spec §3.8, §3.9, §3.13; group "sites") ---- */
.cell-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.cell-link:hover { text-decoration: underline; }
.dot-text { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; max-width: 100%; }
.dot-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* E. site card: fixed 2 rows; the outbound badge in a reserved 120-px slot */
.scard { height: 88px; padding: var(--space-4); display: flex; flex-direction: column; justify-content: space-between; }
.scard-line { height: 24px; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.scard-name { font-weight: var(--text-body-strong-weight); }
.scard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); }
.scard-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2); overflow: hidden; white-space: nowrap; }
.scard-slot { flex: none; width: 144px; display: flex; justify-content: flex-end; }
.pcard { height: 104px; padding: var(--space-4); display: flex; flex-direction: column; }
/* the inline title: the input takes the title's own 44-px box */
.page-head .page-titles { flex: 1; }
.title-edit { position: relative; height: var(--h-control); display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.title-text { flex: 1; min-width: 0; }
.title-form { display: none; position: absolute; left: 0; right: calc(var(--h-control) + var(--space-2)); top: 2px; height: 40px; }
.js .title-edit.is-editing .title-form, .title-edit.is-editing .title-form { display: block; }
.title-edit.is-editing .title-text { visibility: hidden; }
.title-input { width: 100%; height: 40px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); font-size: var(--text-title-size); line-height: var(--text-title-line); font-weight: var(--text-title-weight); letter-spacing: var(--text-title-tracking); }
.title-input:focus-visible { box-shadow: inset 0 0 0 2px var(--color-accent); } /* the ring stays inside the title's box */
.title-input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--color-danger); }
.title-error { top: calc(100% + var(--space-1)); left: 0; max-width: 100%; padding: var(--space-2) var(--space-3); color: var(--color-danger); font-size: var(--text-caption-size); line-height: var(--text-caption-line); }
.title-error:empty { display: none; }
.caption .link, .scard-meta .link { text-decoration: underline; } /* a link inside text is not told by colour alone */
.site-caption { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.site-caption .badge { flex: none; }
.site-address { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { height: var(--h-control); line-height: var(--h-control); font-size: var(--text-h2-size); font-weight: var(--text-h2-weight); letter-spacing: var(--text-h2-tracking); }
/* the outbound card: three fixed rows */
.outbound-card { margin-top: var(--space-6); }
.outbound-row { height: var(--h-row); }
.outbound-state { flex: none; display: flex; align-items: center; gap: var(--space-3); }
.outbound-help { height: 80px; overflow: hidden; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--text-caption-line); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
@media (min-width: 1024px) { .outbound-help { height: 48px; -webkit-line-clamp: 3; } }
.outbound-action { height: var(--h-row); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.outbound-line { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-secondary); }
.outbound-action .btn { flex: none; margin-left: auto; }
.outbound-reason { padding-left: 0; }
.danger-zone { margin-top: var(--space-6); display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
.danger-item { display: flex; flex-direction: column; }
.danger-item .field-help { padding: 2px 0 0; max-width: 360px; }
/* the peer detail: key-value rows of 56 px */
.kv-card { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.kv-end { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.kv-chips { min-width: 0; display: flex; gap: var(--space-2); overflow: hidden; }
.kv-edit { flex: none; }
.kv-help { padding-left: 0; }
/* the connector's rows (§9.10): the version line ellipsizes; «N por aprobar»
   sits in a slot reserved whether or not anything waits; the switch's help
   line is present and empty while the switch is on */
.kv-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.connector-pending-slot { display: inline-block; min-width: 112px; text-align: right; }
.connector-switch .kv-help { text-align: right; }
.notice-card { margin-bottom: var(--space-4); }
/* F. sheets of this group: fixed heights; footers pinned */
/* The sites group's dialogs only: the mapping, names and billing dialogs
   share the .dialog-form class with their own layout, which these rules
   displaced (a refused submit shifted the whole mapping form sideways). */
.sheet-inner, :is(dialog.dialog-site, dialog.dialog-peer, dialog.dialog-outbound, dialog.dialog-confirm-typed, dialog.dialog-qr, dialog.dialog-recipes) .dialog-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
:is(dialog.dialog-site, dialog.dialog-peer, dialog.dialog-outbound, dialog.dialog-confirm-typed, dialog.dialog-qr, dialog.dialog-recipes) .dialog-form .dialog-body { display: flex; flex-direction: column; gap: var(--space-1); }
:is(dialog.dialog-site, dialog.dialog-peer, dialog.dialog-outbound, dialog.dialog-confirm-typed, dialog.dialog-qr, dialog.dialog-recipes) .dialog-form .segmented-field { margin-top: var(--space-2); }
.form-line { flex: none; height: var(--h-field-help); padding: 0 var(--space-6); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--h-field-help); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-line.is-error { color: var(--color-danger); }
.reveal-pending .form-line { padding: 0; }
.dialog-caption { flex: none; margin-bottom: var(--space-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keys-note { flex: none; height: 40px; overflow: hidden; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; }
.draft-caption { padding-left: 0; }
.kind-row { flex: none; }
dialog.dialog-site, dialog.dialog-peer, dialog.dialog-outbound, dialog.dialog-qr, dialog.dialog-recipes { height: 92vh; }
dialog.dialog-confirm-typed { height: 420px; }
@media (min-width: 1024px) {
  dialog.dialog-site { height: 640px; }
  dialog.dialog-peer { height: 640px; }
  dialog.dialog-outbound { height: 520px; }
  dialog.dialog-qr { width: 640px; height: 720px; }
  dialog.dialog-recipes { height: 100vh; }
}
/* E. the configuration shown once: QR 240/280, pre 320, pills, the gate */
.reveal-once { flex: none; margin-bottom: var(--space-3); }
.qr-box { flex: none; width: 240px; height: 240px; margin: 0 auto var(--space-4); }
@media (min-width: 1024px) { .qr-box { width: 280px; height: 280px; } }
.qr-box .qr, .qr-full .qr { width: 100%; height: 100%; }
.qr-skeleton { width: 100%; height: 100%; }
.skeleton.is-still { animation: none; }
.config-pre { flex: none; height: 320px; margin: 0; padding: var(--space-3) var(--space-4); overflow: auto; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); white-space: pre; font-size: var(--text-caption-size); line-height: 20px; }
.config-pre.is-lost { white-space: normal; font-family: var(--font-sans); color: var(--color-text-secondary); }
.reveal-pills { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.reveal-pills .btn { min-width: 0; padding: 0 var(--space-2); font-size: var(--text-label-size); }
/* the peer reveal's side-sheet link (a button); the mapping dialog's .disclosure is a container with its own rules */
button.disclosure { flex: none; width: 100%; height: var(--h-row); margin-top: var(--space-2); padding: 0 var(--space-2); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border: 0; border-radius: var(--radius-field); background: transparent; color: var(--color-text-primary); text-align: left; }
button.disclosure:hover { background: var(--color-surface-2); }
.reveal-pending { flex: none; min-height: 320px; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.reveal-foot { height: 144px; flex-wrap: wrap; align-content: center; padding-top: var(--space-2); padding-bottom: var(--space-4); }
.reveal-foot .check-row { flex: 1 1 100%; min-height: var(--h-row); }
.reveal-foot .btn-primary { flex: 1 1 100%; }
@media (min-width: 1024px) {
  .reveal-foot { height: 80px; flex-wrap: nowrap; padding-bottom: var(--space-2); }
  .reveal-foot .check-row { flex: 1 1 auto; min-width: 0; }
  .reveal-foot .btn-primary { flex: none; min-width: 160px; }
}
.qr-full-body { display: flex; align-items: center; justify-content: center; }
.qr-full { width: min(560px, calc(100vw - 96px), calc(92vh - 128px)); aspect-ratio: 1; }
@media (min-width: 1024px) { .qr-full { width: 560px; } }
.recipes-body { padding-bottom: var(--space-6); }
.recipe { padding: var(--space-4) 0; }
.recipe-title { font-size: var(--text-body-size); line-height: 28px; font-weight: var(--text-body-strong-weight); }
.recipe-steps { list-style: decimal; padding-left: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); color: var(--color-text-secondary); }
.recipe-steps p { color: var(--color-text-primary); }
.recipe-cmd { margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3); max-width: 100%; overflow-x: auto; border-radius: 8px; background: var(--color-field); color: var(--color-text-primary); white-space: pre; font-size: var(--text-caption-size); line-height: 18px; }
.recipe-failover { margin-top: var(--space-3); color: var(--color-warn); font-size: var(--text-label-size); }
.recipe-other { padding-top: var(--space-2); }
.recipe-mode { padding: var(--space-4) 0 0; color: var(--color-text-secondary); }

/* ---- Cuenta, Bitácora, invitation, Inicio's cards (portal-spec §3.14,
   §3.15; group "account"). Geometry rows in docs/notes/b1-portal.md,
   "account group". ---- */
.privacy-short { height: auto; } /* the legal line (legal/aviso-de-privacidad-simplificado.md) is page-load text, longer than B5's 40-px placeholder */
/* the tab bar: equal cells; the active one changes colour and shows a 2-px bar, never weight */
.tabs { height: var(--h-control); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; margin-bottom: var(--space-4); border-radius: var(--radius-field); background: var(--color-surface-1); }
.tab { position: relative; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--color-text-secondary); font-size: var(--text-label-size); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); }
.tab:hover { color: var(--color-text-primary); }
.tab.is-active { background: var(--color-surface-3); color: var(--color-text-primary); }
.tab.is-active::after { content: ""; position: absolute; left: var(--space-4); right: var(--space-4); bottom: 2px; height: 2px; border-radius: 2px; background: var(--color-accent); }
.tab-body { min-height: 240px; }
.profile-card .quota-line { margin-top: var(--space-1); }
.profile-form { margin-top: var(--space-2); }
.form-foot { display: flex; justify-content: flex-end; padding-top: var(--space-2); }
.mail-card { margin-top: var(--space-4); }
/* Datos fiscales: the profile card's form shape; the intro and the state line are 2-line reserved slots */
.fiscal-card { margin-top: var(--space-4); }
.fiscal-card .quota-line { margin-top: var(--space-1); }
.fiscal-intro { padding-left: 0; padding-right: 0; }
.fiscal-form { margin-top: var(--space-2); }
.fiscal-status { padding-left: 0; padding-right: 0; }
.fiscal-status.is-complete { color: var(--color-ok); }
.mail-row { padding-left: 0; margin: var(--space-2) 0 0; }
.inline-form { display: inline-flex; }
/* the inline role select: 40 px inside the 56-px row */
.role-form { display: flex; align-items: center; gap: var(--space-2); height: var(--h-row); }
.role-select { height: 40px; min-width: 0; max-width: 100%; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); font-size: var(--text-label-size); cursor: pointer; }
.role-select:focus-visible { box-shadow: var(--focus-ring); }
.role-select:disabled { opacity: 0.4; cursor: not-allowed; }
/* phone cards of the account tables and the audit: fixed 104 px */
.ucard { position: relative; height: 104px; padding: var(--space-3) 64px var(--space-3) var(--space-4); display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); }
.ucard-email { font-weight: var(--text-body-strong-weight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard-role .role-form { height: 40px; }
.acard { height: 104px; padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); color: inherit; text-decoration: none; }
.acard-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); }
/* Seguridad: two rows of 56 + a reserved 20-px line each */
.sec-row + .sec-row { margin-top: var(--space-1); }
.sec-card + .section-title { margin-top: var(--space-6); }
.sessions-off { min-height: 120px; display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); }
.table-region + .section-title { margin-top: var(--space-6); }
/* the TOTP sheet: fixed height; a 3-dot stepper of fixed size; steps swap the body */
dialog.dialog-totp, dialog.dialog-key, dialog.dialog-invite, dialog.dialog-password, dialog.dialog-totp-off { height: 92vh; }
@media (min-width: 1024px) {
  dialog.dialog-totp { height: 720px; }
  dialog.dialog-key { height: 520px; }
  dialog.dialog-invite { height: 440px; }
  dialog.dialog-password { height: 520px; }
  dialog.dialog-totp-off { height: 400px; }
}
.stepper { flex: none; height: 20px; display: flex; justify-content: center; align-items: center; gap: var(--space-2); }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-surface-3); }
.step-dot.is-done { background: var(--color-text-secondary); }
.step-dot.is-current { background: var(--color-accent); }
.totp-body { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3); padding-top: var(--space-3); }
.totp-text { min-height: 44px; color: var(--color-text-secondary); }
.totp-manual { color: var(--color-text-secondary); font-size: var(--text-label-size); }
.secret-row { height: var(--h-control); display: flex; align-items: center; gap: var(--space-2); }
.secret { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.totp-body .code { margin: 0 auto; }
/* the six-box code is 328 px: on a phone the sheet's body gives it the room (no sideways scroll) */
@media (max-width: 1023.98px) { dialog.dialog-totp .dialog-body, dialog.dialog-totp-off .dialog-body { padding: 0 var(--space-4); } }
.codes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 40px; gap: 0 var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-field); background: var(--color-field); }
.code-cell { display: flex; align-items: center; justify-content: center; }
.key-pre { flex: none; margin: var(--space-2) 0 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-field); background: var(--color-field); white-space: pre-wrap; word-break: break-all; min-height: 72px; }
.key-reveal { display: flex; flex-direction: column; gap: var(--space-2); }
.key-reveal .reveal-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cli-hint { margin-top: var(--space-4); min-height: var(--h-control); display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); color: var(--color-text-secondary); }
.cli-hint code { padding: 2px var(--space-2); border-radius: 6px; background: var(--color-surface-1); color: var(--color-text-primary); }
/* Bitácora: the caption's right slot, the range form, the date picker */
.caption-split { display: flex; justify-content: space-between; gap: var(--space-4); }
.caption-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption-end { flex: none; }
.range-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-3); align-items: start; }
.range-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (min-width: 1024px) {
  .range-form { grid-template-columns: 200px 200px 1fr; }
  .range-actions { grid-column: auto; height: var(--h-field); align-items: center; }
}
.datefield { position: relative; }
.cal-pop { top: calc(var(--h-field) + var(--space-1)); right: 0; width: calc(40px * 7 + var(--space-3) * 2); padding: var(--space-3); }
.cal-head { height: var(--h-control); display: flex; align-items: center; justify-content: space-between; }
.cal-title { flex: 1; text-align: center; font-size: var(--text-label-size); font-weight: var(--text-body-strong-weight); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 40px); grid-template-rows: 24px repeat(6, 40px); }
.cal-dow { display: flex; align-items: center; justify-content: center; color: var(--color-text-secondary); font-size: var(--text-caption-size); }
.cal-day { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-text-primary); font-feature-settings: var(--font-feature-tabular); }
.cal-day:hover { background: var(--color-surface-2); }
.cal-day.is-other { color: var(--color-text-secondary); } /* tertiary is for placeholders only (contrast) */
.cal-day.is-today { box-shadow: inset 0 0 0 1px var(--color-text-secondary); }
.cal-day.is-selected { background: var(--color-accent); color: var(--color-text-on-accent); }
@media (max-width: 1023.98px) {
  .cal-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; display: flex; flex-direction: column; align-items: center; border-radius: var(--radius-card) var(--radius-card) 0 0; z-index: var(--z-sheet); }
}
/* the audit side sheet: key-value rows of 56; the before/after in a fixed box */
dialog.dialog-audit { height: 92vh; }
.diff-title { margin-top: var(--space-4); height: var(--h-control); line-height: var(--h-control); font-size: var(--text-body-size); font-weight: var(--text-body-strong-weight); }
.diff-box { height: 320px; overflow: auto; border-radius: var(--radius-field); background: var(--color-field); }
.diff-box:focus-visible { box-shadow: var(--focus-ring); }
.diff { width: 100%; border-collapse: collapse; font-size: var(--text-caption-size); }
.diff th, .diff td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; word-break: break-all; }
.diff thead th { position: sticky; top: 0; background: var(--color-surface-2); color: var(--color-text-secondary); font-family: var(--font-sans); }
.diff tr.is-changed { background: var(--color-accent-soft); }
/* Inicio: the restrictions card and the two-step nag (page-load layout) */
.restrict-card, .nag-card { margin-top: var(--space-4); }
.restrict-row { padding: var(--space-2) 0; }
.restrict-what { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.restrict-since { margin-left: auto; flex: none; color: var(--color-text-secondary); font-size: var(--text-caption-size); }
.restrict-reason { padding-left: calc(var(--size-status-dot) + var(--space-2)); color: var(--color-text-secondary); }
.nag-card { min-height: 120px; display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.nag-text { flex: 1 1 240px; min-width: 0; }
.nag-actions { display: flex; gap: var(--space-2); }
/* ---- Checkout and Facturación (portal-spec §3.6, §3.12; group "billing").
   Geometry rows in docs/notes/b1-portal.md, "billing group". ---- */
.checkout { display: flex; flex-direction: column; gap: var(--space-4); }
@media (min-width: 1024px) { .checkout { max-width: var(--w-dialog); } }
.summary-explain { height: 40px; overflow: hidden; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.summary-total .kv-value { font-weight: var(--text-body-strong-weight); }
/* phone: each 56-px summary row holds its key over its value (the values do not fit beside the keys at 360 px) */
@media (max-width: 1023.98px) {
  .summary .kv-row { flex-direction: column; align-items: stretch; justify-content: center; gap: 0; }
  .summary .kv-key { font-size: var(--text-label-size); line-height: 18px; }
  .summary .kv-row .kv-value { line-height: 22px; text-align: right; font-size: var(--text-label-size); }
  .summary .summary-total .kv-value { font-size: var(--text-body-size); }
}
.kv-value.num { font-feature-settings: var(--font-feature-tabular); text-align: right; }
.kv-badge { flex: none; }
.kv-ref { min-width: 0; display: flex; align-items: center; gap: var(--space-1); }
.card-form { display: flex; flex-direction: column; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); }
.card-grid .field { min-width: 0; }
.consent-row { height: 80px; align-items: flex-start; padding-top: var(--space-2); }
.consent-label { font-size: var(--text-label-size); line-height: 18px; max-height: 72px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.consent-label a { color: inherit; }
.pci { height: 40px; display: flex; align-items: flex-start; gap: var(--space-2); overflow: hidden; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; }
.pci .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.checkout-legal { height: 80px; overflow: hidden; margin-top: var(--space-2); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 16px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
@media (min-width: 1024px) { .checkout-legal { height: 48px; -webkit-line-clamp: 3; } }
.card-form .form-line { padding: 0; margin-top: var(--space-2); }
.card-cta { margin-top: var(--space-2); }
.card-cta .btn-primary { width: 100%; }
.card-cta-caption, .card-caption { height: var(--h-field-help); }
.field-input.mono ~ .field-trailing .field-unit, .card-brand { font-size: var(--text-caption-size); color: var(--color-text-secondary); }
.wait-card { height: 176px; display: flex; flex-direction: column; justify-content: space-between; }
.wait-spinner { position: static; display: block; width: 24px; height: 24px; margin: 0; visibility: visible; }
.wait-text { height: 66px; overflow: hidden; }
.sub-card .card-head { min-height: 44px; }
.card-on-file .kv-row { gap: var(--space-3); }
.card-text { flex: 1; }
.billing-charges { margin-top: var(--space-6); }
.plans-card, .billing-danger { margin-top: var(--space-4); }
.plans-body { height: 44px; overflow: hidden; color: var(--color-text-secondary); }
.danger-row { height: var(--h-row); display: flex; align-items: center; }
.danger-row .body { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chcard { height: 80px; display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); }
.chcard-line { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-width: 0; }
.chcard-concept { min-width: 0; flex: 1; }
.chcard-amount { flex: none; font-feature-settings: var(--font-feature-tabular); }
.chcard-meta { color: var(--color-text-secondary); font-size: var(--text-label-size); }
.dialog-note { height: 44px; overflow: hidden; margin-bottom: var(--space-3); color: var(--color-text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dialog-card .card-form { padding-bottom: var(--space-4); }
.cancel-block { height: 176px; overflow-y: auto; margin-bottom: var(--space-3); color: var(--color-text-secondary); }
.cancel-undo { margin-top: var(--space-2); color: var(--color-text-primary); }
@media (min-width: 1024px) { .cancel-block { height: 154px; } }
dialog.dialog-card { height: 92vh; }
dialog.dialog-cancel { height: 92vh; }
@media (min-width: 1024px) {
  dialog.dialog-card { height: 600px; }
  dialog.dialog-cancel { height: 560px; }
  dialog.dialog-charge { height: 100vh; }
}

/* ---- toasts: fixed overlay, never in flow ---- */
.toasts { position: fixed; z-index: var(--z-toast); left: var(--gutter); right: var(--gutter); bottom: calc(var(--h-tabbar) + var(--gutter) * 2); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); pointer-events: none; }
@media (min-width: 1024px) { .toasts { left: auto; right: var(--gutter-desktop); bottom: var(--gutter-desktop); width: 380px; align-items: stretch; } }
.layout-auth .toasts { bottom: var(--gutter); }
.toast { pointer-events: auto; width: 100%; max-width: 420px; min-height: var(--h-row); display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-1) var(--space-2) var(--space-4); border-radius: var(--radius-card); background: var(--color-surface-2); box-shadow: var(--shadow-popover); animation: toast-in var(--motion-fast) var(--ease-out); }
.toast-text { flex: 1; min-width: 0; }
.toast-ok { box-shadow: inset 4px 0 0 var(--color-ok), var(--shadow-popover); }
.toast-error { box-shadow: inset 4px 0 0 var(--color-danger), var(--shadow-popover); }
.toast-info { box-shadow: inset 4px 0 0 var(--color-accent), var(--shadow-popover); }
.toast.is-leaving { opacity: 0; transition: opacity var(--motion-fast) var(--ease-in); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* QR (static/js/qr.js): light quiet zone, dark modules, any theme */
.qr { display: block; border-radius: var(--radius-field); }
.qr-light { fill: var(--color-text-primary); }
.qr-dark { fill: var(--color-bg); }

/* ---- boundary and misc ---- */
.boundary, .card.boundary { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }

/* ---- page transition: cross-fade 250 ms (View Transitions where available) ---- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--motion-nav); animation-timing-function: var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  .dot.pulse, .skeleton, .htmx-request .switch .knob, .switch[aria-busy="true"] .knob { animation: none; }
  .spinner { animation-duration: 2.4s; }
  .toast { animation: none; }
}

/* ---- gauge widths: 0–100 %, one class each (CSP style-src 'self': no inline style) ---- */
.pct-0 { width: 0%; } .pct-1 { width: 1%; } .pct-2 { width: 2%; } .pct-3 { width: 3%; } .pct-4 { width: 4%; } .pct-5 { width: 5%; } .pct-6 { width: 6%; } .pct-7 { width: 7%; } .pct-8 { width: 8%; } .pct-9 { width: 9%; }
.pct-10 { width: 10%; } .pct-11 { width: 11%; } .pct-12 { width: 12%; } .pct-13 { width: 13%; } .pct-14 { width: 14%; } .pct-15 { width: 15%; } .pct-16 { width: 16%; } .pct-17 { width: 17%; } .pct-18 { width: 18%; } .pct-19 { width: 19%; }
.pct-20 { width: 20%; } .pct-21 { width: 21%; } .pct-22 { width: 22%; } .pct-23 { width: 23%; } .pct-24 { width: 24%; } .pct-25 { width: 25%; } .pct-26 { width: 26%; } .pct-27 { width: 27%; } .pct-28 { width: 28%; } .pct-29 { width: 29%; }
.pct-30 { width: 30%; } .pct-31 { width: 31%; } .pct-32 { width: 32%; } .pct-33 { width: 33%; } .pct-34 { width: 34%; } .pct-35 { width: 35%; } .pct-36 { width: 36%; } .pct-37 { width: 37%; } .pct-38 { width: 38%; } .pct-39 { width: 39%; }
.pct-40 { width: 40%; } .pct-41 { width: 41%; } .pct-42 { width: 42%; } .pct-43 { width: 43%; } .pct-44 { width: 44%; } .pct-45 { width: 45%; } .pct-46 { width: 46%; } .pct-47 { width: 47%; } .pct-48 { width: 48%; } .pct-49 { width: 49%; }
.pct-50 { width: 50%; } .pct-51 { width: 51%; } .pct-52 { width: 52%; } .pct-53 { width: 53%; } .pct-54 { width: 54%; } .pct-55 { width: 55%; } .pct-56 { width: 56%; } .pct-57 { width: 57%; } .pct-58 { width: 58%; } .pct-59 { width: 59%; }
.pct-60 { width: 60%; } .pct-61 { width: 61%; } .pct-62 { width: 62%; } .pct-63 { width: 63%; } .pct-64 { width: 64%; } .pct-65 { width: 65%; } .pct-66 { width: 66%; } .pct-67 { width: 67%; } .pct-68 { width: 68%; } .pct-69 { width: 69%; }
.pct-70 { width: 70%; } .pct-71 { width: 71%; } .pct-72 { width: 72%; } .pct-73 { width: 73%; } .pct-74 { width: 74%; } .pct-75 { width: 75%; } .pct-76 { width: 76%; } .pct-77 { width: 77%; } .pct-78 { width: 78%; } .pct-79 { width: 79%; }
.pct-80 { width: 80%; } .pct-81 { width: 81%; } .pct-82 { width: 82%; } .pct-83 { width: 83%; } .pct-84 { width: 84%; } .pct-85 { width: 85%; } .pct-86 { width: 86%; } .pct-87 { width: 87%; } .pct-88 { width: 88%; } .pct-89 { width: 89%; }
.pct-90 { width: 90%; } .pct-91 { width: 91%; } .pct-92 { width: 92%; } .pct-93 { width: 93%; } .pct-94 { width: 94%; } .pct-95 { width: 95%; } .pct-96 { width: 96%; } .pct-97 { width: 97%; } .pct-98 { width: 98%; } .pct-99 { width: 99%; }
.pct-100 { width: 100%; }

/* ---- legal texts (/legal/<slug>): a 720-px reading column in the auth layout ---- */
.auth-main:has(.legal-doc) { max-width: 720px; }
.legal-doc { gap: var(--space-4); }
.legal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--color-text-secondary); }
.legal-notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-field); background: var(--color-warn-soft); font-size: var(--text-body-size); line-height: var(--text-body-line); }
.legal-body { font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--color-text-primary); overflow-wrap: anywhere; }
.legal-body > * + * { margin-top: var(--space-3); }
.legal-doc h2, .legal-body h2 { margin-top: var(--space-8); font-size: var(--text-h2-size); line-height: var(--text-h2-line); font-weight: var(--text-h2-weight); letter-spacing: var(--text-h2-tracking); }
.legal-body h3 { margin-top: var(--space-6); font-size: var(--text-body-size); font-weight: var(--text-body-strong-weight); }
.legal-body strong { font-weight: 600; }
.legal-body a { color: var(--color-accent); text-decoration: underline; }
.legal-body ul, .legal-body ol { padding-left: var(--space-6); }
.legal-body ul { list-style: disc; }
.legal-body ol { list-style: decimal; }
.legal-body li + li { margin-top: var(--space-1); }
.legal-body blockquote { padding: var(--space-3) var(--space-4); border-radius: var(--radius-field); background: var(--color-surface-2); }
.legal-body blockquote > * + * { margin-top: var(--space-2); }
.legal-body hr { border: 0; height: 1px; background: var(--color-line); margin: var(--space-6) 0; }
.legal-body td code { white-space: nowrap; }
.legal-body code { font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); font-size: var(--text-mono-size); }
.legal-table { max-width: 100%; overflow-x: auto; border-radius: var(--radius-field); }
.legal-table:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.legal-body table { border-collapse: collapse; font-size: var(--text-label-size); line-height: var(--text-label-line); }
.legal-body th, .legal-body td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; min-width: 120px; }
.legal-body th { font-weight: var(--text-label-weight); color: var(--color-text-secondary); border-bottom: 1px solid var(--color-line); }
.legal-list { display: flex; flex-direction: column; gap: var(--space-3); }
.legal-list li { display: flex; flex-direction: column; gap: 2px; }

/* ---- follow-ups (B1 PR 6, 2026-10-17): the TTL cell, the keepalive
   disclosure, the rekey confirmation. Geometry rows in
   design/state-geometry.md, "Builder additions, 2026-10-17 (follow-ups)". ---- */
/* D. inline-editable cell: the 40-px input takes the cell's own box; the
   row's actions slot shows the check/✕ pair instead of the kebab; the
   refusal is a popover under the cell (the cell lets it out) */
.td:has(> .cell-edit) { overflow: visible; }
.cell-edit { position: relative; height: 40px; display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
.cell-edit-open { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 0 var(--space-2); color: inherit; text-decoration: none; border-radius: 6px; }
.cell-edit-open:hover { text-decoration: underline; }
.cell-form { display: none; position: absolute; inset: 0; }
.cell-edit.is-editing .cell-form { display: block; }
.cell-edit.is-editing .cell-edit-open { visibility: hidden; }
.cell-input { width: 100%; height: 40px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-field); background: var(--color-field); color: var(--color-text-primary); font: inherit; font-feature-settings: var(--font-feature-tabular); text-align: right; }
.cell-input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--color-accent); }
.cell-input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--color-danger); }
.cell-error { top: calc(100% + var(--space-1)); right: 0; width: 280px; padding: var(--space-2) var(--space-3); color: var(--color-danger); font-size: var(--text-caption-size); line-height: var(--text-caption-line); white-space: normal; text-align: left; }
.cell-error:empty { display: none; }
.cell-edit-pair { display: none; }
.row:has(.cell-edit.is-editing) .cell-edit-pair { position: absolute; top: 0; bottom: 0; right: var(--space-1); display: flex; align-items: center; }
.row:has(.cell-edit.is-editing) .menu { visibility: hidden; }
/* the peer sheet's advanced keepalive: a fixed 56-px disclosure row */
.disclosure-row { flex: none; }
.disclosure-row .disclosure-btn { height: var(--h-row); }
/* the rekey confirmation: the consequence in four fixed lines */
.rekey-consequence { flex: none; height: 88px; -webkit-line-clamp: 4; }

/* ---- staff console (portal-spec §3.16; B1 PR 6 staff group). Geometry rows
   in design/state-geometry.md, "Builder additions, 2026-10-17 (staff
   console)". Desktop-first; phone gets the cards. ---- */
.cw-104 { width: 104px; } .cw-128 { width: 128px; } .cw-144 { width: 144px; }
/* D. folding tables (Clientes, Nodos, Transferencia; ruling 3 of
   2026-10-18): nothing scrolls sideways. The widths are on the header cells
   (no colgroup), so a hidden column leaves the grid with its cells. Below
   1440 px the folded columns are hidden and each row's reserved 48-px
   leading cell holds the expander, whose popover (an overlay under the
   button, 320 px, 40-px lines) lists them; from 1440 px they are columns
   and the expander cell leaves, unless a column never fits (Nodos' Agente
   and Kernel stay in the expander). The filter button opens the filter
   sheet whenever a column is folded, so every column still sorts and
   filters. */
.cw-48 { width: 48px; }
.table.is-folding .th-more { padding: 0; }
.table.is-folding .td-more { position: relative; overflow: visible; padding: 0 2px; }
.more-pop { top: calc(100% + var(--space-1)); left: 0; width: 320px; padding: var(--space-2); display: flex; flex-direction: column; text-align: left; font-weight: var(--text-body-weight); }
.more-kv { display: flex; align-items: center; gap: var(--space-3); height: 40px; padding: 0 var(--space-2); }
.more-key { flex: none; width: 136px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-secondary); font-size: var(--text-label-size); }
.more-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-feature-settings: var(--font-feature-tabular); }
.more-value.mono { font-family: var(--font-mono); font-feature-settings: var(--font-feature-mono); font-size: var(--text-mono-size); }
.more-value .badge { margin-left: auto; }
.more-btn .icon { transition: transform var(--motion-fast) var(--ease-out); }
.row-more[open] > .more-btn .icon { transform: rotate(180deg); }
@media (min-width: 1440px) {
  .table.is-folding .fold-more, .more-pop .fold-kv, .fold-filter, .table.is-folding .fold-only-narrow { display: none !important; }
}
@media (max-width: 1439.98px) {
  .table.is-folding .fold-narrow, .table.is-folding .fold-only-wide { display: none !important; }
}
/* the filter sheet on a desktop (a folding table's columns): a side sheet */
@media (min-width: 1024px) {
  .filter-sheet { left: auto; top: 0; height: 100vh; width: 420px; border-radius: 0; }
}
/* Clientes: two lines in the 48-px row (name, then the owner's masked address) */
.staff-name { display: flex; flex-direction: column; justify-content: center; min-width: 0; height: var(--h-row-dense); }
.staff-name-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-label-size); line-height: 18px; font-weight: var(--text-body-strong-weight); }
.staff-name-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption-size); line-height: 16px; color: var(--color-text-secondary); }
/* E. the mini plate (the address plate at row size): dot + IP; and the health caption */
.mini-plate { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.mini-plate-ip { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the transfer gauge at row size: an 80-px bar and the number, right-aligned */
.mini-gauge { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-2); width: 100%; }
.mini-gauge-bar { flex: none; width: 80px; height: 6px; border-radius: 3px; background: var(--color-surface-2); overflow: hidden; }
.mini-gauge-n { flex: none; width: 44px; text-align: right; font-feature-settings: var(--font-feature-tabular); }
.mini-gauge.gauge-warn .gauge-fill { background: var(--color-warn); }
.mini-gauge.gauge-danger .gauge-fill { background: var(--color-danger); }
/* phone cards of the staff tables: fixed 104 px, the kebab in the right 64 px */
.stcard { position: relative; height: 104px; padding: var(--space-3) 64px var(--space-3) var(--space-4); display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); }
.stcard .mcard-line { height: 24px; }
.stcard-menu { position: absolute; right: var(--space-2); top: 0; bottom: 0; display: flex; align-items: center; }
.cards-foot { margin-top: var(--space-2); }
.sum-card { height: var(--h-row); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-4); border-radius: var(--radius-card); background: var(--color-surface-2); font-weight: var(--text-body-strong-weight); }
.sum-card-key { flex: none; }
/* the transfer's sum row: 56 px, pinned under the body, always rendered */
.sum-row .td, .sum-row th { height: var(--h-row); background: var(--color-surface-1); font-weight: var(--text-body-strong-weight); border-top: 1px solid var(--color-line); }
.sum-row th { text-align: left; padding: 0 var(--space-2); }
/* the customer detail: the head (title + badge, the plate at row size, three pills) */
.staff-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.staff-head-title { display: flex; align-items: center; gap: var(--space-3); min-width: 0; height: var(--h-control); }
.staff-head-title .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-head-title .badge { flex: none; }
.staff-plate { display: flex; align-items: center; gap: var(--space-3); height: var(--h-row); padding: 0 var(--space-2) 0 var(--space-4); border-radius: var(--radius-card); background: var(--color-surface-1); min-width: 0; }
.staff-plate-ip { flex: none; font-size: var(--text-h2-size); line-height: var(--text-h2-line); }
.staff-plate-caption { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-secondary); font-size: var(--text-label-size); }
.copy-slot { flex: none; width: var(--h-control); height: var(--h-control); }
.staff-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.staff-pills form { display: contents; }
.staff-pills .btn-danger { margin-left: var(--space-6); } /* the destructive pill set apart */
@media (min-width: 1024px) {
  .staff-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title pills" "plate plate"; }
  .staff-head-title { grid-area: title; }
  .staff-pills { grid-area: pills; flex-wrap: nowrap; justify-content: flex-end; }
  .staff-plate { grid-area: plate; }
}
.staff-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.staff-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.staff-col .card + .card { margin-top: 0; }
@media (min-width: 1024px) { .staff-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card-note { min-height: var(--h-row); display: flex; align-items: center; color: var(--color-text-secondary); }
.staff-node-foot { gap: var(--space-2); }
/* D. the quotas: a 56-px key-value row, the value edits in place in a 120-px
   box; the check/✕ pair lives in the row's reserved 96-px actions slot */
.quota-row { position: relative; }
.quota-cell { flex: none; width: 120px; margin-left: auto; }
.quota-actions { position: relative; flex: none; width: 96px; height: var(--h-row); }
.quota-row .row-spinner { right: 26px; }
.quota-row.htmx-request .row-spinner { visibility: visible; }
.quota-row:has(.cell-edit.is-editing) .cell-edit-pair { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; }
.quota-row.htmx-request .cell-edit-pair { visibility: hidden; }
.quota-cell .cell-error { right: auto; left: 0; }
/* the staff notes: a textarea of 6 fixed rows (168 px) and the reserved 20-px line */
.notes-form { margin-top: var(--space-2); }
.notes-box { height: 192px; }
.notes-box textarea { height: 100%; resize: none; overflow-y: auto; }
.notes-line .help-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-line.is-error .help-text { color: var(--color-danger); }
/* the lists inside the detail's cards: 56-px rows, badges and the kebab at the trailing edge */
.staff-list { display: flex; flex-direction: column; }
.staff-list-scroll { max-height: calc(var(--h-row) * 8); overflow-y: auto; }
.staff-list-scroll:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-field); }
.staff-li { min-height: var(--h-row); height: var(--h-row); display: flex; align-items: center; gap: var(--space-3); }
.staff-li-text { flex: 1; min-width: 0; }
.staff-li-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-label-size); line-height: 18px; }
.staff-li-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption-size); line-height: 16px; color: var(--color-text-secondary); }
.staff-li-badges { flex: none; display: flex; gap: var(--space-2); }
.staff-li-actions { flex: none; width: var(--h-control); display: flex; justify-content: flex-end; }
.staff-li-decide { width: auto; gap: var(--space-2); }
.staff-li-empty { color: var(--color-text-secondary); }
.menu-item.is-disabled { color: var(--color-text-secondary); cursor: not-allowed; }
@media (max-width: 1023.98px) {
  .staff-li-badges .badge + .badge { display: none; } /* the phone row keeps one badge; the second is in the side sheet's words */
}
.staff-audit { margin-top: var(--space-8); }
.staff-audit .audit-window-line { height: var(--h-field-help); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--h-field-help); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* F. the staff dialogs: 480 px / 92 vh, fixed; the consequence in three
   fixed lines, the reason (4 rows) or the typed name, the 20-px form line,
   the footer pinned */
dialog.dialog-staff { height: 92vh; }
dialog.dialog-staff-side { height: 92vh; }
@media (min-width: 1024px) {
  dialog.dialog-staff { height: 480px; }
  dialog.dialog-staff-side { height: 100vh; }
}
dialog.dialog-staff .staff-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.staff-dialog-body { display: flex; flex-direction: column; gap: var(--space-3); }
.staff-consequence { flex: none; height: 66px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; color: var(--color-text-secondary); line-height: 22px; }
.staff-typed { flex: none; }
.staff-ref { flex: none; } /* a lone required field (the impersonation's folio): its helper line reserved */
.staff-rekey-fields { flex: none; display: flex; flex-direction: column; gap: var(--space-3); } /* channel and folio: their helper lines reserved, nothing grows */
.peer-rekey-reason { margin-top: var(--space-2); }
.req-reason { white-space: pre-wrap; overflow-wrap: anywhere; }
.refusal-box { margin: 0; padding: var(--space-3); white-space: pre; font-size: var(--text-caption-size); }
.log-list { display: flex; flex-direction: column; }
.log-li { min-height: var(--h-row); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.log-when { color: var(--color-text-secondary); font-size: var(--text-caption-size); }
.log-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption-size); }
/* E. the rotated token, shown once: mono in a fixed box, copy beside it */
.token-box { flex: none; display: flex; align-items: center; gap: var(--space-2); height: var(--h-row); padding: 0 var(--space-2) 0 var(--space-3); border-radius: var(--radius-field); background: var(--color-field); }
.token-value { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: var(--text-mono-size); }
/* ---- the free trial in the staff console (state-geometry «Builder
   additions, 2026-10-22», Staff console): Pruebas · Rechazos, Pools,
   «¿Quién tenía este puerto?», the trial card. ---- */
.staff-tabs { max-width: 360px; }
/* the phone: the who link under the title, not beside it (the caption keeps its width) */
@media (max-width: 1023.98px) {
  .staff-trials-head { flex-wrap: wrap; align-items: flex-start; }
  .staff-trials-head .page-titles { flex-basis: 100%; }
}
/* a menu action the row's state does not allow: its reason in visible
   text, a reserved 20-px line under it (aria-describedby; title is hover) */
.menu-pop:has(.menu-reason) { width: 320px; }
.menu-reason { flex: none; height: var(--h-field-help); padding: 0 var(--space-3); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: var(--h-field-help); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-danger + .menu-reason { color: var(--color-text-secondary); }
/* the dialogs' fields keep their reserved lines; the body scrolls inside the fixed box */
.staff-days, .staff-dialog-body .field-area { flex: none; }
/* the trial card: the 5 GB gauge with «0.8 de 5 GB» in its 56-px row */
.trial-card-gauge { flex: 1; display: flex; justify-content: flex-end; }
.trial-card-gauge .mini-gauge { width: auto; }
.trial-card-used { flex: none; text-align: right; font-feature-settings: var(--font-feature-tabular); }
/* «¿Quién tenía este puerto?»: four fields (one column on the phone, 2 × 2
   from 1024 px), the form line, the CTA, the fixed 336-px answer region */
.who-grid { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-3); row-gap: var(--space-2); }
@media (min-width: 1024px) { .who-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.who-form .who-line { padding: 0; margin-top: var(--space-1); }
.who-foot { display: flex; justify-content: flex-end; margin-top: var(--space-2); }
.who-answer { height: 336px; overflow: hidden; margin-top: var(--space-4); border-top: 1px solid var(--color-line); }
.who-row .kv-key { flex: none; width: 112px; }
.who-end { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); }
.who-badge-slot { flex: none; width: 136px; display: flex; justify-content: flex-end; }
.who-none .kv-value { flex: 1; }
.who-empty { height: var(--h-row); display: flex; align-items: center; color: var(--color-text-secondary); }
/* C. the month picker (our picker at month granularity): a popover of 3 × 4 fixed cells under the year */
.month-form { margin-bottom: var(--space-2); }
@media (min-width: 1024px) { .month-form { grid-template-columns: 200px 1fr; } }
.month-pop { top: calc(var(--h-field) + var(--space-1)); left: 0; width: calc(96px * 3 + var(--space-3) * 2); padding: var(--space-3); }
.month-grid { display: grid; grid-template-columns: repeat(3, 96px); grid-template-rows: repeat(4, 40px); }
.month-cell { width: 96px; height: 40px; padding: 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-text-primary); font-size: var(--text-label-size); }
.month-cell:hover { background: var(--color-surface-2); }
.month-cell.is-selected { background: var(--color-accent-soft); color: var(--color-text-primary); box-shadow: inset 0 0 0 1px var(--color-accent); } /* white on the accent is 3.2:1 at 13 px */
.month-cell:disabled { color: var(--color-text-secondary); opacity: 0.5; cursor: not-allowed; }
@media (max-width: 1023.98px) {
  .month-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; display: flex; flex-direction: column; align-items: center; border-radius: var(--radius-card) var(--radius-card) 0 0; z-index: var(--z-sheet); }
}

/* ---- the connector (ARCHITECTURE §9.10; state-geometry «Connector» rows) ---- */
/* the new-equipo sheet: the CTA is as wide as its wider label in both
   languages, so «Generar código» ↔ «Generar configuración» moves nothing */
#peer-form .dialog-foot .btn-primary { flex: 1; }
@media (min-width: 1024px) { #peer-form .dialog-foot .btn-primary { flex: none; width: 216px; } }
/* the label fills that width, so the swap changes the text and not the label's box */
#peer-form .dialog-foot .btn-primary .btn-label { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the code, shown once: fixed rows, the expiry only dims */
.code-body { display: flex; flex-direction: column; }
.code-once { flex: none; height: 40px; overflow: hidden; margin-bottom: var(--space-2); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; }
.code-panel { flex: none; height: 96px; display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); border-radius: var(--radius-field); background: var(--color-field); }
.code-value { font-size: 28px; line-height: 36px; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: clip; user-select: all; transition: opacity var(--motion-fast) var(--ease-out); }
.code-pill { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; padding: 0 var(--space-2); }
.code-pill[hidden] { display: none; }
.code-countdown { flex: none; height: 20px; margin: var(--space-1) 0 var(--space-3); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; white-space: nowrap; overflow: hidden; }
.code-reveal.is-expired .code-value, .code-reveal.is-expired .command-text { opacity: 0.4; }
.code-reveal.is-expired .code-countdown { color: var(--color-warn); }
.code-steps { flex: none; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.code-step { display: flex; gap: var(--space-3); align-items: flex-start; padding-top: var(--space-2); }
.code-step.step-download { height: 104px; }
.code-step.step-enter { height: 112px; }
.code-step.step-wait { height: 72px; }
.step-disc { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-surface-2); font-size: var(--text-label-size); line-height: 24px; font-weight: var(--text-label-weight); }
.step-body { flex: 1; min-width: 0; }
.step-title { margin: 0; height: 24px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-pills { height: 44px; margin-top: var(--space-2); }
.command-box { height: 56px; margin-top: var(--space-2); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) 0 var(--space-3); border-radius: var(--radius-field); background: var(--color-field); }
.command-text { white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; transition: opacity var(--motion-fast) var(--ease-out); }
.command-box .copy-pill { padding: 0 var(--space-3); }
.code-status { margin: var(--space-2) 0 0; height: 24px; display: flex; align-items: center; gap: var(--space-2); color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 24px; white-space: nowrap; overflow: hidden; }
.code-status.status-done { color: var(--color-text-primary); }
.code-status.status-expired { color: var(--color-warn); }
.code-status-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.code-spinner { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.code-mappings { flex: none; height: 60px; overflow: hidden; margin: var(--space-2) 0 0; color: var(--color-text-secondary); font-size: var(--text-caption-size); line-height: 20px; }
@media (prefers-reduced-motion: reduce) { .code-spinner { animation-duration: 2.4s; } }
/* the site's unused codes: one 40-px row, always present (empty when none) */
.codes-row { height: 40px; display: flex; align-items: center; gap: var(--space-3); color: var(--color-text-secondary); font-size: var(--text-label-size); }
.codes-menu { position: relative; }
.codes-menu > summary { list-style: none; cursor: pointer; }
.codes-menu > summary::-webkit-details-marker { display: none; }
.codes-pop { top: 32px; left: 0; width: min(420px, calc(100vw - 32px)); margin: 0; padding: var(--space-1) 0; list-style: none; }
.codes-item { height: 48px; display: grid; grid-template-columns: minmax(0, 1fr) 40px 104px auto; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) 0 var(--space-4); color: var(--color-text-primary); }
.codes-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codes-left { white-space: nowrap; color: var(--color-text-secondary); }
.codes-revoke { margin: 0; }
/* the Tipo cell: the kind, then the connector's tag in the same 112-px cell */
.kind-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; white-space: nowrap; }
.kind-tag { flex: none; height: 20px; min-width: 88px; justify-content: center; }
.tag-warn { background: var(--color-warn-soft); }

/* ---- Mapeos: the connector's requests (ARCHITECTURE §9.10) ---- */
/* The 48-px row between the head and the table, laid out always. */
.mappings-waiting { height: 48px; margin: 0; display: flex; align-items: center; gap: var(--space-2); color: var(--color-warn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Destino and Puerto público: the address, then a 20-px badge slot. */
.cell-two { display: flex; width: 100%; }
.cell-two .cell-text { max-width: 100%; }
.cell-two.al-end { align-items: flex-end; }
.cell-badge-slot { height: 20px; display: flex; }
.cell-badge { font-family: var(--font-sans); font-feature-settings: normal; }
.is-dim { color: var(--color-text-secondary); }
/* Estado on a request: «Aprobar» and «Rechazar», 36 px each in the 96-px
   cell (as the copy buttons of a cell); 44 px on the phone card. */
.decide-slot { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-width: 76px; height: 36px; }
.decide-slot .decide-btn { width: 36px; height: 36px; }
.mcard-badge { flex: none; }
.mcard.is-pending { padding-right: calc(88px + var(--space-8)); }
.mcard.is-pending .mcard-menu { right: calc(88px + var(--space-4) + var(--space-1)); }
.mcard .decide-slot { min-width: 88px; height: 44px; gap: 0; }
.mcard .decide-slot .decide-btn { width: 44px; height: 44px; }
/* The approve dialog: 420 px, three label/value rows, a 3-line warning box. */
dialog.dialog-approve { height: 420px; }
.approve-list { margin: 0; display: flex; flex-direction: column; }
.approve-row { height: 44px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-width: 0; }
.approve-row dt { flex: none; color: var(--color-text-secondary); }
.approve-row dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.approve-risky { height: 60px; margin: var(--space-3) 0 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
/* The edit dialog of a connector's mapping: a 2-line caption box. */
.mapping-claim { height: 40px; margin: 0 0 var(--space-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
