/* cert-manager — app components on top of ds.css.
 *
 * Class names are the ones the React components already emit (nav, side,
 * section, ztable, pill, banner, modal…), restyled to the design system:
 * inset layout (sidebar loose on the canvas, content in a floating panel),
 * nested cards for sections, status pills, notices with a side rule instead of
 * colored boxes, and the hatch only where something is in progress.
 */

/* ════════ shell ════════ */
html, body { overflow: hidden; }
body { display: flex; flex-direction: column; height: var(--app-h); }
#root { display: flex; flex-direction: column; flex: 1; min-height: 0; }
a { color: var(--accent-text); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.mono { font-size: 12px; }

.frame { flex: 1; display: flex; min-height: 0; }
.side {
  width: 236px; flex-shrink: 0; overflow-y: auto;
  padding: 4px 8px 12px;
  background: transparent; /* loose on the canvas (§7.1) */
}
.content {
  flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  margin: 0 8px 8px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-inset-panel);
  overflow: hidden;
}
.content-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* ════════ top bar (on the canvas) ════════ */
.nav { flex-shrink: 0; height: 48px; display: flex; align-items: center; gap: 4px; padding: 0 12px 0 0; }
.nav-brand {
  width: 236px; display: flex; align-items: center; gap: 10px; padding: 0 18px; white-space: nowrap; overflow: hidden;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg);
}
.nav-brand::before {
  content: ''; width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: var(--shadow-primary);
}
.nav-brand small { font-weight: 400; color: var(--fg-subtle); font-size: 11px; }
.nav-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-subtle); }
.nav-crumb a { color: var(--fg-muted); }
.nav-crumb .sep { color: var(--line-strong); }
.nav-crumb b { color: var(--fg); font-weight: 500; }
.nav-spacer { flex: 1; }
.nav-info {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  font-size: 11.5px; color: var(--fg-muted); font-family: var(--font-mono);
}
.nav-info b { font-weight: 500; }
.nav-icon {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-md);
  color: var(--fg-muted); cursor: pointer; position: relative;
}
.nav-icon:hover { background: var(--hover); color: var(--fg); }
.nav-icon svg { width: 16px; height: 16px; }

/* user menu (avatar + popover with the theme segmented control, §7.2) */
.nav-user { position: relative; display: flex; align-items: center; }
.nav-user-btn {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 4px;
  border-radius: var(--r-md); cursor: pointer; color: var(--fg); font-size: 12.5px;
}
.nav-user-btn::before {
  content: attr(data-initials); width: 24px; height: 24px; border-radius: 999px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-text);
}
.nav-user-btn:hover { background: var(--hover); }
.nav-user-btn > div { display: flex; flex-direction: column; line-height: 1.15; }
.nav-user-name { font-weight: 500; }
.nav-user-role { color: var(--fg-subtle); font-size: 10.5px; }
.nav-user-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 100; min-width: 232px; padding: 4px;
  background: var(--elevated); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: pop-in var(--dur) var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.nav-user-info { padding: 8px 10px; }
.nav-user-sep { border-top: 1px solid var(--line); margin: 4px 0; }
.nav-user-item {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
  border-radius: 6px; cursor: pointer; color: var(--fg); font-size: 13px;
}
.nav-user-item:hover { background: var(--hover); }
.nav-user-item.danger { color: var(--danger-text); }
.nav-user-item.danger:hover { background: var(--danger-soft); }
.nav-user-theme { padding: 6px 10px 8px; }
.nav-user-theme .section-label { margin-bottom: 6px; }

/* segmented (§8.3) */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-1); }
.seg button {
  border: 0; background: transparent; color: var(--fg-muted); font: inherit; font-size: 12px; font-weight: 500;
  height: 24px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.dark .seg button.on { background: var(--active); box-shadow: none; }

/* ════════ sidebar ════════ */
.side-group { padding: 8px 0; }
.side-group-head {
  padding: 4px 10px 6px;
  font-size: 10.5px; line-height: 16px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle);
}
.side-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px;
  border-radius: var(--r-md); cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 500; color: var(--fg-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-item:hover { background: var(--hover); color: var(--fg); }
.side-item.active { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.dark .side-item.active { background: var(--active); box-shadow: none; }
.side-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.8; }
.side-item.active svg { color: var(--accent-text); stroke-width: 2.1; }
.side-item .ct {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--active); color: var(--fg-muted);
}
.side-item.active .ct { background: var(--accent-soft); color: var(--accent-text); }
.side-item.alert .ct { background: var(--warning-soft); color: var(--warning-text); }
.side-item.crit  .ct { background: var(--danger-soft); color: var(--danger-text); }
.side-item.child { height: 28px; padding-left: 36px; font-size: 12.5px; font-weight: 400; cursor: default; }
.side-item.child:hover { background: transparent; color: var(--fg-muted); }

/* ════════ page header (§7.3) ════════ */
.page-title-bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.ptb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; }
.ptb-left { min-width: 0; flex: 1; }
.ptb-crumb { font-size: 11px; line-height: 14px; color: var(--fg-subtle); margin-bottom: 2px; }
.ptb-crumb a { color: var(--fg-subtle); }
.ptb-crumb .sep { margin: 0 5px; }
.ptb-crumb b { color: var(--fg-muted); font-weight: 500; }
.ptb-h1 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg);
}
.ptb-h1 .mono { font-size: 15px; font-weight: 500; }
.ptb-h1 .ic {
  width: 28px; height: 28px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: var(--r-md); color: var(--fg-muted);
}
.ptb-h1 .ic svg { width: 15px; height: 15px; stroke-width: 1.6; }
.ptb-h1 .count {
  min-width: 20px; height: 20px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent-text);
}
.ptb-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--fg-muted); }
.ptb-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.ptb-meta b { color: var(--fg); font-weight: 500; }
.ptb-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* ════════ buttons (§8.1) ════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  font-size: 13px; font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 80ms;
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-primary); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: transparent; border-color: color-mix(in oklab, var(--danger) 30%, transparent); color: var(--danger-text); box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in oklab, var(--danger) 45%, transparent); }
.btn.danger.solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.danger.solid:hover:not(:disabled) { background: color-mix(in oklab, var(--danger-solid) 88%, black); }
.btn.warn:hover:not(:disabled) { border-color: var(--warning); color: var(--warning-text); }
.btn.success { background: var(--success-soft); border-color: transparent; color: var(--success-text); box-shadow: none; }
.btn.sm { height: 28px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--fg-muted); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
@media (pointer: coarse) { .btn { height: 44px; } .btn.sm { height: 36px; } }

.iconbtn {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg-muted); cursor: pointer;
}
.iconbtn:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
.iconbtn svg { width: 14px; height: 14px; }

/* ════════ section tabs (§7.4) ════════ */
.subtabs { display: flex; gap: 4px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.subtabs .t {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; margin-bottom: -1px;
  font-size: 13px; font-weight: 500; color: var(--fg-muted); cursor: pointer; user-select: none;
  border-bottom: 2px solid transparent;
}
.subtabs .t:hover { color: var(--fg); }
.subtabs .t.active { color: var(--fg); border-bottom-color: var(--accent); }
.subtabs .t .ct {
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 600; background: var(--active); color: var(--fg-muted);
}
.subtabs .t.active .ct { background: var(--accent-soft); color: var(--accent-text); }

/* ════════ page body ════════ */
.body { padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* grid items default to min-width:auto — a wide table would widen the page */
.body > * { min-width: 0; }
@media (max-width: 640px) { .body { padding: 12px; } }
.body + .body { padding-top: 0; }

/* ════════ section = nested card (§8.5) ════════ */
.section { border-radius: var(--r-xl); background: var(--surface-1); padding: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; min-height: 36px; padding: 4px 10px; }
.section-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; font-size: 13px; font-weight: 500; color: var(--fg); }
.section-title svg { width: 15px; height: 15px; stroke-width: 1.6; color: var(--fg-muted); }
.section-title .note { font-weight: 400; color: var(--fg-subtle); font-size: 12px; }
.section-actions { display: flex; gap: 6px; align-items: center; }
/* whatever follows the head (body or a "tight" table) is the inner card */
.section > :not(.section-head) {
  border-radius: var(--r-lg); border: 1px solid var(--inner-line); background: var(--surface-2);
  overflow-x: auto; /* a wide table scrolls inside its card, never the page */
}
.section-body { padding: 16px; }
.section-body.tight { padding: 0; }

/* property sheets (k/v) */
.sheets { display: grid; grid-template-columns: 1fr 1fr; }
.sheet { border-right: 1px solid var(--line); }
.sheet:last-child { border-right: 0; }
.sheet .lbl {
  padding: 12px 16px 6px; border-top: 1px solid var(--line);
  font-size: 10.5px; line-height: 16px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle);
}
.sheet .lbl:first-child { border-top: 0; }
.sheet .kv { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 7px 16px; font-size: 13px; }
.sheet .kv .k { color: var(--fg-muted); }
.sheet .kv .v { color: var(--fg); word-break: break-word; }
.sheet .kv .v .none { color: var(--fg-subtle); }
@media (max-width: 900px) { .sheets { grid-template-columns: 1fr; } .sheet { border-right: 0; } }

/* ════════ status pill (§8.4) ════════ */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap;
  border: 1px solid color-mix(in oklab, currentColor 15%, transparent);
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.ok   { background: var(--success-soft); color: var(--success-text); }
.pill.warn { background: var(--warning-soft); color: var(--warning-text); }
.pill.avg  { background: var(--warning-soft); color: var(--danger-text); }
.pill.err  { background: var(--danger-soft);  color: var(--danger-text); }
.pill.none { background: var(--active);       color: var(--fg-muted); }
.pill.info { background: var(--accent-soft);  color: var(--accent-text); }
.pill.violet { background: var(--violet-soft); color: var(--violet-text); }
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--active); color: var(--fg-muted);
}
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.info { background: var(--info-soft); color: var(--info-text); }
.badge.violet { background: var(--violet-soft); color: var(--violet-text); }
.badge.success { background: var(--success-soft); color: var(--success-text); }
.badge.warning { background: var(--warning-soft); color: var(--warning-text); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); }

/* ════════ tables (§9.4, "clean" variant inside the inner card) ════════ */
.ztable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ztable thead th {
  position: sticky; top: 0; text-align: left; white-space: nowrap; user-select: none;
  padding: 10px 14px 8px; background: var(--surface-2);
  font-size: 11px; font-weight: 500; color: var(--fg-subtle);
  border-bottom: 1px solid var(--line);
}
.ztable tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg); vertical-align: middle; transition: background var(--dur) var(--ease); }
.ztable tbody tr:hover td { background: var(--row-hover); }
.ztable tbody tr:last-child td { border-bottom: 0; }
.ztable tbody tr.clickable { cursor: pointer; }
.ztable .mono { font-size: 12px; }
.ztable a { font-weight: 500; }
.ztable td.right { text-align: right; }
.ztable td.num, .ztable td.nowrap { white-space: nowrap; }
.ztable .empty { padding: 32px 20px; text-align: center; color: var(--fg-subtle); }
.ztable .row-actions { opacity: .55; transition: opacity var(--dur) var(--ease); }
.ztable tr:hover .row-actions, .ztable tr:focus-within .row-actions { opacity: 1; }
@media (pointer: coarse) { .ztable .row-actions { opacity: 1; } }
@media (max-width: 900px) { .ztable .col-2nd { display: none; } }

/* ════════ console (always dark: log output reads better that way) ════════ */
.console {
  background: #141417; color: #dcdce0;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  padding: 14px 16px; max-height: 50vh; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
/* a console inside a section keeps its dark surface (the inner-card rule is more specific) */
.section > .console, .section > .console-wrap .console { background: #141417; border-color: #26262a; }
.console.fill { max-height: none; height: calc(var(--app-h) - 210px); min-height: 280px; }
.console-strip {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 16px;
  background: #0c0c0e; border-top: 1px solid #26262a;
  font-family: var(--font-mono); font-size: 11px; color: #88888f;
}
.console-strip b { color: #dcdce0; font-weight: 500; }

/* ════════ forms (§8.2) ════════ */
.form-grid { display: grid; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--fg-muted); }
.field-label .req { color: var(--danger-text); }
.field-hint { font-size: 11px; line-height: 16px; color: var(--fg-subtle); }
.field-error { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; line-height: 16px; color: var(--danger-text); }
.field.inline { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start; }
.field.inline .field-label { padding-top: 6px; justify-content: flex-end; text-align: right; }
.field.inline .field-control { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
@media (max-width: 640px) { .field.inline { grid-template-columns: 1fr; gap: 4px; } .field.inline .field-label { justify-content: flex-start; text-align: left; padding: 0; } }

.input, .select, .textarea,
.field input[type="text"], .field input[type="email"], .field input[type="number"],
.field input[type="password"], .field input[type="search"], .field input[type="url"], .field input[type="tel"] {
  display: block; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--input); color: var(--fg);
  font: inherit; font-size: 13px; box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input, .select,
.field input[type="text"], .field input[type="email"], .field input[type="number"],
.field input[type="password"], .field input[type="search"], .field input[type="url"], .field input[type="tel"] { height: 32px; padding: 0 10px; }
.input::placeholder, .textarea::placeholder, .field input::placeholder { color: var(--fg-subtle); opacity: 1; }
.input:hover:not(:disabled):not([readonly]), .select:hover:not(:disabled), .textarea:hover:not(:disabled),
.field input:hover:not(:disabled):not([readonly]) { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus, .field input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
}
.input:disabled, .input[readonly], .select:disabled, .field input:disabled { background: var(--surface-1); color: var(--fg-muted); cursor: not-allowed; }
.input.invalid, .field.invalid .input, .field.invalid input { border-color: var(--danger); }
.input.mono, .textarea.mono { font-family: var(--font-mono); font-size: 12px; }
@media (pointer: coarse) {
  .input, .select, .field input { height: 44px; font-size: 16px; }
  .textarea { font-size: 16px; }
}
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.select {
  padding-right: 30px; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23717177' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
.textarea { min-height: 64px; padding: 7px 10px; line-height: 1.6; resize: vertical; }

.check { display: inline-flex; align-items: center; gap: 8px; min-height: 22px; font-size: 13px; color: var(--fg); cursor: pointer; user-select: none; }
.check input[type="checkbox"], .check input[type="radio"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.check input:disabled { opacity: .4; cursor: not-allowed; }
.check.disabled { opacity: .55; cursor: not-allowed; }

.switch { display: inline-flex; align-items: center; gap: 9px; min-height: 22px; position: relative; font-size: 13px; color: var(--fg); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.switch .track { width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; flex-shrink: 0; transition: background var(--dur) var(--ease); }
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + .track { opacity: .4; cursor: not-allowed; }

.number-input { display: inline-flex; align-items: stretch; max-width: 140px; }
.number-input.full { max-width: none; width: 100%; }
.number-input input { flex: 1; min-width: 0; border-radius: 0 !important; text-align: center; }
.number-input .step {
  display: grid; place-items: center; width: 28px; height: 32px; cursor: pointer; user-select: none;
  border: 1px solid var(--line); background: var(--surface-1); color: var(--fg-muted); font-size: 14px;
}
.number-input .step:hover { background: var(--hover); color: var(--fg); }
.number-input .step.dec { border-radius: var(--r-md) 0 0 var(--r-md); border-right: 0; }
.number-input .step.inc { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: 0; }

.input-affix { display: inline-flex; align-items: stretch; width: 100%; }
.input-affix .affix {
  display: grid; place-items: center; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); background: var(--surface-1); color: var(--fg-muted); font-size: 12px;
}
.input-affix .affix.left  { border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); }
.input-affix .affix.right { border-left: 0;  border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-affix .input.left-affix  { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-affix .input.right-affix { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-affix .input.both-affix  { border-radius: 0; }

.field-group { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--inner-line); background: var(--surface-1); }

/* ════════ notice (§10): near-neutral, 2px side rule, never a colored box ════════ */
.banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: var(--r-md); background: var(--surface-1); border-left: 2px solid var(--fg-subtle);
  font-size: 13px; color: var(--fg-muted);
}
.banner b { color: var(--fg); font-weight: 500; }
.banner .ic {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; border-radius: 999px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: var(--fg-subtle);
}
.banner.err  { border-left-color: var(--danger); }  .banner.err .ic  { background: var(--danger); }
.banner.warn { border-left-color: var(--warning); } .banner.warn .ic { background: var(--warning); }
.banner.info { border-left-color: var(--info); }    .banner.info .ic { background: var(--info); }
.banner.ok   { border-left-color: var(--success); } .banner.ok .ic   { background: var(--success); }
.banner code { background: var(--surface-3); color: var(--fg); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 12px; }

/* ════════ modal (§8.7) ════════ */
.modal-bg {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px;
  background: var(--overlay);
}
.modal {
  width: 100%; max-width: 720px; background: var(--elevated);
  border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-xl);
  animation: pop-in 180ms var(--ease);
}
.modal.lg { max-width: 1080px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--fg); }
.modal-title svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--fg-muted); }
.modal-title .mono { color: var(--fg-muted); font-weight: 400; }
.modal-title-stack { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.modal-title-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-title-sub { font-size: 12px; color: var(--fg-subtle); font-family: var(--font-mono); font-weight: 400; }
.modal-close {
  width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--fg-muted); font-size: 18px; cursor: pointer;
}
.modal-close:hover { background: var(--hover); color: var(--fg); }
.modal-body { padding: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .modal-bg { padding: 0; } .modal { border-radius: 0; min-height: var(--app-h); } }

/* ════════ running task: the hatch means "in progress" (§6) ════════ */
.active-task-bar {
  flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  margin: 0 8px 8px 244px; padding: 8px 14px; border-radius: var(--r-lg);
  background-color: var(--warning-soft); color: var(--warning-text); font-size: 13px;
  background-image: repeating-linear-gradient(135deg, color-mix(in oklab, var(--warning) 10%, transparent) 0 6px, transparent 6px 12px);
  animation: hatch-move 1.2s linear infinite;
}
.active-task-bar .pulse { width: 8px; height: 8px; border-radius: 999px; background: var(--warning); flex-shrink: 0; animation: cm-pulse 1.6s infinite; }
@keyframes cm-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--warning) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.active-task-bar .msg { flex: 1; min-width: 0; }
.active-task-bar .msg b { font-weight: 600; }
.active-task-bar .msg .mono { color: var(--fg); }
.active-task-bar .actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ════════ DNS challenge ════════ */
.challenge { margin-bottom: 14px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-1); border-left: 2px solid var(--warning); }
.challenge h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--fg); }
.challenge h4 .ic { color: var(--warning-text); }
.challenge .note { margin-bottom: 10px; font-size: 12px; color: var(--fg-muted); }
.challenge .row { display: grid; grid-template-columns: 60px 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.challenge .row .k { font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-subtle); }
.challenge .row .v {
  padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--input);
  font-family: var(--font-mono); font-size: 12px; color: var(--fg); word-break: break-all;
}
.challenge .footnote { margin-top: 8px; font-size: 11.5px; color: var(--fg-subtle); }
.chal-slot { margin-bottom: 8px; padding: 10px 12px; border-radius: var(--r-lg); border: 1px solid var(--inner-line); background: var(--surface-2); }
.chal-slot.pending { border-style: dashed; opacity: .85; }
.chal-badge { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--fg); }
.chal-badge .num { padding: 0 7px; border-radius: var(--r-sm); background: var(--warning-soft); color: var(--warning-text); font-size: 11px; }
.chal-slot.pending .chal-badge .num { background: var(--active); color: var(--fg-muted); }
.chal-badge .tag { font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.chal-badge .tag.ok { color: var(--success-text); }
.chal-badge .tag.wait { color: var(--fg-subtle); }
.chal-slot .v.vmuted { color: var(--fg-subtle); font-style: italic; background: transparent; border-style: dashed; }

/* ════════ utilities ════════ */
.row-flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.text-mute { color: var(--fg-subtle); }
.text-dim { color: var(--fg-muted); }
.text-err { color: var(--danger-text); }
.text-ok { color: var(--success-text); }
.gap-2 { gap: 6px; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.copy-field { display: flex; gap: 6px; align-items: stretch; }
.copy-field .input { font-family: var(--font-mono); font-size: 12px; }

/* KPI tiles (§9.1) for the registry header */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px; }
.kpi { padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--inner-line); background: var(--surface-2); }
.kpi .v { font-size: 26px; line-height: 32px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; color: var(--fg-subtle); font-weight: 300; }
.kpi .l { font-size: 12px; color: var(--fg-muted); }

/* empty state (§8.12) */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; }
.empty-state .seal { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty-state .seal svg { width: 18px; height: 18px; }
.empty-state h3 { font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 46ch; color: var(--fg-muted); }

/* ════════ auth (login / setup) ════════ */
.auth-bg { min-height: var(--app-h); width: 100vw; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--canvas); }
.auth-card {
  width: 100%; max-width: 440px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2xl); box-shadow: var(--shadow-inset-panel);
}
.auth-card.wide { max-width: 720px; }
.auth-card-head { padding: 22px 24px 14px; }
.auth-card-head::before {
  content: ''; display: block; width: 28px; height: 28px; margin-bottom: 14px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent)); box-shadow: var(--shadow-primary);
}
.auth-card-title { font-size: 18px; line-height: 26px; font-weight: 300; letter-spacing: -0.01em; color: var(--fg); }
.auth-card-sub { margin-top: 4px; font-size: 13px; color: var(--fg-muted); }
.auth-card-body { padding: 4px 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.auth-card-foot { display: flex; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-1); border-radius: 0 0 var(--r-2xl) var(--r-2xl); }
.auth-totp-row { display: flex; gap: 24px; align-items: flex-start; }
.auth-qr { width: 220px; height: 220px; flex-shrink: 0; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); }
.auth-qr svg { width: 100%; height: 100%; display: block; }
.auth-totp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 640px) { .auth-totp-row { flex-direction: column; } }

.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; padding: 10px; border-radius: var(--r-lg); background: var(--surface-1); }
.backup-code {
  padding: 8px 12px; text-align: center; user-select: all; letter-spacing: 1px;
  border-radius: var(--r-md); border: 1px solid var(--inner-line); background: var(--surface-2);
  font-family: var(--font-mono); font-size: 14px;
}

/* ════════ narrow screens ════════ */
@media (max-width: 900px) {
  /* the sidebar becomes a horizontal strip above the panel: never no navigation */
  .frame { flex-direction: column; }
  .side { width: auto; display: flex; gap: 2px; overflow-x: auto; padding: 0 8px 8px; flex-shrink: 0; }
  .side-group { display: flex; gap: 2px; padding: 0; }
  .side-group-head, .side-item.child { display: none; }
  .side-item { flex-shrink: 0; }
  .content { margin: 0 8px 8px 8px; }
  .nav-brand { width: auto; padding: 0 12px; }
  .nav-crumb, .nav-info { display: none; }
  .active-task-bar { margin-left: 8px; }
}
