/* ============================================
   SENDRA — Hypermodern Newsletter Platform
   Sharp, clean, premium SaaS design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* ── Brand (warm dark editorial — see sendra-design skill) ── */
  --primary: #2DB4B0;
  --primary-dark: #1E8C88;
  --primary-light: #4DCCC8;
  --primary-glow: rgba(45, 180, 176, 0.14);
  --primary-glow-soft: rgba(45, 180, 176, 0.06);
  --primary-glow-strong: rgba(45, 180, 176, 0.25);
  --primary-alpha: rgba(45, 180, 176, 0.10);  /* alias used in fallback patterns */

  --accent: #E8B04A;
  --accent-soft: rgba(232, 176, 74, 0.10);
  --accent-glow: rgba(232, 176, 74, 0.20);

  /* ── Warm Dark Surfaces ── */
  --bg: #141210;
  --bg-elevated: #1F1C18;
  --bg-card: #1F1C18;
  --bg-card-hover: #25221D;
  --bg-input: #1A1714;

  --sidebar-bg: #171512;

  /* Legacy aliases (kept for stability; use --primary / --bg-card / etc directly) */
  --teal: #2DB4B0;
  --teal-light: rgba(45, 180, 176, 0.12);
  --bg-secondary: #1F1C18;
  --bg-tertiary: #25221D;
  --card: #1F1C18;
  --card-bg: #1F1C18;

  /* ── Warm Text ── */
  --text-primary: #F5EFE2;
  --text-secondary: #A89F8D;
  --text-muted: #6B6358;
  --text-link: #2DB4B0;

  /* ── Warm Borders ── */
  --border: rgba(232, 220, 200, 0.06);
  --border-hover: rgba(232, 220, 200, 0.12);

  /* ── Overlays / modal scrims ── */
  --overlay: rgba(0, 0, 0, 0.55);
  --overlay-light: rgba(0, 0, 0, 0.35);

  /* ── Status ── */
  --success: #7FB87A;
  --success-bg: rgba(127, 184, 122, 0.12);
  --warning: #E8B04A;
  --warning-bg: rgba(232, 176, 74, 0.12);
  --danger: #E07B7B;
  --danger-bg: rgba(224, 123, 123, 0.12);
  --info: #8CB8F5;
  --info-bg: rgba(140, 184, 245, 0.12);

  /* ── Radius ── */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-lg: 20px;

  /* ── Shadow ── */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.35);

  /* ── Typography ── */
  --font-serif: 'Instrument Serif', Georgia, serif;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Toast colors — warm dark */
  --toast-bg: #1F1C18;
  --toast-success-bg: rgba(127, 184, 122, 0.15);
  --toast-error-bg: rgba(224, 123, 123, 0.15);
  --toast-info-bg: rgba(45, 180, 176, 0.15);
  --toast-success: #7FB87A;
  --toast-error: #E07B7B;
  --toast-info: #2DB4B0;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-sidebar: 110;
  --z-flyout: 150;
  --z-overlay: 200;
  --z-modal: 500;
  --z-toast: 900;
  --z-tooltip: 1000;
}

/* ── Light Theme — warm cream, matches the warm dark family ── */
[data-theme="light"] {
  --bg: #F7F3EA;
  --bg-elevated: #FDFAF2;
  --bg-card: #FDFAF2;
  --bg-card-hover: #F2ECDE;
  --bg-input: #F7F3EA;
  --sidebar-bg: #FDFAF2;
  --text-primary: #2A2520;
  --text-secondary: #7A6E5E;
  --text-muted: #A89F8D;
  --border: rgba(42, 37, 32, 0.08);
  --border-hover: rgba(42, 37, 32, 0.14);
  --shadow: 0 1px 3px rgba(42, 37, 32, 0.06);
  --shadow-md: 0 4px 12px rgba(42, 37, 32, 0.08);
  --shadow-lg: 0 8px 30px rgba(42, 37, 32, 0.12);
  --primary-glow: rgba(45, 180, 176, 0.12);
  --primary-glow-soft: rgba(45, 180, 176, 0.05);
  --primary-glow-strong: rgba(45, 180, 176, 0.22);
  --primary-alpha: rgba(45, 180, 176, 0.08);
  --teal: #2DB4B0;
  --teal-light: rgba(45, 180, 176, 0.08);
  --bg-secondary: #F2ECDE;
  --bg-tertiary: #F7F3EA;
  --card: #FDFAF2;
  --card-bg: #FDFAF2;
  --overlay: rgba(42, 37, 32, 0.35);
  --overlay-light: rgba(42, 37, 32, 0.20);
}
[data-theme="light"] ::selection { background: var(--primary-glow-strong); }
[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237A6E5E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="light"] select option { background: var(--bg-card); color: var(--text-primary); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(42,37,32,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(42,37,32,0.2); }
[data-theme="light"] .sidebar-nav a:hover, [data-theme="light"] .flyout-links a:hover { background: rgba(42,37,32,0.04); color: var(--text-secondary); }
[data-theme="light"] .sidebar-nav a.active, [data-theme="light"] .flyout-links a.active { background: var(--primary-glow); color: var(--primary); border-color: var(--primary-glow-strong); }
[data-theme="light"] .rail-btn:hover { background: rgba(42,37,32,0.05); }
[data-theme="light"] .rail-btn.active { background: var(--primary-glow); color: var(--primary); }
[data-theme="light"] .rail-search-btn:hover { background: rgba(42,37,32,0.05); }
[data-theme="light"] .flyout-panel { box-shadow: 4px 0 16px rgba(42,37,32,0.08); }
[data-theme="light"] .rail-btn .rail-tooltip { background: var(--bg-card); }
[data-theme="light"] .workspace-popover a:hover { background: rgba(42,37,32,0.04); }
[data-theme="light"] .theme-toggle-btn { color: var(--text-secondary); }
[data-theme="light"] .theme-toggle-btn:hover { background: rgba(42,37,32,0.06); }

/* Theme toggle button */
.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card); cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--bg-card-hover); color: var(--primary); border-color: var(--primary); }
.theme-toggle-btn svg { width: 15px; height: 15px; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  text-rendering: geometricPrecision;
  position: relative;
}

/* Ambient warm glows — subtle radial gradients in corners for warmth + depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(232, 176, 74, 0.05), transparent 60%),
    radial-gradient(900px 500px at 10% 90%, rgba(45, 180, 176, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Ensure app content sits above the ambient glow */
.app-shell, .main-content, main { position: relative; z-index: 1; }

/* Serif utility */
.serif { font-family: var(--font-serif); letter-spacing: -0.5px; }

::selection { background: var(--primary-glow-strong); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── Auth ── */
.auth-container {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; position: relative; overflow: hidden;
}
.auth-container::before {
  content: ''; position: absolute; inset: -50%;
  background: radial-gradient(ellipse at 30% 40%, var(--primary-glow-soft) 0%, transparent 60%);
}
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 44px; width: 420px;
  box-shadow: var(--shadow-lg); position: relative; z-index: 1;
}
.auth-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.auth-card .subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.auth-card .logo { font-size: 32px; font-weight: 900; color: var(--primary); margin-bottom: 20px; letter-spacing: -1px; }

.pill-toggle-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pill-toggle { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 8px 16px; border-radius: 100px; font-size: 13px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.pill-toggle:hover { border-color: var(--primary); color: var(--text-primary); }
.pill-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Forms ── */
/* ── Global Form Element Reset (HYPERMODERN) ── */
/* Every select, input, textarea gets styled — no native browser chrome */
select, input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="password"], input[type="number"], input[type="search"], input[type="date"],
input[type="time"], input[type="datetime-local"], textarea {
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); font-size: 14px; font-family: inherit;
  color: var(--text-primary); outline: none; transition: all var(--transition);
  padding: 10px 14px;
}
select:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="url"]:focus, input[type="password"]:focus, input[type="number"]:focus,
input[type="search"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input[type="datetime-local"]:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237C7C8A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select option {
  background: var(--bg-card); color: var(--text-primary);
}
textarea { min-height: 100px; resize: vertical; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 5px; letter-spacing: 0.3px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
}
.form-group input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition); letter-spacing: 0.1px; white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 8px var(--primary-glow-strong);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 3px 16px var(--primary-glow-strong); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary); border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Icon Rail ── */
.icon-rail {
  width: 64px; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 110;
  padding: 12px 0 8px; align-items: center;
}
.rail-logo {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 8px; cursor: pointer; flex-shrink: 0;
}
.rail-logo:hover { opacity: 0.8; }
.rail-search-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s; margin-bottom: 4px; flex-shrink: 0; padding: 0;
}
.rail-search-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.rail-divider {
  width: 24px; height: 1px; background: var(--border); margin: 6px 0; flex-shrink: 0;
}
.rail-items {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: center;
  overflow-y: auto; overflow-x: hidden; width: 100%; padding: 0 8px;
  scrollbar-width: none;
}
.rail-items::-webkit-scrollbar { display: none; }
.rail-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s; flex-shrink: 0; padding: 0; position: relative;
}
.rail-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.rail-btn.active {
  background: var(--primary-alpha); color: var(--primary-light);
  box-shadow: inset 3px 0 0 var(--primary);
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn .rail-tooltip {
  position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
  background: rgba(22,22,32,0.97); color: var(--text-primary); font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  border: 1px solid rgba(255,255,255,0.10); box-shadow: 0 4px 16px rgba(0,0,0,0.4); z-index: 9999;
  opacity: 0; transition: opacity 80ms ease; letter-spacing: 0.01em;
}
.rail-btn:hover .rail-tooltip { opacity: 1; }
.flyout-open .rail-btn .rail-tooltip { opacity: 0 !important; pointer-events: none; }

/* Rail bottom section */
.rail-bottom {
  display: flex; flex-direction: column; gap: 2px; align-items: center; padding: 0 8px;
  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; width: 100%;
}
.rail-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; padding: 0; transition: all 0.15s; flex-shrink: 0;
}
.rail-avatar:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--primary-glow-strong); }

/* ── Flyout Panel ── */
.flyout-panel {
  width: 220px; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 56px; z-index: 105;
  transform: translateX(-100%); transition: transform 0.15s ease-out;
  display: flex; flex-direction: column; padding: 16px 0;
  box-shadow: 4px 0 16px rgba(0,0,0,0.3);
}
.flyout-panel.open { transform: translateX(0); }
.flyout-panel.pinned { transform: translateX(0); }
.flyout-heading {
  font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; padding: 0 16px 10px; flex-shrink: 0;
}
.flyout-links {
  flex: 1; display: flex; flex-direction: column; gap: 1px; padding: 0 8px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.flyout-links::-webkit-scrollbar { width: 4px; }
.flyout-links::-webkit-scrollbar-track { background: transparent; }
.flyout-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
.flyout-links a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  color: var(--text-muted); text-decoration: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.flyout-links a:hover { background: rgba(255,255,255,0.03); color: var(--text-secondary); }
.flyout-links a.active {
  background: var(--primary-alpha); color: var(--primary-light); font-weight: 600;
  border: 1px solid var(--primary-alpha);
}
.flyout-links a .icon { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.flyout-links a .icon svg { flex-shrink: 0; }

/* ── Workspace Popover ── */
.workspace-popover {
  display: none; position: fixed; bottom: 56px; left: 8px; width: 220px; z-index: 200;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px 0;
}
.workspace-popover.open { display: block; }
.workspace-popover .wp-header {
  padding: 10px 14px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.workspace-popover .wp-header .wp-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.workspace-popover .wp-header .wp-plan { font-size: 10px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.workspace-popover .wp-divider { height: 1px; background: var(--border); margin: 4px 0; }
.workspace-popover a {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.workspace-popover a:hover { background: rgba(255,255,255,0.03); color: var(--text-primary); }
.workspace-popover a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Legacy sidebar classes - kept for mobile drawer */
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  color: var(--text-muted); text-decoration: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; transition: all var(--transition);
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.03); color: var(--text-secondary); }
.sidebar-nav a.active {
  background: var(--primary-alpha); color: var(--primary-light); font-weight: 600;
  border: 1px solid var(--primary-alpha);
}
.sidebar-nav a .icon { font-size: 16px; width: 20px; text-align: center; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-nav a .icon svg { flex-shrink: 0; }

/* ── Main ── */
/* ── App body (right of rail) ── */
.app-body { margin-left: 64px; display: flex; flex-direction: column; flex: 1; min-height: 100vh; }

/* ── Top tab bar ── */
.top-tabs-bar {
  height: 48px; display: flex; align-items: center; padding: 0 24px; gap: 2px;
  background: var(--sidebar-bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; flex-shrink: 0;
}
.top-tab {
  height: 48px; padding: 0 16px; border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s; white-space: nowrap;
}
.top-tab:hover { color: var(--text-primary); }
.top-tab.active { color: var(--primary-light); border-bottom-color: var(--primary); font-weight: 600; }

.main { width: 100%; max-width: 1040px; padding: 28px 32px; margin: 0 auto; box-sizing: border-box; }
.page-wrap { max-width: 1040px; margin: 0 auto; }
/* flyout-pinned no longer used — kept as no-op for safety */
.flyout-pinned .main { }
/* Legacy .page-header upgraded to editorial treatment — every page inherits the warm-dark serif header automatically */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.page-header h2 { font-size: 36px; font-weight: 400; letter-spacing: -0.8px; font-family: var(--font-serif); color: var(--text-primary); line-height: 1; margin: 0 0 4px; }
.page-header .subtitle { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; max-width: 540px; }

/* ── Cards ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; color: var(--text-primary); }
.card h3:first-child { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; color: var(--text-primary); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 14px; color: var(--primary); }
.stat-card .stat-value { font-size: 32px; font-weight: 400; font-family: var(--font-serif); letter-spacing: -0.5px; line-height: 1; color: var(--text-primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; font-weight: 500; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-secondary);
}
td strong { color: var(--text-primary); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-active, .badge-published { background: var(--success-bg); color: var(--success); }
.badge-unsubscribed, .badge-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-bounced, .badge-past_due { background: var(--warning-bg); color: var(--warning); }
.badge-draft { background: var(--border); color: var(--text-secondary); }
.badge-scheduled { background: var(--info-bg); color: var(--info); }
.badge-sending { background: var(--warning-bg); color: var(--warning); }
.badge-sent { background: var(--success-bg); color: var(--success); }
.badge-paused { background: var(--border); color: var(--text-muted); }
.badge-archived { background: var(--border); color: var(--text-muted); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }

/* ── Toolbar / Search ── */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.search-input {
  flex: 1; max-width: 320px; padding: 9px 14px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); font-size: 13px; color: var(--text-primary);
  outline: none; font-family: inherit; transition: all var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.search-input::placeholder { color: var(--text-muted); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: center; z-index: 1000;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; width: 520px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp 0.2s ease;
}
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 20px; letter-spacing: -0.3px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { transform:translateY(12px);opacity:0 } to { transform:translateY(0);opacity:1 } }

/* ── Subscriber Profile Modal ── */
.sp-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.sp-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.sp-header-info { flex: 1; min-width: 0; }
.sp-email { font-size: 18px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-header-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.sp-subscribed { font-size: 12px; color: var(--text-muted); }
.sp-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.sp-section { margin-bottom: 20px; }
.sp-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }
.sp-detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sp-detail-label { color: var(--text-secondary); }
.sp-detail-value { color: var(--text-primary); font-weight: 500; }
.sp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-tag { background: var(--primary-alpha); color: var(--primary); padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.sp-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.sp-stat-card { background: var(--primary-alpha); border: 1px solid var(--primary-glow); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.sp-stat-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.sp-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.sp-activity { display: flex; flex-direction: column; gap: 2px; }
.sp-activity-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-xs); font-size: 13px; }
.sp-activity-item:hover { background: var(--bg-card-hover); }
.sp-activity-icon { color: var(--primary); display: flex; align-items: center; flex-shrink: 0; }
.sp-activity-label { color: var(--text-primary); font-weight: 500; text-transform: capitalize; }
.sp-activity-date { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: 13px; }
.btn-danger:hover { background: #dc2626; }

/* ── Template Library ── */
.template-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.template-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all var(--transition);
}
.template-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.template-preview {
  width: 100%; height: 220px; overflow: hidden; background: #ffffff; position: relative;
}
.template-preview iframe {
  width: 300%; height: 300%; transform: scale(0.3333); transform-origin: top left;
  pointer-events: none; border: none; position: absolute; top: 0; left: 0;
}
.template-info { padding: 12px 14px 6px; }
.template-info h4 { font-size: 14px; font-weight: 700; margin: 0; color: var(--text-primary); }
.template-actions { padding: 6px 14px 12px; display: flex; gap: 6px; }

/* ── Email Preview ── */
.email-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.email-preview-header {
  background: var(--bg-elevated); padding: 10px 14px; font-size: 12px;
  color: var(--text-secondary); border-bottom: 1px solid var(--border);
}

/* ── Toast Container ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: var(--z-toast);
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
/* ── Toast ── */
.toast {
  position: relative; max-width: 340px; min-width: 260px;
  background: var(--toast-bg); color: #fff; border-left: 3px solid var(--toast-info);
  padding: 14px 40px 14px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); pointer-events: auto; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  transform: translateX(110%); animation: toastIn 250ms ease-out forwards;
}
.toast.dismissing { animation: toastOut 250ms ease-in forwards; }
.toast.success { background: var(--toast-success-bg); border-left-color: var(--toast-success); }
.toast.error { background: var(--toast-error-bg); border-left-color: var(--toast-error); }
.toast.info { background: var(--toast-info-bg); border-left-color: var(--toast-info); }
.toast .toast-icon { display: flex; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--toast-success); }
.toast.error .toast-icon { color: var(--toast-error); }
.toast.info .toast-icon { color: var(--toast-info); }
.toast .toast-msg { flex: 1; color: #fff; }
.toast .toast-close {
  position: absolute; top: 0; right: 0; width: 36px; height: 100%;
  background: none; border: none; color: rgba(255,255,255,0.5); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.toast .toast-close:hover { color: #fff; }
.toast .toast-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  border-radius: 0 0 10px 10px;
  animation: toastProgress 4s linear forwards;
}
.toast.success .toast-progress { background: var(--toast-success); }
.toast.error .toast-progress { background: var(--toast-error); }
.toast.info .toast-progress { background: var(--toast-info); }
@keyframes toastIn { from { transform: translateX(110%); } to { transform: translateX(0); } }
@keyframes toastOut { from { transform: translateX(0); opacity:1; } to { transform: translateX(110%); opacity:0; } }
@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }

/* ── Empty / Loading ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { margin-bottom: 20px; font-size: 14px; }
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Code Editor ── */
.code-editor {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; line-height: 1.6;
  padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text-primary); min-height: 200px; resize: vertical; width: 100%; tab-size: 2;
}
.code-editor:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px var(--primary-glow); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .auth-card { width: 100%; margin: 16px; padding: 28px; }
}

/* Preview Mode Buttons */
.preview-tab.active, .preview-device.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Campaign Meta Header ── */
.camp-meta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #888;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.15s;
}
.camp-meta-btn:hover { color: var(--primary); }
.camp-meta-btn svg { flex-shrink: 0; }

.camp-author-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.camp-author-add {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #ccc;
  border-radius: 50%;
  font-size: 16px;
  color: #aaa;
  cursor: pointer;
  transition: all 0.15s;
}
.camp-author-add:hover { border-color: var(--primary); color: var(--primary); }

.camp-tag-chip {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #ddd;
  transition: all 0.15s;
}
.camp-tag-chip:hover { opacity: 0.85; }

/* ── Author Dropdown Menu ── */
.camp-author-menu {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 6px;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
  animation: cam-in 0.12s ease-out;
}
@keyframes cam-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.cam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  color: #ccc;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.cam-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cam-item span { flex: 1; }
.cam-item svg:last-child { opacity: 0.4; margin-left: auto; }
.cam-item-accent { color: #f472b6; }
.cam-item-accent:hover { background: rgba(244,114,182,0.12); color: #f9a8d4; }
.cam-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 6px; }

/* ── Content Tag Picker Menu ── */
.camp-tag-menu {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 250px;
  max-height: 360px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
  animation: cam-in 0.12s ease-out;
  display: flex;
  flex-direction: column;
}
.ctm-search {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.ctm-search::placeholder { color: rgba(255,255,255,0.35); }
.ctm-search:focus { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); }
.ctm-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 2px 6px;
}
.ctm-empty {
  padding: 16px 12px;
  color: #888;
  font-size: 13px;
  text-align: center;
}
.ctm-tag-active { background: rgba(255,255,255,0.05) !important; }
.ctm-tag-active svg { color: #5ef0f0; }

/* ── Tag Color Dots ── */
.ctm-dot {
  display: block;
  width: 10px !important;
  height: 10px !important;
  min-width: 10px !important;
  max-width: 10px !important;
  min-height: 10px !important;
  max-height: 10px !important;
  border-radius: 50% !important;
  flex-shrink: 0;
  flex-grow: 0;
}

/* ── Custom Prompt Modal ── */
.pulse-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ppo-in 0.15s ease-out;
}
@keyframes ppo-in { from { opacity: 0; } to { opacity: 1; } }
.pulse-prompt {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 24px;
  width: 340px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  animation: ppm-in 0.15s ease-out;
}
@keyframes ppm-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.pulse-prompt-label {
  font-size: 15px;
  font-weight: 600;
  color: #eee;
  margin-bottom: 12px;
}
.pulse-prompt-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.pulse-prompt-input:focus { border-color: var(--primary); }
.pulse-prompt-input::placeholder { color: rgba(255,255,255,0.3); }
.pulse-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.pulse-prompt-cancel {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: transparent;
  color: #aaa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pulse-prompt-cancel:hover { background: rgba(255,255,255,0.06); color: #fff; }
.pulse-prompt-ok {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pulse-prompt-ok:hover { background: #0ba5a5; }

/* ── Confirm Modal ── */
.pulse-confirm {
  background: var(--bg-card);
  border: 1.5px solid var(--border, rgba(255,255,255,0.07));
  border-radius: var(--radius, 12px);
  padding: 24px;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.pulse-confirm-destructive { border-top: 3px solid var(--danger); }
.pulse-confirm-message {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary, #EEEEF0);
  margin-bottom: 20px;
  line-height: 1.5;
}
.pulse-confirm-ok {
  padding: 9px 20px;
  border-radius: var(--radius-sm, 8px);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: all 0.15s;
}
.pulse-confirm-ok:hover { background: #0ba5a5; }
.pulse-confirm-ok.danger {
  background: var(--danger);
}
.pulse-confirm-ok.danger:hover { background: #dc2626; }

/* ── Multi-Field Modal ── */
.pulse-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ppo-in 0.15s ease-out;
}
.pulse-modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
  animation: ppm-in 0.15s ease-out;
}
.pm-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin-bottom: 24px;
}
.pm-field { margin-bottom: 18px; }
.pm-field-row { display: flex; align-items: center; justify-content: space-between; }
.pm-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.pm-field-row .pm-label { margin-bottom: 0; }
.pm-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-family: inherit;
  color: #333;
  background: #fff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.pm-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.pm-input::placeholder { color: var(--text-muted); }
.pm-input.pm-error { border-color: #e55; }
.pm-textarea {
  min-height: 72px;
  resize: vertical;
}
.pm-color {
  width: 40px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}
.pm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.pm-cancel {
  padding: 9px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pm-cancel:hover { background: #f5f5f5; }
.pm-submit {
  padding: 9px 24px;
  border: none;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pm-submit:hover { background: #333; }

/* ── Newsletter Series Grid ── */
.newsletter-series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.ns-card { cursor: pointer; transition: all var(--transition); }
.ns-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.3); }

/* Info badge — "What's an Issue?" */
.ns-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-alpha);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  padding: 3px 9px;
  border-radius: 99px;
  cursor: default;
  position: relative;
}
.ns-info-badge:hover::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #333;
  width: 280px;
  line-height: 1.5;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  pointer-events: none;
  white-space: normal;
}

/* ── Survey Question Card ── */
.survey-q-card { transition: border-color var(--transition); }
.survey-q-card:hover { border-color: var(--border-hover); }

/* ── Segment Type Picker ── */
.seg-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.seg-type-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.seg-type-card:hover { border-color: var(--border-hover); background: var(--bg-elevated); }
.seg-type-selected { border-color: var(--primary) !important; background: var(--primary-glow) !important; }
.seg-type-selected::after {
  content: '✓'; position: absolute; top: 8px; right: 10px;
  width: 20px; height: 20px; background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.seg-type-icon { font-size: 28px; margin-bottom: 10px; }
.seg-type-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.seg-type-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

/* ── Segment Condition Builder ── */
.seg-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.seg-rule-field {
  min-width: 180px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
}
.seg-rule-field:focus { border-color: var(--primary); outline: none; }
.seg-rule-value { flex: 1; display: flex; gap: 8px; align-items: center; }
.seg-rule-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
}
.seg-rule-input:focus { border-color: var(--primary); outline: none; }

/* ── CSV Map Select ── */
.csv-map-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}
.csv-map-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }

/* ============================================
   MOBILE RESPONSIVE OVERHAUL
   ============================================ */

/* ── Custom Checkbox & Toggle ── */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  flex-shrink: 0;
  vertical-align: middle;
}
input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow-strong);
}
input[type="checkbox"]:hover:not(:checked) {
  border-color: rgba(255,255,255,0.4);
}

/* Light-mode checkboxes (in .pm- modals) */
.pm-field input[type="checkbox"],
.pulse-modal input[type="checkbox"] {
  border-color: #ccc;
  background: #fff;
}
.pm-field input[type="checkbox"]:checked,
.pulse-modal input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

/* ── Checkbox label rows (form-row style) ── */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.check-row label {
  font-size: 14px;
  color: var(--text-secondary, #7C7C8A);
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

/* ── Inline SVG icons in buttons ── */
.btn svg, button svg { vertical-align: middle; position: relative; top: -1px; }

/* ── Mobile drawer (full-width nav, replaces sidebar on mobile) ── */
.mobile-drawer {
  display: none; width: 280px; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 160;
  padding: 0;
}
.mobile-drawer .sidebar-logo {
  padding: 20px 20px 16px; font-size: 22px; font-weight: 900; color: var(--primary);
  letter-spacing: -0.5px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.mobile-drawer .sidebar-nav {
  flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto; scrollbar-width: thin;
}
.mobile-drawer .sidebar-footer {
  padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted);
}

/* ── Sidebar close button (mobile only) ── */
.sidebar-close-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card); cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
  flex-shrink: 0; padding: 0;
}
.sidebar-close-btn:hover { background: var(--bg-card-hover); color: var(--danger); border-color: var(--danger); }
@media (max-width: 768px) { .sidebar-close-btn { display: flex; } }

/* ── Mobile hamburger button ── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  transition: all 0.15s;
}
.mobile-menu-btn:hover { border-color: var(--primary); }
.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary, #EEEEF0);
  border-radius: 2px;
  transition: all 0.2s;
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar mobile overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Min touch target size ── */
.btn, button {
  min-height: 36px;
}
@media (max-width: 768px) {
  .btn, button {
    min-height: 44px;
  }
}

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  /* Hamburger visible */
  .mobile-menu-btn { display: flex; }

  /* Icon rail + flyout hidden on mobile */
  .icon-rail { display: none; }
  .flyout-panel { display: none; }
  .workspace-popover { display: none; }

  /* Mobile drawer */
  .mobile-drawer {
    display: flex !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    z-index: 160;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .mobile-drawer.mobile-open {
    transform: translateX(0);
  }

  /* Main content full width on mobile */
  .app-body { margin-left: 0 !important; }
  .main {
    padding: 64px 16px 24px;
  }

  /* Page header stacks */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Stats grid single column on tiny screens */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Tables scroll horizontally */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  table { min-width: 600px; }

  /* Modals full-width bottom sheet on mobile */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 20px 32px !important;
    animation: slideUpMobile 0.25s cubic-bezier(0.4,0,0.2,1) !important;
  }
  @keyframes slideUpMobile {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* Modal drag handle */
  .modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  /* Modal actions full-width */
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* Pulse modals (light) */
  .pulse-modal-overlay {
    align-items: flex-end !important;
    padding: 0;
  }
  .pulse-modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 20px 32px !important;
    animation: slideUpMobile 0.25s cubic-bezier(0.4,0,0.2,1) !important;
  }
  .pulse-modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
    margin: 0 auto 16px;
  }
  .pm-actions { flex-direction: column-reverse; gap: 8px; }
  .pm-actions .pm-cancel,
  .pm-actions .pm-submit { width: 100%; text-align: center; }

  /* Prompt modal */
  .pulse-prompt { width: calc(100% - 32px) !important; }
  .pulse-prompt-actions { flex-direction: column-reverse; gap: 8px; }
  .pulse-prompt-cancel,
  .pulse-prompt-ok { width: 100%; text-align: center; }

  /* Toolbar stacks */
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-input { max-width: 100% !important; width: 100%; }

  /* Template grid */
  .template-grid {
    grid-template-columns: 1fr !important;
  }

  /* Newsletter series grid */
  .newsletter-series-grid {
    grid-template-columns: 1fr !important;
  }

  /* Segment type grid */
  .seg-type-grid {
    grid-template-columns: 1fr !important;
  }

  /* Segment rule wraps */
  .seg-rule {
    flex-wrap: wrap;
  }
  .seg-rule-field { min-width: 100%; }

  /* Auth card */
  .auth-card {
    width: calc(100% - 32px) !important;
    margin: 16px !important;
    padding: 28px 20px !important;
  }

  /* Input sizes — bigger touch targets */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .pm-input,
  .search-input,
  .pulse-prompt-input {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px 14px !important;
  }

  /* Card padding tighter */
  .card { padding: 16px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value { font-size: 26px; }

  /* Page header title */
  .page-header h2 { font-size: 20px; }
}

/* ── Mobile: hide less important table columns ── */
@media (max-width: 768px) {
  /* Campaigns table (all): hide Type(2), Recipients(4), Opens(5), Clicks(6), Created(7) — keep Name, Status, Actions */
  .campaigns-table th:nth-child(2),
  .campaigns-table td:nth-child(2),
  .campaigns-table th:nth-child(4),
  .campaigns-table td:nth-child(4),
  .campaigns-table th:nth-child(5),
  .campaigns-table td:nth-child(5),
  .campaigns-table th:nth-child(6),
  .campaigns-table td:nth-child(6),
  .campaigns-table th:nth-child(7),
  .campaigns-table td:nth-child(7) { display: none !important; }

  /* Marketing table: hide Audience(3), Opens(4), CTR(5), Date(6) — keep Campaign, Status, Actions */
  .marketing-table th:nth-child(3),
  .marketing-table td:nth-child(3),
  .marketing-table th:nth-child(4),
  .marketing-table td:nth-child(4),
  .marketing-table th:nth-child(5),
  .marketing-table td:nth-child(5),
  .marketing-table th:nth-child(6),
  .marketing-table td:nth-child(6) { display: none !important; }

  /* Campaigns action buttons: icon-only on mobile */
  .campaigns-table .btn-sm,
  .marketing-table .btn-sm { padding: 6px 8px !important; font-size: 0 !important; }
  .campaigns-table .btn-sm svg,
  .marketing-table .btn-sm svg { font-size: initial; }

  /* Subscribers table: hide Tags(5), Subscribed(6) — keep Checkbox, Email, Name, Status, Actions */
  .subscribers-table th:nth-child(5),
  .subscribers-table td:nth-child(5),
  .subscribers-table th:nth-child(6),
  .subscribers-table td:nth-child(6) { display: none !important; }

  /* Team table: hide Email, Joined (keep Member, Role, Actions) */
  .team-table th:nth-child(2),
  .team-table td:nth-child(2),
  .team-table th:nth-child(4),
  .team-table td:nth-child(4) { display: none !important; }

  /* Dashboard: two-col to single col */
  .dash-two-col { grid-template-columns: 1fr !important; }
  .dash-stats-grid { grid-template-columns: 1fr 1fr !important; }

  /* Billing pricing grid: single column */
  .billing-pricing-grid { grid-template-columns: 1fr !important; }

  /* Modals: full width on mobile */
  .modal {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    margin: 16px !important;
    max-height: 85vh;
    overflow-y: auto;
  }

  /* Link in Bio: single column, hide preview */
  .lib-split-layout {
    grid-template-columns: 1fr !important;
  }
  .lib-preview-panel {
    display: none !important;
  }
  .lib-header { flex-wrap: wrap; gap: 8px; }
  .lib-header-actions { width: 100%; justify-content: flex-end; }

  /* Campaign editor: settings panel as bottom sheet on mobile */
  #campEditorShell > div:nth-child(2) {
    flex-direction: column !important;
  }
  #campSettingsPanel {
    width: 100% !important;
    max-height: 50vh;
    border-left: none !important;
    border-top: 1px solid #2a2a2a;
    overflow-y: auto !important;
  }
  #campSettingsPanel > div {
    width: 100% !important;
  }

  /* Campaign editor top bar: wrap on mobile */
  #campEditorShell > div:first-child {
    flex-wrap: wrap;
    height: auto !important;
    padding: 8px 12px !important;
    gap: 6px !important;
  }
  #campEditorShell #campName {
    min-width: 100% !important;
    order: -1;
  }

  /* Analytics charts full width */
  .analytics-chart { width: 100% !important; }

  /* Bulk action bar: stack vertically */
  #bulkActionBar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  #bulkActionBar .btn { width: 100%; justify-content: center; }

  /* Body no scroll when sidebar open */
  body.sidebar-open { overflow: hidden !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .dash-stats-grid { grid-template-columns: 1fr !important; }
  .main { padding: 64px 12px 24px; }
}

/* Page fade-in transition */
.page-entering { animation: pageEnter 150ms ease forwards; }
@keyframes pageEnter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================
   GLOBAL UTILITY CLASSES — UI Overhaul
   ============================================ */

/* ── Glassmorphism Card ── */
.glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: all var(--transition);
}
.glass-card:hover {
  border-color: var(--primary-glow-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-2px);
}
[data-theme="light"] .glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.5));
  border-color: rgba(0,0,0,0.06);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,1);
}

/* ── Avatar Initial Circle ── */
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
  text-transform: uppercase;
}
.avatar-circle-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-circle-lg { width: 40px; height: 40px; font-size: 16px; }

/* ── Count Badge ── */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 99px; font-size: 11px; font-weight: 700;
  background: var(--primary-glow); color: var(--primary);
}

/* ── Page Title Row ── */
.page-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title-row h2 {
  font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin: 0;
}
.page-title-row .subtitle {
  color: var(--text-secondary); font-size: 13px; margin-top: 3px;
}
.page-title-row .actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* ── Stat Chip (inline number pill) ── */
.stat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.04); color: var(--text-secondary);
}
.stat-chip-success { background: var(--success-bg); color: var(--success); }
.stat-chip-primary { background: var(--primary-glow); color: var(--primary); }
.stat-chip-warning { background: var(--warning-bg); color: var(--warning); }
.stat-chip-danger { background: var(--danger-bg); color: var(--danger); }

/* ── Card Hover Lift ── */
.card-lift { transition: all 0.2s ease; }
.card-lift:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }

/* ── Trend Indicator ── */
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ── Activity Dot ── */
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ── Section Divider ── */
.section-divider {
  height: 1px; background: var(--border); margin: 24px 0;
}

/* ── Smooth Scroll ── */
.main { scroll-behavior: smooth; }

/* ── Search Bar Full Width ── */
.search-bar-full {
  width: 100%; padding: 11px 16px 11px 42px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--text-primary);
  outline: none; font-family: inherit; transition: all var(--transition);
}
.search-bar-full:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-bar-full::placeholder { color: var(--text-muted); }
.search-bar-wrap {
  position: relative; margin-bottom: 16px;
}
.search-bar-wrap .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}

/* ── Filter Chip Row ── */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px;
}
.filter-chip {
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--text-primary); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Settings Section ── */
.settings-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
}
.settings-section h3 {
  font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--text-primary);
}
.settings-section .section-desc {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 20px;
}
.settings-section-danger {
  border-color: var(--danger-bg);
}
.settings-section-danger h3 { color: var(--danger); }

/* ── Integration Card ── */
.integration-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; transition: all var(--transition);
}
.integration-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.integration-card .integration-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.integration-card .integration-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.integration-card .integration-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; margin-bottom: 14px;
}

/* ── Usage Bar ── */
.usage-bar-wrap { margin-bottom: 16px; }
.usage-bar-label {
  display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px;
}
.usage-bar-label span:first-child { color: var(--text-secondary); font-weight: 500; }
.usage-bar-label span:last-child { color: var(--text-primary); font-weight: 700; }
.usage-bar {
  height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden;
}
.usage-bar-fill {
  height: 100%; border-radius: 4px; transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.usage-bar-fill.warning { background: linear-gradient(90deg, var(--warning), var(--accent)); }
.usage-bar-fill.danger { background: linear-gradient(90deg, var(--danger), #f87171); }

/* ── Dashboard Stat Cards ── */
.dash-stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; display: flex; align-items: flex-start; gap: 14px;
  transition: border-color var(--transition);
}
.dash-stat-card:hover { border-color: var(--primary); }
.dash-stat-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary-glow);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dash-stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.dash-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* ── Dashboard Quick Action Buttons ── */
.dash-quick-action {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary); font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: border-color var(--transition), background var(--transition);
}
.dash-quick-action:hover { border-color: var(--primary); background: var(--bg-card); }

/* ── Newsletter Series Stat Cards (summary row) ── */
.ns-stat-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; display: flex; align-items: center; gap: 16px;
  transition: all var(--transition);
}
.ns-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.ns-stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ns-stat-value { font-size: 32px; font-weight: 400; color: var(--text-primary); line-height: 1; letter-spacing: -0.5px; font-family: var(--font-serif); }
.ns-stat-label { font-size: 12px; color: var(--text-secondary); }

/* ── Card Hover Border Effect (CSS-only) ── */
.ns-card:hover { border-color: var(--ns-accent, var(--primary)); transform: translateY(-1px); }

/* ── Table Row Hover States (CSS-only) ── */
.table-container table tbody tr { transition: background 0.1s; cursor: pointer; }
.table-container table tbody tr:hover { background: rgba(255,255,255,0.03); }
[data-theme='light'] .table-container table tbody tr:hover { background: rgba(0,0,0,0.03); }

/* ── Modal Close Button ── */
.modal-close-btn {
  position: absolute; top: 16px; right: 16px;
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition); padding: 0;
}
.modal-close-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }
.modal { position: relative; }

/* ── Campaign Actions Dropdown ── */
.campaign-primary-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; border: none; transition: all var(--transition);
}
.campaign-primary-action.send { background: var(--primary); color: #fff; }
.campaign-primary-action.send:hover { background: var(--primary-dark); }
.campaign-primary-action.report { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.campaign-primary-action.report:hover { border-color: var(--border-hover); }
.campaign-more-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition); padding: 0;
}
.campaign-more-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); color: var(--text-primary); }

/* ── Form Error + Disabled States ── */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--danger); }
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus { box-shadow: 0 0 0 2px var(--danger-bg); }
.form-error-msg { font-size: 12px; color: var(--danger); margin-top: 4px; }
.btn:disabled, .btn.btn-disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

/* === Link-in-Bio Editor === */

/* Empty state */
.lib-empty-state {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  min-height: 70vh; text-align: center; max-width: 400px; margin: 0 auto;
}
.lib-empty-icon {
  width: 64px; height: 64px; margin: 0 auto 20px; background: var(--bg-card);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}

/* Header bar */
.lib-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 16px; gap: 12px;
}
.lib-header-left { display: flex; align-items: center; gap: 12px; }
.lib-header-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #065f5f);
  display: flex; align-items: center; justify-content: center;
}
.lib-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lib-header-avatar span { font-size: 16px; font-weight: 700; color: #fff; }
.lib-header-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.lib-header-slug { font-size: 12px; font-family: monospace; color: var(--primary); margin-top: 2px; }
.lib-header-actions { display: flex; gap: 8px; align-items: center; }
.lib-header-btn { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* Save button with dirty dot */
.lib-save-btn { position: relative; }
.lib-dirty-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f97316;
  position: absolute; top: -2px; right: -2px;
  animation: lib-pulse 1.5s infinite;
}
@keyframes lib-pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}

/* Split layout */
.lib-split-layout {
  display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 1279px) {
  .lib-split-layout { grid-template-columns: 380px 1fr; gap: 16px; }
}

/* Editor panel (left) */
.lib-editor-panel {
  background: var(--bg-card); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
}

/* Tab bar */
.lib-tab-bar {
  display: flex; border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.lib-tab-btn {
  flex: 1; padding: 12px 8px; border: none; background: transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s; position: relative; font-family: inherit;
}
.lib-tab-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.02); }
.lib-tab-btn.active { color: var(--text-primary); }
.lib-tab-btn.active::after {
  content: ''; position: absolute; bottom: -1px; left: 12px; right: 12px;
  height: 2px; background: var(--primary); border-radius: 2px 2px 0 0;
}

/* Tab panels */
.lib-tab-panel { display: none; padding: 16px; overflow-y: auto; max-height: calc(100vh - 180px); }
.lib-tab-panel.active { display: block; }

/* Section styling */
.lib-section { margin-bottom: 20px; }
.lib-section-title {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.06em; font-weight: 600; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

/* Fields */
.lib-field { margin-bottom: 12px; }
.lib-label {
  font-size: 12px; color: var(--text-secondary); display: block;
  margin-bottom: 6px; font-weight: 500;
}
.lib-input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; outline: none; font-family: inherit;
  box-sizing: border-box; transition: border-color 0.15s;
}
.lib-input:focus { border-color: var(--primary); }
.lib-input-mono { font-family: monospace; font-size: 12px; }
textarea.lib-input { resize: vertical; }

/* Avatar preview */
.lib-avatar-preview {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-input);
  flex-shrink: 0; overflow: hidden; border: 1px solid var(--border);
}
.lib-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Slug display */
.lib-slug-display {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-input); border-radius: 8px; border: 1px solid var(--border);
}
.lib-slug-prefix { font-size: 13px; color: var(--text-muted); font-family: monospace; }
.lib-slug-value { font-size: 13px; color: var(--primary); font-family: monospace; font-weight: 600; }
.lib-slug-copy {
  margin-left: auto; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 4px; transition: color 0.15s;
}
.lib-slug-copy:hover { color: var(--text-primary); }

/* Toggle row */
.lib-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  font-size: 13px; color: var(--text-primary);
}

/* Switch toggle */
.lib-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer;
}
.lib-switch input { opacity: 0; width: 0; height: 0; }
.lib-switch-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #333; border-radius: 24px; transition: 0.3s;
}
.lib-switch-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s;
}
.lib-switch input:checked + .lib-switch-slider { background: var(--primary); }
.lib-switch input:checked + .lib-switch-slider::before { transform: translateX(20px); }

/* Theme grid */
.lib-theme-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.lib-theme-card {
  border: 2px solid var(--border); border-radius: 10px; cursor: pointer;
  padding: 4px; transition: all 0.15s; position: relative; overflow: hidden;
}
.lib-theme-card:hover { border-color: var(--border-hover); }
.lib-theme-card.active { border-color: var(--primary); }
.lib-theme-preview {
  width: 100%; height: 48px; border-radius: 6px; position: relative;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
}
.lib-theme-accent {
  width: 20px; height: 4px; border-radius: 2px; opacity: 0.8;
}
.lib-theme-label {
  font-size: 11px; color: var(--text-secondary); text-align: center;
  padding: 4px 0 2px; font-weight: 500;
}
.lib-theme-checkmark {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  background: var(--primary-glow-strong); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Collapsible sections */
.lib-collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 0; border: none; background: transparent;
  color: var(--text-secondary); font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.lib-collapsible-header svg { transition: transform 0.2s; }
.lib-collapsible-header.open svg { transform: rotate(180deg); }
.lib-collapsible-body {
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.lib-collapsible-body.open { max-height: 300px; }

/* Color row */
.lib-color-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px;
}
.lib-color-dot {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  transition: box-shadow 0.15s; border: 2px solid transparent;
}
.lib-color-dot:hover { box-shadow: 0 0 0 2px rgba(255,255,255,0.1); }
.lib-color-dot.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary); }
.lib-color-dot-light { border-color: #444; }
.lib-color-dot-light.active { border-color: var(--primary); }
.lib-color-picker {
  width: 24px; height: 24px; border: none; border-radius: 50%;
  cursor: pointer; padding: 0; background: transparent;
}

/* Segment control */
.lib-segment {
  display: flex; background: var(--bg-input); border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border);
}
.lib-segment > * {
  flex: 1; padding: 8px 0; text-align: center; cursor: pointer;
  transition: all 0.15s; border: none; background: transparent;
  color: var(--text-muted); font-size: 12px; font-family: inherit;
}
.lib-segment > *:not(:last-child) { border-right: 1px solid var(--border); }
.lib-segment > *.active { background: var(--primary); color: #fff; }

/* Font picker */
.lib-font-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.lib-font-option {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text-secondary);
  transition: all 0.15s; text-align: center;
}
.lib-font-option:hover { border-color: var(--border-hover); color: var(--text-primary); }
.lib-font-option.active { border-color: var(--primary); color: var(--primary); background: var(--primary-glow-soft); }

/* Blocks header */
.lib-blocks-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.lib-blocks-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.lib-add-block-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: transparent; border: 1px solid var(--primary); color: var(--primary);
  border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.lib-add-block-btn:hover { background: var(--primary-alpha); }

/* Empty blocks state */
.lib-empty-blocks {
  text-align: center; padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.lib-empty-blocks-title { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.lib-empty-blocks-desc { font-size: 12px; color: var(--text-muted); }
.lib-add-first-btn {
  margin-top: 8px; padding: 10px 24px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.lib-add-first-btn:hover { background: #0b9d9d; }

/* Block cards */
.lib-block-card {
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px;
  transition: all 0.15s; overflow: hidden; background: var(--bg-elevated);
}
.lib-block-card:hover { border-color: var(--border-hover); }
.lib-block-card.editing { border-left: 3px solid var(--primary); background: var(--primary-glow-soft); }
.lib-block-card.disabled { opacity: 0.5; }
.lib-block-card.dragging { opacity: 0.4; }

.lib-block-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  cursor: pointer; min-height: 52px; box-sizing: border-box;
}
.lib-block-header:hover .lib-block-actions { opacity: 1; }
.lib-block-header:hover .lb-drag-handle { opacity: 1; }

.lb-drag-handle {
  cursor: grab; color: var(--text-muted); flex-shrink: 0; touch-action: none;
  opacity: 0; transition: opacity 0.15s; width: 10px;
  display: flex; align-items: center; justify-content: center;
}
.lb-drag-handle:hover { color: var(--text-secondary); }
.lb-drag-handle:active { cursor: grabbing; }

.lib-block-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--primary-alpha); display: flex;
  align-items: center; justify-content: center; color: var(--primary);
}
.lib-block-icon.faded { opacity: 0.4; }

.lib-block-info { flex: 1; min-width: 0; }
.lib-block-label {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-block-subtitle {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lib-block-status { font-size: 12px; flex-shrink: 0; }

.lib-block-actions {
  display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; flex-shrink: 0;
}
.lib-block-action-btn {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text-muted); border-radius: 6px; transition: all 0.15s;
}
.lib-block-action-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.lib-block-delete-btn:hover { color: var(--danger); background: var(--danger-bg); }

.lib-block-chevron {
  flex-shrink: 0; color: var(--text-muted); transition: transform 0.2s;
}
.lib-block-card.editing .lib-block-chevron { transform: rotate(180deg); }

/* Block accordion body */
.lib-block-body {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
}
.lib-block-body:not(:empty) {
  padding: 0 12px 12px; border-top: 1px solid var(--border);
}

/* Block form actions */
.lib-block-form-actions {
  display: flex; gap: 8px; margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.lib-block-save-btn {
  flex: 1; background: var(--primary); border: none; color: #fff; border-radius: 8px;
  padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.15s;
}
.lib-block-save-btn:hover { background: #0b9d9d; }
.lib-block-form-delete {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 8px; padding: 10px 14px; cursor: pointer; font-family: inherit;
  transition: all 0.15s; display: flex; align-items: center;
}
.lib-block-form-delete:hover { border-color: var(--danger); color: var(--danger); }

/* Drag placeholder */
.lib-drag-placeholder {
  height: 3px; background: var(--primary); border-radius: 2px; margin: 4px 0;
}

/* Preview panel */
.lib-preview-panel {
  position: sticky; top: 20px;
}
.lib-preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.lib-preview-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
}
.lib-preview-dot {
  width: 8px; height: 8px; background: var(--success); border-radius: 50%;
  animation: lib-pulse 2s infinite;
}
.lib-preview-actions { display: flex; gap: 4px; }
.lib-preview-toggle-btn,
.lib-preview-refresh-btn {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 8px; padding: 6px 8px; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center;
}
.lib-preview-toggle-btn:hover,
.lib-preview-refresh-btn:hover {
  border-color: var(--border-hover); color: var(--text-primary);
}

/* Spinning refresh */
.lib-spinning svg { animation: lib-spin 0.8s linear infinite; }
@keyframes lib-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Preview device frame */
.lib-preview-frame {
  display: flex; justify-content: center;
}
.lib-preview-device {
  background: var(--bg); border-radius: 28px; padding: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); transition: width 0.3s ease, max-width 0.3s ease;
}
.lib-device-notch {
  width: 4px; height: 4px; background: var(--text-muted); border-radius: 50%;
  margin: 0 auto 8px;
}
.lib-device-screen {
  background: #fff; border-radius: 18px; overflow: hidden; height: 600px;
}
.lib-device-home {
  width: 40px; height: 4px; background: #333; border-radius: 2px;
  margin: 8px auto 0;
}

/* Preview URL bar */
.lib-preview-url {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 10px; font-size: 12px; font-family: monospace;
  color: var(--text-muted);
}
.lib-preview-url button {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; border-radius: 4px; transition: color 0.15s;
}
.lib-preview-url button:hover { color: var(--text-primary); }

/* Block picker modal */
.lib-picker-header { margin-bottom: 16px; }
.lib-picker-header h2 { margin: 0 0 4px; color: var(--text-primary); font-size: 18px; }
.lib-picker-header p { margin: 0; color: var(--text-muted); font-size: 13px; }
.lib-picker-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.lib-picker-card {
  padding: 14px 8px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.lib-picker-card:hover {
  border-color: var(--primary); background: var(--primary-glow-soft);
  transform: translateY(-1px);
}
.lib-picker-icon {
  width: 40px; height: 40px; margin: 0 auto 8px; border-radius: 10px;
  background: var(--primary-alpha); display: flex;
  align-items: center; justify-content: center; color: var(--primary);
}
.lib-picker-name {
  font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px;
}
.lib-picker-desc {
  font-size: 10px; color: var(--text-muted); line-height: 1.3;
}

/* ============================================
   NUDGE BANNERS
   ============================================ */
.nudge-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  margin-bottom: 20px; animation: nudgeFadeIn 0.3s ease;
}
@keyframes nudgeFadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.nudge-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nudge-content { flex: 1; min-width: 0; }
.nudge-headline { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.nudge-body { font-size: 13px; color: var(--text-secondary); margin-left: 8px; }
.nudge-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nudge-cta { white-space: nowrap; }
.nudge-dismiss {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 18px; padding: 4px 6px; border-radius: 6px; line-height: 1;
  transition: color var(--transition);
}
.nudge-dismiss:hover { color: var(--text-primary); }
.nudge-warning { border-color: var(--warning-bg); background: rgba(232, 176, 74, 0.04); }
.nudge-tip { border-color: var(--primary-glow-strong); background: var(--primary-glow-soft); }
.nudge-success { border-color: var(--success-bg); background: rgba(127, 184, 122, 0.04); }
.nudge-info { border-color: var(--info-bg); background: rgba(140, 184, 245, 0.04); }
@media (max-width: 600px) {
  .nudge-banner { flex-wrap: wrap; gap: 10px; }
  .nudge-body { display: block; margin-left: 0; margin-top: 2px; }
}

/* ============================================
   FORMS STATS ROW (3-card mini dashboard)
   ============================================ */
.forms-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px;
}
.forms-stat-card {
  padding: 18px 20px; text-align: center;
}
.forms-stat-value {
  font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1.1;
}
.forms-stat-label {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px; font-weight: 500;
}
@media (max-width: 600px) {
  .forms-stats-row { grid-template-columns: 1fr; }
}

/* ============================================
   FORM CARD — Progressive Disclosure
   ============================================ */
.form-card .form-card-expanded {
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.form-card:hover .form-card-expanded {
  max-height: 140px;
}

/* ============================================
   FORM SMELL CHIPS
   ============================================ */
.smell-chip {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}
.smell-warning { background: var(--warning-bg); color: var(--warning); }
.smell-danger { background: var(--danger-bg); color: var(--danger); }
.smell-muted { background: var(--border); color: var(--text-muted); }

/* ============================================
   FORM PREVIEW PANEL (slide-in)
   ============================================ */
.form-preview-panel {
  position: fixed; top: 0; right: -380px; width: 360px; height: 100vh;
  background: var(--bg-card); border-left: 1px solid var(--border);
  z-index: 1100; display: flex; flex-direction: column;
  transition: right 0.3s ease; box-shadow: var(--shadow-lg);
}
.form-preview-panel.open { right: 0; }
.form-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.form-preview-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1099; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.form-preview-overlay.open { opacity: 1; pointer-events: auto; }

/* ============================================
   FORM TABS
   ============================================ */
.form-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; background: var(--bg-elevated);
  padding: 0 4px; margin-bottom: 24px;
}
.form-tab {
  padding: 14px 20px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; transition: all var(--transition);
  white-space: nowrap; font-family: inherit;
}
.form-tab:hover { color: var(--text-secondary); }
.form-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.form-tab-content { display: none; animation: formTabFadeIn 0.2s ease; }
.form-tab-content.active { display: block; }
@keyframes formTabFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================
   FORM SETTINGS — 2-column layout
   ============================================ */
.form-settings-grid {
  display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 900px) {
  .form-settings-grid { grid-template-columns: 1fr; }
}
.form-settings-left { overflow-y: auto; max-height: calc(100vh - 140px); }
.form-settings-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.form-settings-section h4 {
  font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

/* Form type pills */
.form-type-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.form-type-pill {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; background: none;
  color: var(--text-secondary); transition: all var(--transition); font-family: inherit;
}
.form-type-pill:hover { border-color: var(--primary); color: var(--primary); }
.form-type-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Status toggle */
.form-status-toggle {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.form-status-track {
  width: 48px; height: 26px; border-radius: 13px; background: var(--border);
  position: relative; transition: background var(--transition);
}
.form-status-track.active { background: var(--primary); }
.form-status-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  position: absolute; top: 2px; left: 2px; transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.form-status-track.active .form-status-thumb { transform: translateX(22px); }
.form-status-label { font-size: 14px; font-weight: 600; }

/* Color swatches */
.color-swatch-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent;
  cursor: pointer; transition: all var(--transition); position: relative;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--primary); }
.color-swatch-custom {
  width: 32px; height: 32px; border-radius: 8px; border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-muted); font-size: 16px; transition: all var(--transition);
}
.color-swatch-custom:hover { border-color: var(--primary); color: var(--primary); }
.color-hex-input {
  width: 90px; font-size: 13px; padding: 6px 8px; border-radius: var(--radius-xs);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
  font-family: monospace;
}

/* Field rows (draggable) */
.form-field-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: var(--bg-card); cursor: grab;
  transition: all var(--transition);
}
.form-field-row:hover { border-color: var(--border-hover); }
.form-field-row.dragging { opacity: 0.5; }
.form-field-row .field-icon {
  color: var(--text-muted); flex-shrink: 0; cursor: grab;
}
.form-field-row .field-name { flex: 1; font-size: 14px; font-weight: 500; }
.form-field-row .field-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 4px; transition: color var(--transition);
}
.form-field-row .field-remove:hover { color: var(--danger); }

/* Tag input */
.tag-input-container {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); min-height: 42px; align-items: center;
}
.tag-input-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--primary-glow); color: var(--primary); cursor: pointer;
}
.tag-input-tag:hover { background: var(--primary-glow-strong); }
.tag-input-field {
  border: none; background: none; color: var(--text-primary); font-size: 13px;
  outline: none; min-width: 100px; flex: 1; font-family: inherit;
}

/* Char counter */
.char-counter {
  font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 2px;
}
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--danger); }

/* ============================================
   FORM LIVE PREVIEW
   ============================================ */
.form-preview-container {
  position: sticky; top: 80px; width: 100%; max-width: 380px;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
}
.form-preview-device-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.form-preview-device-btn {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: none; color: var(--text-muted); cursor: pointer; font-size: 14px;
  transition: all var(--transition); font-family: inherit;
}
.form-preview-device-btn:hover { color: var(--text-primary); }
.form-preview-device-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.form-preview-render {
  padding: 20px; min-height: 300px; display: flex; align-items: flex-start;
  justify-content: center; overflow: auto; transition: all 0.2s ease;
}
.form-preview-inner {
  background: #fff; border-radius: 8px; padding: 24px; width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: max-width 0.2s ease;
}
.form-preview-inner h3 { color: #111827; margin: 0 0 4px; }
.form-preview-inner p { color: #6b7280; font-size: 14px; margin: 0 0 16px; line-height: 1.5; }
.form-preview-inner input {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 14px; margin-bottom: 10px; box-sizing: border-box;
  font-family: inherit;
}
.form-preview-inner .preview-btn {
  width: 100%; padding: 12px; border: none; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: default; color: #fff;
}
.form-preview-share-btn {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: none; color: var(--text-secondary); cursor: pointer; font-size: 12px;
  font-family: inherit; transition: all var(--transition);
}
.form-preview-share-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ============================================
   FORM DASHBOARD — Filter bar
   ============================================ */
.forms-filter-bar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap;
}
.forms-filter-bar input[type="text"] {
  flex: 1; min-width: 180px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
}
.forms-filter-bar select {
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
  font-size: 13px; font-family: inherit; cursor: pointer;
}

/* ============================================
   FORM CARD — Redesigned
   ============================================ */
.form-card-new {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all var(--transition); position: relative;
}
.form-card-new:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.form-card-body { padding: 18px 20px; }
.form-card-badges { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.form-card-perf {
  position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}
.form-card-perf.gold { background: var(--warning-bg); color: var(--warning); }
.form-card-perf.green { background: var(--success-bg); color: var(--success); }
.form-card-perf.yellow { background: var(--warning-bg); color: var(--warning); }
.form-card-perf.red { background: var(--danger-bg); color: var(--danger); }
.form-card-perf.gray { background: var(--border); color: var(--text-muted); }
.form-card-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.form-card-desc {
  font-size: 12px; color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; margin-bottom: 14px;
}
.form-card-metrics {
  display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary);
  padding-top: 12px; border-top: 1px solid var(--border); align-items: center;
}
.form-card-sparkline { margin-left: auto; }
.form-card-actions {
  display: flex; gap: 4px; padding: 8px 20px 14px; border-top: 1px solid var(--border);
}
.form-card-more {
  position: relative; display: inline-block;
}
.form-card-dropdown {
  position: absolute; bottom: 100%; right: 0; min-width: 160px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 100; display: none; overflow: hidden;
}
.form-card-dropdown.open { display: block; }
.form-card-dropdown button {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  border: none; background: none; color: var(--text-primary); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: background var(--transition);
}
.form-card-dropdown button:hover { background: var(--bg-card-hover); }
.form-card-dropdown button.danger { color: var(--danger); }

/* ============================================
   FORM ANALYTICS — Charts
   ============================================ */
.form-analytics-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.form-analytics-summary .stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; text-align: center;
}
.form-analytics-summary .stat-value {
  font-size: 26px; font-weight: 800; color: var(--text-primary);
}
.form-analytics-summary .stat-label {
  font-size: 12px; color: var(--text-secondary); margin-top: 2px;
}
.form-period-selector {
  display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 20px;
}
.form-period-btn {
  padding: 8px 16px; border: none; background: none; color: var(--text-secondary);
  cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit;
  transition: all var(--transition);
}
.form-period-btn:hover { color: var(--text-primary); }
.form-period-btn.active { background: var(--primary); color: #fff; }
.form-chart-container {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px; overflow-x: auto;
}
.form-breakdown-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px;
}
.form-breakdown-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px;
}
.form-breakdown-card h5 {
  font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px;
}
.form-breakdown-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-secondary); padding: 4px 0;
}
@media (max-width: 768px) {
  .form-analytics-summary { grid-template-columns: repeat(2, 1fr); }
  .form-breakdown-row { grid-template-columns: 1fr; }
}

/* ============================================
   FORM SUBMISSIONS TABLE
   ============================================ */
.form-sub-search {
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
  font-size: 14px; width: 280px; margin-bottom: 16px; font-family: inherit;
}
.form-sub-status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.form-sub-status.confirmed { background: var(--success-bg); color: var(--success); }
.form-sub-status.pending { background: var(--warning-bg); color: var(--warning); }
.form-sub-status.unsubscribed { background: var(--border); color: var(--text-muted); }
.form-sub-detail-row {
  background: var(--bg-elevated); border-top: 1px solid var(--border);
}
.form-sub-detail-row td {
  padding: 12px 16px; font-size: 13px; color: var(--text-secondary);
}
.form-sub-pagination {
  display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px;
}

/* ============================================
   FORM EMBED TAB
   ============================================ */
.form-embed-code {
  background: #1a1a2e; border-radius: var(--radius-sm); padding: 16px 20px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 13px;
  color: #a8b2d1; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
  overflow-x: auto; border: 1px solid rgba(255,255,255,0.06);
}
.form-embed-steps {
  display: flex; flex-direction: column; gap: 16px; margin: 20px 0;
}
.form-embed-step {
  display: flex; align-items: flex-start; gap: 14px;
}
.form-embed-step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-glow);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.form-embed-step-text { font-size: 14px; color: var(--text-secondary); padding-top: 4px; }

/* ============================================
   GLOBAL INPUT MODERNIZATION
   ============================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="date"],
input[type="time"],
textarea {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  outline: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
input[type="text"]:not(textarea),
input[type="email"]:not(textarea),
input[type="password"]:not(textarea),
input[type="number"]:not(textarea),
input[type="url"]:not(textarea),
input[type="tel"]:not(textarea),
input[type="search"]:not(textarea),
input[type="date"]:not(textarea),
input[type="time"]:not(textarea) {
  height: 40px !important;
  padding: 0 14px !important;
}
textarea {
  padding: 10px 14px !important;
  resize: vertical !important;
  line-height: 1.6 !important;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  background: var(--bg-elevated) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-muted) !important; }
input:disabled, textarea:disabled { opacity: 0.5 !important; cursor: not-allowed !important; }

select:not([class*="custom"]) {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  height: 40px !important;
  padding: 0 36px 0 14px !important;
  outline: none !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  box-sizing: border-box !important;
  width: 100% !important;
}
select:focus:not([class*="custom"]) {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

/* Light theme: ensure dark text on light bg */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="url"],
[data-theme="light"] input[type="tel"],
[data-theme="light"] textarea,
[data-theme="light"] select:not([class*="custom"]) {
  color: var(--text-primary) !important;
  background: var(--bg-input) !important;
}

/* Catch inputs without explicit type attribute (defaults to text) */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]) {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  height: 40px !important;
  padding: 0 14px !important;
  outline: none !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  background: var(--bg-elevated) !important;
}

/* Chrome autofill override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  caret-color: var(--text-primary) !important;
}

/* ── Custom Dropdown (replaces native <select> popup) ── */
.sendra-dropdown {
  position: relative; display: inline-block; user-select: none;
}
.sendra-dropdown-trigger {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); padding: 6px 10px;
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; font-family: inherit; transition: all var(--transition);
  white-space: nowrap; min-width: 80px; height: 28px;
}
.sendra-dropdown-trigger:hover { border-color: var(--border-hover); color: var(--text-primary); }
.sendra-dropdown-trigger.open { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.sendra-dropdown-chevron {
  margin-left: auto; transition: transform 0.2s ease;
  width: 10px; height: 10px; flex-shrink: 0;
}
.sendra-dropdown-trigger.open .sendra-dropdown-chevron { transform: rotate(180deg); }
.sendra-dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
  box-shadow: var(--shadow-lg); z-index: var(--z-tooltip);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.sendra-dropdown-menu.visible {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.sendra-dropdown-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-xs);
  font-size: 13px; color: var(--text-primary); cursor: pointer;
  transition: background 0.1s ease; white-space: nowrap;
}
.sendra-dropdown-option:hover { background: var(--primary-glow); color: var(--primary); }
.sendra-dropdown-option.selected { color: var(--primary); font-weight: 600; }
.sendra-dropdown-option.selected::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); margin-left: auto; flex-shrink: 0;
}

/* ── Focus-Visible (keyboard accessibility) ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ── Light Theme Toast Overrides ── */
[data-theme="light"] {
  --toast-bg: #f0f4f8;
  --toast-success-bg: #ecfdf5;
  --toast-error-bg: #fef2f2;
  --toast-info-bg: #f0f4f8;
}
[data-theme="light"] .toast .toast-msg { color: #111827; }
[data-theme="light"] .toast .toast-close { color: rgba(0,0,0,0.4); }
[data-theme="light"] .toast .toast-close:hover { color: #111827; }

/* ── Tablet Breakpoint ── */
@media (max-width: 1024px) {
  .page-header { flex-direction: column; gap: 12px; }
  .page-header .btn { width: 100%; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── Small Mobile Breakpoint ── */
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 20px; }
  .card { padding: 16px; }
  .table-container { font-size: 12px; }
  .table-container th, .table-container td { padding: 8px 10px; }
  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { max-width: 100%; min-width: auto; }
}

/* ============================================
   EDITORIAL DASHBOARD (v2 — warm dark)
   ============================================ */

.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.dash-kicker {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.dash-greeting {
  font-size: 44px;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text-primary);
  margin: 0;
  font-weight: 400;
}
.dash-greeting em { font-style: italic; color: var(--accent); }
.dash-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Primary + ghost buttons — pill shape, editorial feel */
.btn-primary {
  background: var(--text-primary);
  color: var(--bg);
  border-radius: 99px;
  padding: 11px 18px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(245, 239, 226, 0.15);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 8px 24px rgba(42, 37, 32, 0.15);
}
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
  border-radius: 99px;
  padding: 11px 18px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-card-hover); }
.btn-brand {
  background: var(--primary);
  color: #0D1512;
  border-radius: 99px;
  padding: 11px 18px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-brand:hover {
  transform: translateY(-1px);
  background: var(--primary-light);
  box-shadow: 0 8px 24px var(--primary-glow-strong);
}

/* Stat cards */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.dash-stat-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.dash-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.dash-stat-card::after {
  content: '';
  position: absolute;
  top: -40%; right: -40%;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.dash-stat-card:hover::after { opacity: 1; }
.dash-stat-card .stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.dash-stat-card .stat-value {
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.dash-stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}
.dash-stat-card .stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  padding: 3px 8px;
  border-radius: 99px;
}

/* Hero accent block */
.hero-accent {
  background: linear-gradient(135deg, #1F3532 0%, #182522 100%);
  border: 1px solid var(--primary-glow-strong);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  position: relative;
  overflow: hidden;
}
.hero-accent::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 180, 176, 0.18), transparent 70%);
}
[data-theme="light"] .hero-accent {
  background: linear-gradient(135deg, #E6F2F1 0%, #F0F7F6 100%);
  border-color: var(--primary-glow-strong);
  color: var(--text-primary);
}

/* Quick actions */
.quick-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.quick-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.quick-action .qa-left { display: flex; align-items: center; gap: 14px; }
.quick-action .qa-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quick-action .qa-text { display: flex; flex-direction: column; gap: 2px; }
.quick-action .qa-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.quick-action .qa-desc { font-size: 11.5px; color: var(--text-muted); font-weight: 400; }

/* Activity items */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-item .activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}
.activity-item .activity-dot-info { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.activity-item .activity-dot-muted { background: var(--text-muted); box-shadow: 0 0 0 3px var(--border); }
.activity-item .activity-body { flex: 1; min-width: 0; }
.activity-item .activity-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-item .activity-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-greeting { font-size: 36px; }
}
@media (max-width: 600px) {
  .dash-stats-grid { grid-template-columns: 1fr; }
  .dash-greeting { font-size: 28px; }
  .dash-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================
   EDITORIAL PAGE HEADER (shared across pages)
   ============================================ */

.page-header-editorial {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.page-title {
  font-size: 40px;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text-primary);
  margin: 0 0 6px;
  font-weight: 400;
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 540px;
}
.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .page-header-editorial { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 30px; }
}

/* ==========================================================================
   Social Overview — skeleton loaders + sticky quick-action bar (Phase 6 T2)
   ========================================================================== */

@keyframes ovShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.ov-skel {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.03) 100%);
  background-size: 200% 100%;
  animation: ovShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: block;
}

.ov-skel-line        { height: 12px; margin-bottom: 8px; }
.ov-skel-line.short  { width: 40%; }
.ov-skel-line.medium { width: 65%; }
.ov-skel-line.long   { width: 90%; }
.ov-skel-chip        { height: 64px; border-radius: 12px; }
.ov-skel-row         { height: 48px; border-radius: 8px; margin-bottom: 10px; }

.ov-action-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(to bottom,
    var(--bg) 0%,
    var(--bg) 70%,
    transparent 100%);
  padding: 12px 0;
  margin-bottom: 8px;
}

.ov-row {
  transition: background-color .12s ease, transform .12s ease;
  padding: 10px 8px;
  border-radius: 6px;
  margin: 0 -8px;
}
.ov-row:hover { background: rgba(255,255,255,0.03); }
.ov-row.clickable { cursor: pointer; }
.ov-row.clickable:hover { transform: translateX(2px); }

/* ==========================================================================
   Social Inbox — responsive 3-col grid (Phase 7 inbox polish A1+A3)
   ========================================================================== */

.inbox-sidebar { align-self: flex-start; }

/* Tablet: fold saved-replies column below the list */
@media (max-width: 1200px) {
  .inbox-grid { grid-template-columns: 220px 1fr !important; }
  .inbox-saved { grid-column: 1 / -1; }
}

/* Small tablet: sidebar becomes a collapsible drawer overlayed on the list */
@media (max-width: 900px) {
  .inbox-grid { grid-template-columns: 1fr !important; }
  #inboxFiltersToggle { display: inline-flex !important; }
  .inbox-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px; z-index: 800;
    transform: translateX(-110%);
    transition: transform .2s ease-out;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    overflow-y: auto;
    border-radius: 0 10px 10px 0;
  }
  .inbox-sidebar.inbox-sidebar-open { transform: translateX(0); }
}
