:root {
  color-scheme: light;
  --background: oklch(0.98 0 0);
  --foreground: oklch(0.12 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.12 0 0);
  --muted: oklch(0.94 0 0);
  --muted-foreground: oklch(0.5 0 0);
  --primary: oklch(0.55 0.18 196);
  --primary-foreground: oklch(0.99 0 0);
  --secondary: oklch(0.94 0 0);
  --secondary-foreground: oklch(0.18 0 0);
  --accent: oklch(0.92 0.04 196);
  --accent-foreground: oklch(0.2 0.06 196);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.88 0 0);
  --input: oklch(0.88 0 0);
  --ring: oklch(0.55 0.18 196);
  --radius: 0.5rem;
  --sidebar: oklch(0.975 0 0);
  --sidebar-foreground: oklch(0.12 0 0);
  --sidebar-border: oklch(0.88 0 0);
  --sidebar-accent: oklch(0.92 0.04 196);
  --sidebar-accent-foreground: oklch(0.2 0.06 196);
  --success: oklch(0.55 0.15 150);
  --success-soft: oklch(0.55 0.15 150 / 12%);
  --success-border: oklch(0.55 0.15 150 / 22%);
  --danger-soft: oklch(0.577 0.245 27.325 / 10%);
  --danger-border: oklch(0.577 0.245 27.325 / 24%);
  --shadow: 0 1px 3px oklch(0 0 0 / 8%), 0 8px 24px oklch(0 0 0 / 6%);
  --orb-primary: oklch(0.55 0.18 196 / 7%);
  --orb-secondary: oklch(0.55 0.18 196 / 5%);
  --code-bg: oklch(0.16 0.01 240);
  --code-text: oklch(0.85 0.01 240);
  --font-sans: "Geist Variable", "Geist", system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.108 0.005 240);
  --foreground: oklch(0.93 0.005 240);
  --card: oklch(0.14 0.006 240);
  --card-foreground: oklch(0.93 0.005 240);
  --muted: oklch(0.19 0.007 240);
  --muted-foreground: oklch(0.58 0.01 240);
  --primary: oklch(0.75 0.16 196);
  --primary-foreground: oklch(0.1 0.02 196);
  --secondary: oklch(0.2 0.008 240);
  --secondary-foreground: oklch(0.9 0.005 240);
  --accent: oklch(0.22 0.03 196);
  --accent-foreground: oklch(0.8 0.12 196);
  --destructive: oklch(0.65 0.22 25);
  --border: oklch(1 0 0 / 7%);
  --input: oklch(1 0 0 / 10%);
  --ring: oklch(0.75 0.16 196);
  --sidebar: oklch(0.12 0.006 240);
  --sidebar-foreground: oklch(0.93 0.005 240);
  --sidebar-border: oklch(1 0 0 / 7%);
  --sidebar-accent: oklch(0.19 0.015 196);
  --sidebar-accent-foreground: oklch(0.8 0.12 196);
  --success: oklch(0.7 0.15 150);
  --success-soft: oklch(0.7 0.15 150 / 14%);
  --success-border: oklch(0.7 0.15 150 / 24%);
  --danger-soft: oklch(0.65 0.22 25 / 12%);
  --danger-border: oklch(0.65 0.22 25 / 24%);
  --shadow: 0 1px 3px oklch(0 0 0 / 30%), 0 12px 32px oklch(0 0 0 / 24%);
  --orb-primary: oklch(0.75 0.16 196 / 8%);
  --orb-secondary: oklch(0.75 0.16 196 / 5%);
  --code-bg: oklch(0.08 0.005 240);
  --code-text: oklch(0.82 0.01 240);
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  transition: background 220ms ease, color 220ms ease;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
h4,
p,
pre,
strong,
span,
ol,
ul {
  margin: 0;
}

.hidden {
  display: none !important;
}

/* ── Background orbs (login / setup) ── */

.backdrop-orbs {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.backdrop-orbs::before,
.backdrop-orbs::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orb-pulse 4s ease-in-out infinite;
}

.backdrop-orbs::before {
  left: -10%;
  top: -15%;
  width: min(42rem, 90vw);
  height: min(42rem, 90vw);
  background: var(--orb-primary);
}

.backdrop-orbs::after {
  right: -5%;
  bottom: -20%;
  width: min(48rem, 95vw);
  height: min(48rem, 95vw);
  background: var(--orb-secondary);
  animation-delay: 1s;
}

@keyframes orb-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.95);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.85);
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pulse-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Theme switcher ── */

.theme-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
}

.theme-switcher-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: oklch(from var(--background) l c h / 80%);
  color: var(--foreground);
  box-shadow: var(--shadow);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-switcher-trigger:hover {
  background: var(--muted);
}

.theme-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  padding: 4px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.theme-switcher-menu[hidden] {
  display: none;
}

.theme-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.theme-option:hover {
  background: var(--muted);
}

.theme-option.active {
  background: var(--accent);
}

.theme-option-icon {
  margin-top: 2px;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.7;
}

.theme-option-copy {
  flex: 1;
  display: grid;
  gap: 2px;
}

.theme-option-copy strong {
  font-size: 0.875rem;
  font-weight: 500;
}

.theme-option-copy span {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.theme-option-check {
  font-size: 0.8rem;
  color: var(--primary);
  opacity: 0;
}

.theme-option.active .theme-option-check {
  opacity: 1;
}

/* ── ONZ logo (mesmo asset do vpn-onz: src/email/onz-logo.ts) ── */

.onz-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
}

.onz-logo-lg {
  width: 108px;
  height: 29px;
}

.onz-logo-sm {
  width: 72px;
  height: 19px;
  flex-shrink: 0;
}

.onz-logo-footer {
  width: 108px;
  height: 29px;
  opacity: 0.92;
}

/* ── Layout shells ── */

.app-shell,
.screen {
  min-height: 100vh;
}

.screen {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.screen-auth,
.screen-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 64px;
  padding-bottom: 40px;
}

.auth-stage,
.setup-stage {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  animation: fade-in-up 400ms ease both;
}

.auth-brand,
.setup-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-brand h1,
.setup-brand h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.screen-copy,
.sidebar-copy,
.section-helper,
small,
.session-status {
  color: var(--muted-foreground);
  line-height: 1.6;
  font-size: 0.875rem;
}

.session-status {
  min-height: 20px;
  text-align: center;
  font-size: 0.8125rem;
}

.session-status.error {
  color: var(--destructive);
}

.eyebrow {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.eyebrow-muted {
  color: var(--muted-foreground);
}

/* ── Cards ── */

.panel-card,
.hero-card,
.callout-card,
.auth-form-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.panel-card,
.callout-card,
.auth-form-card {
  padding: 24px;
}

.auth-form-card {
  display: grid;
  gap: 16px;
}

.auth-form-head {
  display: grid;
  gap: 6px;
  text-align: center;
}

.callout-card {
  width: min(640px, 100%);
  margin-top: 48px;
}

.callout-card pre {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow: auto;
}

.callout-card code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--primary);
}

.setup-code-block {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: oklch(from var(--muted) l c h / 40%);
}

.footer-tagline {
  margin-top: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(from var(--muted-foreground) l c h / 50%);
}

/* ── Workspace layout ── */

.page-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 12px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar);
  transition: background 220ms ease, border-color 220ms ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
}

.sidebar-header-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sidebar-header-copy strong {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-header-copy span {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-block {
  display: grid;
  gap: 8px;
  padding: 0 6px;
}

.sidebar-block h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-user-card,
.sidebar-status-card {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: oklch(from var(--muted) l c h / 40%);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: oklch(from var(--primary) l c h / 20%);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--primary);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role,
.sidebar-status-detail {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--muted-foreground);
}

.sidebar-status-card strong {
  display: block;
  margin-top: 2px;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
}

.sidebar-actions {
  display: grid;
  gap: 6px;
  padding: 0 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 150ms ease;
}

.sidebar-nav-link:hover {
  opacity: 0.9;
}

.sidebar-nav-icon {
  font-size: 0.95rem;
  opacity: 0.85;
}

.environment-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.environment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  padding: 0 4px;
  flex: 1;
}

.environment-card {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.environment-card:not(.empty):hover,
.environment-card.active {
  border-color: oklch(from var(--primary) l c h / 25%);
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.environment-card.empty {
  cursor: default;
  opacity: 0.7;
}

.environment-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.environment-card span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.environment-card.active span {
  color: oklch(from var(--sidebar-accent-foreground) l c h / 70%);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  overflow-y: auto;
  animation: fade-in-up 280ms ease both;
}

/* ── Hero / detail ── */

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
}

.hero-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-header,
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header.compact {
  margin-bottom: 14px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

h4 {
  font-size: 0.875rem;
  font-weight: 500;
}

.stack-panel {
  display: grid;
  gap: 16px;
}

.empty-state-card {
  min-height: 200px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-card {
  min-height: 160px;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.summary-list li {
  display: grid;
  gap: 2px;
}

.summary-list strong {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.summary-list span {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--foreground);
  word-break: break-all;
}

/* ── Flow overview ── */

.flow-overview {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
}

.flow-overview li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
}

.flow-index {
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: oklch(from var(--primary) l c h / 15%);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
}

.flow-overview strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
}

.flow-overview span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* ── Prerequisites & steps ── */

.prerequisites-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 6px;
}

.prerequisites-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prerequisites-list li.ok {
  background: var(--success-soft);
  border-color: var(--success-border);
}

.prerequisites-list li.pending {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.prerequisite-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.prerequisites-list li.ok .prerequisite-icon {
  background: oklch(from var(--success) l c h / 18%);
  color: var(--success);
}

.prerequisites-list li.pending .prerequisite-icon {
  background: oklch(from var(--destructive) l c h / 14%);
  color: var(--destructive);
}

.prerequisites-list strong {
  display: block;
  font-size: 0.8125rem;
}

.prerequisites-list span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.step-timeline {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  gap: 6px;
}

.step-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: oklch(from var(--muted) l c h / 30%);
  transition: background 180ms ease, border-color 180ms ease;
}

.step-item.running {
  border-color: oklch(from var(--primary) l c h / 30%);
  background: oklch(from var(--primary) l c h / 10%);
}

.step-item.success {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.step-item.error {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.step-marker {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.step-item.running .step-marker {
  background: oklch(from var(--primary) l c h / 15%);
  color: var(--primary);
}

.step-item.success .step-marker {
  background: oklch(from var(--success) l c h / 18%);
  color: var(--success);
}

.step-item.error .step-marker {
  background: oklch(from var(--destructive) l c h / 14%);
  color: var(--destructive);
}

.step-copy strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.step-copy span {
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ── Output ── */

.output-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.output-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.output-tab:hover {
  background: var(--muted);
}

.output-tab.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.output-summary {
  display: grid;
  gap: 14px;
}

.result-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.result-meta {
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: oklch(from var(--muted) l c h / 30%);
}

.result-card h4 {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.result-card pre,
.output-card pre {
  margin: 0;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.result-error {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
}

.result-error h3 {
  color: var(--destructive);
  margin-bottom: 6px;
}

.output-card pre {
  min-height: 200px;
}

/* ── Buttons ── */

.primary-button,
.ghost-button,
.accent-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
}

.primary-button:hover:not(:disabled) {
  background: oklch(from var(--primary) l c h / 85%);
}

.accent-button {
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
}

.accent-button:hover:not(:disabled) {
  background: oklch(from var(--primary) l c h / 85%);
}

.ghost-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
}

.ghost-button:hover {
  background: var(--muted);
}

.ghost-button.subtle {
  color: var(--muted-foreground);
}

.ghost-button.danger-outline {
  color: var(--destructive);
  border-color: var(--danger-border);
}

.ghost-button.danger-outline:hover {
  background: var(--danger-soft);
}

.primary-button:disabled,
.accent-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button:active:not(:disabled),
.accent-button:active:not(:disabled),
.ghost-button:active {
  transform: translateY(1px);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid oklch(from var(--primary-foreground) l c h / 30%);
  border-top-color: var(--primary-foreground);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.header-actions,
.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Status pills ── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill.idle {
  background: var(--muted);
  color: var(--muted-foreground);
}

.status-pill.running {
  background: oklch(from var(--primary) l c h / 15%);
  color: var(--primary);
}

.status-pill.running::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.error {
  background: var(--danger-soft);
  color: var(--destructive);
}

.section-tag {
  padding: 4px 8px;
  border-radius: var(--radius);
  background: oklch(from var(--primary) l c h / 12%);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-tag.optional {
  background: var(--muted);
  color: var(--muted-foreground);
}

/* ── Forms ── */

.form-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.form-grid-top {
  margin-top: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label span {
  font-size: 0.8125rem;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 8px 12px;
  height: 36px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="file"] {
  height: auto;
  padding: 8px;
  font-size: 0.75rem;
}

input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(from var(--ring) l c h / 30%);
}

label small {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.empty-slot {
  visibility: hidden;
}

/* ── Admin panel ── */

.text-link {
  color: var(--primary);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
  margin-top: 8px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--sidebar-foreground);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 150ms ease;
}

.admin-nav-item:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.admin-nav-item.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  font-weight: 600;
}

.sidebar-nav-icon {
  opacity: 0.7;
  font-size: 0.85rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}

.sidebar-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--sidebar-foreground);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar-menu-btn:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.sidebar-menu-btn.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  font-weight: 600;
}

.sidebar-menu-icon {
  opacity: 0.75;
  font-size: 0.85rem;
  width: 1rem;
  text-align: center;
}

.view-page-header,
.admin-page-header {
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.view-page-header h1,
.admin-page-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.view-tabs,
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.view-tab,
.admin-tab {
  position: relative;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease;
}

.view-tab:hover,
.admin-tab:hover {
  color: var(--foreground);
}

.view-tab.active,
.admin-tab.active {
  color: var(--foreground);
  font-weight: 600;
}

.view-tab.active::after,
.admin-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--foreground);
  border-radius: 2px 2px 0 0;
}

.tests-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-main {
  position: relative;
}

.admin-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-section-header h2 {
  font-size: 1.5rem;
  margin-top: 4px;
}

.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  background: var(--muted);
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover {
  background: var(--muted);
}

.mono-cell {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.muted-cell {
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

.actions-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.ok {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-badge.admin {
  background: var(--accent);
  color: var(--accent-foreground);
}

.status-badge.operator {
  background: var(--muted);
  color: var(--muted-foreground);
}

.status-badge.muted {
  background: var(--muted);
  color: var(--muted-foreground);
}

.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted-foreground);
}

.admin-empty strong {
  color: var(--foreground);
}

.admin-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in 200ms ease;
}

.admin-toast.success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.admin-toast.error {
  background: var(--danger-soft);
  color: var(--destructive);
  border: 1px solid var(--danger-border);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.cert-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cert-upload > span {
  font-size: 0.8125rem;
  font-weight: 500;
}

.cert-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cert-paste {
  width: 100%;
  min-height: 72px;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  resize: vertical;
}

.admin-back-link {
  width: 100%;
  text-align: center;
  text-decoration: none;
  margin-bottom: 12px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--card);
  color: var(--foreground);
}

@media (max-width: 900px) {
  .admin-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-table-wrap {
    overflow-x: auto;
  }

  .actions-cell {
    flex-direction: column;
  }
}

/* ── Responsive ── */

@media (max-width: 1080px) {
  .detail-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-border);
    max-height: none;
  }

  .sidebar-user-card,
  .hero-card,
  .panel-header,
  .section-title-row,
  .header-actions,
  .hero-actions,
  .result-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 16px;
  }

  .theme-switcher {
    top: 12px;
    right: 12px;
  }
}
