/*
 * portal.css
 *
 * Canary portal design system: v5 tokens.
 * All portal views and auth pages use these tokens.
 * Matches canary-web v5.scss exactly.
 *
 * Fonts loaded via Google Fonts in portal.html.erb layout.
 */

/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --ink:    #1A1A14;
  --ink-2:  #4A4840;
  --ink-3:  #8A8478;
  --bg:     #ffffff;
  --warm:   #F5F3EC;
  --warm-1: #F8F6F0;
  --warm-2: #F0EDE4;
  --warm-3: #E5E1D5;
  --yellow: #FFD600;
  --border: #E0DDD4;
  --red:    #CC2200;
  --green:  #1B7A3E;
  --amber:  #9A6600;

  --sans:   'Bricolage Grotesque', system-ui, sans-serif;
  --serif:  'Source Serif 4', Georgia, serif;
  --mono:   'JetBrains Mono', monospace;

  --radius: 6px;
  --radius-lg: 10px;
}

/* ============================================================
   Reset + base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--ink); text-decoration: underline; }
a:hover { opacity: 0.7; }

/* ============================================================
   Portal nav
   ============================================================ */
.portal-nav {
  position: relative;
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  z-index: 100;
}

.portal-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo */
.canary-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.canary-logo:hover { opacity: 1; }
.canary-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--ink);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.canary-logo em { font-style: normal; }

/* Nav layout: left = logo + primary links, right = dropdowns */
.portal-nav-left  { display: flex; align-items: center; gap: 2px; }
.portal-nav-right { display: flex; align-items: center; gap: 4px; }

/* Desktop nav links */
.portal-nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
}

.portal-nav-link {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 0;
  transition: color 0.1s;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}
.portal-nav-link:hover {
  color: var(--ink);
  border-bottom-color: var(--border);
}
.portal-nav-link.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}
.portal-nav-link.active:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* AI nav link: subtle accent */
.portal-nav-link--ai {
  font-weight: 600;
}
.portal-nav-link--ai::before {
  content: "✦ ";
  font-size: 9px;
  vertical-align: middle;
  opacity: 0.6;
}

/* Nav divider between groups */
.portal-nav-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Nav dropdown (details/summary, no JS) */
.portal-nav-dropdown {
  position: relative;
}

.portal-nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: var(--radius);
  background: none;
  border: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.1s, color 0.1s;
}
.portal-nav-dropdown-toggle::-webkit-details-marker { display: none; }
.portal-nav-dropdown-toggle::marker { display: none; }
.portal-nav-dropdown-toggle:hover {
  background: var(--warm);
  color: var(--ink);
}
.portal-nav-dropdown[open] .portal-nav-dropdown-toggle {
  background: var(--warm);
  color: var(--ink);
}

/* Chevron icon */
.portal-nav-dropdown-toggle .chev {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.15s;
}
.portal-nav-dropdown[open] .portal-nav-dropdown-toggle .chev {
  transform: rotate(180deg);
}

/* Dropdown menu panel */
.portal-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26,26,20,0.10);
  padding: 6px;
  z-index: 200;
}

/* Menu header (non-clickable label) */
.portal-nav-dropdown-header {
  padding: 8px 10px 6px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 4px;
}
.portal-nav-dropdown-header-name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.portal-nav-dropdown-header-sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}

/* Menu items */
.portal-nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-align: left;
  box-sizing: border-box;
}
.portal-nav-dropdown-item:hover {
  background: var(--warm);
  color: var(--ink);
  opacity: 1;
}
.portal-nav-dropdown-item.active {
  background: var(--ink);
  color: var(--bg);
}
.portal-nav-dropdown-item--danger { color: var(--red); }
.portal-nav-dropdown-item--danger:hover { background: #FFF0EE; color: var(--red); }

.portal-nav-dropdown-divider {
  height: 1.5px;
  background: var(--border);
  margin: 4px 0;
}

/* User avatar initials badge */
.portal-nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Workspace badge in dropdown toggle */
.portal-nav-ws-badge {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile hamburger */
.portal-nav-mobile { display: none; }

@media (max-width: 700px) {
  .portal-nav-left .portal-nav-links { display: none; }
  .portal-nav-right .portal-nav-dropdown { display: none; }
  .portal-nav-mobile { display: block; }

  .portal-nav-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    list-style: none;
    padding: 8px;
    background: none;
    border: none;
  }
  .portal-nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
  }

  .portal-nav-drawer {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1.5px solid var(--border);
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 200;
  }

  .portal-nav-drawer a, .portal-nav-drawer button {
    display: block;
    padding: 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    font-family: var(--sans);
    cursor: pointer;
  }
  .portal-nav-drawer a:last-child,
  .portal-nav-drawer button:last-child { border-bottom: none; }
  .portal-nav-drawer a.active { color: var(--ink); background: var(--yellow); padding-left: 8px; }

  .portal-nav-drawer-user {
    margin-top: 12px;
    font-size: 13px;
    color: var(--ink-3);
  }

  .portal-nav-mobile:not([open]) .portal-nav-drawer { display: none; }
  .portal-nav-mobile[open] .portal-nav-drawer { display: flex; }
}

/* ============================================================
   Subscription banners
   ============================================================ */
.portal-banner {
  padding: 10px 20px;
  font-size: 14px;
  text-align: center;
  font-family: var(--sans);
}
.portal-banner--trial {
  background: var(--yellow);
  color: var(--ink);
}
.portal-banner--warning {
  background: var(--red);
  color: #fff;
}
.portal-banner a {
  font-weight: 700;
  text-decoration: underline;
  color: inherit;
}

/* ============================================================
   Page wrapper
   ============================================================ */
.portal-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px;
}

.portal-page-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 24px;
}

.portal-page-header {
  margin-bottom: 32px;
}
.portal-page-header h1 {
  font-family: var(--sans);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.portal-page-header p {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-2);
}

/* ============================================================
   Flash messages
   ============================================================ */
.flash { padding: 12px 20px; font-size: 14px; border-radius: var(--radius); margin-bottom: 20px; }
.flash--notice { background: #E8F5E9; color: #1B5E20; border: 1px solid #A5D6A7; }
.flash--alert  { background: #FFEBEE; color: #B71C1C; border: 1px solid #FFCDD2; }
.flash--toast {
  margin-bottom: 0;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  max-width: 380px;
  animation: flash-in 0.2s ease both;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.flash--toast.flash--hiding {
  opacity: 0;
  transform: translateY(8px);
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Auth pages (signup, verify, invite)
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.auth-logo em { font-style: normal; }

.auth-card h1 {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 8px;
}

.auth-card p.auth-sub {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 32px;
  line-height: 1.5;
}

.auth-field { margin-bottom: 16px; }

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-field input[type="email"],
.auth-field input[type="text"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.auth-field input:focus { border-color: var(--ink); }

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
}
.auth-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.auth-checkbox label {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  cursor: pointer;
}
.auth-checkbox a { color: var(--ink); }

.auth-btn {
  display: block;
  width: 100%;
  padding: 13px 20px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.85; color: var(--bg); }

.auth-meta {
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}
.auth-meta a { color: var(--ink-2); }

.auth-divider {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 32px 0;
}

/* Check email page */
.auth-check-icon {
  width: 44px;
  height: 44px;
  background: var(--warm);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

/* ── Pricing plan cards (billing/plans) ────────────────────────────── */
.v5-plans {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.v5-plan {
  background: var(--bg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
}
.v5-plan--pick { background: #FFFBEE; }
.v5-plan-tier {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.v5-plan-price {
  font-family: var(--sans);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}
.v5-plan-mo {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 22px;
}
.v5-plan-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 24px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  list-style: none;
  padding: 0;
}
.v5-plan-items li::before {
  content: '+ ';
  color: var(--ink-3);
}
.v5-plan-cta {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.v5-plan-cta:hover { border-color: var(--ink-2); color: var(--ink); }
.v5-plan--pick .v5-plan-cta {
  background: var(--ink);
  color: var(--bg);
  border-color: transparent;
}
.v5-plan--pick .v5-plan-cta:hover { opacity: 0.85; }
.v5-plan-small {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  margin-top: 10px;
}

/* Expired/error states */
.auth-expired {
  text-align: center;
  padding: 20px 0;
}
.auth-expired .auth-expired-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

/* ============================================================
   Buttons (shared)
   ============================================================ */
.btn,
.btn--primary,
.btn--secondary,
.btn--danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn--primary   { background: var(--ink); color: var(--bg); }
.btn--primary:hover { opacity: 0.85; color: var(--bg); }
.btn--secondary { background: transparent; border-color: var(--border); color: var(--ink-2); }
.btn--secondary:hover { background: var(--warm); opacity: 1; color: var(--ink); }
.btn--danger    { background: var(--red); color: #fff; }
.btn--danger:hover { opacity: 0.85; color: #fff; }

/* ============================================================
   Dashboard stats block: Canary seamless 1px-gap grid
   ============================================================ */
.portal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
}
.portal-stat {
  background: var(--bg);
  padding: 22px 24px;
}
.portal-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 8px;
}
.portal-stat-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
}
.portal-stat-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 6px;
}

/* ============================================================
   Heatmap table (matches canary-web v5 classes exactly)
   ============================================================ */
.v5-hmap-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.v5-hmap-chips {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.v5-hmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.v5-hmap-table thead {
  background: var(--warm);
  border-bottom: 1px solid var(--border);
}
.v5-hmap-table th {
  text-align: left;
  padding: 11px 18px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  white-space: nowrap;
}
.v5-hmap-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-family: var(--sans);
}
.v5-hmap-table tbody tr:last-child td { border-bottom: none; }
.v5-hmap-row { cursor: pointer; transition: background 0.08s; }
.v5-hmap-row:hover { background: var(--warm); }

/* Client name cell */
.v5-cn { font-weight: 700; color: var(--ink); font-size: 14px; }
.v5-cc { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* Score badges */
.v5-sc { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.v5-sc--pos { color: #1B7A3E; }
.v5-sc--neg { color: #CC2200; }
.v5-sc--neu { color: var(--ink-2); }

/* Status badges */
.v5-st {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--sans);
}
.v5-st--risk { color: #CC2200; }
.v5-st--ok   { color: #1B7A3E; }
.v5-st--sil  { color: var(--ink-3); }
.v5-st--dn   { color: #B45309; }
.v5-st--warn { color: #9A6600; }

/* Trend bar: outer is the track, inner fill expands by width% */
.v5-bar { width: 72px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.v5-bar-v { height: 100%; border-radius: 2px; background: #1B7A3E; }
.v5-bar-v--neg { background: #CC2200; }

/* Renewal countdown */
.v5-rn { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.v5-rn--now { color: var(--red); font-weight: 600; }

/* Filter chips */
.v5-hmap-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.v5-hmap-chip:hover { background: var(--warm); color: var(--ink); opacity: 1; }
.v5-hmap-chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Heatmap filter bar */
.heatmap-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.heatmap-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.heatmap-search input {
  width: 100%;
  padding: 7px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  outline: none;
}
.heatmap-search input:focus { border-color: var(--ink); }

/* Pagination */
.portal-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 13px;
  color: var(--ink-3);
}
.portal-pagination-links { display: flex; gap: 8px; }

/* ============================================================
   Section card (used on account detail, settings, etc.)
   ============================================================ */
.portal-section {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.portal-section-header {
  padding: 18px 20px;
  border-bottom: 1.5px solid var(--border);
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-section-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.portal-section-body { padding: 20px; }

/* ============================================================
   Forms (portal forms)
   ============================================================ */
.portal-form-field { margin-bottom: 16px; }
.portal-form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.portal-form-field input[type="text"],
.portal-form-field input[type="email"],
.portal-form-field input[type="date"],
.portal-form-field input[type="number"],
.portal-form-field select,
.portal-form-field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.portal-form-field input:focus,
.portal-form-field select:focus,
.portal-form-field textarea:focus { border-color: var(--ink); }
.portal-form-field textarea { resize: vertical; min-height: 100px; }
.portal-form-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.portal-form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ============================================================
   Token-expired / shared error
   ============================================================ */
.token-expired-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}
.token-expired-card {
  max-width: 400px;
  text-align: center;
}
.token-expired-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.token-expired-card p {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ============================================================
   Settings page
   ============================================================ */

/* Section cards: each settings section is a card */
.portal-section-card {
  background: var(--warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.portal-section-card--muted {
  opacity: 0.7;
}

.portal-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.portal-section-desc {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 20px;
}

/* Connection rows */
.settings-connections {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.settings-conn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.settings-conn-row:last-child {
  border-bottom: none;
}

.settings-conn-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-conn-email {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-conn-meta {
  font-size: 12px;
  color: var(--ink-3);
}

.settings-conn-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Empty state */
.settings-empty {
  font-size: 14px;
  color: var(--ink-3);
  padding: 16px 0;
  margin-bottom: 16px;
}

/* Connect buttons */
.settings-connect-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-connect-btn {
  font-size: 13px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
}

/* Notification toggle */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-toggle-info {
  flex: 1;
}

.settings-toggle-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.settings-toggle-desc {
  font-size: 13px;
  color: var(--ink-2);
}

/* Toggle switch */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.settings-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s;
}

.settings-toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}

.settings-toggle-input:checked + .settings-toggle-slider {
  background: var(--ink);
}

.settings-toggle-input:checked + .settings-toggle-slider::before {
  transform: translateX(20px);
}

/* Small danger button */
.btn--sm {
  font-size: 12px;
  padding: 5px 10px;
}

/* ============================================================
   Account detail page
   ============================================================ */

/* Section heading and spacing */
.acct-section {
  margin-bottom: 32px;
}
.acct-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 12px;
}

/* Metadata definition list */
.acct-meta {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 14px;
  max-width: 600px;
}
.acct-meta dt {
  color: var(--ink-3);
  font-weight: 500;
}
.acct-meta dd {
  color: var(--ink);
  font-weight: 500;
}

/* Signal list (section 3: what's driving this) */
.acct-signal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.acct-signal-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--warm);
  border-radius: var(--radius);
  font-size: 14px;
}
.acct-signal-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  flex-shrink: 0;
  min-width: 100px;
  padding-top: 2px;
}
.acct-signal-content {
  flex: 1;
  color: var(--ink);
  line-height: 1.5;
}
.acct-signal-date {
  font-size: 12px;
  color: var(--ink-3);
  flex-shrink: 0;
}

/* Email list (section 5) */
.acct-email-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.acct-email-list li {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.acct-email-list li:last-child { border-bottom: none; }

/* Note list (sections 6, 7) */
.acct-note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.acct-note-list li {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.acct-note-list li:last-child { border-bottom: none; }

/* Alert list (section 9) */
.acct-alert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.acct-alert-list li {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.acct-alert-list li:last-child { border-bottom: none; }

/* Empty state */
.acct-empty {
  font-size: 14px;
  color: var(--ink-3);
  padding: 12px 0;
}

/* Inline note/promise form panel */
.acct-form-panel {
  background: var(--warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* Settings section and field (used in new account form) */
.settings-section {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--warm);
  margin-bottom: 20px;
}
.settings-field {
  margin-bottom: 16px;
}
.settings-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings-field input[type="text"],
.settings-field input[type="email"],
.settings-field input[type="password"],
.settings-field input[type="date"],
.settings-field input[type="number"],
.settings-field select,
.settings-field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus { border-color: var(--ink); }
.settings-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}
.field-error {
  display: block;
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }
.mt-0  { margin-top: 0; }
.mt-4  { margin-top: 4px; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4  { margin-bottom: 4px; }
.mb-6  { margin-bottom: 6px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.pt-16 { padding-top: 16px; }
.ml-6  { margin-left: 6px; }
.mv-16 { margin-top: 16px; margin-bottom: 16px; }
.text-muted { color: var(--ink-3); font-size: 13px; }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 12px; }
.font-mono  { font-family: var(--mono); }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Small label and mono variants used in step form */
.label-sm  { font-size: 11px; font-weight: 700; color: var(--ink-2); font-family: var(--sans); }
.mono-sm   { font-size: 11px; font-family: var(--mono); color: var(--ink-3); }
.code-inline {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--warm);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink-2);
}

/* Form footer bar */
.form-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  border-top: 1.5px solid var(--border);
  margin-top: 20px;
}

/* ============================================================
   Manager view: stat cards
   ============================================================ */
.portal-stat-card {
  background: var(--warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.portal-stat-card--link {
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.portal-stat-card--link:hover {
  background: var(--bg);
}
.portal-stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 4px;
}
.portal-stat-label {
  font-size: 13px;
  color: var(--ink-3);
}

/* ============================================================
   Settings: labels, inputs, radio rows, data blocks
   ============================================================ */
.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.settings-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.settings-input:focus { border-color: var(--ink); }

.settings-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.settings-radio-row:hover { border-color: var(--ink-3); }
.settings-radio-row--selected {
  border-color: var(--ink);
  background: var(--warm);
}
.settings-radio-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.settings-radio-desc {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* Settings data/privacy blocks (section 6) */
.settings-data-block {
  padding: 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.settings-data-block:first-of-type { border-top: none; }
.settings-data-block--danger .settings-data-label { color: var(--red); }
.settings-data-info { flex: 1; min-width: 220px; }
.settings-data-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.settings-data-desc {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ============================================================
   Audit trail: event type chip
   ============================================================ */
.audit-event-type {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--warm);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* ============================================================
   Dashboard: connection health strip
   ============================================================ */
.dash-connections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
}

.dash-conn-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-right: 1px solid var(--border);
  text-decoration: none;
  background: var(--bg);
  transition: background 0.1s;
}
.dash-conn-item:last-child { border-right: none; }
.dash-conn-item:hover { background: var(--warm-1); opacity: 1; }

.dash-conn-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.dash-conn-icon--ok   { background: #E8F5E9; color: var(--green); }
.dash-conn-icon--warn { background: #FFF8E1; color: var(--amber); }
.dash-conn-icon--off  { background: var(--warm-2); color: var(--ink-3); }

.dash-conn-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 2px;
}
.dash-conn-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.dash-conn-status--ok   { color: var(--green); }
.dash-conn-status--warn { color: var(--amber); }
.dash-conn-status--off  { color: var(--ink-3); }

/* ============================================================
   Dashboard: setup checklist
   ============================================================ */
.setup-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.setup-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setup-item:last-child { border-bottom: none; }

.setup-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
}
.setup-num--done {
  background: #E8F5E9;
  color: var(--green);
}
.setup-num--next {
  background: var(--ink);
  color: var(--bg);
}
.setup-num--todo {
  background: var(--warm-2);
  color: var(--ink-3);
  border: 1.5px solid var(--border);
}

.setup-text {
  flex: 1;
  min-width: 0;
}
.setup-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1px;
}
.setup-title--done {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}
.setup-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.4;
}
.setup-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================
   Dashboard: sends usage bar
   ============================================================ */
.sends-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.sends-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.sends-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--ink);
  transition: width 0.4s ease;
}
.sends-bar-fill--warn { background: var(--amber); }
.sends-bar-fill--crit { background: var(--red); }
.sends-bar-pct {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--ink-3);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* ============================================================
   Integration cards (Settings page)
   ============================================================ */
.integration-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--bg);
}
.integration-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--warm-1);
}
.integration-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.integration-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.integration-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.integration-card-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}
.integration-card-body {
  padding: 16px 24px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ============================================================
   Sequence step builder: card, timing, step types, editor layout
   ============================================================ */

/* Generic card (used by step form) */
.card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
}
.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body {
  padding: 18px;
}

/* Utility spacing used in step form */
.mb-8  { margin-bottom: 8px; }
.mt-12 { margin-top: 12px; }
.ml-6  { margin-left: 6px; }
.mv-16 { margin-top: 16px; margin-bottom: 16px; }

/* Label caps: section labels in MONO/UPPERCASE */
.label-caps {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

/* Step type selector grid */
.step-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.step-type-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
  text-align: left;
}
.step-type-btn:hover { border-color: var(--ink-3); background: var(--warm); }
.step-type-btn.selected { border-color: var(--ink); background: var(--warm); }
.step-type-btn-icon { font-size: 20px; flex-shrink: 0; }
.step-type-btn-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.step-type-btn-sub   { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* Timing row: "Wait X days Y hours (business/calendar)" */
.timing-delay-row,
.send-window-row,
.send-days-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.timing-label {
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* Inline inputs inside timing rows */
.input--inline {
  width: 64px;
  padding: 6px 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.12s;
  text-align: center;
}
.input--inline:focus { border-color: var(--ink); }

/* Generic input class (full-width) */
.input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.12s;
}
.input:focus { border-color: var(--ink); }
.input::placeholder { color: var(--ink-3); }

/* Textarea class */
.textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.12s;
  resize: vertical;
  min-height: 180px;
  line-height: 1.6;
}
.textarea:focus { border-color: var(--ink); }
.textarea::placeholder { color: var(--ink-3); }

/* Generic select class */
.select {
  display: block;
  width: 100%;
  padding: 9px 32px 9px 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238A8478'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  appearance: none;
  transition: border-color 0.12s;
  cursor: pointer;
}
.select:focus { border-color: var(--ink); }

/* Inline select (inside timing rows, auto width) */
.select--inline {
  display: inline-block;
  width: auto;
  min-width: 100px;
  padding: 6px 28px 6px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238A8478'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  appearance: none;
  transition: border-color 0.12s;
  cursor: pointer;
}
.select--inline:focus { border-color: var(--ink); }

/* Day pills (send days picker) */
.day-pill {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--sans);
  background: var(--warm);
  color: var(--ink-3);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
}
.day-pill:hover { border-color: var(--ink-3); color: var(--ink); }
.day-pill.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Hint text */
.hint {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}

/* Badge (inline) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge--amber { background: #FEF3C7; color: #92400E; }
.badge--green { background: #DCFCE7; color: #166534; }
.badge--red   { background: #FEE2E2; color: #991B1B; }
.badge--ink   { background: var(--ink); color: var(--bg); }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
}

/* Two-column step editor layout */
.step-editor-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1100px) {
  .step-editor-cols {
    grid-template-columns: 1fr 380px;
    align-items: start;
  }
}

/* Field wrapper */
.field {
  margin-bottom: 16px;
}
.field label,
.field .label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 5px;
}

/* Token bar (personalization tokens) */
.token-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.token-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  background: var(--warm);
  color: var(--ink-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s;
  user-select: none;
}
.token-pill:hover { background: var(--border); }

/* Live preview panel */
.step-preview-panel {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  position: sticky;
  top: 20px;
}
.step-preview-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.step-preview-email {
  padding: 16px;
  font-size: 13px;
  min-height: 200px;
}
.step-preview-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.step-preview-subject {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.step-preview-body {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Template picker panel */
.template-picker {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 16px;
}
.template-picker-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-family: var(--mono);
}
.template-list {
  max-height: 320px;
  overflow-y: auto;
}
.template-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s;
}
.template-item:last-child { border-bottom: none; }
.template-item:hover { background: var(--warm); }
.template-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.template-item-cat {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  text-transform: capitalize;
}

/* Condition section */
.condition-details summary { list-style: none; }
.condition-details summary::-webkit-details-marker { display: none; }

/* AB test section */
.ab-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

/* ============================================================
   Sequence show: visual timeline + arrival estimate
   ============================================================ */

/* Timeline layout */
.seq-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .seq-layout { grid-template-columns: 1fr; }
}

/* Timeline spine */
.seq-timeline {
  position: relative;
}
.seq-timeline-spine {
  position: absolute;
  left: 19px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: var(--border);
  z-index: 0;
}

/* Individual step node */
.seq-node {
  position: relative;
  display: flex;
  gap: 16px;
  margin-bottom: 0;
}
.seq-node-dot {
  width: 38px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 1;
}
.seq-node-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border);
}
.seq-node-num--wait { background: var(--warm); color: var(--ink-3); }
.seq-node-num--task { background: #F0F0FF; color: #3730A3; }

/* Step card body */
.seq-node-card {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 0;
  transition: border-color 0.1s;
}
.seq-node-card:hover { border-color: var(--ink-3); }

.seq-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
  gap: 10px;
}
.seq-node-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seq-node-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.seq-node-body {
  padding: 14px 16px;
}

/* Delay connector between nodes */
.seq-delay {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 8px 54px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.seq-delay-arrow {
  font-size: 14px;
  color: var(--border-2, var(--border));
}

/* Step stats mini-grid */
.seq-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 12px;
}
.seq-stat {
  background: var(--bg);
  padding: 10px 12px;
}
.seq-stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.seq-stat-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.seq-stat-value--green { color: var(--green); }

/* Arrival estimate table */
.seq-est {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 28px;
}
.seq-est-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.seq-est-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.seq-est-from {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--mono);
}
.seq-est-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.seq-est-table th {
  text-align: left;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
}
.seq-est-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
}
.seq-est-table tbody tr:last-child td { border-bottom: none; }
.seq-est-table tbody tr:hover { background: var(--warm); }
.seq-est-subject { font-weight: 600; color: var(--ink); }
.seq-est-time    { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.seq-est-empty   { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* Sidebar stat block (enrollment counts) */
.seq-sidebar-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.seq-sidebar-stat {
  background: var(--bg);
  padding: 16px 18px;
  transition: background 0.08s;
}
.seq-sidebar-stat:hover { background: var(--warm); }
.seq-sidebar-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 6px;
}
.seq-sidebar-stat-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.seq-sidebar-stat-value--green { color: var(--green); }

/* Sequence settings mini-card */
.seq-settings-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 16px;
}
.seq-settings-card-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
}
.seq-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
}
.seq-settings-row:last-child { border-bottom: none; }
.seq-settings-val {
  font-weight: 600;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

/* ============================================================
   Setup wizard
   ============================================================ */

/* Thin progress bar pinned below nav — track is transparent so it does not
   double up with the nav border-bottom */
.setup-progress-bar {
  position: fixed;
  top: 57.5px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 90;
}
.setup-progress-bar-fill {
  height: 100%;
  background: var(--ink);
  transition: width 0.4s ease;
}
