/* ============================================================
   Investment-D  ·  Attio / Instantly Design System  ·  v3
   Pure CSS — no framework. Spreadsheet-CRM hybrid aesthetic.
   ============================================================ */

[x-cloak] { display: none !important; }

/* ─── Design Tokens ─── */
:root {
  --brand:        #4F46E5;
  --brand-light:  #EEF2FF;
  --brand-lighter: #F5F7FF;
  --brand-dark:   #4338CA;
  --brand-text:   #4F46E5;

  --bg-app:       #f8f9fa;
  --bg-surface:   #ffffff;
  --bg-muted:     #f3f4f6;
  --bg-hover:     #f9fafb;
  --bg-active:    #EEF2FF;
  --bg-subtle:    #FAFAFA;

  --border:       #E5E7EB;
  --border-strong: #D1D5DB;
  --border-subtle: #F3F4F6;

  --text-primary:    #111827;
  --text-secondary:  #6B7280;
  --text-tertiary:   #9CA3AF;
  --text-muted:      #9CA3AF;
  --text-placeholder: #9CA3AF;
  --text-disabled:   #D1D5DB;

  --green:        #059669;
  --green-bg:     #ECFDF5;
  --green-border: #A7F3D0;
  --amber:        #D97706;
  --amber-bg:     #FFFBEB;
  --amber-border: #FDE68A;
  --red:          #DC2626;
  --red-bg:       #FEF2F2;
  --red-border:   #FECACA;
  --rose:         #E11D48;
  --rose-bg:      #FFF1F2;
  --rose-border:  #FECDD3;
  --blue:         #4F46E5;
  --blue-bg:      #EEF2FF;
  --blue-border:  #C7D2FE;
  --slate:        #64748B;
  --slate-bg:     #F1F5F9;
  --slate-border: #CBD5E1;

  --success:     #12B76A;
  --success-bg:  #ECFDF5;
  --info:        #2563EB;
  --info-bg:     #EFF6FF;
  --danger:      #DC2626;
  --warning:     #D97706;

  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius:      8px;
  --radius-md:   10px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  --shadow-xs:   0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.03);
  --transition-fast: 120ms cubic-bezier(.4,0,.2,1);
  --transition-base: 200ms cubic-bezier(.4,0,.2,1);
  --transition-smooth: 300ms cubic-bezier(.4,0,.2,1);
  --transition-spring: 400ms cubic-bezier(.175,.885,.32,1.275);

  --sidebar-w:   240px;
  --topbar-h:    48px;
  --font:        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-app);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }
h1,h2,h3,h4,h5,h6 { color: var(--text-primary); font-weight: 600; line-height: 1.25; }
strong { font-weight: 600; }
p { margin: 0; }

/* ============================================================
   APP SHELL — CSS Grid: sidebar | (topbar + body)
   ============================================================ */
.app-body { min-height: 100vh; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.app-shell__wrapper {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.app-shell__body {
  flex: 1;
  padding: 0;
  background: var(--bg-app);
}

.app-shell__container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 32px 160px;
  width: 100%;
}

.app-shell__content {
  display: grid;
  gap: 24px;
}

/* ============================================================
   SIDEBAR — White, border-right, 220px
   ============================================================ */
/* ── Sidebar ── */
.app-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  width: var(--sidebar-w);
  overflow: hidden;
  z-index: 40;
}

.app-sidebar__header {
  flex-shrink: 0;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.app-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.app-sidebar__logo-mark {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.app-sidebar__logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ── Nav ── */
.app-sidebar__nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}
.app-sidebar__nav::-webkit-scrollbar { width: 0; }

.app-sidebar__nav-group {
  padding: 0 8px;
}
.app-sidebar__nav-group + .app-sidebar__nav-group { margin-top: 2px; }

.app-sidebar__nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 10px 5px;
}

.app-sidebar__nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.app-sidebar__nav-item { margin: 1px 0; }

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: 1;
}

.app-sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.app-sidebar__link--active {
  background: var(--bg-active);
  color: var(--brand);
  font-weight: 500;
}

.app-sidebar__icon {
  width: 18px;
  height: 18px;
  font-size: 17px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.app-sidebar__link:hover .app-sidebar__icon { color: var(--text-secondary); }
.app-sidebar__link--active .app-sidebar__icon { color: var(--brand); }

.app-sidebar__link-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer ── */
.app-sidebar__footer {
  flex-shrink: 0;
  padding: 10px 8px 14px;
  border-top: 1px solid var(--border);
}

.app-sidebar__lang-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.app-sidebar__lang-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}


/* ============================================================
   TOPBAR — 48px, border-bottom, breadcrumb style
   ============================================================ */
.app-topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
}

.app-topbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--text-secondary);
  margin-right: 8px;
}
.app-topbar__toggle:hover { background: var(--bg-muted); color: var(--text-primary); }
@media (max-width: 1199px) {
  .app-topbar__toggle { display: flex; }
}

.app-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 24px;
  gap: 16px;
}

.app-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-topbar__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar__title-dim {
  color: var(--text-tertiary);
  font-weight: 400;
}

.app-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.app-topbar__lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 120ms, color 120ms;
}
.app-topbar__lang:hover { border-color: var(--border-strong); color: var(--text-secondary); }

/* Topbar search */
.app-topbar__center { flex: 1; max-width: 400px; margin: 0 auto; }
.app-topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 120ms, box-shadow 120ms;
}
.app-topbar__search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
  background: var(--bg-surface);
}
.app-topbar__search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}
.app-topbar__search-input::placeholder { color: var(--text-placeholder); }
.app-topbar__search-kbd {
  font-size: 10px;
  font-family: var(--font);
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Breadcrumb segments */
.app-topbar__breadcrumb-sep { color: var(--text-tertiary); font-weight: 400; margin: 0 2px; }
.app-topbar__breadcrumb-seg { color: var(--text-secondary); font-weight: 400; }
.app-topbar__breadcrumb-seg--current { color: var(--text-primary); font-weight: 600; }

/* Legacy hidden topbar */
.app-language-toggle,
.app-topbar__search-placeholder,
.app-topbar__search-icon,
.app-topbar__search-text { display: none; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.app-page { min-height: 0; }
.app-page-header {
  padding: 0 0 20px;
}

.app-page-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-pretitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.subheader {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-page-header__desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 600px;
}

.app-page-header__kpis {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.app-kpi {
  text-align: right;
}

.app-kpi__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-kpi__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ============================================================
   CARDS — Nearly invisible, subtle border only
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.card-body {
  padding: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
}

/* ============================================================
   TABLES — The hero element. Clean, spreadsheet feel.
   ============================================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
  white-space: nowrap;
  text-align: left;
  position: sticky;
  top: 0;
}

.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover {
  background: var(--bg-hover);
}

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

.table-vcenter td,
.table-vcenter th {
  vertical-align: middle;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
  line-height: 1.4;
  cursor: pointer;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(79,70,229,0.2);
}
.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: 0 2px 4px rgba(79,70,229,0.25);
  transform: translateY(-0.5px);
}

.btn-outline-primary {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline-primary:hover {
  background: var(--brand-light);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}

.btn-outline-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-outline-danger:hover {
  background: var(--red-bg);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 120ms;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-control::placeholder { color: var(--text-placeholder); }

.form-select {
  display: block;
  width: 100%;
  padding: 7px 32px 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  appearance: none;
  transition: border-color 120ms;
}
.form-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-full);
  line-height: 1.5;
  white-space: nowrap;
}

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

.bg-warning-lt {
  background: var(--amber-bg);
  color: var(--amber);
}

.bg-red-lt {
  background: var(--red-bg);
  color: var(--red);
}

/* ============================================================
   PILLS — Status, Risk, Chip
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-pill--ready    { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.status-pill--blocked  { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.status-pill--draft    { background: var(--slate-bg); color: var(--slate); border-color: var(--slate-border); }
.status-pill--pending  { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.status-pill--active   { background: var(--blue-bg); color: var(--brand); border-color: var(--blue-border); }
.status-pill--frozen   { background: var(--slate-bg); color: var(--slate); border-color: var(--slate-border); }

.app-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.app-chip--green { background: var(--green-bg); color: var(--green); }
.app-chip--amber { background: var(--amber-bg); color: var(--amber); }
.app-chip--rose  { background: var(--rose-bg); color: var(--rose); }
.app-chip--blue  { background: var(--blue-bg); color: var(--brand); }
.app-chip--slate { background: var(--slate-bg); color: var(--slate); }
.app-chip--red   { background: var(--red-bg); color: var(--red); }
.app-chip--purple { background: var(--purple-bg); color: var(--purple); }

/* ============================================================
   BOOTSTRAP GRID COMPAT
   ============================================================ */
.container-xl { max-width: 1140px; margin: 0 auto; padding: 0 16px; width: 100%; }
.container-fluid { max-width: 100%; margin: 0 auto; padding: 0 16px; width: 100%; }

/* ============================================================
   DISPLAY UTILITIES
   ============================================================ */
.d-none          { display: none !important; }
.d-block         { display: block !important; }
.d-flex          { display: flex !important; }
.d-grid          { display: grid !important; }
.d-inline-flex   { display: inline-flex !important; }
.flex-wrap       { flex-wrap: wrap !important; }
.flex-column     { flex-direction: column !important; }
.flex-grow-1     { flex-grow: 1 !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-end     { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-start  { align-items: flex-start !important; }
.align-items-end    { align-items: flex-end !important; }

/* ============================================================
   SPACING UTILITIES
   ============================================================ */
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 16px !important; }
.gap-4 { gap: 24px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }

.ms-auto { margin-left: auto !important; }
.me-auto { margin-right: auto !important; }
.me-1 { margin-right: 4px !important; }
.me-2 { margin-right: 8px !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 16px !important; }
.p-4 { padding: 24px !important; }
.px-3 { padding-left: 16px !important; padding-right: 16px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }

.w-100 { width: 100% !important; }

/* ============================================================
   TEXT UTILITIES
   ============================================================ */
.text-secondary { color: var(--text-secondary) !important; }
.text-danger    { color: var(--red) !important; }
.text-success   { color: var(--green) !important; }
.text-warning   { color: var(--amber) !important; }
.text-muted     { color: var(--text-tertiary) !important; }
.text-end       { text-align: right !important; }
.text-start     { text-align: left !important; }
.text-center    { text-align: center !important; }
.text-break     { word-break: break-word !important; overflow-wrap: break-word !important; }
.fw-semibold    { font-weight: 600 !important; }
.fw-bold        { font-weight: 700 !important; }
.small          { font-size: 12px !important; }
.fs-5           { font-size: 18px !important; }

/* ── Fine-grained typography utilities (extracted from inline styles) ── */
.text-xs        { font-size: 10px; }
.text-2xs       { font-size: 11px; }
.text-sm        { font-size: 12px; }
.text-base      { font-size: 13px; }
.text-tertiary  { color: var(--text-tertiary); }
.text-primary   { color: var(--text-primary) !important; }
.text-brand     { color: var(--brand); }
.text-green     { color: var(--green); }
.text-amber     { color: var(--amber); }
.text-rose      { color: var(--rose); }
.flex-1         { flex: 1; }

/* ── Common compound patterns ── */
.meta-sm        { font-size: 12px; color: var(--text-tertiary); }
.meta-xs        { font-size: 11px; color: var(--text-tertiary); }
.meta-2xs       { font-size: 10px; color: var(--text-tertiary); }
.hint-box       { padding: 8px; background: var(--bg-muted); border-radius: var(--radius-sm); }
.empty-state    { text-align: center; color: var(--text-secondary); padding: 24px; }

/* ============================================================
   NAVBAR COMPAT (legacy Tabler mapping)
   ============================================================ */
.navbar-light      { background: var(--bg-surface); }
.sticky-top        { position: sticky; top: 0; z-index: 20; }

/* ============================================================
   PAGE COMPAT (legacy Tabler mapping)
   ============================================================ */
.page:not(.app-shell) { min-height: 100vh; display: flex; flex-direction: column; }
.page-wrapper { flex: 1; display: flex; flex-direction: column; }
.page-body    { flex: 1; }
.page-header  { padding: 16px 0; }
.d-print-none { }
@media print { .d-print-none { display: none !important; } }

/* ============================================================
   DASHBOARD — #dashboard-snapshot
   ============================================================ */
#dashboard-snapshot { /* wrapper — no special styles needed */ }

/* Status Bar */
.ds-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.ds-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.ds-status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.ds-status-badge--green { background: var(--green-bg); color: var(--green); }
.ds-status-badge--amber { background: var(--amber-bg); color: var(--amber); }
.ds-status-badge--red   { background: var(--red-bg); color: var(--red); }
.ds-status-badge--rose  { background: var(--rose-bg); color: var(--rose); }
.ds-status-badge--blue  { background: var(--blue-bg); color: var(--brand); }
.ds-status-badge--slate { background: var(--slate-bg); color: var(--slate); }

/* Metrics */
.ds-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  gap: 12px;
}

/* Mobile responsive — override inline grid-template-columns from dashboard */
@media (max-width: 768px) {
  .ds-metrics {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 480px) {
  .ds-metrics {
    grid-template-columns: 1fr !important;
  }
}

.ds-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
.ds-metric-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.ds-metric-card__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.ds-metric-card__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Hero Card */
.dashboard-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.dashboard-hero-card__backdrop { display: none; }

/* Command Header */
.ds-command-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ds-command-header__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ds-command-header__action {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.ds-command-header__desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.ds-command-header__stats {
  display: flex;
  gap: 16px;
}

/* Pipeline Stages */
.ds-pipeline-stages {
  display: flex;
  gap: 2px;
}

.ds-pipeline-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}
.ds-pipeline-stage:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.ds-pipeline-stage:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.ds-pipeline-stage__num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.ds-pipeline-stage__content {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Candidate Bar */
.ds-candidate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ds-candidate-bar__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.ds-candidate-bar__meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Main Layout (2-column) */
.ds-main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

.ds-main-col { min-width: 0; }
.ds-side-col { min-width: 0; }

/* Empty State — see enhanced version below */

/* Activity Feed */
.ds-activity-feed {
  display: flex;
  flex-direction: column;
}

.ds-activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.ds-activity-item:last-child { border-bottom: none; }

.ds-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  margin-top: 5px;
}

.ds-activity-msg {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.ds-activity-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Health Row */
.ds-health-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.ds-health-row__label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
}

.ds-health-row__bar {
  flex: 1;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.ds-health-row__bar > div {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand);
}

.ds-health-row__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* Expandable */
.ds-expandable {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ds-expandable__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 120ms;
}
.ds-expandable__header:hover { background: var(--bg-hover); }

.ds-expandable__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ds-expandable__subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 8px;
}

.ds-expandable__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-expandable__toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: transform 200ms;
}

.ds-expandable__body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

/* Stat Block */
.ds-stat-block {
  padding: 12px 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
}
.ds-stat-block--accent {
  background: var(--brand-light);
  border-left: 3px solid var(--brand);
}

/* Candidate Card */
.ds-candidate-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* 2-col grid */
.ds-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ds-col { min-width: 0; }

/* List items */
.ds-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.ds-list-item:last-child { border-bottom: none; }

.ds-list-item__meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ds-list-item__badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.ds-list-item__time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.ds-list-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Card header variants */
.ds-card-header--amber {
  background: var(--amber-bg);
  border-bottom-color: var(--amber-border);
}

.ds-card-header--green {
  background: var(--green-bg);
  border-bottom-color: var(--green-border);
}

.ds-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* Info grid / Health grid / KPI row */
.ds-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.ds-health-grid {
  display: grid;
  gap: 8px;
}

.ds-kpi-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.ds-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Domain-specific rows */
.ds-market-row,
.ds-conflict-row,
.ds-assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ds-market-row:last-child,
.ds-conflict-row:last-child,
.ds-assignment-row:last-child { border-bottom: none; }

/* Queue Item */
.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms;
  font-size: 13px;
}
.queue-item:hover { background: var(--bg-hover); }
.queue-item:last-child { border-bottom: none; }

.queue-item--selected {
  background: var(--bg-active);
  border-left: 2px solid var(--brand);
}

/* ============================================================
   NEW MODULE COMPONENTS (Accounts, Warmup, Sequences, etc.)
   ============================================================ */

/* Health bar — inline colored meter */
.ds-health-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.ds-health-meter__bar {
  flex: 1;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.ds-health-meter__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}
.ds-health-meter__fill--green { background: var(--green); }
.ds-health-meter__fill--amber { background: var(--amber); }
.ds-health-meter__fill--rose  { background: var(--red); }
.ds-health-meter__value {
  font-size: 12px;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
}

/* Classification chips — for unibox */
.ds-class-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.ds-class-chip--interested    { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.ds-class-chip--not_interested { background: var(--rose-bg); color: var(--rose); border: 1px solid var(--rose-border); }
.ds-class-chip--out_of_office { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.ds-class-chip--bounced       { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.ds-class-chip--auto_reply    { background: var(--slate-bg); color: var(--slate); border: 1px solid var(--slate-border); }

/* Funnel bar — horizontal step visualization */
.ds-funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
}
.ds-funnel__step {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ds-funnel__label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 120px;
  text-align: right;
}
.ds-funnel__bar-wrapper {
  flex: 1;
  height: 24px;
  background: var(--bg-muted);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.ds-funnel__bar {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-xs);
  transition: width 400ms ease;
  min-width: 2px;
}
.ds-funnel__value {
  font-size: 13px;
  font-weight: 600;
  min-width: 40px;
}

/* Unibox message list */
.ds-message-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ds-message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms;
}
.ds-message-row:last-child { border-bottom: none; }
.ds-message-row:hover { background: var(--bg-hover); }
.ds-message-row--active { background: var(--brand-light); }
.ds-message-row--unread .ds-message-row__subject { font-weight: 600; color: var(--text-primary); }
.ds-message-row__main { flex: 1; min-width: 0; }
.ds-message-row__from { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.ds-message-row__subject { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-message-row__preview { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ds-message-row__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ds-message-row__time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* Message detail panel */
.ds-message-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
}
.ds-message-detail__header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.ds-message-detail__subject {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.ds-message-detail__meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ds-message-detail__body {
  padding: 16px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
}
.ds-message-detail__actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* Sequence timeline */
.ds-seq-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 0;
}
.ds-seq-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}
.ds-seq-step:last-child { padding-bottom: 0; }
.ds-seq-step::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.ds-seq-step:last-child::before { display: none; }
.ds-seq-step__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  z-index: 1;
}
.ds-seq-step__icon--email { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }
.ds-seq-step__icon--task  { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.ds-seq-step__icon--condition { background: var(--slate-bg); color: var(--slate); border: 1px solid var(--slate-border); }
.ds-seq-step__content { flex: 1; }
.ds-seq-step__title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.ds-seq-step__meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* Filter tabs */
.ds-filter-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.ds-filter-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 100ms;
}
.ds-filter-tab:hover { color: var(--text-primary); }
.ds-filter-tab--active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* KPI large card */
.ds-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.ds-kpi-card__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.ds-kpi-card__label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.ds-kpi-card__sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* KPI row — 4-up layout */
.ds-kpi-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 767px) {
  .ds-kpi-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Two-column inbox layout */
.ds-inbox-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}
@media (max-width: 1199px) {
  .ds-inbox-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   ACTION BAR
   ============================================================ */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

/* ============================================================
   ENHANCED EMPTY STATES
   ============================================================ */
.ds-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
  font-size: 13px;
}
.ds-empty-state i {
  font-size: 36px;
  display: block;
  margin-bottom: 10px;
  color: var(--border-strong);
}
.ds-empty-state__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ds-empty-state__desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
.ds-empty-state .btn {
  margin-top: 4px;
}

/* ============================================================
   CHART ENHANCEMENTS — bars, sparklines, funnels
   ============================================================ */

/* CSS-only mini sparkline for dashboard KPI cards */
.ds-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  margin-top: 8px;
}
.ds-sparkline__bar {
  flex: 1;
  min-width: 3px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
  opacity: 0.5;
  transition: opacity var(--transition-base), height 300ms ease;
}
.ds-sparkline__bar:last-child {
  opacity: 0.9;
}
.ds-sparkline__bar:hover {
  opacity: 1;
}

/* Daily chart bar with tooltips */
.ds-chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: default;
}
.ds-chart-bar__sent {
  width: 60%;
  min-width: 16px;
  max-width: 36px;
  background: var(--brand);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  opacity: 0.75;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.ds-chart-bar__replied {
  width: 60%;
  min-width: 16px;
  max-width: 36px;
  background: var(--green);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  opacity: 0.75;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.ds-chart-bar:hover .ds-chart-bar__sent,
.ds-chart-bar:hover .ds-chart-bar__replied {
  opacity: 1;
  transform: scaleY(1.04);
  transform-origin: bottom;
}
.ds-chart-bar__label {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 6px;
  white-space: nowrap;
}
.ds-chart-bar__value {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.ds-chart-bar:hover .ds-chart-bar__value {
  opacity: 1;
  color: var(--text-primary);
  font-weight: 600;
}

/* Tooltip for chart bars */
.ds-chart-bar__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 10;
}
.ds-chart-bar:hover .ds-chart-bar__tooltip {
  opacity: 1;
}

/* Funnel step with arrow */
.ds-funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}
.ds-funnel-step + .ds-funnel-step::before {
  content: "";
  position: absolute;
  left: 55px;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--border-strong);
}
.ds-funnel-step__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.ds-funnel-step__label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 120px;
  text-align: right;
  flex-shrink: 0;
}
.ds-funnel-step__bar-wrapper {
  flex: 1;
  height: 32px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.ds-funnel-step__bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 600ms ease;
  min-width: 2px;
  display: flex;
  align-items: center;
  padding-left: 10px;
}
.ds-funnel-step__count {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ds-funnel-step__pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 48px;
  text-align: right;
  flex-shrink: 0;
}

/* Funnel color progression */
.ds-funnel-step:nth-child(1) .ds-funnel-step__bar { background: var(--brand); }
.ds-funnel-step:nth-child(2) .ds-funnel-step__bar { background: #6366F1; }
.ds-funnel-step:nth-child(3) .ds-funnel-step__bar { background: #818CF8; }
.ds-funnel-step:nth-child(4) .ds-funnel-step__bar { background: #10B981; }
.ds-funnel-step:nth-child(5) .ds-funnel-step__bar { background: #059669; }
.ds-funnel-step:nth-child(6) .ds-funnel-step__bar { background: #047857; }

/* ============================================================
   TABLE ENHANCEMENTS
   ============================================================ */

/* App table — alias for consistent usage */
.app-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.app-table thead th {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-muted); white-space: nowrap;
}
.app-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); vertical-align: middle;
}
.app-table tbody tr { transition: background var(--transition-fast); }
.app-table tbody tr:hover { background: var(--bg-hover); }
.app-table tbody tr:last-child td { border-bottom: none; }

/* Sequence/Account table mini progress bar */
.ds-mini-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.ds-mini-bar__track {
  flex: 1;
  height: 4px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.ds-mini-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}
.ds-mini-bar__value {
  font-size: 12px;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
}

/* ============================================================
   ALERT / NOTIFICATION BAR
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.alert-info {
  background: var(--blue-bg);
  color: var(--brand);
  border: 1px solid var(--blue-border);
}
.alert-warning {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}
.alert-danger {
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

/* ============================================================
   BUTTON OUTLINE WARNING
   ============================================================ */
.btn-outline-warning {
  background: transparent;
  color: var(--amber);
  border-color: var(--amber);
}
.btn-outline-warning:hover {
  background: var(--amber-bg);
}

/* ============================================================
   RESPONSIVE — dashboard 2-col and unibox
   ============================================================ */
@media (max-width: 1199px) {
  .app-page--dashboard > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }
  .app-page--unibox > div:last-of-type {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 767px) {
  .ds-funnel-step__label {
    min-width: 80px;
    font-size: 12px;
  }
}

/* ============================================================
   ANIMATION
   ============================================================ */
.is-fresh {
  animation: fresh-pulse 250ms ease-out;
}

@keyframes fresh-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79,70,229,0.2); }
  100% { box-shadow: 0 0 0 6px transparent; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet — collapse sidebar */
@media (max-width: 1199px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    left: -280px;
    width: 280px;
    transition: left 200ms ease;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
  }
  .app-sidebar.is-open {
    left: 0;
  }
  .app-sidebar.is-open .app-sidebar__backdrop {
    display: block;
  }
  .app-sidebar__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: -1;
  }

  .ds-main-layout {
    grid-template-columns: 1fr;
  }

  .ds-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Narrow tablet */
@media (max-width: 767px) {
  .app-shell__container {
    padding: 16px;
  }

  .app-page-header__row {
    flex-direction: column;
  }

  .app-page-header__kpis {
    flex-direction: row;
    gap: 16px;
  }
  .app-kpi { text-align: left; }

  .ds-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .ds-pipeline-stages {
    flex-direction: column;
  }
  .ds-pipeline-stage:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .ds-pipeline-stage:last-child  { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

  .ds-command-header {
    flex-direction: column;
  }
}

/* Phone */
@media (max-width: 575px) {
  html { font-size: 13px; }

  .app-shell__container {
    padding: 12px;
  }

  .app-topbar__inner {
    padding: 0 12px;
  }

  .ds-metrics {
    grid-template-columns: 1fr;
  }

  .ds-info-grid {
    grid-template-columns: 1fr;
  }

}

/* ============================================================
   SCROLLBAR — Attio-style thin, subtle
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Selection color */
::selection { background: rgba(79,70,229,0.15); color: var(--text-primary); }

/* Focus ring — Attio-style brand glow */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Code blocks */
code {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .app-sidebar,
  .app-topbar { display: none; }

  .app-shell { grid-template-columns: 1fr; }

  .app-shell__container { padding: 0; max-width: 100%; }
}

/* ============================================================
   ANIMATIONS & TRANSITIONS — Silky smooth interactions
   ============================================================ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); max-height: 120px; }
  to   { opacity: 0; transform: translateY(-8px); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(79,70,229,0); }
}
@keyframes barGrow {
  from { width: 0%; }
}
@keyframes countUp {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.card {
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth), border-color var(--transition-smooth);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.ds-metric-card {
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
  animation: fadeInUp 0.4s ease both;
}
.ds-metric-card:nth-child(1) { animation-delay: 0s; }
.ds-metric-card:nth-child(2) { animation-delay: 0.05s; }
.ds-metric-card:nth-child(3) { animation-delay: 0.1s; }
.ds-metric-card:nth-child(4) { animation-delay: 0.15s; }
.ds-metric-card:nth-child(5) { animation-delay: 0.2s; }
.ds-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.ds-metric-card__value {
  animation: countUp 0.5s var(--transition-spring) both;
}

.btn {
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.app-chip {
  transition: all var(--transition-fast);
}
.app-chip:hover {
  filter: brightness(0.95);
}

.app-sidebar__link {
  transition: all var(--transition-base);
}
.app-sidebar__link:hover {
  transform: translateX(2px);
}

.ds-mini-bar__fill {
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
  animation: barGrow 0.8s ease both;
}

table tbody tr {
  transition: background var(--transition-fast);
}
table tbody tr:hover {
  background: var(--bg-hover);
}

.notif-item {
  transition: all var(--transition-smooth);
  animation: fadeInUp 0.3s ease both;
}
.notif-item--dismissing {
  animation: fadeOut 0.35s ease forwards;
  pointer-events: none;
}
.notif-item:hover {
  background: var(--bg-hover);
}

.app-shell__container > * {
  animation: fadeInUp 0.3s ease both;
}

.ds-sparkline__bar {
  transition: height 0.6s cubic-bezier(.4,0,.2,1);
}

.ds-empty-state {
  animation: fadeInUp 0.5s ease both;
}

input, select, textarea {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.badge-pulse {
  animation: pulseGlow 2s infinite;
}

/* ── Bootstrap-compat badge colors ── */
.bg-success { background-color: var(--success) !important; color: #fff; }
.bg-danger { background-color: var(--danger) !important; color: #fff; }
.bg-warning { background-color: var(--warning) !important; color: #000; }
.bg-primary { background-color: var(--brand) !important; color: #fff; }
.bg-secondary { background-color: var(--text-muted) !important; color: #fff; }
.bg-info { background-color: #2e90fa !important; color: #fff; }

/* ── Bootstrap-compat button variants ── */
.btn-success { background: var(--success); color: #fff; border: 1px solid var(--success); }
.btn-success:hover { background: #0fa968; }
.btn-outline-success { background: transparent; color: var(--success); border: 1px solid var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-info { background: transparent; color: #2e90fa; border: 1px solid #2e90fa; }
.btn-outline-info:hover { background: #2e90fa; color: #fff; }

/* ── Disabled button state ── */
.btn:disabled, .btn[disabled], .btn.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

/* ── Bootstrap-compat form components ── */
.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control, .input-group .form-select {
  flex: 1 1 auto;
  border-radius: 0;
}
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group-text {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.form-check-input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.form-check-label {
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.form-control-sm, .form-select-sm {
  padding: 4px 8px;
  font-size: 13px;
  min-height: 32px;
}

.form-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-table {
  width: 100%;
  margin: 0;
}
.card-table thead th {
  background: var(--bg-subtle);
}

/* ── Page header left section ── */
.app-page-header__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Accessibility: prefers-reduced-motion ── */
/* ── Spin animation (used by form loading states) ── */
.spin, .ti-spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Notification badge (extracted from inline) ── */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--rose);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  transition: all var(--transition-smooth);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Dark Mode ─── */
@media (prefers-color-scheme: dark) {
  :root {
    --brand:        #818CF8;
    --brand-light:  #1E1B4B;
    --brand-lighter: #1a1c2e;
    --brand-dark:   #A5B4FC;
    --brand-text:   #A5B4FC;

    --bg-app:       #0f1117;
    --bg-surface:   #1a1d2e;
    --bg-muted:     #1f2233;
    --bg-hover:     #252839;
    --bg-active:    #1E1B4B;

    --border:       #2d3148;
    --border-strong: #3d4260;

    --text-primary:    #E2E8F0;
    --text-secondary:  #94A3B8;
    --text-tertiary:   #64748B;
    --text-placeholder: #475569;
    --text-disabled:   #334155;

    --green:        #34D399;
    --green-bg:     #064E3B;
    --green-border: #065F46;
    --amber:        #FBBF24;
    --amber-bg:     #451A03;
    --amber-border: #78350F;
    --red:          #F87171;
    --red-bg:       #450A0A;
    --red-border:   #7F1D1D;
    --rose:         #FB7185;
    --rose-bg:      #4C0519;
    --rose-border:  #881337;
    --blue:         #818CF8;
    --blue-bg:      #1E1B4B;
    --blue-border:  #312E81;
    --slate:        #94A3B8;
    --slate-bg:     #1E293B;
    --slate-border: #334155;

    --shadow-xs:   0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:   0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  }

  .app-sidebar {
    background: #12141f;
    border-color: var(--border);
  }

  .app-topbar {
    background: var(--bg-surface);
    border-color: var(--border);
  }

  .app-topbar__search-input {
    background: var(--bg-muted);
    border-color: var(--border);
    color: var(--text-primary);
  }

  .btn--outline { border-color: var(--border); color: var(--text-secondary); }
  .btn--outline:hover { background: var(--bg-hover); border-color: var(--border-strong); }

  input, select, textarea {
    background: var(--bg-muted);
    border-color: var(--border);
    color: var(--text-primary);
  }

  .card-table th { background: var(--bg-muted); }
  .card-table td { border-color: var(--border); }
}

/* ─── Contact Detail Layout ─── */
.ds-detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.ds-detail-layout__sidebar { position: sticky; top: calc(var(--topbar-h) + 16px); }
@media (max-width: 900px) {
  .ds-detail-layout { grid-template-columns: 1fr; }
  .ds-detail-layout__sidebar { position: static; }
}

.ds-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ds-breadcrumb__link { color: var(--text-secondary); text-decoration: none; }
.ds-breadcrumb__link:hover { color: var(--brand); }
.ds-breadcrumb__sep { color: var(--text-tertiary); }
.ds-breadcrumb__current { color: var(--text-primary); font-weight: 500; }

.ds-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; }
.ds-avatar--lg { width: 64px; height: 64px; font-size: 20px; }

.ds-info-list__row { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ds-info-list__row:last-child { border-bottom: none; }
.ds-info-list__label { color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.ds-info-list__value { color: var(--text-primary); font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.ds-info-list__value a { color: var(--brand); text-decoration: none; }
.ds-info-list__value a:hover { text-decoration: underline; }

.ds-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ─── Timeline ─── */
.ds-timeline { padding: 16px 0; }
.ds-timeline__item { display: flex; gap: 12px; padding: 12px 20px; position: relative; }
.ds-timeline__item:not(:last-child)::before {
  content: ''; position: absolute; left: 34px; top: 36px; bottom: -12px;
  width: 2px; background: var(--border);
}
.ds-timeline__icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; background: var(--bg-muted); color: var(--text-secondary); }
.ds-timeline__icon--tracking { background: var(--blue-bg); color: var(--blue); }
.ds-timeline__icon--deal { background: var(--green-bg); color: var(--green); }
.ds-timeline__icon--enrollment { background: var(--brand-light); color: var(--brand); }
.ds-timeline__content { flex: 1; min-width: 0; }
.ds-timeline__title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.ds-timeline__detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.ds-timeline__time { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* ─── Sequence Step Card ─── */
.ds-step-card { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.ds-step-card:last-child { border-bottom: none; }
.ds-step-card__header { display: flex; align-items: center; gap: 10px; }
.ds-step-card__number {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-light);
  color: var(--brand); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ds-step-card__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-step-card__subject { margin-top: 8px; margin-left: 38px; font-size: 13px; color: var(--text-primary); }
.ds-step-card__body { margin-left: 38px; }

/* ─── DS Card (generic card component) ─── */
.ds-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.ds-card__header { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.ds-card__title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0; }
.ds-card__subtitle { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.ds-card__body { padding: 16px 20px; }
.ds-card__footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-muted); }

/* ─── DS Table (compact data table) ─── */
.ds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-table th { padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); border-bottom: 1px solid var(--border); background: var(--bg-muted); }
.ds-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.ds-table tr:last-child td { border-bottom: none; }
.ds-table tr:hover td { background: var(--bg-hover); }
.ds-table--compact th { padding: 8px 12px; }
.ds-table--compact td { padding: 8px 12px; }

/* ─── DS Detail Layout ─── */
.ds-detail-layout__main { min-width: 0; }

/* ─── DS Info List (key-value rows) ─── */
.ds-info-list { display: flex; flex-direction: column; gap: 0; }
.ds-info-list__row { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ds-info-list__row:last-child { border-bottom: none; }
.ds-info-list__label { width: 100px; flex-shrink: 0; color: var(--text-tertiary); font-size: 12px; }
.ds-info-list__value { flex: 1; color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ─── DS Command Header actions ─── */
.ds-command-header__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── Page-specific modifiers (BEM hooks) ─── */
.app-page--campaigns {}
.app-page--sequences {}
.app-page--contacts {}
.app-page--analytics {}
.app-page--warmup {}
.app-page--settings {}
.app-page--automations {}
.app-page--brand-sites {}
.app-page--crm {}
.app-page--meetings {}
.app-page--verification {}
.app-page--blocklist {}
.app-page--lead-finder {}
.app-page--diagnostics {}
.app-page--inbox-placement {}
.app-page--api-webhooks {}
.app-page--trade {}
.app-page--intent {}
.app-page--whatsapp {}
.app-page--livechat {}
.app-page--website-visitors {}
.app-page--notifications {}

/* Unibox grid layout */
.app-page--unibox__grid { display: grid; grid-template-columns: 7fr 3fr; gap: 16px; align-items: start; }

/* ─── Chip size variant ─── */
.app-chip--sm { font-size: 10px; padding: 1px 6px; }

/* ─── Page header title ─── */
.app-page-header__title { font-size: 20px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.2; }

/* ─── Sidebar logout link ─── */
.app-sidebar__link--logout { color: var(--text-tertiary); }
.app-sidebar__link--logout:hover { color: var(--rose); }

/* ═══════════════════════════════════════════════════════════════
 * 可访问性 + 移动端 + 暗黑模式补强 (Round 3 UX 优化)
 * ═══════════════════════════════════════════════════════════════ */

/* Skip to content - 键盘用户跳过 sidebar 直达正文 */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--brand);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-to-content:focus {
  left: 0;
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* 移动端 tap targets - WCAG 2.5.5 最低 44×44px */
@media (pointer: coarse) {
  .btn-sm, button.btn-sm, a.btn-sm {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 14px;
  }
  .ds-table-row-action, .icon-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 提高 tertiary 文字对比度 (WCAG AA 4.5:1) */
:root {
  --text-tertiary: #6B7280;  /* 之前 #9CA3AF (~2.8:1) → 现在 #6B7280 (~4.6:1) */
}

/* 状态颜色 + 文字双重指示 - 色盲友好 */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot--success { background: var(--green); box-shadow: inset 0 0 0 2px rgba(34,197,94,0.2); }
.status-dot--warning { background: var(--amber); box-shadow: inset 0 0 0 2px rgba(245,158,11,0.2); }
.status-dot--error { background: var(--rose); box-shadow: inset 0 0 0 2px rgba(244,63,94,0.2); }
.status-dot--success::after { content: " ✓"; }
.status-dot--error::after { content: " ✕"; }

/* HTMX loading indicator - 全局 */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }
#htmx-global-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 200% 100%; animation: htmx-loading 1.5s linear infinite;
  z-index: 9999; display: none;
}
.htmx-request #htmx-global-progress { display: block; }
@keyframes htmx-loading {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* 暗黑模式补强 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-tertiary: #9CA3AF; /* 暗模式 tertiary 反而需要亮一点 */
  }
}

/* 减少动画 - prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .app-shell__content { animation: none !important; }
}

/* Visually hidden - 给屏幕阅读器，视觉隐藏 */
.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}

/* ═══════════════════════════════════════════════════════════════
 * Setup Wizard — 极简调性，对标 Linear/Stripe
 * ═══════════════════════════════════════════════════════════════ */

.setup-wizard {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.setup-wizard__header { margin-bottom: 16px; }
.setup-wizard__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.setup-wizard__title .ti { color: var(--brand); font-size: 20px; }
.setup-wizard__subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.setup-wizard__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.setup-wizard__step a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.setup-wizard__step a:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.setup-wizard__step a:active { transform: scale(0.98); }

.setup-wizard__step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setup-wizard__step-icon { color: var(--text-tertiary); font-size: 16px; }
.setup-wizard__step-label { font-size: 13px; font-weight: 500; }

.setup-wizard__step--parallel a {
  border-color: var(--amber-border);
  background: var(--amber-bg);
}
.setup-wizard__step--parallel .setup-wizard__step-num { background: var(--amber); }

.setup-wizard__tip {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.setup-wizard__tip .ti { color: var(--brand); font-size: 14px; }

@media (max-width: 768px) {
  .setup-wizard__steps { grid-template-columns: 1fr; }
}

/* Warmup score progress bar */
.warmup-score { display: flex; align-items: center; gap: 8px; }
.warmup-score__bar {
  flex: 1; height: 6px; background: var(--bg-muted);
  border-radius: var(--radius-full); overflow: hidden;
}
.warmup-score__fill {
  height: 100%; border-radius: var(--radius-full);
  transition: width 600ms cubic-bezier(.4,0,.2,1);
}
.warmup-score__num { font-size: 13px; font-weight: 600; min-width: 28px; text-align: right; }

/* KPI delta indicator */
.ds-metric-delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; margin-top: 4px;
}
.ds-metric-delta--up { color: var(--green); }
.ds-metric-delta--down { color: var(--rose); }
.ds-metric-delta--flat { color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════
 * Round B 数据可视化升级
 * ═══════════════════════════════════════════════════════════════ */

/* Outreach Funnel 漏斗图 */
.outreach-funnel { display: flex; flex-direction: column; gap: 8px; }
.outreach-funnel__row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.outreach-funnel__label { color: var(--text-secondary); font-weight: 500; }
.outreach-funnel__bar-wrap {
  background: var(--bg-muted);
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.outreach-funnel__bar {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding-left: 10px;
  transition: width 600ms cubic-bezier(.4,0,.2,1);
  min-width: 28px;
}
.outreach-funnel__count {
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.outreach-funnel__conv {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
  font-weight: 600;
}

/* Doughnut Gauge for warmup score */
.warmup-gauge {
  position: relative;
  width: 64px;
  height: 64px;
}
.warmup-gauge svg { transform: rotate(-90deg); }
.warmup-gauge__bg { stroke: var(--bg-muted); }
.warmup-gauge__fill {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms ease-out;
}
.warmup-gauge__num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

/* 7×24 Heatmap for analytics */
.send-heatmap {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  font-size: 10px;
}
.send-heatmap__hour-label {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 9px;
}
.send-heatmap__day-label {
  font-size: 10px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}
.send-heatmap__cell {
  aspect-ratio: 1;
  background: var(--bg-muted);
  border-radius: 2px;
  cursor: pointer;
  transition: transform 100ms;
  min-height: 14px;
}
.send-heatmap__cell:hover { transform: scale(1.3); z-index: 2; }
.send-heatmap__cell--l1 { background: rgba(79,70,229,0.15); }
.send-heatmap__cell--l2 { background: rgba(79,70,229,0.35); }
.send-heatmap__cell--l3 { background: rgba(79,70,229,0.55); }
.send-heatmap__cell--l4 { background: rgba(79,70,229,0.75); }
.send-heatmap__cell--l5 { background: rgba(79,70,229,1); }

/* Sparkline */
.sparkline {
  width: 60px;
  height: 24px;
  vertical-align: middle;
  display: inline-block;
}
.sparkline__line { fill: none; stroke-width: 1.5; }
.sparkline__area { stroke: none; opacity: 0.15; }

/* ─── Auth pages (login / error) ─── */
.auth-page { display: flex; align-items: center; justify-content: center; background: #f8f9fb; }
@media (prefers-color-scheme: dark) {
  .auth-page { background: #0f1117; }
}

/* ─── Login page ─── */
.login-card { background: #fff; border-radius: 12px; padding: 40px 36px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); width: 100%; max-width: 380px; }
.login-card__logo { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; justify-content: center; }
.login-card__mark { background: #4f46e5; color: #fff; font-size: 14px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.login-card__title { font-size: 18px; font-weight: 600; color: #1a1a2e; }
.login-card__error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.login-card__label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }
.login-card__field + .login-card__field { margin-top: 14px; }
.login-card__input { width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.login-card__input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.login-card__btn { width: 100%; padding: 11px; background: #4f46e5; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 20px; transition: background 0.2s; }
.login-card__btn:hover { background: #4338ca; }

@media (prefers-color-scheme: dark) {
  .login-card { background: #1a1d2e; box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
  .login-card__title { color: #e2e8f0; }
  .login-card__label { color: #94a3b8; }
  .login-card__input { background: #0f1117; border-color: #334155; color: #e2e8f0; }
  .login-card__input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
}

/* ─── Error page ─── */
.error-card { background: #fff; border-radius: 12px; padding: 40px 36px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); width: 100%; max-width: 420px; text-align: center; }
.error-card__code { font-size: 48px; font-weight: 800; color: #4f46e5; margin-bottom: 8px; }
.error-card__title { font-size: 18px; font-weight: 600; color: #1a1a2e; margin-bottom: 12px; }
.error-card__detail { font-size: 14px; color: #64748b; line-height: 1.5; margin-bottom: 24px; }
.error-card__link { display: inline-block; padding: 10px 24px; background: #4f46e5; color: #fff; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; transition: background 0.2s; }
.error-card__link:hover { background: #4338ca; }

@media (prefers-color-scheme: dark) {
  .error-card { background: #1a1d2e; box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
  .error-card__code { color: #818cf8; }
  .error-card__title { color: #e2e8f0; }
  .error-card__detail { color: #94a3b8; }
}

/* ─── Settings page ─── */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings-sidebar { position: sticky; top: calc(var(--topbar-h) + 24px); }
.settings-panels { display: grid; gap: 20px; }
.settings-form { display: grid; gap: 16px; max-width: 640px; }
.settings-form--narrow { max-width: 520px; }
.settings-status-card { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-muted); font-size: 12.5px; }
.settings-status-card__label { color: var(--text-tertiary); }
.settings-warning-banner { border: 2px solid var(--orange); background: var(--orange-bg); border-radius: 8px; padding: 16px; }
.settings-warning-banner__title { font-weight: 600; color: var(--orange); font-size: 14px; margin-bottom: 8px; }
.settings-integration-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.settings-integration-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-muted); display: flex; align-items: center; justify-content: center; }
.settings-integration-icon i { font-size: 18px; color: var(--text-secondary); }
.settings-section-hint { color: var(--text-secondary); font-size: 12px; }
.settings-locked-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }
.settings-mode-label { font-weight: 600; margin-bottom: 8px; }
.settings-mode-options { display: grid; gap: 8px; }
.settings-mode-card { cursor: pointer; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); transition: var(--transition-fast); display: flex; align-items: flex-start; gap: 12px; }
.settings-mode-card--prewarm { border-color: var(--amber); background: var(--amber-bg); }
.settings-mode-card--live { border-color: var(--green); background: var(--green-bg); }
.settings-mode-card__radio { margin-top: 3px; }
.settings-mode-card__title { font-weight: 700; }
.settings-mode-card__title--prewarm { color: var(--amber); }
.settings-mode-card__title--live { color: var(--green); }
.settings-mode-card__title i { font-size: 15px; vertical-align: -1px; }
.settings-mode-card__desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.settings-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-send-toggles { display: flex; flex-direction: column; gap: 12px; }
.settings-safety-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.settings-safety-checks { display: grid; gap: 8px; }
.settings-window-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.settings-muted-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Toggle pattern (reused across settings + other pages) */
.toggle-label { cursor: pointer; font-size: 13px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.toggle-label--disabled { cursor: default; }
.toggle-checkbox { width: 16px; height: 16px; accent-color: var(--brand); }
.toggle-checkbox--warning { accent-color: var(--orange); }
.toggle-checkbox--danger { accent-color: var(--rose); }

/* Card variants */
.card-body--flush { padding: 0; }
.card-body--tight { padding: 8px; }
.card-header--compact { padding: 10px 16px; }
.card-title--compact { font-size: 13px; }
.card-title--lg { font-size: 15px; font-weight: 700; }

/* Section heading / desc (ICP wizard + general) */
.section-heading { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.section-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

/* Selection cards (ICP wizard) */
.selection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.selection-grid--2col { grid-template-columns: repeat(2, 1fr); }
.selection-grid--3col { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.selection-list { display: flex; flex-direction: column; gap: 8px; }
.selection-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.selection-card--active { border-color: var(--brand); background: var(--brand-light); }
.selection-card--lg { padding: 14px 16px; gap: 10px; }
.selection-card--radio { padding: 14px 16px; gap: 10px; }
.selection-card__title { font-weight: 600; font-size: 14px; }
.selection-card__desc { font-size: 12px; color: var(--text-tertiary); }

/* Progress bar (ICP wizard) */
.progress-bar-wrap { height: 4px; background: var(--bg-muted); border-radius: 2px; overflow: hidden; }
.progress-stats { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-tertiary); margin-bottom: 8px; text-transform: uppercase; }

/* Nav footer */
.nav-footer { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Result preview (ICP wizard) */
.result-summary { background: var(--bg-subtle); padding: 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.result-summary__row { margin-bottom: 8px; }
.result-action { background: var(--brand-light); padding: 14px; border-radius: 8px; font-size: 13px; color: var(--text-primary); margin-bottom: 20px; }
.result-action__list { margin: 6px 0 0 18px; padding: 0; }

/* Dashboard components */
.ds-reply-summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background 80ms; }
.ds-reply-unread-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.ds-reply-sentiment { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; }
.ds-reply-sentiment--positive { background: var(--green-bg); color: var(--green); }
.ds-reply-sentiment--negative { background: var(--rose-bg, #fef2f2); color: var(--rose); }
.ds-reply-sentiment--neutral { background: var(--bg-muted); color: var(--text-tertiary); }
.ds-reply-content { flex: 1; min-width: 0; }
.ds-reply-from { display: flex; align-items: center; gap: 8px; }
.ds-reply-from__name { font-size: 13px; color: var(--text-primary); }
.ds-reply-from__name--unread { font-weight: 700; }
.ds-reply-from__email { font-size: 11px; color: var(--text-tertiary); }
.ds-reply-subject { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ds-reply-subject__text { font-weight: 600; color: var(--text-primary); }
.ds-reply-subject__preview { color: var(--text-tertiary); }
.ds-reply-time { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; min-width: 60px; text-align: right; }
.ds-reply-expanded { padding: 0 16px 16px 52px; border-top: 1px solid var(--border); }
.ds-reply-body { padding: 12px; margin-top: 12px; background: var(--bg-muted); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; }
.ds-campaign-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 12px; }
.ds-campaign-row--bordered { border-bottom: 1px solid var(--border); }
.ds-campaign-row__name { flex: 1; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-campaign-row__meta { color: var(--text-tertiary); }
.ds-kpi-delta-text { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.ds-chart-legend { display: flex; align-items: center; gap: 12px; font-size: 11px; }
.ds-chart-legend__item { display: flex; align-items: center; gap: 3px; }
.ds-chart-swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ds-chart-swatch--brand { background: var(--brand); }
.ds-chart-swatch--green { background: var(--green); }
.ds-metrics--5col { grid-template-columns: repeat(5, 1fr); }
.ds-empty-state-icon { font-size: 36px; display: block; margin-bottom: 8px; opacity: 0.4; }
.ds-empty-state-icon--sm { font-size: 20px; margin-bottom: 4px; }

/* Utility helpers */
.btn--fit { width: fit-content; }
.btn--full { width: 100%; padding: 12px; }
.text-11 { font-size: 11px; }
.text-12 { font-size: 12px; }
.text-13 { font-size: 13px; }
.text-mono { font-family: monospace; font-size: 12px; }

/* Health scan placeholder */
.health-placeholder { padding: 24px; text-align: center; color: var(--text-tertiary); }
.health-placeholder i { font-size: 20px; }
.health-error { padding: 16px; color: var(--rose); }

/* Table flush (no margin) */
.table--flush { margin: 0; }

/* Integration connected status */
.integration-connected { color: var(--green); }
.integration-disconnected { color: var(--text-tertiary); }

/* Form grid layouts */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.form-grid-2-1-1 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.form-grid-2-1-1-1 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.form-grid-1-2-1 { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 12px; }

/* Background panels */
.bg-panel { padding: 12px; background: var(--bg-muted); border-radius: var(--radius-sm); }
.bg-panel--tight { padding: 8px; background: var(--bg-muted); border-radius: var(--radius-sm); }
.bg-panel--bordered { padding: 12px; background: var(--bg-muted); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.bordered-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }

/* Section labels */
.section-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.section-label--sm { font-size: 11px; color: var(--text-tertiary); font-weight: 600; }
.label-hint { font-size: 11px; color: var(--text-tertiary); }

/* Health / progress mini bars */
.health-bar { width: 80px; height: 6px; background: var(--bg-muted); border-radius: 99px; overflow: hidden; }
.health-bar__fill { height: 100%; border-radius: 99px; transition: width 0.3s; }
.health-bar--sm { width: 100%; height: 4px; background: var(--bg-muted); border-radius: 99px; overflow: hidden; }
.health-bar--sm .health-bar__fill { height: 100%; border-radius: 99px; transition: width 0.3s; }

/* Brand avatar */
.brand-avatar { width: 36px; height: 36px; border-radius: var(--radius-sm); flex-shrink: 0; }
.brand-avatar--img { object-fit: cover; }
.brand-avatar--letter { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700; background: var(--brand); }
.brand-avatar--circle { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot--green { background: var(--green); }
.status-dot--amber { background: var(--amber); }
.status-dot--red { background: var(--rose); }
.status-dot--brand { background: var(--brand); }

/* Timeline step */
.timeline-step-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.timeline-connector { width: 2px; flex: 1; min-height: 20px; background: var(--border); margin: 4px 0; }

/* Config section */
.config-section { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.config-section--tight { padding: 8px; background: var(--bg-muted); border-radius: var(--radius-sm); }

/* Card header compact */
.card-header--brand { background: var(--brand-lighter); border-bottom-color: var(--blue-border); }
.card-header--brand .card-title { color: var(--brand); }
.card-header--green { background: var(--green-bg); border-bottom-color: var(--green-border); }
.card-header--green .card-title { color: var(--green); }

/* Table alignment helpers */
.td-center { text-align: center; }
.td-end { text-align: end; }
.td-ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Domain health check grid */
.dh-check { text-align: center; padding: 12px; border-radius: var(--radius-sm); }
.dh-check--pass { background: var(--green-bg); }
.dh-check--fail { background: var(--rose-bg); }

/* Alert / warning boxes */
.alert-box { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; }
.alert-box--rose { background: var(--rose-bg); border: 1px solid var(--rose-border); color: var(--rose); }
.alert-box--amber { background: var(--amber-bg); border: 1px solid var(--amber-border); }
.alert-box--green { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }

/* Form label sm */
.form-label--sm { font-size: 11px; }

/* Card padding zero */
.card-body--p0 { padding: 0; }

/* Email fieldset */
.email-fieldset { padding: 10px; background: var(--bg-muted); border-radius: var(--radius-sm); }
.email-fieldset__title { font-weight: 600; font-size: 13px; }

/* Sequence panel */
.seq-panel { display: none; }
.seq-panel--brand { border-color: var(--brand); border-width: 1px; }
.seq-panel--green { border-color: var(--green); border-width: 1px; }

/* Step type colors */
.step-type--email { background: var(--blue-bg); color: var(--brand); border: 1px solid var(--blue-border); }
.step-type--task { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.step-type--condition { background: var(--slate-bg); color: var(--slate); border: 1px solid var(--slate-border); }
.step-type--whatsapp { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }

/* Missing fields warning */
.missing-fields-warn { margin-top: 8px; margin-left: 52px; padding: 8px 12px; background: var(--rose-bg); border: 1px solid var(--rose-border); border-radius: var(--radius-sm); font-size: 12px; color: var(--rose); }

/* Expanded detail section */
.expanded-detail { margin-top: 16px; margin-left: 52px; }

/* Card header --amber */
.card-header--amber { background: var(--amber-bg); border-bottom-color: var(--amber-border); }
.card-header--amber .card-title { color: var(--amber); }

/* Binding chain margin */
.binding-chain { margin-left: 52px; }

/* Step card preview */
.step-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.step-preview__header { background: var(--bg-muted); padding: 8px 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.step-preview__body { padding: 12px; font-size: 13px; line-height: 1.6; color: var(--text-secondary); max-height: 300px; overflow-y: auto; }
.step-preview__footer { background: var(--bg-muted); padding: 6px 12px; font-size: 11px; color: var(--text-tertiary); border-top: 1px solid var(--border); }

/* Empty state center */
.empty-center { padding: 32px; text-align: center; color: var(--text-tertiary); }

/* Side panel (fixed right) */
.side-panel { display: none; position: fixed; top: 0; right: 0; bottom: 0; width: 480px; background: var(--bg-surface); box-shadow: -4px 0 24px rgba(0,0,0,0.1); z-index: 100; padding: 24px; overflow-y: auto; }

/* Code preview */
.code-preview { font-size: 12px; white-space: pre-wrap; color: var(--text-secondary); background: var(--bg-muted); padding: 12px; border-radius: var(--radius-sm); margin-top: 8px; max-height: 200px; overflow-y: auto; }

/* Mailbox scroll list */
.mailbox-scroll-list { max-height: 140px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }

/* Table header align */
.th-center { text-align: center; }
.th-end { text-align: end; }

/* Card flush body */
.card-body--p0 { padding: 0; }

/* Sequence panel --amber */
.seq-panel--amber { border-color: var(--amber); border-width: 1px; }

/* Pending actions card */
.pending-actions-card { border-left: 3px solid var(--amber); }
.pending-actions-body { padding: 8px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pending-actions-label { font-size: 11px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: 0.05em; }
.pending-actions-link { font-size: 12px; color: var(--text-primary); text-decoration: none; display: flex; align-items: center; gap: 4px; }

/* Spam check result panel */
.spam-result { margin-top: 12px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.spam-result__header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.spam-result__score { font-size: 28px; font-weight: 700; line-height: 1; }
.spam-result__verdict { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 100px; }
.spam-result__body { padding: 0 14px 14px; }
.spam-result__issues { margin-bottom: 8px; }
.spam-result__issue { display: flex; align-items: flex-start; gap: 6px; padding: 4px 0; font-size: 12px; }
.spam-result__issue-sev { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 3px; }
.spam-result__suggestions { border-top: 1px solid var(--border); padding-top: 8px; }
.spam-result__suggestion { font-size: 12px; color: var(--text-secondary); padding: 2px 0; display: flex; align-items: flex-start; gap: 4px; }
.spam-result__loading { padding: 20px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.spam-result--safe { border-color: var(--green-border); }
.spam-result--safe .spam-result__header { background: var(--green-bg); }
.spam-result--safe .spam-result__score { color: var(--green); }
.spam-result--caution { border-color: var(--amber-border); }
.spam-result--caution .spam-result__header { background: var(--amber-bg); }
.spam-result--caution .spam-result__score { color: var(--amber); }
.spam-result--risky { border-color: var(--rose-border); }
.spam-result--risky .spam-result__header { background: var(--rose-bg); }
.spam-result--risky .spam-result__score { color: var(--rose); }
.spam-result--blocked { border-color: var(--rose-border); }
.spam-result--blocked .spam-result__header { background: var(--rose-bg); }
.spam-result--blocked .spam-result__score { color: var(--rose); }
.sev-critical { background: var(--rose); }
.sev-high { background: var(--amber); }
.sev-medium { background: var(--text-tertiary); }

@media (prefers-color-scheme: dark) {
  .selection-card--active { background: rgba(99,102,241,0.12); }
  .result-action { background: rgba(99,102,241,0.1); }
}

/* ── Sequence Flow Builder (Visual Drag-Drop) ── */
.flow-node:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-color: var(--brand) !important;
}
.flow-node.sortable-ghost {
  opacity: 0.4;
  background: var(--brand-bg) !important;
}
.flow-node.sortable-chosen {
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ── Purple variant (AI actions) ── */
:root {
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --purple-border: #c4b5fd;
}
.btn-outline-purple {
  border: 1px solid var(--purple-border);
  color: var(--purple);
  background: transparent;
}
.btn-outline-purple:hover {
  background: var(--purple-bg);
  border-color: var(--purple);
}

@media (prefers-color-scheme: dark) {
  :root {
    --purple-bg: rgba(124,58,237,0.12);
    --purple-border: #7c3aed;
  }
}
