/* ============================================
   Favoured Signal Intelligence — Design System
   Superhuman / Linear inspired dark UI
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Backgrounds */
    --bg-deep: #0a0e27;
    --bg-surface: #111538;
    --bg-card: #161a3e;
    --bg-elevated: #1c2148;
    --bg-hover: #1f2550;
    --bg-glass: rgba(17, 21, 56, 0.72);

    /* Borders */
    --border: rgba(99, 102, 241, 0.12);
    --border-subtle: rgba(99, 102, 241, 0.06);
    --border-focus: rgba(99, 102, 241, 0.4);

    /* Text */
    --text-primary: #e8eaed;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --text-inverse: #0a0e27;

    /* Accent colors */
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);

    --success: #10b981;
    --success-subtle: rgba(16, 185, 129, 0.12);
    --success-glow: rgba(16, 185, 129, 0.3);

    --warning: #f59e0b;
    --warning-subtle: rgba(245, 158, 11, 0.12);

    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.12);
    --danger-glow: rgba(239, 68, 68, 0.3);

    /* Tier colors */
    --tier1: #6366f1;
    --tier1-bg: rgba(99, 102, 241, 0.08);
    --tier2: #f59e0b;
    --tier2-bg: rgba(245, 158, 11, 0.08);

    /* Kanban stage colors */
    --stage-detected: #5c6078;
    --stage-qualified: #6366f1;
    --stage-contacted: #f59e0b;
    --stage-replied: #10b981;
    --stage-converted: #06d6a0;
    --stage-skipped: #5c6078;

    /* Typography */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'DM Mono', 'SF Mono', 'Fira Code', monospace;

    /* Spacing (8px grid) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Radii */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-focus);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --duration-fast: 150ms;
    --duration: 250ms;
    --duration-slow: 400ms;
}

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

/* --- Base --- */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

::selection {
    background: var(--accent);
    color: #fff;
}

/* ============================================
   Navigation
   ============================================ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-6);
    height: 56px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 3px;
    user-select: none;
}

.nav-links {
    display: flex;
    gap: var(--sp-1);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -13px;
    left: var(--sp-4);
    right: var(--sp-4);
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.nav-date {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 920px;
    margin: 0 auto;
    padding: calc(56px + var(--sp-8)) var(--sp-6) var(--sp-12);
}

.container-wide {
    max-width: 100%;
    margin: 0 auto;
    padding: calc(56px + var(--sp-8)) var(--sp-6) var(--sp-12);
}

/* ============================================
   Stats Bar
   ============================================ */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-12);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5) var(--sp-5);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.stat-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
}

.stat-card--urgent {
    border-left: 3px solid var(--danger);
}

.stat-card--warning {
    border-left: 3px solid var(--warning);
}

.stat-number {
    font-size: 36px;
    font-weight: 500;
    font-family: var(--font-mono);
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: var(--sp-1);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* ============================================
   Sections
   ============================================ */
.section {
    margin-bottom: var(--sp-12);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding-bottom: var(--sp-4);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border-subtle);
}

.section-header--urgent {
    color: var(--danger);
    border-bottom-color: var(--danger-subtle);
}

.section-header--warning {
    color: var(--warning);
    border-bottom-color: var(--warning-subtle);
}

.section-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0;
    text-transform: none;
}

/* ============================================
   Review Card — The Core Experience
   ============================================ */
.card-stack-area {
    position: relative;
    perspective: 600px;
    min-height: 200px;
}

/* Ghost cards behind */
.card-stack-area::before,
.card-stack-area::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: -4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    z-index: -1;
    opacity: 0.5;
    transform: scale(0.97) translateY(6px);
}

.card-stack-area::after {
    top: 12px;
    left: 16px;
    right: 16px;
    bottom: -8px;
    opacity: 0.25;
    transform: scale(0.94) translateY(12px);
    z-index: -2;
}

.review-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform var(--duration) var(--ease-out),
                box-shadow var(--duration) var(--ease-out);
    position: relative;
    z-index: 1;
}

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

/* Swipe exit animations */
.review-card.card-exit-right {
    animation: cardExitRight 0.5s var(--ease-out) forwards;
}

.review-card.card-exit-left {
    animation: cardExitLeft 0.5s var(--ease-out) forwards;
}

.review-card.card-enter {
    animation: cardEnter 0.4s var(--ease-bounce) forwards;
}

@keyframes cardExitRight {
    0% { transform: translateX(0) rotateZ(0); opacity: 1; }
    100% { transform: translateX(150%) rotateZ(15deg); opacity: 0; filter: drop-shadow(0 0 40px var(--success-glow)); }
}

@keyframes cardExitLeft {
    0% { transform: translateX(0) rotateZ(0); opacity: 1; }
    100% { transform: translateX(-150%) rotateZ(-15deg); opacity: 0; filter: drop-shadow(0 0 40px var(--danger-glow)); }
}

@keyframes cardEnter {
    0% { transform: translateY(20px) scale(0.95); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Editing state */
.review-card.editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 24px rgba(99, 102, 241, 0.15);
}

/* Card tier badge */
.card-tier {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    margin: var(--sp-4) var(--sp-5) 0;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 1px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.card-tier.tier-1 {
    background: var(--tier1-bg);
    color: var(--accent-hover);
}

.card-tier.tier-2 {
    background: var(--tier2-bg);
    color: var(--warning);
}

/* Card body */
.card-body {
    padding: var(--sp-4) var(--sp-5) var(--sp-5);
}

.card-company {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: var(--sp-4);
    line-height: 1.2;
}

/* Metadata grid */
.card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2) var(--sp-6);
    margin-bottom: var(--sp-5);
    font-size: 14px;
}

.meta-item {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.meta-value {
    color: var(--text-primary);
    font-size: 14px;
}

/* Draft email block */
.card-email {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: var(--sp-4) var(--sp-5);
    margin-top: var(--sp-3);
    position: relative;
}

.card-email::before {
    content: '';
    position: absolute;
    left: 0;
    top: var(--sp-3);
    bottom: var(--sp-3);
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.5;
}

.card-email.empty {
    color: var(--text-muted);
    font-style: italic;
    border-style: dashed;
}

.card-email.empty::before {
    display: none;
}

.email-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-2);
    font-family: var(--font-mono);
}

.email-text {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

/* Edit form */
.edit-area {
    margin-top: var(--sp-3);
}

.edit-area label {
    display: block;
    margin-bottom: var(--sp-2);
}

.email-editor {
    width: 100%;
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.65;
    resize: vertical;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.email-editor:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Card actions */
.card-actions {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--border-subtle);
    justify-content: flex-end;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all var(--duration-fast) ease;
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #34d399;
    box-shadow: 0 0 16px var(--success-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-focus);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-danger-ghost:hover:not(:disabled) {
    color: var(--danger);
    background: var(--danger-subtle);
}

.btn kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.5;
    margin-left: 2px;
}

/* ============================================
   Reply & Overdue Cards
   ============================================ */
.action-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-4);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.action-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
}

.action-card--urgent {
    border-left: 3px solid var(--danger);
}

.action-card--warning {
    border-left: 3px solid var(--warning);
}

.action-card-info {
    min-width: 0;
    flex: 1;
}

.action-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.action-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.action-card-actions {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* ============================================
   Progress / Queue
   ============================================ */
.queue-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    margin-top: var(--sp-5);
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.progress-bar {
    width: 200px;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: var(--radius-full);
    transition: width var(--duration) var(--ease-out);
}

/* ============================================
   Queue Empty — Celebration
   ============================================ */
.queue-empty {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
}

.empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--sp-6);
    background: var(--success-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    animation: celebrationPop 0.6s var(--ease-bounce) forwards;
}

@keyframes celebrationPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes checkDraw {
    0% { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

.queue-empty h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}

.queue-empty p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: var(--sp-6);
}

.empty-actions {
    display: flex;
    gap: var(--sp-3);
    justify-content: center;
}

/* ============================================
   Kanban Board
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--sp-3);
    overflow-x: auto;
    padding-bottom: var(--sp-4);
}

.kanban-column {
    background: var(--bg-surface);
    border-radius: var(--radius);
    min-width: 170px;
    border: 1px solid var(--border-subtle);
}

.kanban-header {
    padding: var(--sp-3) var(--sp-4);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.kanban-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-header--detected::before { background: var(--stage-detected); }
.kanban-header--qualified::before { background: var(--stage-qualified); }
.kanban-header--contacted::before { background: var(--stage-contacted); }
.kanban-header--replied::before { background: var(--stage-replied); }
.kanban-header--converted::before { background: var(--stage-converted); }
.kanban-header--skipped::before { background: var(--stage-skipped); }

.kanban-count {
    background: var(--bg-elevated);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.kanban-cards {
    padding: var(--sp-2);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-height: 70vh;
    overflow-y: auto;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--sp-3);
    font-size: 13px;
    transition: border-color var(--duration-fast) ease,
                box-shadow var(--duration-fast) ease,
                transform var(--duration-fast) ease;
    cursor: default;
}

.kanban-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kanban-card--stale { border-left: 3px solid var(--danger); }
.kanban-card--urgent { border-left: 3px solid var(--warning); }
.kanban-card--healthy { border-left: 3px solid var(--success); }

.kanban-card-company {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.3;
}

.kanban-card-signal {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 2px;
}

.kanban-card-contact {
    font-size: 12px;
    color: var(--text-muted);
}

.kanban-card-date {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 4px;
}

/* ============================================
   Analytics
   ============================================ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.analytics-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    transition: border-color var(--duration-fast) ease;
}

.analytics-card:hover {
    border-color: var(--border-focus);
}

.analytics-card.full-width {
    grid-column: 1 / -1;
}

.analytics-card h3 {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--sp-5);
    font-weight: 500;
}

.analytics-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--sp-5);
}

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

.metric-value {
    font-size: 32px;
    font-weight: 500;
    font-family: var(--font-mono);
    letter-spacing: -1px;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.delta {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.data-table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td:not(:first-child) {
    font-family: var(--font-mono);
    font-size: 14px;
}

.data-table tbody tr {
    transition: background var(--duration-fast) ease;
}

.data-table tbody tr:hover {
    background: var(--bg-card);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalEnter 0.3s var(--ease-bounce);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalEnter {
    0% { transform: scale(0.95) translateY(8px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--sp-5);
}

/* Next action modal */
.next-action-options {
    margin: var(--sp-4) 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    margin: var(--sp-1) 0;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: background var(--duration-fast) ease;
}

.radio-option:hover {
    background: var(--bg-deep);
}

.radio-option input[type="radio"] {
    accent-color: var(--accent);
}

.form-group {
    margin: var(--sp-4) 0;
}

.form-group label {
    display: block;
    margin-bottom: var(--sp-1);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group textarea {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: var(--sp-3);
    font-family: var(--font-sans);
    font-size: 14px;
    resize: vertical;
    transition: border-color var(--duration-fast) ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Legacy modal (keyboard shortcuts) */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* ============================================
   Keyboard Shortcuts Bar
   ============================================ */
.keyboard-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-6);
    padding: var(--sp-2) var(--sp-6);
    height: 40px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
    transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.keyboard-bar.hidden {
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
}

.keyboard-hint {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: 0 1px 0 var(--border);
}

/* ============================================
   Page Title
   ============================================ */
.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: var(--sp-6);
}

.page-title span {
    color: var(--text-muted);
    font-weight: 400;
}

/* ============================================
   Utilities
   ============================================ */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }

.dot-separator {
    color: var(--text-muted);
    margin: 0 var(--sp-1);
}

/* HTMX transition classes */
.htmx-swapping {
    opacity: 0;
    transition: opacity var(--duration-fast) ease;
}

.htmx-settling {
    opacity: 1;
    transition: opacity var(--duration) ease;
}

.htmx-added {
    animation: cardEnter 0.4s var(--ease-bounce) forwards;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .card-meta {
        grid-template-columns: 1fr;
    }

    .card-actions {
        flex-wrap: wrap;
    }

    .action-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-card-actions {
        width: 100%;
    }

    .action-card-actions .btn {
        flex: 1;
    }

    .nav-date {
        display: none;
    }

    .keyboard-bar {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-2);
    }

    .stat-number {
        font-size: 28px;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .container,
    .container-wide {
        padding-left: var(--sp-4);
        padding-right: var(--sp-4);
    }

    .card-body {
        padding: var(--sp-3) var(--sp-4) var(--sp-4);
    }

    .card-actions {
        padding: var(--sp-3) var(--sp-4);
    }

    .card-actions .btn {
        flex: 1;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
        padding: var(--sp-3) var(--sp-4);
    }

    .empty-actions {
        flex-direction: column;
    }

    .empty-actions .btn {
        width: 100%;
    }

    .nav-links {
        gap: 0;
    }

    .nav-link {
        padding: var(--sp-2) var(--sp-3);
        font-size: 13px;
    }

    .page-title {
        font-size: 20px;
    }

    .card-stack-area::before,
    .card-stack-area::after {
        display: none;
    }
}
