/* Plepys high-craft visual layer built strictly on Salvaro Identity OKLCH tokens.
   Aesthetic: Linear + Resend + Tailscale — tactile hairlines, subtle ambient OKLCH aura,
   frosted glass topbar, bento KPI tiles, pill tabs, dual-pane inbox, and visual flow cards. */

:root {
  --violet: light-dark(oklch(53% 0.17 285), oklch(73% 0.15 285));
  --violet-bg: color-mix(in oklab, var(--violet) 12%, var(--surface));
  --aura-1: color-mix(in oklab, var(--accent) 13%, transparent);
  --aura-2: color-mix(in oklab, var(--violet) 10%, transparent);
  --glass-bg: color-mix(in oklab, var(--surface) 78%, transparent);
  --card-shadow: 0 1px 2px var(--shadow-near), 0 8px 24px -12px var(--shadow-far);
}

/* Subtle ambient radial aura behind workspace and auth card */
.mt-body {
  background-image:
    radial-gradient(60% 420px at 18% 0%, var(--aura-1), transparent 72%),
    radial-gradient(50% 380px at 84% 0%, var(--aura-2), transparent 72%);
  background-repeat: no-repeat;
}

.mt-auth-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(480px 320px at 50% 34%, var(--aura-1), transparent 72%);
}

.mt-auth-card {
  position: relative;
  border-color: color-mix(in oklab, var(--border-strong) 80%, transparent);
}

.mt-auth-orb {
  width: 54px;
  height: 54px;
  color: var(--accent);
  background: var(--accent-bg);
  border-color: color-mix(in oklab, var(--accent) 28%, transparent);
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 8%, transparent);
}

.auth-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.auth-features span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.auth-features .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* Brand mark */
.mt-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: oklch(99% 0 0);
  box-shadow: 0 2px 10px -2px color-mix(in oklab, var(--accent) 55%, transparent);
}

.mt-brand-mark .icon {
  width: 15px;
  height: 15px;
}

.brand-tag {
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* Frosted glass topbar */
.mt-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid var(--border);
}

.mt-topbar-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 var(--s-5);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.mt-topbar-left,
.mt-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
}

/* Theme toggle icon visibility */
.theme-ico-dark {
  display: none;
}

:root[data-theme="dark"] .theme-ico-light {
  display: none;
}

:root[data-theme="dark"] .theme-ico-dark {
  display: inline-grid;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-ico-light {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-ico-dark {
    display: inline-grid;
  }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  max-width: 220px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  flex: none;
}

.user-chip .ws-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Live SSE indicator */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
}

.live-pill.is-live {
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in oklab, var(--success) 32%, transparent);
}

.live-pill.is-live .live-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 25%, transparent);
  animation: live-pulse 2.2s ease-in-out infinite;
}

.live-pill.is-offline {
  color: var(--warning);
  background: var(--warning-bg);
}

.live-pill.is-offline .live-dot {
  background: var(--warning);
}

@keyframes live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--success) 45%, transparent);
  }
  50% {
    box-shadow: 0 0 0 5px transparent;
  }
}

/* Workspace main container */
.mt-main {
  max-width: 1260px;
  margin: 0 auto;
  padding: 28px var(--s-5) 64px;
}

/* Hero strip */
.mt-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
  gap: var(--s-5);
  align-items: end;
  margin-bottom: var(--s-6);
}

.mt-hero-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid color-mix(in oklab, var(--accent) 24%, transparent);
  border-radius: 999px;
}

.eyebrow-badge .icon {
  width: 13px;
  height: 13px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 550;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.status-chip.is-ok {
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in oklab, var(--success) 28%, transparent);
}

.status-chip.is-warn {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: color-mix(in oklab, var(--warning) 30%, transparent);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.mt-hero-copy h1 {
  font-size: clamp(24px, 3vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.mt-hero-copy .sub {
  max-width: 54ch;
  font-size: 14.5px;
  margin-top: 8px;
}

.mt-hero-endpoint {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.endpoint-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.endpoint-label .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.endpoint-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.endpoint-pill code {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: color-mix(in oklab, currentColor 14%, transparent);
  opacity: 0.85;
}

/* Primary button subtle polish */
.mt-cta-glow {
  box-shadow: 0 1px 2px var(--shadow-near), 0 6px 16px -6px color-mix(in oklab, var(--accent) 45%, transparent);
}

/* KPI Bento Strip */
.mt-bento-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--s-5);
}

.stat-tile {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.stat-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--card-shadow);
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
}

.stat-icon .icon {
  width: 15px;
  height: 15px;
}

.tone-accent {
  color: var(--accent);
  background: var(--accent-bg);
}

.tone-violet {
  color: var(--violet);
  background: var(--violet-bg);
}

.tone-success {
  color: var(--success);
  background: var(--success-bg);
}

.tone-warn {
  color: var(--warning);
  background: var(--warning-bg);
}

.stat-val {
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.stat-sub {
  font-size: 12.5px;
  color: var(--subtle);
}

/* Segmented Pill Tabs */
.mt-pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  margin-bottom: var(--s-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.mt-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.mt-tab .icon {
  width: 15px;
  height: 15px;
  opacity: 0.8;
}

.mt-tab:hover {
  color: var(--text);
  background: color-mix(in oklab, var(--surface) 60%, transparent);
}

.mt-tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 3px var(--shadow-near);
}

.mt-tab.active .icon {
  color: var(--accent);
  opacity: 1;
}

.tab-count {
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
}

.mt-tab.active .tab-count {
  color: var(--accent);
  background: var(--accent-bg);
}

/* Elevated editor/panel cards */
.mt-elevated-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.card-head-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: var(--s-4);
}

.card-head-bar h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.card-head-bar h3 .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* Toolbar */
.mt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: var(--s-3);
}

.search-field {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.search-field .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--subtle);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px 0 34px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pills select {
  min-height: 36px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Dual-pane unified Inbox / Delivery Frame */
.inbox-frame {
  display: grid;
  grid-template-columns: minmax(310px, 410px) minmax(0, 1fr);
  min-height: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.inbox-rail {
  display: flex;
  flex-direction: column;
  max-height: 760px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface-2) 45%, var(--surface));
}

.inbox-canvas {
  min-width: 0;
  padding: var(--s-5);
  background: var(--surface);
}

.mt-empty-canvas {
  min-height: 440px;
  align-content: center;
  border: 0;
}

/* Email / Delivery rail row */
.rail-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}

.rail-item:hover {
  background: var(--surface-2);
}

.rail-item.is-selected {
  background: var(--surface);
}

.rail-item.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.rail-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.rail-avatar.is-in {
  color: var(--accent);
  background: var(--accent-bg);
}

.rail-avatar.is-out {
  color: var(--success);
  background: var(--success-bg);
}

.rail-avatar.is-warn {
  color: var(--warning);
  background: var(--warning-bg);
}

.rail-avatar.is-err {
  color: var(--danger);
  background: var(--danger-bg);
}

.rail-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.row-subject {
  font-size: 13.5px;
  font-weight: 640;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-time {
  font-size: 11.5px;
  color: var(--subtle);
  white-space: nowrap;
}

.row-addr {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.row-preview {
  font-size: 12.5px;
  color: var(--subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Detail Reading Canvas */
.detail-card {
  display: grid;
  gap: var(--s-4);
}

.detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--border);
}

.detail-header h3 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 660;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.addr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
}

.addr-pill:hover {
  border-color: var(--border-strong);
}

.sub-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  width: fit-content;
}

.sub-tab {
  min-height: 29px;
  padding: 0 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.sub-tab:hover {
  color: var(--text);
}

.sub-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow-near);
}

.email-iframe {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: oklch(100% 0 0);
}

.pre-box {
  margin: 0;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 400px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Playground visual flow banner */
.flow-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  margin-bottom: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.flow-node {
  display: grid;
  gap: 3px;
  flex: 1 1 160px;
  min-width: 0;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.flow-node.is-accent {
  background: var(--accent-bg);
  border-color: color-mix(in oklab, var(--accent) 30%, transparent);
}

.flow-node-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.flow-node code {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-arrow {
  color: var(--subtle);
  display: inline-grid;
  place-items: center;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.preset-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.playground-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.15fr);
  gap: var(--s-4);
  align-items: start;
}

/* Vertical Stepper Trace Timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding-left: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

.trace-step {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
}

.trace-step::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 28%, transparent);
}

.trace-step.is-ok::before {
  background: var(--success);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--success) 28%, transparent);
}

.trace-step.is-err::before {
  background: var(--danger);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--danger) 28%, transparent);
}

.trace-list,
.thread-list,
.attempts-list {
  display: grid;
  gap: 10px;
}

.trace-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
}

/* Bento grid for Mailboxes & Domains */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 12px;
}

.bento-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.bento-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow);
}

.mailbox-addr-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.mailbox-addr-bar code {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Visual Route Flow Cards + Toggle Switch */
.route-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.route-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow);
}

.route-card.is-disabled {
  opacity: 0.68;
}

.route-flow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.route-flow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.switch-btn {
  position: relative;
  width: 38px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.switch-btn::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow-near);
  transition: transform 0.18s var(--ease);
}

.switch-btn.is-on {
  background: var(--success);
  border-color: var(--success);
}

.switch-btn.is-on::after {
  transform: translateX(16px);
}

/* Health cards in Settings */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: var(--s-6);
}

.health-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}

.health-card.is-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow);
}

.health-card strong {
  display: block;
  font-size: 13.5px;
}

.health-card .muted {
  margin: 2px 0 0;
  font-size: 12.5px;
}

.health-card .muted .icon {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
}

/* Setup steps */
.setup-steps {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

.step-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
}

/* Attachments & ghost buttons */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-ghost .icon {
  width: 14px;
  height: 14px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.attachment-chip:hover {
  border-color: var(--border-strong);
}

.mt-top {
  margin-top: var(--s-4);
}

/* Floating Toast Notifications */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.22s var(--ease) both;
}

.toast.is-ok {
  border-color: color-mix(in oklab, var(--success) 45%, transparent);
}

.toast.is-error {
  color: var(--danger);
  border-color: color-mix(in oklab, var(--danger) 45%, transparent);
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--success);
}

.toast.is-error .toast-dot {
  background: var(--danger);
}

@media (max-width: 980px) {
  .mt-hero {
    grid-template-columns: 1fr;
  }

  .mt-bento-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inbox-frame,
  .playground-grid {
    grid-template-columns: 1fr;
  }

  .inbox-rail {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  .mt-topbar-inner {
    padding: 0 var(--s-3);
  }

  .mt-main {
    padding: 18px var(--s-3) 48px;
  }

  .mt-bento-stats {
    grid-template-columns: 1fr 1fr;
  }

  .user-chip .ws-user-email,
  .brand-tag {
    display: none;
  }

  .flow-arrow {
    display: none;
  }
}
