/* ========================================
   Comment Engine — Design System
   ======================================== */

/* ── CSS Variables ── */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #8b5cf6;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    --dark: #111827;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --instagram: #E1306C;
    --instagram-end: #F77737;
    --facebook: #1877F2;

    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
code { background: var(--gray-100); padding: 1px 5px; border-radius: 3px; font-size: 0.8rem; color: var(--primary-hover); }
hr { border: none; }

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

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--dark);
    color: #e5e7eb;
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; }
.logo-icon { font-size: 1.4rem; }
.logo-text { font-size: 1.1rem; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius);
    color: var(--gray-400); font-size: 0.875rem; font-weight: 500;
    transition: var(--transition); cursor: pointer;
    margin: 1px 0;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e5e7eb; }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--primary); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.account-selector { display: flex; flex-direction: column; gap: 6px; }

.selector-label {
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--gray-500);
}

/* ── Main Content ── */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
    padding: 0 32px;
    display: flex; align-items: center; justify-content: space-between;
}

.page-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--text-secondary); padding: 4px;
}
.hamburger svg { width: 24px; height: 24px; }

/* ── Warning Banner ── */
.warning-banner {
    background: var(--warning-light); border-bottom: 1px solid #fde68a;
    padding: 10px 32px; display: flex; align-items: center; gap: 8px;
    font-size: 0.875rem; color: #92400e;
}
.warning-banner svg { flex-shrink: 0; }
.warning-banner a { color: #92400e; font-weight: 600; text-decoration: underline; }

/* ── Section Panels ── */
.content-section { display: none; padding: 28px 32px; max-width: 1400px; }
.content-section.active { display: block; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius); font-size: 0.875rem;
    font-weight: 600; border: none; cursor: pointer;
    transition: var(--transition); white-space: nowrap;
    font-family: inherit; line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm { padding: 6px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ── Connect Buttons (platform-specific) ── */
.connect-ig-btn {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
}
.connect-ig-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.connect-fb-btn { background: var(--facebook); color: #fff; }
.connect-fb-btn:hover { background: #1565d8; transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ── Cards ── */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); transition: var(--transition);
    margin-bottom: 20px;
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 0.95rem; font-weight: 700; margin: 0; }

.card-body { padding: 20px; }

.master-toggle-card { border-left: 4px solid var(--primary); }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); padding: 20px;
    box-shadow: var(--shadow-sm); transition: var(--transition);
    display: flex; align-items: flex-start; gap: 16px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-info { flex: 1; display: flex; flex-direction: column; }
.stat-number { font-size: 1.75rem; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Charts ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

.chart-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); padding: 20px;
    box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; }

.chart-bars { display: flex; flex-direction: column; gap: 10px; }

.chart-bar-row { display: flex; align-items: center; gap: 10px; }
.chart-label { width: 90px; flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 22px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; min-width: 2px; }
.chart-value { width: 40px; font-size: 0.78rem; font-weight: 600; color: var(--text-primary); text-align: right; flex-shrink: 0; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; padding: 2px 8px;
    border-radius: 100px; font-size: 0.7rem; font-weight: 600;
    text-transform: capitalize; white-space: nowrap; flex-shrink: 0;
}

/* Intent badges */
.badge-intent-spam { background: #fef2f2; color: #dc2626; }
.badge-intent-hate { background: #fef2f2; color: #991b1b; }
.badge-intent-question { background: #eff6ff; color: #2563eb; }
.badge-intent-lead { background: #f0fdf4; color: #16a34a; }
.badge-intent-positive { background: #ecfdf5; color: #059669; }
.badge-intent-negative { background: #fff7ed; color: #ea580c; }
.badge-intent-off_topic { background: #f9fafb; color: #6b7280; }

/* Action badges */
.badge-action-reply { background: #eff6ff; color: #2563eb; }
.badge-action-hide { background: #fef2f2; color: #dc2626; }
.badge-action-delete { background: #fef2f2; color: #991b1b; }
.badge-action-like { background: #fdf4ff; color: #c026d3; }
.badge-action-dm_private_reply { background: #f0fdf4; color: #16a34a; }
.badge-action-dm { background: #f0fdf4; color: #16a34a; }
.badge-action-dm_and_reply { background: #f0fdf4; color: #16a34a; }
.badge-action-ignore { background: #f9fafb; color: #6b7280; }

/* Status badges */
.badge-status-received { background: #f9fafb; color: #6b7280; }
.badge-status-actioned { background: #ecfdf5; color: #059669; }
.badge-status-error { background: #fef2f2; color: #dc2626; }
.badge-status-rate_limited { background: #fffbeb; color: #d97706; }

/* Platform badges */
.badge-platform-instagram { background: linear-gradient(45deg, #f09433, #dc2743); color: #fff; }
.badge-platform-facebook { background: var(--facebook); color: #fff; }

/* ── Account Cards ── */
.accounts-grid { display: flex; flex-direction: column; gap: 24px; }

.accounts-group { margin-bottom: 0; }
.accounts-group-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.9rem; font-weight: 700; color: var(--gray-700);
    padding: 8px 4px; margin-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}
.accounts-group-count {
    font-weight: 400; font-size: 0.78rem; color: var(--gray-400);
    margin-left: auto;
}
.accounts-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.account-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 2px solid var(--border); padding: 20px;
    box-shadow: var(--shadow-sm); transition: var(--transition);
}
.account-card:hover { box-shadow: var(--shadow); border-color: var(--gray-300); }
.account-card-selected { border-color: var(--primary); background: var(--primary-light); }
.account-card-selected:hover { border-color: var(--primary-hover); }

.account-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.account-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.account-id { font-size: 0.78rem; color: var(--text-muted); }
.account-expiry { font-size: 0.72rem; color: var(--gray-400); margin-top: 2px; }
.account-expiry-warning { color: var(--warning); font-weight: 600; }
.account-expiry-danger { color: var(--danger); font-weight: 600; }

.account-card-actions {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 14px; margin-top: 14px;
    border-top: 1px solid var(--gray-100);
}

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-group { margin-bottom: 0; }
.form-label {
    display: block; font-size: 0.84rem; font-weight: 600;
    color: var(--text-primary); margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
    width: 100%; padding: 9px 12px; border-radius: var(--radius);
    border: 1px solid var(--gray-300); font-size: 0.875rem;
    font-family: inherit; color: var(--text-primary);
    background: var(--bg-card); transition: var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 36px;
}

.form-select-sm {
    width: 100%; padding: 8px 10px; border-radius: var(--radius);
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    color: #e5e7eb; font-size: 0.8rem; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    font-family: inherit;
}
.form-select-sm option { background: var(--dark); color: #e5e7eb; }

/* ── Range Slider ── */
.form-range {
    width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
    background: var(--gray-200); border-radius: 3px; outline: none;
    margin-top: 8px;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px;
    border-radius: 50%; background: var(--primary); cursor: pointer;
    box-shadow: var(--shadow-sm); transition: var(--transition);
}
.form-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.form-range::-moz-range-thumb {
    width: 18px; height: 18px; border: none;
    border-radius: 50%; background: var(--primary); cursor: pointer;
}

.slider-value {
    font-weight: 700; color: var(--primary);
}

/* ── Toggle Switch ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--gray-300); border-radius: 100px; transition: var(--transition);
}
.toggle-slider::before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: var(--transition); box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.toggle-lg { width: 56px; height: 30px; }
.toggle-lg .toggle-slider::before { height: 24px; width: 24px; }
.toggle-lg input:checked + .toggle-slider::before { transform: translateX(26px); }

/* ── Toggle Rows ── */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
}
.toggle-row strong { font-size: 0.875rem; }
.toggle-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Content Containers ── */
.dashboard-content,
.settings-content,
.keywords-content,
.activity-content { }

/* ── Empty State ── */
.empty-state {
    text-align: center; padding: 80px 40px;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-state h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { color: var(--text-secondary); font-size: 0.95rem; max-width: 400px; margin: 0 auto 24px; }

/* ── Loading / Skeleton ── */
.loading-skeleton { padding: 16px 0; }
.skeleton-row {
    height: 16px; margin-bottom: 12px;
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
.skeleton-row:nth-child(2) { width: 80%; }
.skeleton-row:nth-child(3) { width: 60%; }

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

/* ── Recent Activity Items ── */
.activity-item {
    padding: 12px 0; border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }

.activity-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.activity-item-header strong { font-size: 0.84rem; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); }
.activity-text { font-size: 0.84rem; color: var(--text-secondary); margin-bottom: 6px; }
.activity-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Data Table ── */
.data-table-wrapper {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 10px 16px; font-size: 0.75rem;
    font-weight: 600; color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.03em; background: var(--gray-50);
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 16px; font-size: 0.84rem; border-bottom: 1px solid var(--gray-100); }
.data-table tr:last-child td { border-bottom: none; }

.expandable-row { cursor: pointer; transition: var(--transition); }
.expandable-row:hover td { background: var(--gray-50); }

.comment-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }

.detail-row td { padding: 0 !important; }
.detail-content {
    padding: 16px 20px; background: var(--gray-50);
    border-bottom: 2px solid var(--border); font-size: 0.84rem;
}
.detail-field { margin-bottom: 6px; }
.detail-field strong { color: var(--text-secondary); font-size: 0.78rem; }
.reply-field { background: var(--info-light); padding: 8px 12px; border-radius: var(--radius); border-left: 3px solid var(--info); margin: 8px 0; }
.dm-field { background: var(--success-light); padding: 8px 12px; border-radius: var(--radius); border-left: 3px solid var(--success); margin: 8px 0; }
.manual-reply-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-200); }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px 0; }
.pagination-info { font-size: 0.84rem; color: var(--text-secondary); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--bg-card); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }

.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; color: var(--text-muted); padding: 4px; line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

/* ── Wizard Steps ── */
.wizard-steps {
    display: flex; align-items: center; justify-content: center;
    gap: 32px; margin-bottom: 24px;
}
.wizard-step {
    display: flex; align-items: center; gap: 8px;
    color: var(--gray-400); font-size: 0.84rem; font-weight: 500;
}
.wizard-step.active { color: var(--primary); }
.wizard-step.active .step-number { background: var(--primary); color: #fff; }
.wizard-step.completed { color: var(--success); }
.wizard-step.completed .step-number { background: var(--success); color: #fff; }

.step-number {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-200); color: var(--gray-500);
    font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
}

/* ── Wizard Panels ── */
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

/* ── Platform Cards ── */
.platform-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.platform-card {
    padding: 28px 20px; border-radius: var(--radius-lg);
    border: 2px solid var(--border); text-align: center;
    cursor: pointer; transition: var(--transition);
    background: none; font-family: inherit; color: var(--text-primary);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.platform-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.platform-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 4px;
}
.ig-icon { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.fb-icon { background: var(--facebook); }

.platform-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ── Setup Instructions ── */
.setup-instructions { display: flex; flex-direction: column; gap: 10px; }

.instruction-step {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.875rem; color: var(--text-secondary);
}

.instruction-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
    margin-top: 1px;
}

.instruction-step a { color: var(--primary); font-weight: 600; }

/* ── Success Check ── */
.success-check {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--success-light); display: flex;
    align-items: center; justify-content: center;
    margin: 0 auto;
    animation: scaleIn 0.3s ease;
}
@keyframes scaleIn { from { transform: scale(0); } to { transform: scale(1); } }

/* ── Keyword Trigger Cards ── */
.trigger-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 14px 16px;
    margin-bottom: 10px;
    transition: var(--transition);
}
.trigger-card:hover { box-shadow: var(--shadow); }

.trigger-header {
    display: flex; align-items: center; justify-content: space-between;
}

.trigger-keyword { font-weight: 700; font-size: 0.9rem; }

.trigger-template {
    font-size: 0.78rem; color: var(--text-muted); margin-top: 8px;
    padding-top: 8px; border-top: 1px solid var(--gray-100);
}

/* ── Toast ── */
.toast-container {
    position: fixed; bottom: 20px; right: 20px;
    display: flex; flex-direction: column-reverse; gap: 8px;
    z-index: 300; pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 0.84rem; font-weight: 500;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
    max-width: 360px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }

.toast-success { background: #065f46; color: #fff; }
.toast-error { background: #991b1b; color: #fff; }
.toast-warning { background: #92400e; color: #fff; }
.toast-info { background: #1e40af; color: #fff; }

.toast-icon { flex-shrink: 0; display: flex; }
.toast-message { flex: 1; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Spinner ── */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.7s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Setup Wizard ── */
.setup-wizard { max-width: 680px; }

.setup-progress { margin-bottom: 28px; }

.setup-progress-steps {
    display: flex; align-items: center; justify-content: space-between;
    gap: 4px; padding: 16px 20px;
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}

.setup-step {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; font-weight: 500; color: var(--gray-400);
    white-space: nowrap;
}
.setup-step.active { color: var(--primary); }
.setup-step.active .setup-step-num { background: var(--primary); color: #fff; }
.setup-step.completed { color: var(--success); }
.setup-step.completed .setup-step-num { background: var(--success); color: #fff; }

.setup-step-num {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-200); color: var(--gray-500);
    font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

.setup-panel { display: none; }
.setup-panel.active { display: block; }

/* Setup nav indicator dot */
.setup-indicator {
    width: 8px; height: 8px; border-radius: 50%;
    margin-left: auto; flex-shrink: 0;
}
.setup-indicator.setup-pending { background: var(--danger); }
.setup-indicator.setup-done { background: var(--success); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: flex; }
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .content-section { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .accounts-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-input, .filter-bar .form-select { max-width: 100%; }
    .platform-cards { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .setup-progress-steps { flex-wrap: wrap; gap: 8px; }
    .setup-step span:not(.setup-step-num) { display: none; }
}

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