/* Command Center Dashboard - Core Styles */
/* ======================================= */

:root {
    /* Electric Calm — Brand Identity */
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(6, 182, 212, 0.08);
    --sidebar-active: rgba(6, 182, 212, 0.12);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #22d3ee;
    --sidebar-width: 260px;

    --header-bg: #1e293b;
    --header-border: rgba(6, 182, 212, 0.1);
    --header-height: 60px;

    --content-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.04);
    --card-radius: 12px;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;

    /* Primary Accent */
    --cyan: #06b6d4;
    --cyan-hover: #22d3ee;
    --cyan-pressed: #0891b2;

    /* Semantic Colors */
    --green: #84cc16;
    --green-dark: #65a30d;
    --yellow: #eab308;
    --red: #ef4444;
    --red-dark: #dc2626;
    --blue: #06b6d4;
    --orange: #f97316;
    --lime: #a3e635;

    /* Brand colors */
    --brand-swisschems: #dc2626;
    --brand-nextchems: #16a34a;
    --brand-enhancedathlete: #2563eb;
    --brand-enhancedclinics: #7c3aed;
    --brand-pumpingiron: #ea580c;
    --brand-miraclesupplement: #9333ea;
    --brand-legitshops: #0891b2;
    --brand-musclebrawn: #b91c1c;
    --brand-sarmguide: #0d9488;
    --brand-tonyhugeis: #ca8a04;

    --font-heading: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-stack: var(--font-body);
}

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

body {
    font-family: var(--font-body);
    background: var(--content-bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(6, 182, 212, 0.1);
}

.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(6, 182, 212, 0.1); }
.sidebar-logo-row { display: flex; align-items: center; gap: 10px; }
.sidebar-logo { font-family: var(--font-heading); font-size: 18px; font-weight: 700; letter-spacing: 0.05em; }
.logo-command { color: #ffffff; }
.logo-center { color: var(--cyan); }
.sidebar-subtitle { font-size: 11px; color: var(--text-muted); display: block; margin-top: 4px; font-family: var(--font-body); letter-spacing: 0.02em; }
.sidebar-nav { list-style: none; padding: 10px 0; }
.nav-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #475569; padding: 18px 20px 6px; font-family: var(--font-heading); }

.nav-link {
    display: flex; align-items: center;
    padding: 10px 20px; color: var(--sidebar-text);
    text-decoration: none; font-size: 14px;
    font-family: var(--font-heading); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
    transition: background 0.15s, color 0.15s;
    cursor: pointer; gap: 10px;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--cyan-hover); }
.nav-link.active { background: var(--sidebar-active); color: var(--sidebar-text-active); border-left: 3px solid var(--cyan); }
.nav-link.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.nav-link.future { opacity: 0.25; cursor: not-allowed; pointer-events: none; }
.nav-icon { font-size: 14px; width: 20px; text-align: center; }

.nav-badge {
    background: var(--cyan); color: #fff;
    font-family: var(--font-mono); font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px; margin-left: auto;
}

.coming-soon {
    font-size: 10px; background: #334155; color: var(--text-muted);
    padding: 2px 6px; border-radius: 4px; margin-left: auto;
}
.phase-tag {
    font-size: 9px; background: #1e293b; color: #475569;
    padding: 2px 5px; border-radius: 3px; margin-left: auto;
}

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

/* ---- Top Header ---- */
.top-header {
    height: var(--header-height); background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex; align-items: center; padding: 0 24px;
    position: sticky; top: 0; z-index: 50; gap: 16px;
    color: #cbd5e1;
}
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: #cbd5e1; padding: 4px 8px; }
.header-left { flex: 1; }
.header-title { font-size: 18px; font-weight: 700; color: #ffffff; font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.05em; }
.header-right { display: flex; align-items: center; gap: 20px; }

.agent-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #94a3b8; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); display: inline-block; }
.status-dot.active { background: var(--green); }
.status-dot.inactive { background: var(--red); }
.status-dot.planned { background: #9ca3af; }
.status-dot.future-dot { background: #d1d5db; }

.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; }
.user-name { font-weight: 600; color: #ffffff; }
.user-role { color: #64748b; }

.logout-btn {
    color: #94a3b8; text-decoration: none; font-size: 13px;
    padding: 4px 10px; border: 1px solid #334155; border-radius: 6px; transition: all 0.15s;
}
.logout-btn:hover { background: rgba(6,182,212,0.1); color: var(--cyan-hover); border-color: var(--cyan); }

/* ---- Content Area ---- */
.content-area { padding: 24px; }

/* ---- Cards ---- */
.card { background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow); overflow: hidden; border: 1px solid var(--border); transition: border-color 0.2s, box-shadow 0.2s; }
.card:hover { border-color: rgba(6, 182, 212, 0.2); box-shadow: 0 4px 12px rgba(6, 182, 212, 0.08); }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.03em; }
.card-body { padding: 20px; }
.card-disabled { opacity: 0.6; }

/* ---- Stats Row ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow); padding: 20px; text-align: center; }
.stat-card.stat-highlight { border: 2px solid var(--cyan); }
.stat-card.stat-clickable { cursor: pointer; transition: all 0.15s; }
.stat-card.stat-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(6,182,212,0.1); }
.stat-value { font-family: var(--font-mono); font-size: 32px; font-weight: 600; color: var(--cyan); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-body); }

/* ---- Quick Actions ---- */
.quick-actions { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---- Two / Three Column Layout ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ---- Buttons ---- */
.btn {
    display: inline-block; padding: 10px 24px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: all 0.2s; font-family: var(--font-heading); line-height: 1.4;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.btn-primary { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; }
.btn-primary:hover { box-shadow: 0 0 16px rgba(6,182,212,0.4); transform: translateY(-1px); }
.btn-secondary { background: #f1f5f9; color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; border-color: var(--cyan); }
.btn-green { background: linear-gradient(135deg, #84cc16, #65a30d); color: #fff; }
.btn-green:hover { box-shadow: 0 0 16px rgba(132,204,22,0.4); transform: translateY(-1px); }
.btn-red { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-red:hover { box-shadow: 0 0 16px rgba(239,68,68,0.4); transform: translateY(-1px); }
.btn-yellow { background: var(--yellow); color: #1e293b; }
.btn-full { width: 100%; text-align: center; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; font-family: var(--font-stack); transition: border-color 0.15s;
    color: var(--text-primary); background: #fff;
}
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---- Alert Items (Home) ---- */
.alert-item { padding: 12px 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.1s; }
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: #f8fafc; }
.alert-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.alert-item-subject { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.alert-item-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.alert-time { font-size: 12px; color: var(--text-muted); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #f1f5f9; color: var(--text-secondary); }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fff7ed; color: #9a3412; }

/* ---- Brand Tags ---- */
.brand-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #fff; background: var(--text-muted); }
.brand-enhancedathlete, .brand-ea { background: var(--brand-enhancedathlete); }
.brand-nextchems, .brand-nc { background: var(--brand-nextchems); }
.brand-swisschems, .brand-sc { background: var(--brand-swisschems); }
.brand-enhancedclinics { background: var(--brand-enhancedclinics); }
.brand-pumpingiron { background: var(--brand-pumpingiron); }
.brand-miraclesupplement { background: var(--brand-miraclesupplement); }
.brand-legitshops { background: var(--brand-legitshops); }
.brand-musclebrawn { background: var(--brand-musclebrawn); }
.brand-sarmguide { background: var(--brand-sarmguide); }
.brand-tonyhugeis { background: var(--brand-tonyhugeis); }

/* ---- Filters Bar ---- */
.filters-bar {
    display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
    padding: 16px 20px; background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
    align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.filter-select {
    padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px;
    font-family: var(--font-stack); color: var(--text-primary); background: #fff; cursor: pointer; min-width: 130px;
}
.filter-select:focus { outline: none; border-color: var(--blue); }

/* ---- Ticket Queue Header ---- */
.ticket-queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 0 4px; }
.ticket-count { font-size: 13px; color: var(--text-secondary); }
.last-updated { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.refresh-btn { background: none; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.refresh-btn:hover { background: #f1f5f9; color: var(--text-primary); }

/* ---- Ticket List ---- */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }

.ticket-row {
    display: grid;
    grid-template-columns: 14px 80px 100px 1fr 100px 50px 50px 60px 90px auto;
    align-items: center; gap: 10px; padding: 12px 16px;
    background: var(--card-bg); border-radius: var(--card-radius);
    box-shadow: var(--card-shadow); cursor: pointer; transition: all 0.15s; font-size: 13px;
}
.ticket-row:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }

.ticket-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-pending { background: var(--yellow); }
.dot-approved { background: var(--green); }
.dot-edited { background: var(--blue); }
.dot-rejected { background: var(--red); }

.ticket-id { font-family: var(--font-mono); font-weight: 600; color: var(--cyan); }
.ticket-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-topic { color: var(--text-secondary); font-size: 12px; }
.ticket-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.ticket-status-badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-edited { background: #dbeafe; color: #1e40af; }
.status-rejected { background: #fef2f2; color: #991b1b; }

.cell-sentiment, .cell-urgency, .cell-confidence { font-family: var(--font-mono); font-weight: 500; font-size: 13px; text-align: center; }

/* Inline action buttons on ticket rows */
.row-actions { display: flex; gap: 4px; align-items: center; }
.row-actions .btn-xs { opacity: 0.8; white-space: nowrap; }
.row-actions .btn-xs:hover { opacity: 1; }
.ticket-row .row-actions { visibility: hidden; }
.ticket-row:hover .row-actions { visibility: visible; }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; padding: 10px; }
.page-btn {
    padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff;
    color: var(--text-primary); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---- Modal ---- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 200;
    justify-content: center; align-items: flex-start; padding: 30px 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 900px; max-height: 90vh; overflow-y: auto;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: var(--card-bg); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; font-family: var(--font-heading); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }

/* Modal detail sections */
.detail-section { margin-bottom: 20px; }
.detail-section h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.3px; }

.detail-content { background: #f8fafc; padding: 14px; border-radius: 8px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.detail-value { font-size: 14px; font-weight: 500; }

/* Conversation bubbles */
.conversation { margin-bottom: 20px; }
.msg-bubble { padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; margin-bottom: 8px; max-width: 95%; }
.msg-incoming { background: #f1f5f9; color: var(--text-primary); border-bottom-left-radius: 4px; }
.msg-outgoing { background: #dbeafe; color: #1e3a5f; border-bottom-right-radius: 4px; margin-left: auto; }
.msg-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.3px; }
.msg-edited { background: #f0fdf4; color: #14532d; border: 1px dashed #86efac; border-bottom-right-radius: 4px; margin-left: auto; }

/* Reasoning collapsible */
.reasoning-toggle { cursor: pointer; color: var(--blue); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.reasoning-toggle:hover { text-decoration: underline; }
.reasoning-content { display: none; margin-top: 8px; }
.reasoning-content.open { display: block; }

.action-buttons { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #f1f5f9; flex-wrap: wrap; align-items: center; }
.edit-area { display: none; margin-top: 16px; }
.edit-textarea {
    width: 100%; min-height: 150px; padding: 12px; border: 1px solid #e2e8f0;
    border-radius: 8px; font-size: 14px; font-family: var(--font-stack); line-height: 1.5;
    resize: vertical; color: var(--text-primary);
}
.edit-textarea:focus { outline: none; border-color: var(--blue); }
.edit-buttons { display: flex; gap: 8px; margin-top: 10px; }
.reject-area { display: none; margin-top: 16px; }

/* Needs Review Banner */
.review-banner {
    background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #eab308;
    border-radius: 8px; padding: 12px 16px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px; font-size: 14px; color: #92400e;
}
.review-banner strong { font-weight: 700; white-space: nowrap; }

/* Customer message block */
.msg-customer {
    background: #f1f5f9; border-left: 3px solid #94a3b8;
    padding: 14px 16px; border-radius: 0 8px 8px 0;
    font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--text-primary);
}

/* Draft response block */
.msg-draft {
    background: #eff6ff; border-left: 3px solid #2563eb;
    padding: 14px 16px; border-radius: 0 8px 8px 0;
    font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--text-primary);
}

/* Agent reasoning block */
.msg-reasoning {
    background: #f8fafc; border-left: 3px solid #cbd5e1;
    padding: 12px 16px; border-radius: 0 8px 8px 0;
    font-size: 13px; line-height: 1.6; white-space: pre-wrap;
    color: var(--text-secondary); font-style: italic;
}

/* Empty message placeholder */
.msg-empty {
    padding: 12px 16px; font-size: 13px; color: var(--text-muted);
    font-style: italic; background: #f8fafc; border-radius: 8px;
}

/* Collapsible sections */
.collapsible-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; cursor: pointer; font-size: 13px; font-weight: 600;
    text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.3px;
    user-select: none;
}
.collapsible-header:hover { color: var(--text-secondary); }
.collapsible-body { display: none; padding: 12px 0; }
.collapsible-body.open { display: block; }
.caret { font-size: 10px; transition: transform 0.2s; }
.collapsible-header.expanded .caret { transform: rotate(90deg); }

/* Confidence dot */
.conf-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 4px; vertical-align: middle;
}

/* Modal topic label */
.modal-topic {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-left: 8px;
}

/* No-draft gray dot */
.dot-none { background: #d1d5db; }

/* ---- Toast Notifications ---- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 500;
    font-family: var(--font-body);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2); color: #fff; min-width: 280px;
    animation: toastIn 0.3s ease forwards;
}
.toast-success { background: linear-gradient(135deg, #84cc16, #65a30d); }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-info { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.toast-exit { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ---- Section Headers ---- */
.section-header { margin-bottom: 12px; margin-top: 8px; }
.section-header h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Ticket Toolbar ---- */
.ticket-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 0 4px; }

/* ---- Agent Status Cards (Home) ---- */
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 24px; }
.agent-card {
    background: var(--card-bg); border-radius: 8px; box-shadow: var(--card-shadow);
    padding: 12px; display: flex; align-items: center; gap: 10px; font-size: 13px;
    transition: all 0.15s;
}
.agent-card.agent-live { border-left: 3px solid var(--green); }
.agent-card.agent-planned { opacity: 0.6; }
.agent-card.agent-future { opacity: 0.35; }
.agent-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.agent-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-running { background: var(--green); animation: pulse-green 2s infinite; }
.dot-planned { background: #9ca3af; }
.dot-future { background: #d1d5db; }
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(132, 204, 22, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(132, 204, 22, 0); }
}

.agent-info { flex: 1; min-width: 0; }
.agent-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-phase { font-size: 11px; color: var(--text-muted); }

.agent-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-live { background: #dcfce7; color: #166534; }
.badge-planned { background: #f1f5f9; color: #64748b; }
.badge-future { background: #f8fafc; color: #94a3b8; }

/* ---- Brand Overview Cards (Home) ---- */
.brand-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.brand-card {
    background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
    padding: 16px; transition: all 0.15s;
}
.brand-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.brand-card-inactive { opacity: 0.35; cursor: default !important; }
.brand-card-inactive:hover { transform: none !important; box-shadow: var(--card-shadow) !important; }

.brand-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.brand-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.brand-card-name { font-size: 14px; font-weight: 600; }
.brand-card-inactive-text { font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px 0; }

.brand-card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 4px; }
.brand-stat { text-align: center; }
.brand-stat-value { font-size: 16px; font-weight: 700; color: var(--text-primary); display: block; }
.brand-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

/* ---- Activity Feed ---- */
.activity-item { padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.activity-item:last-child { border-bottom: none; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; min-width: 55px; }
.activity-desc { font-weight: 500; }
.activity-user { font-size: 12px; color: var(--text-muted); }
.activity-approved .activity-desc { color: var(--green); }
.activity-edited .activity-desc { color: var(--blue); }
.activity-rejected .activity-desc { color: var(--red); }

/* Alert type variants */
.alert-urgent { border-left: 3px solid var(--red); padding-left: 12px; }
.alert-negative { border-left: 3px solid var(--orange); padding-left: 12px; }

/* Card subtitle */
.card-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* Badge gray */
.badge-gray { background: #f1f5f9; color: #64748b; }

/* Safety gates table specific */
.safety-gates-table td { vertical-align: middle; }
.safety-gates-table td:first-child { width: 60px; text-align: center; }

/* ---- Navigation Shortcut Cards (Home) ---- */
.nav-shortcuts {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
.shortcut-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
    padding: 20px 24px; text-decoration: none; color: var(--text-primary);
    transition: all 0.2s; border: 2px solid transparent; position: relative;
}
.shortcut-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.shortcut-review { border-color: var(--cyan); }
.shortcut-review:hover { border-color: var(--cyan-hover); background: rgba(6,182,212,0.04); box-shadow: 0 0 20px rgba(6,182,212,0.1); }
.shortcut-analytics:hover { border-color: var(--green); background: rgba(132,204,22,0.04); box-shadow: 0 0 20px rgba(132,204,22,0.1); }
.shortcut-global:hover { border-color: var(--cyan-pressed); background: rgba(6,182,212,0.04); box-shadow: 0 0 20px rgba(6,182,212,0.1); }
.shortcut-icon { font-size: 28px; flex-shrink: 0; }
.shortcut-label { font-size: 16px; font-weight: 700; font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.03em; }
.shortcut-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.shortcut-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--cyan); color: #fff; font-family: var(--font-mono); font-size: 13px; font-weight: 600;
    min-width: 26px; height: 26px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center; padding: 0 6px;
}

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

/* ---- Charts ---- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card { min-height: 300px; }
.chart-full { grid-column: 1 / -1; }

/* ---- Data Tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; padding: 10px 12px; background: #f8fafc; font-weight: 600;
    color: var(--text-secondary); font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.3px; border-bottom: 2px solid #e2e8f0; cursor: pointer;
}
.data-table th:hover { color: var(--text-primary); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: var(--text-primary); }
.data-table tr:hover td { background: #f8fafc; }
.data-table .clickable-row { cursor: pointer; }
.data-table .clickable-row:hover td { background: #eef2ff; }

/* ---- Safety Gates ---- */
.safety-gate-row { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; gap: 12px; }
.safety-gate-row:last-child { border-bottom: none; }
.gate-num { width: 28px; height: 28px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; }
.gate-name { font-weight: 600; min-width: 140px; }
.gate-desc { flex: 1; color: var(--text-secondary); }
.gate-status { font-size: 12px; font-weight: 600; }
.gate-on { color: var(--green); }
.gate-off { color: var(--text-muted); }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.config-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #f8fafc; gap: 10px; }
.config-row:last-child { border-bottom: none; }
.config-label { font-size: 13px; color: var(--text-secondary); min-width: 140px; }
.config-value { font-size: 14px; font-weight: 500; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1; border-radius: 24px; transition: 0.3s;
}
.toggle-slider::before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle.disabled { opacity: 0.4; pointer-events: none; }

.l3-categories { margin-top: 10px; }
.l3-category { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.l3-category.disabled { opacity: 0.4; }
.range-disabled { opacity: 0.4; pointer-events: none; }

/* ---- Login Page ---- */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: var(--card-bg); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); padding: 40px; border: 1px solid rgba(6,182,212,0.1); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-family: var(--font-heading); font-size: 28px; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.05em; }
.login-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; font-family: var(--font-body); }
.login-form { margin-top: 24px; }

/* ---- 2FA Setup ---- */
.setup-container { max-width: 600px; margin: 0 auto; }
.qr-container { text-align: center; padding: 20px; background: #fff; border-radius: 12px; border: 2px solid #e2e8f0; margin: 20px auto; max-width: 280px; }
.qr-image { max-width: 240px; }
.manual-key { text-align: center; font-size: 13px; margin: 16px 0; color: var(--text-secondary); }
.manual-key code { background: #f1f5f9; padding: 4px 10px; border-radius: 4px; font-size: 14px; letter-spacing: 1px; }
.setup-form { margin-top: 20px; }
.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.backup-code { background: #f1f5f9; padding: 8px 14px; border-radius: 6px; text-align: center; font-size: 16px; letter-spacing: 2px; font-weight: 600; }

/* ---- Topic Blocks (Topics Explorer) ---- */
.topic-blocks {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px;
}
.topic-block {
    background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
    padding: 16px; cursor: pointer; transition: all 0.15s;
    display: flex; flex-direction: column; justify-content: center;
}
.topic-block:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.topic-block-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; text-transform: capitalize; }
.topic-block-count { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.topic-block-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ---- Utilities ---- */
.loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .two-col, .three-col { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .ticket-row { grid-template-columns: 14px 70px 80px 1fr 80px auto; font-size: 12px; }
    .ticket-row .ticket-topic, .ticket-row .cell-urgency,
    .ticket-row .cell-confidence, .ticket-row .ticket-time { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .agent-cards { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (max-width: 640px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .filters-bar { flex-direction: column; }
    .filter-select { width: 100%; }
    .quick-actions { flex-direction: column; }
    .detail-grid, .detail-grid-3 { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
    .login-card { padding: 24px; }
    .backup-codes { grid-template-columns: 1fr; }
    .brand-cards { grid-template-columns: 1fr 1fr; }
    .ticket-row .row-actions { visibility: visible; }
}
