/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0B0F1A;
    --bg-card: #111827;
    --bg-elevated: #1A2235;
    --bg-hover: #1E293B;
    --border: #1E293B;
    --border-light: #2D3A4F;
    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --teal: #14B8A6;
    --teal-dim: #0D9488;
    --teal-glow: rgba(20,184,166,.15);
    --green: #22C55E;
    --red: #EF4444;
    --orange: #F59E0B;
    --blue: #3B82F6;
    --purple: #8B5CF6;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-w: clamp(200px, 25vw, 240px);
}
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: #5EEAD4; }
img { max-width: 100%; }
ul { list-style: none; }
.container { max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--font); font-weight: 600; border-radius: var(--radius); cursor: pointer; border: none; transition: all .2s; white-space: nowrap; }
.btn-xs { padding: 3px 8px; font-size: .7rem; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-md { padding: 8px 18px; font-size: .85rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: #0D9488; color: #fff; box-shadow: 0 0 20px var(--teal-glow); }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { border-color: var(--teal); color: var(--teal); }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 50px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-orange { background: rgba(245,158,11,.15); color: var(--orange); }
.badge-blue { background: rgba(59,130,246,.15); color: var(--blue); }
.badge-teal { background: var(--teal-glow); color: var(--teal); }
.badge-purple { background: rgba(139,92,246,.15); color: var(--purple); }
.badge-gray { background: rgba(100,116,139,.2); color: var(--text-muted); }

/* ===== LANDING NAV ===== */
.landing-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; backdrop-filter: blur(12px); background: rgba(11,15,26,.8); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logo:hover { color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--text-secondary); font-size: .85rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }

/* ===== HERO ===== */
.hero { padding: 140px 0 80px; text-align: center; background: radial-gradient(ellipse at 50% 0%, rgba(20,184,166,.08) 0%, transparent 60%); }
.hero-badge { display: inline-block; background: var(--teal-glow); color: var(--teal); padding: 6px 16px; border-radius: 50px; font-size: .8rem; font-weight: 600; margin-bottom: 24px; }
.hero h1 { font-size: 3.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -.02em; }
.gradient-text { background: linear-gradient(135deg, #14B8A6, #3B82F6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { font-size: 1.15rem; color: var(--text-secondary); max-width: 40rem; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 4rem; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .8rem; color: var(--text-muted); }

/* ===== FEATURES ===== */
.features { padding: 80px 0; }
.section-title { text-align: center; font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.section-sub { text-align: center; color: var(--text-secondary); margin-bottom: 48px; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: border-color .2s, transform .2s; }
.feature-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.feature-icon { font-size: 1.8rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: .88rem; }

/* ===== SOCIAL PROOF ===== */
.social-proof { padding: 40px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.logos-row { display: flex; justify-content: center; align-items: center; gap: 48px; flex-wrap: wrap; }
.proof-logo { color: var(--text-muted); font-size: 1rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .5; }

/* ===== PRICING ===== */
.pricing { padding: 80px 0; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; max-width: 64rem; margin: 0 auto; }
.price-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.15rem 1.85rem; text-align: center; position: relative; transition: border-color .2s; }
.price-card:hover { border-color: var(--border-light); }
.price-card.popular { border-color: var(--teal); box-shadow: 0 0 2.5rem var(--teal-glow); }
.popular-badge { position: absolute; top: -0.75rem; left: 50%; transform: translateX(-50%); background: var(--teal); color: #fff; padding: 4px 16px; border-radius: 50px; font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.price-tier { font-size: .85rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 0.5rem; }
.price-amount { font-size: 2.8rem; font-weight: 800; margin-bottom: 1.5rem; }
.currency { font-size: 1.4rem; vertical-align: super; }
.period { font-size: .9rem; color: var(--text-muted); font-weight: 400; }
.price-features { margin-bottom: 1.75rem; }
.price-features li { padding: 0.5rem 0; font-size: .88rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.price-features li:last-child { border-bottom: none; }

/* ===== FINAL CTA ===== */
.final-cta { padding: 5rem 0; text-align: center; background: radial-gradient(ellipse at 50% 100%, rgba(20,184,166,.06) 0%, transparent 60%); }
.final-cta h2 { font-size: 2rem; margin-bottom: 0.75rem; }
.final-cta p { color: var(--text-secondary); margin-bottom: 1.75rem; }

/* ===== FOOTER ===== */
.footer { padding: 3rem 0 1.5rem; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; gap: 3rem; flex-wrap: wrap; margin-bottom: 2rem; }
.footer-brand p { color: var(--text-muted); font-size: .85rem; margin-top: 0.5rem; }
.footer-links { display: flex; gap: 4rem; }
.footer-links div { display: flex; flex-direction: column; gap: 6px; }
.footer-links h4 { font-size: .75rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: .05em; margin-bottom: 0.25rem; }
.footer-links a { color: var(--text-secondary); font-size: .85rem; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.25rem; font-size: .8rem; color: var(--text-muted); }

/* =====================================================   APP SHELL / DASHBOARD
   ============================================================ */

/* Sidebar */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; transition: transform .3s; }
.sidebar-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar-nav { flex: 1; padding: 0.75rem 0.5rem; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border-radius: var(--radius); color: var(--text-secondary); font-size: .88rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--teal-glow); color: var(--teal); }
.nav-item svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.nav-item .nav-badge { margin-left: auto; background: var(--teal); color: #fff; font-size: .65rem; padding: 1px 6px; border-radius: 50px; font-weight: 700; }
.nav-section { padding: 1rem 0.75rem 0.4rem; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.sidebar-footer { padding: 0.75rem 0.5rem; border-top: 1px solid var(--border); }
.user-pill { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); }
.user-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--blue)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; color: #fff; flex-shrink: 0; }
.user-info { min-width: 0; }
.user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: .7rem; color: var(--teal); }

/* Main content */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.75rem; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 40; }
.topbar h1 { font-size: 1.25rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 0.65rem; }
.page-content { padding: 1.75rem; }

/* Cards & metric cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.metric-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 0.25rem; }
.metric-value { font-size: 1.8rem; font-weight: 700; }
.metric-change { font-size: .75rem; margin-top: 2px; }
.metric-change.up { color: var(--green); }
.metric-change.down { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); font-size: .88rem; vertical-align: middle; }
tr:hover td { background: var(--bg-hover); }
.table-actions { display: flex; gap: 6px; }

/* Toggle switch */
.toggle { position: relative; width: 2.25rem; height: 1.25rem; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border-light); border-radius: 50px; transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 1rem; height: 1rem; left: 2px; bottom: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider::before { transform: translateX(1rem); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 0.75rem; opacity: .4; }
.empty-state p { margin-bottom: 1rem; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { padding: 0.65rem 1.15rem; font-size: .85rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }

/* Modals */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 90%; max-width: 36rem; max-height: 90vh; overflow-y: auto; padding: 1.75rem; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.65rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.6rem 0.75rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: .88rem; outline: none; transition: border-color .15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--teal); }
.form-textarea { resize: vertical; min-height: 5rem; }
.form-select { cursor: pointer; }

/* Sequence editor wrapper */
.sequence-editor-wrap { margin-bottom: .65rem; }
.sequence-editor-header { margin-bottom: .5rem; }
.sequence-editor-label { font-size: .8rem; color: var(--text-muted); display: block; margin-bottom: .5rem; }
.step-type-palette { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .65rem; }
.step-palette-btn { display: flex; align-items: center; gap: .35rem; padding: .3rem .65rem; font-size: .8rem; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); border-radius: 9999px; cursor: pointer; transition: border-color .15s, background .15s; }
.step-palette-btn:hover { border-color: var(--teal); background: var(--teal-glow); }
.step-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Sequence steps */
.sequence-step { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.85rem; background: var(--bg-elevated); border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius); margin-bottom: 0.65rem; cursor: default; transition: border-color .15s, opacity .15s; }
.sequence-step.dragging { opacity: .4; }
.sequence-step.drag-over { border-color: var(--teal); border-style: dashed; background: var(--teal-glow); }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: 1.1rem; line-height: 1.75rem; flex-shrink: 0; user-select: none; padding: 0 2px; }
.drag-handle:active { cursor: grabbing; }
.step-num-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.step-num { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--teal-glow); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.step-type-badge { font-size: .8rem; text-align: center; padding: 2px 4px; border-radius: 4px; flex-shrink: 0; }
.step-content { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; align-items: end; }
.step-content .form-group { margin-bottom: 0; }
.step-content .form-group.full-width { grid-column: 1 / -1; }
.step-delete { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; padding: 0.25rem; border-radius: 4px; flex-shrink: 0; transition: color .15s, background .15s; align-self: flex-start; }
.step-delete:hover { color: #f87171; background: rgba(248,113,113,.1); }
.step-subject { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.step-meta { font-size: .75rem; color: var(--text-muted); }
.modal-wide { max-width: 52rem !important; }

/* Inbox items */
.inbox-item { display: flex; gap: 0.85rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item.unread { background: rgba(20,184,166,.04); }
.inbox-item.unread .inbox-from { font-weight: 700; color: var(--text); }
.inbox-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--teal); margin-top: 6px; flex-shrink: 0; visibility: hidden; }
.inbox-item.unread .inbox-dot { visibility: visible; }
.inbox-body { flex: 1; min-width: 0; }
.inbox-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.inbox-from { font-size: .88rem; color: var(--text-secondary); }
.inbox-subject { font-size: .88rem; font-weight: 500; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-preview { font-size: .8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; }

/* Health bars */
.health-bar { height: 0.5rem; background: var(--bg-elevated); border-radius: 50px; overflow: hidden; }
.health-bar-fill { height: 100%; border-radius: 50px; transition: width .4s; }

/* Charts placeholder */
.chart-placeholder { height: 12.5rem; background: var(--bg-elevated); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .85rem; position: relative; overflow: hidden; }
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 3.25rem; }
.mini-chart .bar { width: 0.5rem; border-radius: 2px 2px 0 0; background: var(--teal); opacity: .7; transition: height .3s; }

/* Search */
.search-box { position: relative; }
.search-box input { padding-left: 2.25rem; }
.search-box svg { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 1rem; height: 1rem; }

/* Responsive */
@media (max-width: 60rem) {
    .features-grid, .pricing-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.2rem; }
    .hero-stats { gap: 1.5rem; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .nav-links { display: none; flex-direction: column; position: fixed; top: 60px; left: 0; right: 0; bottom: 0; background: rgba(11,15,26,.97); backdrop-filter: blur(16px); padding: 1.5rem; gap: 0.5rem; z-index: 99; overflow-y: auto; animation: mobileMenuIn .25s ease-out; }
    .nav-links.open { display: flex; }
    .nav-links a:not(.btn) { display: block; padding: 0.85rem 1rem; font-size: 1.05rem; color: var(--text); border-radius: var(--radius); transition: background .15s; }
    .nav-links a:not(.btn):hover { background: var(--bg-hover); }
    .nav-links .btn { width: 100%; justify-content: center; padding: 0.85rem 1rem; font-size: 1rem; min-height: 48px; }
    .nav-links .btn + .btn { margin-top: 0.25rem; }
    @keyframes mobileMenuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
    .footer-links { gap: 2rem; }
}
@media (max-width: 40rem) {
    .hero h1 { font-size: 1.8rem; }
    .metrics-row { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 1rem; }
}

/* Sidebar mobile toggle */
.sidebar-toggle { display: none; position: fixed; top: 0.85rem; left: 0.85rem; z-index: 60; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); width: 2.25rem; height: 2.25rem; border-radius: var(--radius); cursor: pointer; align-items: center; justify-content: center; }
@media (max-width: 60rem) {
    .sidebar-toggle { display: flex; }
    .topbar { padding-left: 3.75rem; }
}

/* Sidebar backdrop overlay on mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 45;
}
.sidebar-backdrop.open { display: block; }

/* Focus-visible styles for keyboard accessibility */
.btn:focus-visible,
.btn-icon:focus-visible,
.nav-item:focus-visible,
.tab:focus-visible,
.tab-btn:focus-visible,
.toggle:focus-visible,
a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px var(--teal-glow);
}

/* Utility */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-md { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }
.text-right { text-align: right; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== INBOX ENHANCEMENTS ===== */
.inbox-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inbox-active { background: var(--bg-elevated) !important; }
.inbox-reply-box { border-top: 1px solid var(--border); padding-top: 0.75rem; }

/* ===== UNIFIED INBOX — THREADED UI ===== */
.inbox-sync-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; font-size: .82rem; }
.inbox-sync-bar .status { color: var(--text-secondary); }
.inbox-sync-bar .sync-btn { flex-shrink: 0; }

.inbox-thread { border-bottom: 1px solid var(--border); transition: background .15s; }
.inbox-thread:last-child { border-bottom: none; }
.inbox-thread:hover { background: var(--bg-hover); }
.inbox-thread.unread { background: rgba(20,184,166,.04); }
.inbox-thread.unread .inbox-from { font-weight: 700; color: var(--text); }
.inbox-thread.unread .inbox-dot { visibility: visible; }
.inbox-thread-expanded { background: var(--bg-elevated) !important; }

.inbox-thread-header { display: flex; gap: 0.85rem; padding: 0.85rem 1.25rem; cursor: pointer; align-items: flex-start; }

.inbox-conversation { border-top: 1px solid var(--border); padding: 1rem 1.25rem; }

.inbox-messages-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: clamp(15rem, 50vh, 22.5rem); overflow-y: auto; margin-bottom: 1rem; }

.inbox-message-bubble { padding: 0.75rem 1rem; border-radius: var(--radius); max-width: 80%; }
.inbox-message-bubble.received { background: var(--bg-card); border: 1px solid var(--border); align-self: flex-start; }
.inbox-message-bubble.sent { background: rgba(20,184,166,.12); border: 1px solid rgba(20,184,166,.25); align-self: flex-end; }
.inbox-message-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.35rem; }
.inbox-message-meta .from { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.inbox-message-meta .time { font-size: .72rem; color: var(--text-muted); }
.inbox-message-body { font-size: .85rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.inbox-reply-area { border-top: 1px solid var(--border); padding-top: 0.75rem; }

/* Provider badges */
.inbox-provider-badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.inbox-provider-badge--gmail { background: rgba(234,67,53,.15); color: #EA4335; }
.inbox-provider-badge--outlook,
.inbox-provider-badge--microsoft_graph { background: rgba(0,114,239,.15); color: #0072EF; }
.inbox-provider-badge--imap { background: rgba(99,102,241,.15); color: #6366F1; }
.inbox-provider-badge--smtp { background: rgba(148,163,184,.1); color: var(--text-muted); }

/* Provider tab active states */
.btn-outline.inbox-tab-active { border-color: var(--teal); color: var(--teal); }

/* ===== COLD CALLING ===== */
.calling-active-card { border-color: var(--teal); box-shadow: 0 0 1.85rem var(--teal-glow); }
.calling-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.calling-detail { background: var(--bg-elevated); border-radius: var(--radius); padding: 0.75rem; }
.calling-detail span { display: block; font-size: .72rem; margin-bottom: 2px; }
.calling-outcomes { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.calling-status-ring .spin-ring { animation: spin-dash 3s linear infinite; transform-origin: center; }
@keyframes spin-dash { to { transform: rotate(360deg); } }

/* ===== ICP RESEARCH ===== */
.icp-filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 1rem; }
.icp-filters-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.icp-filter-label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.icp-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.icp-tag { padding: 4px 11px; border-radius: 50px; border: 1.5px solid var(--border-light); background: transparent; color: var(--text-secondary); cursor: pointer; font-size: .78rem; font-family: var(--font); font-weight: 500; transition: all .15s; white-space: nowrap; }
.icp-tag:hover { border-color: var(--teal); color: var(--teal); }
.icp-tag--active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.icp-tag--active:hover { background: var(--teal-dim); border-color: var(--teal-dim); color: #fff; }

/* ICP Automation Features */
.icp-effectiveness-bar { display: flex; align-items: center; gap: 8px; padding: 12px; background: var(--bg-muted); border-radius: 8px; margin-top: 12px; }
.icp-effectiveness-label { font-size: .8rem; color: var(--text-muted); }
.icp-effectiveness-score { font-weight: 600; font-size: .85rem; }

/* ===== SEGMENTS ===== */
.segment-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segment-selector { display: flex; align-items: center; gap: 8px; }
.segment-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; transition: border-color .2s; }
.segment-card:hover { border-color: var(--teal); }
.segment-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.segment-card-title { font-weight: 600; font-size: 0.95rem; }
.segment-card-meta { font-size: .75rem; color: var(--text-muted); }
.segment-card-count { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--teal); }
.segment-filters-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.5rem; }
.segment-filter-chip { padding: 2px 8px; border-radius: 50px; background: var(--bg-elevated); border: 1px solid var(--border); font-size: .7rem; color: var(--text-secondary); }
.segment-actions { display: flex; gap: 6px; margin-top: 0.75rem; }
.segment-actions .btn-sm { font-size: .72rem; padding: 4px 10px; }
.segments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100vw - 2rem), 1fr)); gap: 1rem; }
.segment-dropdown-group { display: flex; align-items: center; gap: 8px; }
.segment-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 50px; background: var(--teal-glow); color: var(--teal); font-size: .7rem; font-weight: 600; }

/* ===== CRM PIPELINE ===== */
.crm-pipeline { display: flex; gap: 0.75rem; overflow-x: auto; padding-bottom: 0.75rem; min-height: 25rem; }
.crm-stage { min-width: 14rem; flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s, background .2s; }
.crm-stage.drag-over { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-glow), 0 0 1rem var(--teal-glow); background: rgba(20,184,166,.08); transform: scale(1.01); }
.crm-stage-header { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.crm-stage-title { font-weight: 700; font-size: .88rem; }
.crm-stage-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.crm-stage-cards { padding: 0.65rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; min-height: 4rem; }
.crm-deal-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; cursor: grab; transition: border-color .15s, box-shadow .15s, opacity .2s, transform .2s; position: relative; }
.crm-deal-card:hover { border-color: var(--teal); box-shadow: 0 0 0.75rem var(--teal-glow); }
.crm-deal-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; box-shadow: 0 0 0 4px var(--teal-glow); }
.crm-deal-card.dragging { opacity: 0.5; cursor: grabbing; transform: scale(0.98); }
.crm-deal-card.card-moving { opacity: 0.8; cursor: wait; border-color: var(--teal); }
.crm-deal-card.card-moving .card-spinner { display: flex; }

/* Card loading spinner overlay */
.card-spinner { display: none; position: absolute; inset: 0; background: rgba(11, 15, 26, 0.7); border-radius: var(--radius); align-items: center; justify-content: center; z-index: 10; }
.card-spinner .spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Drag source stage highlighting */
.crm-stage.drag-source { border-color: var(--teal); background: rgba(20, 184, 166, 0.08); }

/* Stage duration badge */
.crm-stage-duration { display: inline-block; font-size: 0.68rem; color: var(--text-muted); background: rgba(255,255,255,0.05); border-radius: 50px; padding: 1px 6px; margin-left: 4px; }

/* Drop indicator line */
.crm-stage-drop-indicator { height: 2px; background: var(--teal); border-radius: 1px; margin: 2px 0; opacity: 0; transition: opacity .15s; }
.crm-stage.drag-over .crm-stage-drop-indicator { opacity: 1; }

/* ARIA live region for stage move announcements */
.crm-live-region { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== REMOTE MOVE VISUAL FEEDBACK ===== */

/* Pulse animation for cards moved by other users */
@keyframes card-remote-pulse {
  0%, 100% { 
    border-color: var(--teal);
    box-shadow: 0 0 0 0 var(--teal-glow);
  }
  50% { 
    border-color: var(--teal);
    box-shadow: 0 0 20px 5px var(--teal-glow);
  }
}

@keyframes card-pickup {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
  20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.crm-deal-card.card-remote-moved {
  animation: card-remote-pulse 2s ease-in-out 2;
  border-color: var(--teal);
}

.remote-move-indicator {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== ENHANCED DROP ZONE PREVIEW ===== */

.crm-stage-drop-indicator {
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--teal-dim));
  border-radius: 2px;
  margin: 4px 0;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: scaleX(0.8);
}

.crm-stage.drag-over .crm-stage-drop-indicator {
  opacity: 1;
  transform: scaleX(1);
  animation: drop-indicator-pulse 1s ease-in-out infinite;
}

@keyframes drop-indicator-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ===== KEYBOARD DRAG-AND-DROP STYLES ===== */

.crm-deal-card.keyboard-dragging {
  opacity: 0.9;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-glow), 0 8px 32px rgba(0,0,0,0.4);
  transform: scale(1.02);
  z-index: 100;
}

.crm-deal-card.keyboard-drag-source {
  background: var(--teal-glow);
}

.crm-stage.keyboard-drop-target {
  border-style: dashed;
  border-color: var(--border-light);
  background: rgba(20,184,166,0.03);
}

.crm-stage.keyboard-drop-target-active {
  border-style: solid;
  border-color: var(--teal);
  background: rgba(20,184,166,0.08);
  box-shadow: inset 0 0 0 2px var(--teal-glow);
  animation: stage-pulse 1s ease-in-out infinite;
}

@keyframes stage-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--teal-glow); }
  50% { box-shadow: inset 0 0 0 4px var(--teal-glow); }
}

/* ===== STAGE HISTORY ENHANCEMENTS ===== */

.stage-history-filters {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.stage-history-filters .form-select,
.stage-history-filters .form-input {
  background: var(--bg-card);
  border-color: var(--border);
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}

.stage-history-entry {
  position: relative;
  transition: background 0.15s ease;
}

.stage-history-entry:hover {
  background: var(--bg-hover);
}

.crm-stage-duration {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
  margin-left: 8px;
}

.crm-stage-duration.duration-short {
  background: rgba(34,197,94,0.15);
  color: var(--green);
}

.crm-stage-duration.duration-medium {
  background: rgba(245,158,11,0.15);
  color: var(--orange);
}

.crm-stage-duration.duration-long {
  background: rgba(239,68,68,0.15);
  color: var(--red);
}

.stage-progress-indicator {
  font-size: 0.85rem;
  margin-left: 6px;
  opacity: 0.7;
}

.stage-note {
  background: var(--bg-card);
  border-left: 3px solid var(--teal);
  padding: 8px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 6px;
}

.note-label {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.75rem;
}

.stage-entry-actions {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.stage-history-entry:hover .stage-entry-actions {
  opacity: 1;
}

.stage-history-stats {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.stage-history-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== STAGE NOTE MODAL ===== */

#modal-stage-note .modal {
  max-width: 28rem;
}

#stage-note-input {
  min-height: 80px;
  resize: vertical;
}

/* ===== IMPROVED DRAG GHOST ===== */

.crm-deal-card.dragging {
  opacity: 0.7;
  cursor: grabbing;
  transform: rotate(2deg) scale(0.98);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border-color: var(--teal);
}

/* Drag source stage highlighting */
.crm-stage.drag-source {
  border-color: var(--teal);
  background: rgba(20, 184, 166, 0.05);
}

/* Enhanced drag over state */
.crm-stage.drag-over {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow), 0 0 2rem var(--teal-glow);
  background: rgba(20,184,166,0.1);
  transform: scale(1.01);
  transition: all 0.2s ease;
}

@keyframes spin { to { transform: rotate(360deg); } }
.crm-card-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.crm-card-actions .btn { font-size: .68rem; padding: 2px 6px; }

/* CRM Activity Timeline */
.crm-timeline { display: flex; flex-direction: column; gap: 0.75rem; }
.crm-timeline-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.crm-timeline-item:last-child { border-bottom: none; }
.crm-timeline-icon { font-size: 1.1rem; min-width: 1.5rem; text-align: center; margin-top: 2px; }
.crm-timeline-body { flex: 1; min-width: 0; }
.crm-timeline-subject { margin-bottom: 2px; }
.crm-timeline-text { color: var(--text-secondary); margin-bottom: 2px; }
.crm-timeline-meta { color: var(--text-muted); }

/* CRM Timeline filter tabs */
.crm-timeline-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.crm-timeline-filters .btn { font-size: 0.78rem; padding: 0.2rem 0.65rem; }

/* Call timer display */
.calling-timer { font-family: monospace; font-size: 1.4rem; font-weight: 700; color: var(--teal); min-width: 3.5rem; text-align: center; }

/* Selected disposition outcome button */
.calling-outcome-btn.selected { border-color: var(--teal); background: rgba(20, 184, 166, 0.12); color: var(--teal); font-weight: 600; }

/* Duration display in timeline */
.crm-timeline-duration { font-size: 0.78rem; color: var(--text-muted); margin-left: 0.4rem; }

/* ============================================
   CRM Kanban Board - Animations & Interactions
   ============================================ */

/* 1. Remote Move Animations - Pulse effect when another user moves a card */
@keyframes remoteMovePulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.6); transform: scale(1); }
  50% { box-shadow: 0 0 20px 4px rgba(20, 184, 166, 0.3); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); transform: scale(1); }
}

.crm-deal-card.remote-moved {
  animation: remoteMovePulse 0.8s ease-out;
  border-color: var(--teal);
}

/* 2. Enhanced Drag Feedback */
.crm-deal-card.drag-preview {
  opacity: 0.9;
  transform: scale(1.05) rotate(2deg);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 0 2px var(--teal),
    0 0 30px rgba(20, 184, 166, 0.2);
  cursor: grabbing;
  z-index: 1000;
}

.crm-deal-card {
  transition: 
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out,
    opacity 0.15s ease-out,
    border-color 0.15s ease-out;
  will-change: transform, box-shadow;
}

.crm-deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.crm-deal-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
  border-style: dashed;
  border-color: var(--teal);
}

/* 3. Stage Transition Effects */
.crm-stage.drop-target-active {
  background: rgba(20, 184, 166, 0.08);
  border-color: var(--teal);
  box-shadow: 
    inset 0 0 40px rgba(20, 184, 166, 0.1),
    0 0 0 2px var(--teal);
  transform: scale(1.01);
}

.crm-stage {
  transition: 
    background-color 0.2s ease-out,
    border-color 0.2s ease-out,
    box-shadow 0.2s ease-out,
    transform 0.2s ease-out;
}

.crm-stage-cards.drop-receiving {
  background: rgba(20, 184, 166, 0.05);
  border-radius: 8px;
  min-height: 100px;
}

.crm-stage-cards {
  transition: background-color 0.2s ease-out;
}

.crm-stage.drag-over .crm-stage-cards {
  background: rgba(20, 184, 166, 0.03);
}

/* 4. Loading/Progress States */
@keyframes savingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes savingStripes {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

.crm-deal-card.saving {
  position: relative;
  animation: savingPulse 1.2s ease-in-out infinite;
  pointer-events: none;
}

.crm-deal-card.saving::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 25%,
    rgba(20, 184, 166, 0.05) 25%,
    rgba(20, 184, 166, 0.05) 50%,
    transparent 50%,
    transparent 75%,
    rgba(20, 184, 166, 0.05) 75%
  );
  background-size: 20px 20px;
  animation: savingStripes 1s linear infinite;
  border-radius: inherit;
  pointer-events: none;
}

.crm-stage.saving .crm-stage-header::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(20, 184, 166, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* 5. History Timeline Enhancements */
.stage-history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 1.25rem;
}

.stage-history-timeline::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--border) 0%,
    var(--teal) 20%,
    var(--teal) 80%,
    var(--border) 100%
  );
  border-radius: 1px;
}

.stage-history-entry {
  position: relative;
  padding: 0.6rem 0 0.9rem 0.75rem;
  border-left: none;
}

.stage-history-entry::before {
  content: '';
  position: absolute;
  left: -0.975rem;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  background: var(--bg-card);
  border: 2px solid var(--teal);
  border-radius: 50%;
  z-index: 1;
  transition: 
    background-color 0.2s ease-out,
    transform 0.2s ease-out;
}

.stage-history-entry:hover::before {
  background: var(--teal);
  transform: scale(1.2);
}

.stage-history-entry.current::before {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.stage-history-entry.entered {
  animation: entrySlideIn 0.4s ease-out;
}

@keyframes entrySlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.stage-history-duration {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  margin-top: 0.25rem;
  transition: all 0.2s ease-out;
}

.stage-history-duration.short {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.stage-history-duration.medium {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
}

.stage-history-duration.long {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.stage-history-duration::before {
  content: '⏱';
  font-size: 0.7rem;
}

/* 6. Accessibility Improvements */
.crm-deal-card:focus-visible,
.crm-stage:focus-visible,
.stage-history-entry:focus-visible {
  outline: none;
  box-shadow: 
    0 0 0 2px var(--bg-main),
    0 0 0 4px var(--teal);
}

.crm-deal-card:focus-visible {
  transform: translateY(-2px);
}

.crm-pipeline:focus-within .crm-stage {
  opacity: 0.85;
  transition: opacity 0.2s ease-out;
}

.crm-pipeline:focus-within .crm-stage:focus-within,
.crm-pipeline:focus-within .crm-stage:hover {
  opacity: 1;
}

/* Keyboard drag operation indicator */
.crm-deal-card.keyboard-dragging {
  outline: 2px dashed var(--teal);
  outline-offset: 2px;
  animation: keyboardDragPulse 1.5s ease-in-out infinite;
}

@keyframes keyboardDragPulse {
  0%, 100% { outline-color: var(--teal); }
  50% { outline-color: rgba(20, 184, 166, 0.4); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .crm-deal-card,
  .crm-stage,
  .crm-stage-cards,
  .stage-history-entry {
    transition: none !important;
    animation: none !important;
  }
  
  .crm-deal-card.remote-moved {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px var(--teal);
  }
  
  .crm-deal-card.drag-preview {
    transform: scale(1.02);
    opacity: 0.9;
  }
  
  .crm-deal-card.saving::after {
    animation: none;
    background: rgba(20, 184, 166, 0.05);
  }
  
  .stage-history-entry.entered {
    animation: none;
    opacity: 1;
  }
  
  .crm-stage.saving .crm-stage-header::after {
    animation: none;
    border-color: var(--teal);
    opacity: 0.5;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .crm-deal-card.dragging {
    border-width: 3px;
    border-style: dashed;
  }
  
  .crm-stage.drop-target-active {
    outline: 3px solid var(--teal);
    outline-offset: -3px;
  }
  
  .crm-deal-card:focus-visible,
  .crm-stage:focus-visible,
  .stage-history-entry:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
  }
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main, #0B0F1A);
  z-index: 1000;
}
.login-screen.hidden { display: none; }
.login-card {
  background: var(--bg-card, #151A2D);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 1.15rem;
  padding: 2.5rem;
  width: 90%;
  max-width: 26rem;
  box-shadow: 0 1.25rem 3.75rem rgba(0,0,0,0.4);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin: 0;
}
.login-subtitle {
  color: var(--text-secondary, rgba(255,255,255,0.5));
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}
.login-screen .form-group {
  margin-bottom: 1rem;
}
.login-screen label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary, rgba(255,255,255,0.6));
  margin-bottom: 6px;
}
.login-screen input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--bg-main, #0B0F1A);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 0.5rem;
  color: var(--text-primary, #fff);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.login-screen input:focus {
  border-color: #14B8A6;
}
.remember-me-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.remember-me-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}
.remember-me-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.login-error {
  color: #EF4444;
  font-size: 0.88rem;
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
}
.login-success {
  color: #14B8A6;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}
.login-btn {
  width: 100%;
  padding: 0.75rem;
  background: #14B8A6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover {
  background: #0D9488;
}
.login-footer {
  text-align: center;
  color: var(--text-secondary, rgba(255,255,255,0.4));
  font-size: 0.8rem;
  margin-top: 1rem;
}
.login-toggle {
  text-align: center;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  font-size: 0.88rem;
  margin-top: 0.75rem;
}
.login-toggle a {
  color: #14B8A6;
  text-decoration: none;
  font-weight: 600;
}
.login-toggle a:hover {
  text-decoration: underline;
}
.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
#app-shell.hidden { display: none; }

/* ===== CSV IMPORT UI ===== */
.csv-step { display: none; }
.csv-step.active { display: block; }

.csv-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.csv-dropzone:hover {
  border-color: var(--teal);
  background: rgba(20,184,166,.05);
}
.csv-dropzone.dragover {
  border-color: var(--teal);
  background: var(--teal-glow);
}
.csv-dropzone-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}
.csv-dropzone-text {
  font-size: .9rem;
  color: var(--text-secondary);
}

.csv-file-info {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  font-size: .82rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.csv-preview-wrap {
  max-height: 10rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  white-space: nowrap;
}
.csv-preview-table th {
  background: var(--bg-elevated);
  padding: 6px 10px;
  font-size: .68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.csv-preview-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  max-width: 9.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csv-mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.csv-mapping-col-name {
  flex: 0 0 10.5rem;
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.csv-mapping-row .form-select {
  flex: 1;
}

.csv-import-results {
  padding: 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.csv-error-list {
  list-style: none;
  margin-top: 0.5rem;
  max-height: 10rem;
  overflow-y: auto;
  font-size: .78rem;
  color: var(--red);
}
.csv-error-list li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.csv-error-list li:last-child { border-bottom: none; }

/* ===== DELIVERABILITY TOOLING ===== */

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { padding: 0.85rem 1.25rem; font-size: .88rem; font-weight: 600; color: var(--text-secondary); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all .15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 50px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.status-good { background: rgba(34,197,94,.15); color: var(--green); }
.status-warning { background: rgba(245,158,11,.15); color: var(--orange); }
.status-error { background: rgba(239,68,68,.15); color: var(--red); }
.status-pending { background: rgba(100,116,139,.15); color: var(--text-muted); }

/* Section headers */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }

/* Auth summary */
.auth-summary { display: flex; gap: 2rem; padding: 1rem 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.auth-stat { text-align: center; }
.auth-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.auth-stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* Reputation summary */
.reputation-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 1rem; background: var(--bg-elevated); border-radius: var(--radius); margin-bottom: 1.25rem; }
.rep-metric { text-align: center; }
.rep-metric-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.rep-metric-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* Score badge */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; font-weight: 700; font-size: 1rem; }
.score-badge.good { background: rgba(34,197,94,.15); color: var(--green); }
.score-badge.fair { background: rgba(245,158,11,.15); color: var(--orange); }
.score-badge.poor { background: rgba(239,68,68,.15); color: var(--red); }

/* Issues list */
.issues-list { display: flex; flex-direction: column; gap: 0.5rem; }
.issue-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-elevated); border-radius: var(--radius); border-left: 3px solid; }
.issue-item.issue-error { border-left-color: var(--red); }
.issue-item.issue-warning { border-left-color: var(--orange); }
.issue-item.issue-info { border-left-color: var(--blue); }
.issue-domain { font-weight: 600; font-size: .85rem; }
.issue-text { font-size: .85rem; color: var(--text-secondary); }

/* Warmup stats */
.warmup-stats { display: flex; gap: 2rem; padding: 1rem 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.warmup-stat { text-align: center; }
.warmup-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.warmup-stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; }

/* Warmup guide */
.warmup-guide { background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; }
.guide-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.guide-row:last-child { border-bottom: none; }
.guide-header { background: var(--bg-hover); font-weight: 600; font-size: .75rem; text-transform: uppercase; color: var(--text-muted); }

/* Progress cell */
.progress-cell { min-width: 8rem; }

/* Validation sections */
.validation-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.validation-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.validation-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.validation-title { font-weight: 600; font-size: 1rem; }
.validation-status { font-size: .85rem; font-weight: 600; }
.validation-status.valid { color: var(--green); }
.validation-status.invalid { color: var(--red); }
.validation-record { display: block; padding: 0.75rem; background: var(--bg-elevated); border-radius: var(--radius); font-size: .8rem; font-family: monospace; color: var(--text-secondary); margin-bottom: 0.75rem; word-break: break-all; }
.validation-details { font-size: .85rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.validation-recommendations { margin: 0; padding-left: 1.25rem; font-size: .85rem; color: var(--text-secondary); }
.validation-recommendations li { margin-bottom: 0.35rem; }

/* Validation results (quick) */
.validation-results { background: var(--bg-elevated); border-radius: var(--radius); padding: 1rem; }
.validation-result-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.validation-result-item:last-child { border-bottom: none; }
.result-label { font-weight: 600; }
.result-status.valid { color: var(--green); }
.result-status.invalid { color: var(--red); }
.validation-score { font-weight: 700; color: var(--text); }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; padding: 0.75rem; border-bottom: 1px solid var(--border); }
.data-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); font-size: .88rem; vertical-align: middle; }
.data-table tr:hover td { background: var(--bg-hover); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--text-muted); margin-bottom: 1.25rem; }

/* Form helpers */
.form-help { font-size: .8rem; color: var(--text-muted); margin-top: 0.5rem; }
.form-row { display: flex; gap: 0.75rem; align-items: center; }

/* Loading states */
.loading-placeholder { text-align: center; padding: 2rem; color: var(--text-muted); }
.loading { display: inline-block; color: var(--text-muted); }

/* Text utilities */
.text-success { color: var(--green); }
.text-error { color: var(--red); }
.text-warning { color: var(--orange); }

/* =====================================================   Email Provider Integrations — wizard, provider cards, OAuth
   ============================================================ */

/* Wizard step indicator */
.wizard-steps { display: flex; align-items: center; margin-bottom: 20px; }
.wizard-step { display: flex; align-items: center; gap: 6px; }
.wizard-step-num { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.wizard-step-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.wizard-step.active .wizard-step-num { border-color: var(--teal); background: var(--teal); color: #fff; }
.wizard-step.active .wizard-step-label { color: var(--teal); font-weight: 600; }
.wizard-step.completed .wizard-step-num { border-color: var(--green); background: var(--green); color: #fff; }
.wizard-step.completed .wizard-step-label { color: var(--green); }
.wizard-step-divider { flex: 1; height: 2px; background: var(--border); margin: 0 8px; }

/* Provider selection cards */
.provider-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.provider-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; background: var(--bg-card); }
.provider-card:hover { border-color: var(--teal); background: var(--bg-hover); }
.provider-card.selected { border-color: var(--teal); background: rgba(20,184,166,.07); }
.provider-card-name { font-weight: 600; font-size: .92rem; }
.provider-card-desc { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.provider-icon { width: 44px; height: 44px; border-radius: 8px; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.provider-icon-gmail { color: #EA4335; }
.provider-icon-outlook { color: #0078D4; }

/* OAuth buttons */
.oauth-btn { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; border: none; width: 100%; justify-content: center; transition: opacity .15s; }
.oauth-btn:hover { opacity: .88; }
.oauth-btn-google { background: #fff; color: #3c4043; border: 1.5px solid #dadce0; }
.oauth-btn-microsoft { background: #fff; color: #323130; border: 1.5px solid #8a8886; }

/* Connection status inline indicator */
.connection-status { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 500; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.connection-status-connected .connection-dot { background: var(--green); }
.connection-status-connected { color: var(--green); }
.connection-status-unconfigured .connection-dot { background: var(--text-muted); }
.connection-status-unconfigured { color: var(--text-muted); }
.connection-status-failed .connection-dot { background: var(--red); }
.connection-status-failed { color: var(--red); }
.connection-status-expired .connection-dot { background: var(--orange); }
.connection-status-expired { color: var(--orange); }

/* Test result panel inside wizard step 3 */
.test-result-success { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 8px; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: var(--green); font-weight: 500; font-size: .88rem; }
.test-result-error { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 8px; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: var(--red); font-weight: 500; font-size: .88rem; }
.test-result-pending { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 8px; background: var(--bg-hover); color: var(--text-muted); font-size: .88rem; }

/* =====================================================   MULTICHANNEL SEQUENCE BUILDER - Phase 3 Enhancement
   ============================================================ */

/* Sequence Builder Layout */
.sequence-builder-layout {
  display: grid;
  grid-template-columns: minmax(clamp(160px, 22vw, 220px), 220px) 1fr;
  gap: 1.25rem;
  height: 100%;
  min-height: clamp(20rem, 40vh, 25rem);
}

@media (max-width: 60rem) {
  .sequence-builder-layout {
    grid-template-columns: 1fr;
  }
}

/* Step Type Palette */
.step-palette {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  height: fit-content;
}

.step-palette-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.step-palette-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 0.4rem;
  border: 1px solid transparent;
}

.step-palette-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.step-palette-item:active {
  transform: translateY(1px);
}

.step-palette-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.step-palette-info {
  flex: 1;
  min-width: 0;
}

.step-palette-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.step-palette-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-palette-channel {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.channel-email { color: var(--teal); background: var(--teal-glow); }
.channel-call { color: var(--orange); background: rgba(245,158,11,0.15); }
.channel-linkedin { color: var(--purple); background: rgba(139,92,246,0.15); }
.channel-wait { color: var(--text-muted); background: rgba(100,116,139,0.2); }

/* Step Editor Container */
.sequence-editor-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  min-height: clamp(20rem, 40vh, 25rem);
}

.sequence-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sequence-editor-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.sequence-editor-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

#campaign-steps-editor {
  position: relative;
}

#campaign-steps-editor.drag-over-palette {
  background: var(--teal-glow);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--teal);
}

/* Sequence Step Wrapper */
.sequence-step-wrapper {
  position: relative;
  margin-bottom: 0;
}

.sequence-step-wrapper.dragging {
  opacity: 0.5;
}

.sequence-step-wrapper.drag-over {
  padding-top: 1.5rem;
}

.sequence-step-wrapper.drag-over::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--teal-glow);
}

/* Step Connector Lines */
.step-connector {
  position: relative;
  height: 1.25rem;
  margin-left: 1.5rem;
  width: 2px;
  background: var(--border-light);
}

.step-connector::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-light);
}

.step-connector[data-from-channel="email"] { background: var(--teal); opacity: 0.5; }
.step-connector[data-from-channel="email"]::before { background: var(--teal); }
.step-connector[data-from-channel="call"] { background: var(--orange); opacity: 0.5; }
.step-connector[data-from-channel="call"]::before { background: var(--orange); }
.step-connector[data-from-channel="linkedin"] { background: var(--purple); opacity: 0.5; }
.step-connector[data-from-channel="linkedin"]::before { background: var(--purple); }
.step-connector[data-from-channel="wait"] { background: var(--text-muted); opacity: 0.3; }
.step-connector[data-from-channel="wait"]::before { background: var(--text-muted); }

/* Enhanced Sequence Step */
.sequence-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  cursor: default;
  transition: border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  position: relative;
}

.sequence-step:hover {
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sequence-step.dragging-row {
  opacity: 0.4;
}

.sequence-step.expanded {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal-glow);
}

/* Channel-specific accent colors on hover */
.sequence-step[data-channel="email"]:hover { border-left-color: var(--teal); }
.sequence-step[data-channel="call"]:hover { border-left-color: var(--orange); }
.sequence-step[data-channel="linkedin"]:hover { border-left-color: var(--purple); }
.sequence-step[data-channel="wait"]:hover { border-left-color: var(--text-muted); }

/* Step Preview Button */
.step-preview-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s;
  align-self: flex-start;
  opacity: 0.6;
}

.step-preview-btn:hover {
  opacity: 1;
  background: var(--bg-hover);
}

.step-preview-btn.active {
  opacity: 1;
  color: var(--teal);
  background: var(--teal-glow);
}

/* Step Preview Panel */
.step-preview-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.75rem 1rem;
  margin: -0.5rem 0 0.5rem 3rem;
  display: none;
  animation: slideDown 0.2s ease;
}

.sequence-step.expanded + .step-preview-panel,
.sequence-step-wrapper:has(.sequence-step.expanded) .step-preview-panel {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-content {
  font-size: 0.8rem;
}

.preview-subject {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.preview-body {
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.preview-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 0.5rem;
}

.preview-wait {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wait-icon {
  font-size: 1rem;
}

/* Palette Drag State */
.step-palette-item[draggable="true"] {
  cursor: grab;
}

.step-palette-item[draggable="true"]:active {
  cursor: grabbing;
}

/* Step Type Channel Badge */
.step-channel-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 50px;
  margin-left: 0.5rem;
}

/* Empty State for Editor */
.sequence-editor-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.sequence-editor-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Multichannel Flow Visualization */
.multichannel-flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  font-size: 0.75rem;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.flow-step-icon {
  font-size: 0.9rem;
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Tooltip for drag instructions */
.drag-instruction {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
}

.drag-instruction.visible {
  opacity: 1;
/* ===== SEQUENCE ENGINE STATUS WIDGET ===== */
.engine-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem 1.5rem;
}

.engine-status-running {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.3);
}

.engine-status-stopped {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

/* OOO badge — orange indicator on enrollment rows */
.ooo-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.2);
  color: var(--orange);
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-left: 6px;
  vertical-align: middle;
}

/* Manual resume button in enrollment viewer */
.resume-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  background: var(--teal-glow);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
  transition: background 0.15s;
}
.resume-btn:hover {
  background: rgba(20, 184, 166, 0.25);
}

/* ============================================================
   Workspace Management — switcher, members, roles, invites
   ============================================================ */

/* Workspace Switcher */
.ws-switcher { position: relative; margin-top: 8px; }
.ws-switcher-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: .85rem; font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s; }
.ws-switcher-btn:hover { border-color: var(--teal); background: rgba(20,184,166,.07); }
.ws-switcher-dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 200; padding: 4px; }
.ws-switcher-item { display: block; width: 100%; padding: 8px 10px; border-radius: 6px; background: none; border: none; color: var(--text); font-size: .85rem; text-align: left; cursor: pointer; transition: background .12s; }
.ws-switcher-item:hover { background: var(--bg-hover); }
.ws-switcher-item.active { color: var(--teal); font-weight: 600; }

/* Member list */
.ws-member-list { display: flex; flex-direction: column; gap: 6px; }
.ws-member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--bg-hover); border-radius: 8px; flex-wrap: wrap; }
.ws-member-info { display: flex; align-items: center; gap: 10px; }
.ws-member-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: #fff; font-size: .9rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ws-member-name { font-size: .9rem; font-weight: 500; }
.ws-member-email { font-size: .78rem; color: var(--text-muted); }
.ws-member-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Role badge */
.ws-role-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.ws-role-badge--owner { background: #F59E0B; color: #fff; }
.ws-role-badge--admin { background: #3B82F6; color: #fff; }
.ws-role-badge--member { background: #6B7280; color: #fff; }

/* Invite form */
.ws-invite-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ws-invite-form .form-input { flex: 1; min-width: 10rem; }

/* Pending invite rows */
.ws-invite-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--bg-hover); border-radius: 8px; flex-wrap: wrap; }

/* Workspace Management */
.members-card { background: var(--card-bg, #fff); border-radius: 12px; padding: 24px; margin-top: 16px; border: 1px solid var(--border-color, #e5e7eb); }
.members-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.member-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-color, #e5e7eb); }
.member-item:last-child { border-bottom: none; }
.member-info { display: flex; align-items: center; gap: 12px; }
.member-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary, #4f46e5); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.member-details { display: flex; flex-direction: column; }
.member-name { font-weight: 500; font-size: 14px; }
.member-email { font-size: 12px; color: var(--text-secondary, #6b7280); }
.role-badge { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.role-badge--owner { background: #fef3c7; color: #92400e; }
.role-badge--admin { background: #dbeafe; color: #1e40af; }
.role-badge--member { background: #f3f4f6; color: #374151; }
.member-actions { display: flex; gap: 8px; align-items: center; }
.member-actions select { padding: 4px 8px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; font-size: 12px; }
.member-actions button { padding: 4px 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; font-size: 12px; cursor: pointer; background: #fff; }
.member-actions button.btn-danger { color: #dc2626; border-color: #fecaca; }
.member-actions button.btn-danger:hover { background: #fef2f2; }
.invite-form { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-color, #e5e7eb); }
.invite-form input { flex: 1; padding: 8px 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; font-size: 14px; }
.invite-form select { padding: 8px 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; font-size: 14px; }
.invite-form button { padding: 8px 16px; background: var(--primary, #4f46e5); color: #fff; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
.invite-form button:hover { opacity: 0.9; }
.pending-invites { margin-top: 16px; }
.pending-invites h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary, #6b7280); }
.invite-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.invite-email { font-size: 14px; }
.invite-role { font-size: 12px; color: var(--text-secondary, #6b7280); }
.invite-cancel { color: #dc2626; cursor: pointer; font-size: 12px; background: none; border: none; }
.workspace-switcher { position: relative; padding: 8px 12px; margin: 8px 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; cursor: pointer; }
.workspace-switcher-name { font-weight: 600; font-size: 14px; }
.workspace-switcher-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg, #fff); border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; margin-top: 4px; }
.workspace-switcher-item { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.workspace-switcher-item:hover { background: var(--hover-bg, #f3f4f6); }
.workspace-switcher-item.active { font-weight: 600; color: var(--primary, #4f46e5); }
