/* Certus Deploy — reusable components. */

/* ---------- Buttons: primary / secondary (default) / ghost / danger ---------- */

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 40px; padding: 0 1rem; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 0.9rem/1 var(--font); white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform 0.1s;
}
.btn .mdi { font-size: 1.1rem; line-height: 1; }
.btn:hover { text-decoration: none; border-color: rgba(18, 26, 59, 0.38); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); border-radius: var(--radius); }
.btn-secondary { /* same as the default .btn — kept explicit in templates */ }
.btn-primary { background: var(--certus-accent); border-color: var(--certus-accent); color: #fff; box-shadow: 0 1px 2px rgba(18, 26, 59, 0.12), 0 6px 16px -10px rgba(37, 99, 235, 0.9); }
.btn-primary:hover { background: var(--certus-accent-hover); border-color: var(--certus-accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-bg); border-color: #FCA5A5; }
.btn-sm { height: 32px; padding: 0 0.7rem; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-sm .mdi { font-size: 1rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.is-loading { cursor: progress; opacity: 0.85; }
.btn.is-loading .mdi { animation: mdi-spin 1s infinite linear; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem; transition: color var(--motion-fast), border-color var(--motion-fast), background-color var(--motion-fast);
}
.icon-btn:hover { color: var(--certus-accent-hover); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn-sm { width: 26px; height: 26px; font-size: 0.9rem; border-radius: 6px; }
.icon-btn.is-copied, .term-btn.is-copied, .btn.is-copied { color: var(--success); }

.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin: 0; }

/* ---------- Panels (cards) ---------- */

.panel {
  margin-bottom: var(--space-5); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: var(--fs-section); font-weight: 700; letter-spacing: -0.005em; color: var(--text); }
.panel-sub { margin-top: 2px; font-size: 0.84rem; color: var(--text-muted); }
.panel-pad { padding: var(--space-4) var(--space-5); }

.grid-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--space-5); align-items: start; }
.grid-aside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: var(--space-5); align-items: start; }

/* ---------- Tables ---------- */

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-table); }
.table th {
  padding: 0.65rem 1rem; text-align: left; white-space: nowrap;
  font-size: var(--fs-table-head); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { height: 52px; padding: 0.55rem 1rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--motion-fast); }
.table tbody tr:hover td { background: #FAFBFE; }
.table-compact td { height: 46px; }

/* Clickable rows: the first cell holds the anchor; the row highlights on hover and keyboard focus. */
.row-link { cursor: pointer; }
.table tbody .row-link:hover td, .table tbody .row-link:focus-within td { background: var(--surface-hover); }
.row-link:hover td:first-child, .row-link:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--certus-accent); }
.row-link .cell-link:focus-visible { box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
.row-failed td:first-child { box-shadow: inset 3px 0 0 var(--danger-solid); }
.row-failed:hover td:first-child, .row-failed:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--danger-solid); }
.row-chevron { margin-left: var(--space-1); font-size: 1.2rem; color: var(--text-subtle); vertical-align: middle; }

.row-dim td { color: var(--text-subtle); }
.row-dim td code { color: var(--text-subtle); text-decoration: line-through; }
.cell-link { font-weight: 600; color: var(--text); white-space: nowrap; }
.cell-link:hover { color: var(--certus-accent-hover); }
.cell-sub { display: block; margin-top: 1px; font-size: var(--fs-caption); color: var(--text-subtle); }
code.sha { padding: 0.12rem 0.42rem; border-radius: 6px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-soft); }
code.path { color: var(--text-2); }
.filter-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); }

/* ---------- Badges, chips, states (icon + label, never color alone) ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; height: 24px; padding: 0 0.55rem 0 0.4rem;
  border-radius: 6px; border: 1px solid transparent;
  font: 600 var(--fs-badge)/1 var(--font); letter-spacing: 0.01em; white-space: nowrap;
}
.badge .mdi { font-size: 0.95rem; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-error { background: var(--danger-bg); color: var(--danger-strong); border-color: var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-muted { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-border); }
.status-lg .badge { height: 30px; padding: 0 0.75rem 0 0.55rem; font-size: 0.82rem; border-radius: var(--radius-sm); vertical-align: middle; }
.status-lg .badge .mdi { font-size: 1.1rem; }

.env {
  display: inline-flex; align-items: center; height: 22px; padding: 0 0.5rem; border-radius: 6px;
  font: 700 0.72rem/1 var(--font-mono); letter-spacing: 0.04em;
  color: var(--certus-blue-700); background: #EAF0FF; border: 1px solid #D3DEFB;
}
.env-lg { height: 28px; font-size: 0.78rem; vertical-align: middle; }

.state { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; font-weight: 500; white-space: nowrap; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; }
.state-on { color: var(--success); }
.state-on .state-dot { background: var(--success-solid); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.state-off { color: var(--text-muted); }
.state-off .state-dot { background: transparent; border: 2px solid #94A3B8; }
h1 .state { font-size: 0.85rem; letter-spacing: 0; }

.trigger { display: inline-flex; align-items: center; gap: 0.3rem; font: 500 0.86rem/1 var(--font); color: var(--text-2); white-space: nowrap; }
.trigger .mdi { font-size: 1rem; color: var(--text-subtle); }

.target {
  display: inline-flex; align-items: center; height: 22px; padding: 0 0.5rem; border-radius: 6px;
  font: 600 0.78rem/1 var(--font-mono); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
}
.target-dark { color: #fff; background: rgba(0, 202, 255, 0.12); border-color: rgba(0, 202, 255, 0.35); }

.live-dot { position: relative; display: inline-block; width: 8px; height: 8px; margin-left: 0.25rem; border-radius: 50%; background: var(--certus-cyan); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--certus-cyan); animation: ping 1.6s ease-out infinite; }

/* ---------- Empty states ---------- */

.empty-state { display: grid; justify-items: center; gap: 0.5rem; padding: 3rem 1.5rem 3.25rem; text-align: center; }
.empty-state h3 { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.empty-state p { max-width: 50ch; color: var(--text-muted); }
.empty-state .btn { margin-top: 0.75rem; }
.empty-icon {
  display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 0.4rem; border-radius: 14px;
  font-size: 1.6rem; color: var(--certus-accent);
  background: radial-gradient(circle at 30% 25%, #FFFFFF, #E7EEFF 70%);
  box-shadow: inset 0 0 0 1px #D6E1FB;
}
.empty-compact { padding: 2rem 1.25rem 2.25rem; }
.empty-compact .empty-icon { width: 44px; height: 44px; font-size: 1.35rem; border-radius: var(--radius-md); }

/* ---------- Alerts ---------- */

.alert {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.85rem 1rem; margin-bottom: var(--space-5); border-radius: var(--radius-md);
  border: 1px solid; border-left-width: 4px; font-size: 0.92rem;
}
.alert > .mdi { font-size: 1.25rem; line-height: 1.2; }
.alert-success { background: #F0FDF4; color: #14532D; border-color: var(--success-border); border-left-color: var(--success-solid); }
.alert-success > .mdi { color: #16A34A; }
.alert-error { background: var(--danger-bg); color: #7F1D1D; border-color: var(--danger-border); border-left-color: var(--danger-solid); }
.alert-error > .mdi { color: #DC2626; }
.alert-info { background: var(--info-bg); color: #0C2A66; border-color: var(--info-border); border-left-color: var(--info-solid); }
.alert-info > .mdi { color: var(--info-solid); }
.alert-inset { margin: var(--space-4) var(--space-5); }

/* ---------- Key/value lists ---------- */

.kv { margin: 0; padding: 0.4rem var(--space-5) 0.9rem; }
.kv > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--space-4); padding: 0.6rem 0; border-bottom: 1px dashed #E5EAF2; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-size: 0.84rem; color: var(--text-muted); }
.kv dd { margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; min-width: 0; color: var(--text); }
.kv-stack > div { grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-3); padding: 0.5rem 0; }
.kv-stack dd { font-size: 0.875rem; }
.copy-row { flex-wrap: nowrap !important; align-items: flex-start !important; }
.copy-row code { flex: 1; min-width: 0; font-size: 0.78rem; color: var(--text-2); }

/* ---------- Forms ---------- */

.form-layout { max-width: var(--form-width); }
.form-section { padding: 1.35rem 1.4rem 1.5rem; overflow: visible; }
.form-section-head { margin-bottom: 1.1rem; }
.form-section-head h2 { font-size: var(--fs-section); font-weight: 700; color: var(--text); }
.form-section-head p { margin-top: 2px; font-size: 0.86rem; color: var(--text-muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.optional { margin-left: 0.25rem; font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.hint { font-size: var(--fs-caption); color: var(--text-muted); }
.hint code { font-size: 0.78rem; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 42px; padding: 0.55rem 0.8rem;
  font: 400 0.92rem/1.4 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
input.mono, textarea.mono { font-family: var(--font-mono); font-size: 0.85rem; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: #94A3B8; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: rgba(18, 26, 59, 0.38); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--certus-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); }
input:user-invalid, textarea:user-invalid { border-color: var(--danger-solid); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }
select {
  appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23545F78'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 20px;
}

.input-group { display: flex; align-items: stretch; }
.input-group input { min-width: 0; border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > :last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.addon {
  display: inline-flex; align-items: center; padding: 0 0.75rem; flex: none;
  font-size: 0.85rem; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border-strong);
}
.input-group .addon:first-child { border-right: 0; }
.input-group .addon:last-child { border-left: 0; }

.toggle-list { display: grid; gap: 0.6rem; }
.toggle {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0.95rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  transition: border-color var(--motion-fast), background-color var(--motion-fast);
}
.toggle:hover { border-color: var(--border-strong); background: #FBFCFE; }
.toggle input {
  appearance: none; position: relative; flex: none; width: 40px; height: 24px; margin: 0; cursor: pointer;
  border-radius: var(--radius-full); background: #CBD5E1; transition: background-color 0.18s;
}
.toggle input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(2, 8, 23, 0.3); transition: transform 0.18s var(--ease);
}
.toggle input:checked { background: var(--certus-accent); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle input:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-full); }
.toggle-text { display: grid; line-height: 1.3; }
.toggle-text strong { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.toggle-text span { font-size: 0.82rem; color: var(--text-muted); }

.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.9rem 0;
  background: linear-gradient(180deg, rgba(245, 246, 250, 0), var(--bg) 35%);
}
.form-actions-inset { position: static; padding: 0.9rem var(--space-5); background: var(--surface-2); border-top: 1px solid var(--border); }
.form-panel { position: sticky; top: calc(var(--appbar-h) + 16px); }

.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input:not([type="hidden"]) { flex: 1; min-width: 160px; width: auto; }
.panel-pad.inline-form { border-bottom: 1px solid var(--border); background: var(--surface-2); }

.search { position: relative; display: block; }
.search .mdi { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.15rem; pointer-events: none; }
.search input[type="search"] { width: 340px; padding-left: 2.2rem; }

/* ---------- Filters & pagination ---------- */

.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4);
  padding: 14px var(--space-5); border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.filter { display: grid; gap: 4px; min-width: 190px; }
.filter label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text-muted); }
.filter select { min-height: 36px; padding-block: 0.3rem; font-size: 0.875rem; }
.filter-actions { display: flex; gap: var(--space-2); }
.filter-count { margin-left: auto; align-self: center; font-size: 0.84rem; color: var(--text-muted); }

.pagination {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); background: var(--surface-2);
}
.pagination-info, .pagination-page { font-size: 0.84rem; color: var(--text-muted); }
.pagination-links { display: flex; align-items: center; gap: var(--space-3); }

/* ---------- Terminal (log viewer) ---------- */

.terminal {
  min-width: 0; overflow: hidden; border-radius: var(--radius-md);
  background: var(--certus-navy-950); border: 1px solid #10224A;
  box-shadow: 0 24px 48px -28px rgba(2, 8, 23, 0.85), inset 0 1px 0 rgba(0, 202, 255, 0.12);
}
.terminal-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: 0.6rem 0.9rem 0.6rem 1rem;
  background: linear-gradient(180deg, #0B1A3A, var(--certus-navy-900)); border-bottom: 1px solid var(--line-on-dark);
}
.terminal-title { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; font-weight: 600; color: #E7EEFA; white-space: nowrap; }
.terminal-title .mdi { color: var(--certus-cyan); font-size: 1.1rem; }
.terminal-cmd { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; color: #6F82A6; }
.terminal-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.terminal-opt { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-on-dark-subtle); cursor: pointer; user-select: none; }
.terminal-opt input { accent-color: var(--certus-cyan); }
.term-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 30px; padding: 0 0.65rem;
  border: 1px solid rgba(148, 178, 230, 0.22); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04);
  font: 600 0.78rem/1 var(--font); color: #D3DEF0; cursor: pointer; white-space: nowrap;
}
.term-btn:hover { background: rgba(255, 255, 255, 0.09); color: #fff; text-decoration: none; }
.term-btn.is-copied { color: #4ADE80; border-color: rgba(74, 222, 128, 0.4); }
.term-btn:focus-visible { box-shadow: 0 0 0 3px rgba(0, 202, 255, 0.45); }
.terminal-screen { position: relative; }
.terminal-screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(90% 60% at 50% 0%, rgba(0, 202, 255, 0.05), transparent 70%);
}
.terminal-body {
  margin: 0; min-height: 420px; max-height: calc(100dvh - 240px); overflow: auto; padding: 1rem 1.2rem 1.25rem;
  font: 400 0.82rem/1.65 var(--font-mono); color: #D3DEF0; white-space: pre-wrap; word-break: break-word;
  background: transparent; tab-size: 4;
  scrollbar-color: #1E3566 transparent;
}
.terminal-body.is-nowrap { white-space: pre; word-break: normal; }
.terminal-body:empty::before { content: "Aguardando o primeiro registro…"; color: #4B5D80; }
.terminal-body::selection { background: rgba(0, 202, 255, 0.3); color: #fff; }
.terminal-body:focus-visible { box-shadow: inset 0 0 0 3px rgba(0, 202, 255, 0.45); border-radius: 0; }
.terminal-foot {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1rem;
  font: 500 0.76rem/1.2 var(--font-mono); color: var(--text-on-dark-subtle);
  background: var(--certus-navy-900); border-top: 1px solid var(--line-on-dark);
}
.terminal.is-live .terminal-foot { color: var(--certus-cyan); }
.cursor { display: inline-block; width: 8px; height: 14px; background: var(--certus-cyan); animation: blink 1s steps(1) infinite; }

/* ---------- Failure summary ---------- */

.failure {
  margin-bottom: var(--space-5); overflow: hidden;
  background: var(--surface); border: 1px solid var(--danger-border); border-left: 4px solid var(--danger-solid);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
}
.failure-head { display: flex; gap: 14px; padding: 18px var(--space-5) 4px; }
.failure-icon { font-size: 1.9rem; line-height: 1; color: var(--danger-solid); }
.failure h2 { font-size: 1.12rem; font-weight: 700; color: var(--danger-strong); }
.failure-reason { margin-top: 4px; font-size: 0.95rem; color: var(--text); }
.failure-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) 40px; margin: 0; padding: 10px var(--space-5) 16px 66px; }
.failure-facts dt { font-size: 0.75rem; color: var(--text-muted); }
.failure-facts dd { margin: 2px 0 0; font-weight: 700; color: var(--text); }
.failure-tail { border-top: 1px solid var(--danger-border); background: var(--certus-navy-950); }
.failure-tail-head {
  display: flex; justify-content: space-between; gap: var(--space-3); padding: 8px var(--space-4);
  font: 600 0.76rem/1.3 var(--font); letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-on-dark-subtle); background: #0B1A3A;
}
.failure-tail-head a { display: inline-flex; align-items: center; gap: 2px; text-transform: none; letter-spacing: 0; color: #93C5FD; }
.failure-tail-body {
  margin: 0; max-height: 300px; overflow: auto; padding: 12px var(--space-4) 14px;
  font: 400 0.8rem/1.6 var(--font-mono); color: #E5E9F2; white-space: pre-wrap; word-break: break-word;
}
.failure-tail-body:focus-visible { box-shadow: inset 0 0 0 3px rgba(0, 202, 255, 0.45); border-radius: 0; }

.live-banner {
  display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); padding: 12px var(--space-4);
  border: 1px solid var(--info-border); border-left: 4px solid var(--certus-cyan); border-radius: var(--radius-md);
  background: var(--info-bg); color: #0C2A66; font-size: 0.92rem;
}
.live-banner .live-dot { margin-left: 2px; }

/* ---------- Timeline ---------- */

.timeline { display: grid; margin: 0; padding: var(--space-4) var(--space-5) 18px; list-style: none; }
.timeline li { position: relative; display: flex; gap: var(--space-3); padding-bottom: var(--space-4); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--border); }
.timeline li > div { display: grid; line-height: 1.35; }
.timeline strong { font-size: 0.875rem; color: var(--text); }
.timeline li > div > span { font-size: var(--fs-caption); color: var(--text-muted); }
.tl-dot {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%;
  font-size: 14px; color: var(--text-subtle); background: var(--surface); border: 2px solid var(--border-strong);
}
.tl-done .tl-dot { color: #fff; background: var(--certus-accent); border-color: var(--certus-accent); }
.tl-done:not(:last-child)::after { background: var(--certus-accent) !important; }
.tl-current .tl-dot { color: var(--certus-accent); border-color: var(--certus-accent); }
.tl-success .tl-dot { color: #fff; background: #16A34A; border-color: #16A34A; }
.tl-failed .tl-dot { color: #fff; background: var(--danger-solid); border-color: var(--danger-solid); }
.tl-failed strong { color: var(--danger-strong); }
.tl-pending .tl-dot { border-style: dashed; }

/* ---------- Dialog ---------- */

.dialog {
  width: min(520px, calc(100vw - 2rem)); padding: 0; border: 0; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-modal), 0 0 0 1px rgba(2, 8, 23, 0.08);
}
.dialog::backdrop { background: rgba(2, 8, 23, 0.62); backdrop-filter: blur(3px); }
.dialog[open] { animation: rise 0.22s var(--ease) both; }
.dialog form { margin: 0; }
.dialog-head { display: flex; align-items: center; gap: 0.8rem; padding: 1.35rem 1.5rem 0.75rem; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: var(--radius-md); font-size: 1.3rem; color: var(--certus-cyan); background: var(--certus-navy-900); }
.dialog-head h2 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.dialog-facts { margin: 0.5rem 1.5rem 0; border-radius: var(--radius-md); background: var(--certus-navy-950); color: #DCE6F6; overflow: hidden; }
.dialog-facts > div { padding: 0.75rem 1rem; }
.dialog-facts > div + div { border-top: 1px solid var(--line-on-dark); }
.dialog-facts dt { font-size: 0.74rem; color: #6F82A6; }
.dialog-facts dd { margin: 0.2rem 0 0; }
.dialog-facts code { color: #fff; font-size: 0.9rem; word-break: break-all; }
.dialog-note { padding: 0.9rem 1.5rem 0; font-size: 0.85rem; color: var(--text-muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1.2rem 1.5rem 1.35rem; }
.dialog-wide { width: min(820px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; }
.dialog-steps { margin: 0.4rem 1.5rem 0.8rem; padding-left: 1.25rem; color: var(--text); font-size: 0.9rem; line-height: 1.55; }
.script-toolbar { display: flex; gap: 0.5rem; padding: 0 1.5rem; }
.script-block {
  margin: 0.75rem 1.5rem; padding: 1rem; max-height: 42vh; overflow: auto;
  border-radius: var(--radius-md); background: var(--certus-navy-950); color: #DCE6F6;
  font-size: 0.78rem; line-height: 1.45; white-space: pre; tab-size: 2;
}
#setup-command { white-space: pre-wrap; word-break: break-all; font-size: 0.85rem; }
.setup-fallback { margin: 1rem 0 0; }
.setup-fallback > summary { padding: 0 1.5rem 0.6rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }

/* ---------- Responsive components ---------- */

@media (max-width: 1480px) {
  .grid-split { grid-template-columns: minmax(0, 1fr); }
  .grid-split .kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
}

@media (max-width: 1180px) {
  .grid-aside { grid-template-columns: minmax(0, 1fr); }
  .form-panel { position: static; }
}

@media (max-width: 960px) {
  .grid-split .kv { grid-template-columns: minmax(0, 1fr); }
  .filter { min-width: 0; flex: 1 1 160px; }
  .filter-count { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv > div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .search input[type="search"] { width: 100%; }
  .failure-facts { padding-left: var(--space-5); }
}
