/* =====================================================
   HADEZ INTELLIGENCE PLATFORM - STYLESHEET
   Multi-Campaign Political Intelligence
   ===================================================== */

:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --secondary: #c62828;
    --accent: #ff6f00;
    --success: #2e7d32;
    --warning: #f9a825;
    --danger: #c62828;
    --info: #0277bd;
    --dark: #1a1a2e;
    --darker: #0f0f1a;
    --card-bg: #16213e;
    --card-border: #233554;
    --text: #e0e0e0;
    --text-muted: #90a4ae;
    --text-bright: #ffffff;
    --sidebar-w: 260px;
    --sidebar-collapsed-w: 64px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--darker);
    color: var(--text);
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, var(--primary) 100%);
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    border-right: 1px solid var(--card-border);
    transition: width 0.25s ease;
}
.sidebar-header {
    text-align: center;
    padding: 15px 20px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}
.sidebar-header h2 {
    font-size: 16px;
    color: var(--text-bright);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--accent);
    margin-top: 5px;
    letter-spacing: 1px;
}
.sidebar-header .classification {
    display: inline-block;
    background: var(--secondary);
    color: white;
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 3px;
    margin-top: 8px;
    letter-spacing: 2px;
    font-weight: 700;
}
.nav-section {
    padding: 8px 15px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.08);
    color: var(--text-bright);
    border-left-color: var(--accent);
}
.nav-link .icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-link .badge {
    margin-left: auto;
    background: var(--secondary);
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* MAIN CONTENT */
.main { margin-left: var(--sidebar-w); padding: 20px 30px; min-height: 100vh; transition: margin-left 0.25s ease; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--card-border);
}
.page-header h1 {
    font-size: 22px;
    color: var(--text-bright);
    font-weight: 600;
}
.page-header .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

/* CARDS */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}
.card-header h3 {
    font-size: 15px;
    color: var(--text-bright);
    font-weight: 600;
}
.card-sm { padding: 15px; }

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon.blue { background: rgba(2,119,189,0.2); color: var(--info); }
.stat-icon.green { background: rgba(46,125,50,0.2); color: var(--success); }
.stat-icon.red { background: rgba(198,40,40,0.2); color: var(--danger); }
.stat-icon.orange { background: rgba(255,111,0,0.2); color: var(--accent); }
.stat-icon.purple { background: rgba(106,27,154,0.2); color: #ab47bc; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-bright); }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* GRID LAYOUTS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead th {
    background: rgba(0,0,0,0.3);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
}
tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: top;
}
tbody tr:hover { background: rgba(255,255,255,0.03); }

/* BADGES */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-pro { background: rgba(46,125,50,0.2); color: #66bb6a; }
.badge-kontra { background: rgba(198,40,40,0.2); color: #ef5350; }
.badge-netral { background: rgba(144,164,174,0.2); color: #b0bec5; }
.badge-high, .badge-tinggi { background: rgba(198,40,40,0.25); color: #ef5350; }
.badge-medium, .badge-sedang { background: rgba(249,168,37,0.25); color: #fdd835; }
.badge-low, .badge-rendah { background: rgba(46,125,50,0.25); color: #66bb6a; }
.badge-critical { background: rgba(198,40,40,0.3); color: #ff5252; border: 1px solid rgba(198,40,40,0.5); }
.badge-completed { background: rgba(46,125,50,0.24); color: #7ee787; border: 1px solid rgba(126,231,135,0.35); }
.badge-pending { background: rgba(249,168,37,0.24); color: #ffd166; border: 1px solid rgba(255,209,102,0.35); }
.badge-in-progress { background: rgba(2,119,189,0.26); color: #74d7ff; border: 1px solid rgba(116,215,255,0.35); }
.badge-draft { background: rgba(144,164,174,0.2); color: #b0bec5; }
.badge-active { background: rgba(2,119,189,0.2); color: #4fc3f7; }
.badge-standby { background: rgba(249,168,37,0.24); color: #ffd166; border: 1px solid rgba(255,209,102,0.35); }
.badge-inactive { background: rgba(198,40,40,0.24); color: #ff8a80; border: 1px solid rgba(255,138,128,0.35); }
.badge-not-started { background: rgba(144,164,174,0.24); color: #d1d9e0; border: 1px solid rgba(209,217,224,0.28); }

.empty-state {
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 18px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* TEAM PAGE */
.team-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 14px;
    align-items: start;
}
.team-queue-item {
    align-items: flex-start;
}
.team-queue-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.team-subteam-list {
    display: grid;
    gap: 10px;
}
.team-subteam-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
}
.team-subteam-total {
    min-width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    background: rgba(255,111,0,0.12);
}
.team-cell-subtext {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.45;
}

/* QUICK OPS (shared operational list component) */
.quick-ops-list {
    display: grid;
    gap: 10px;
}
.quick-ops-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px;
}
.quick-ops-item-stack {
    align-items: flex-start;
    flex-direction: column;
}
.quick-ops-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
}
.quick-ops-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.quick-ops-submeta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

/* TIMELINE PAGE ADJUSTMENTS */
.timeline-control-bar {
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.timeline-inline-action {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.timeline-task-row {
    border-left: 3px solid rgba(249,168,37,0.55);
}
.timeline-icon-btn {
    min-width: 30px;
    min-height: 30px;
    padding: 4px 6px;
    justify-content: center;
}
.timeline-icon-btn i {
    font-size: 15px;
}
.timeline-priority-wrap {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 8px;
}
.timeline-priority-table {
    font-size: 12px;
}
.timeline-priority-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
.timeline-priority-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}
.hidden-row {
    display: none;
}

/* RISKS PAGE COMPACT LAYOUT */
.risk-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
    gap: 14px;
    align-items: start;
}
.risk-priority-wrap {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 8px;
}
.risk-priority-table {
    font-size: 12px;
}
.risk-priority-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
.risk-priority-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}
.risk-priority-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.risk-icon-btn {
    min-width: 30px;
    min-height: 30px;
    padding: 4px 6px;
    justify-content: center;
}
.risk-icon-btn i {
    font-size: 14px;
}
.risk-cell-subtext {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.45;
}
.risk-expand summary {
    cursor: pointer;
    font-size: 11px;
    color: var(--accent);
    user-select: none;
}
.risk-expand summary::marker {
    color: var(--accent);
}

/* PROGRESS BAR */
.progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.progress-fill.blue { background: linear-gradient(90deg, #0277bd, #4fc3f7); }
.progress-fill.green { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.progress-fill.orange { background: linear-gradient(90deg, #e65100, #ff9800); }
.progress-fill.red { background: linear-gradient(90deg, #b71c1c, #ef5350); }

/* MUSDES SIMULATION */
.musdes-sim-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.musdes-sim-card {
    min-width: 0;
}
.musdes-progress-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.musdes-vote-row {
    display: flex;
    gap: 15px;
    font-size: 13px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.musdes-task-sticky {
    position: sticky;
    top: 70px;
    z-index: 5;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    background: rgba(8, 24, 40, 0.92);
    backdrop-filter: blur(4px);
}
.musdes-task-sticky-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.musdes-task-sticky-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.musdes-queue-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .team-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* INFLUENCE METER */
.influence-meter {
    display: flex;
    gap: 2px;
    align-items: center;
}
.influence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.influence-dot.filled { background: var(--accent); }
.influence-dot.filled.high { background: #ef5350; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
}
.btn-primary { background: var(--primary-light); color: white; }
.btn-primary:hover { background: #3949ab; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #388e3c; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #d32f2f; }
.btn-warning { background: var(--accent); color: white; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-outline { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* FORMS */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,111,0,0.15);
}
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }

/* FILTER BAR */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
    padding: 6px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h3 {
    color: var(--text-bright);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

/* PHASE TIMELINE */
.phase-timeline {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    overflow-x: auto;
    padding: 10px 0;
}
.phase-item {
    flex: 1;
    min-width: 160px;
    text-align: center;
    position: relative;
    padding: 15px 10px;
}
.phase-item::after {
    content: '→';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}
.phase-item:last-child::after { display: none; }
.phase-number {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 700;
    font-size: 14px;
}
.phase-number.not-started { background: rgba(144,164,174,0.2); color: #b0bec5; border: 2px solid #546e7a; }
.phase-number.in-progress { background: rgba(2,119,189,0.3); color: #4fc3f7; border: 2px solid #0277bd; animation: pulse 2s infinite; }
.phase-number.completed { background: rgba(46,125,50,0.3); color: #66bb6a; border: 2px solid #2e7d32; }
.phase-name { font-size: 11px; color: var(--text); font-weight: 600; }
.phase-kpi { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(2,119,189,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(2,119,189,0); }
}

/* RISK HEATMAP */
.risk-heatmap {
    display: grid;
    grid-template-columns: auto repeat(3, 1fr);
    gap: 2px;
    margin: 15px 0;
}
.heatmap-cell {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}
.heatmap-header { background: rgba(0,0,0,0.3); color: var(--text-muted); }
.heatmap-low { background: rgba(46,125,50,0.15); color: #66bb6a; }
.heatmap-medium { background: rgba(249,168,37,0.15); color: #fdd835; }
.heatmap-high { background: rgba(198,40,40,0.2); color: #ef5350; }

/* NETWORK MAP (Constituent Relationships) */
.network-node {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    font-size: 11px;
    margin: 2px;
    border: 1px solid var(--card-border);
}
.network-node.pro { border-color: #2e7d32; }
.network-node.kontra { border-color: #c62828; }

/* DONUT CHART (CSS only) */
.donut-chart {
    width: 120px; height: 120px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}
.donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-bright);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--darker); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ALERT */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-warning { background: rgba(255,111,0,0.1); border: 1px solid rgba(255,111,0,0.3); color: var(--accent); }
.alert-danger { background: rgba(198,40,40,0.1); border: 1px solid rgba(198,40,40,0.3); color: #ef5350; }
.alert-success { background: rgba(46,125,50,0.1); border: 1px solid rgba(46,125,50,0.3); color: #66bb6a; }
.alert-info { background: rgba(2,119,189,0.1); border: 1px solid rgba(2,119,189,0.3); color: #4fc3f7; }

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--card-border); margin-bottom: 20px; }
.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* KPI Indicator */
.kpi-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    margin-bottom: 8px;
}
.kpi-label { font-size: 11px; color: var(--text-muted); flex: 1; }
.kpi-value { font-size: 14px; font-weight: 700; color: var(--text-bright); }

/* =====================================================
   MOBILE APP SHELL
   ===================================================== */

/* Top header bar — iOS/Android status-bar style */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    height: 52px;
    background: var(--dark);
    border-bottom: 1px solid var(--card-border);
    z-index: 150;
    align-items: center;
    padding: 0 8px;
    gap: 8px;
    box-sizing: border-box;
}
.mobile-header .hamburger,
.mobile-header .mobile-search-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text-muted);
    font-size: 20px; cursor: pointer; border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.mobile-header .hamburger:active,
.mobile-header .mobile-search-btn:active { background: rgba(255,255,255,0.08); }
.mobile-header .brand {
    font-size: 14px; font-weight: 700; color: var(--text-bright);
    letter-spacing: 1.5px; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-header .brand small {
    font-size: 10px; color: var(--text-muted); font-weight: 400;
    display: block; letter-spacing: 0.5px; margin-top: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Bottom navigation — app-style tab bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 60px;
    background: var(--dark);
    border-top: 1px solid var(--card-border);
    z-index: 150;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-sizing: border-box;
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; text-decoration: none;
    color: var(--text-muted); font-size: 10px;
    padding: 6px 8px; border-radius: 8px;
    background: none; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-width: 52px; transition: color 0.15s;
}
.bottom-nav-item i { font-size: 20px; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:active { background: rgba(255,255,255,0.05); }

/* Sidebar backdrop overlay */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop.active { display: block; }

/* =====================================================
   MOBILE CARD VIEW — replaces tables on phones
   ===================================================== */
.mobile-card-list { display: none; }
.mobile-data-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: transparent;
}
.mobile-data-card .mdc-top {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.mobile-data-card .mdc-name {
    font-size: 14px; font-weight: 600; color: var(--text-bright);
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-data-card .mdc-badges { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.mobile-data-card .mdc-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-data-card .mdc-detail {
    display: none;
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--card-border);
    font-size: 12px; color: var(--text);
}
.mobile-data-card .mdc-detail.open { display: block; }
.mobile-data-card .mdc-detail-row {
    display: flex; justify-content: space-between; padding: 4px 0;
}
.mobile-data-card .mdc-detail-row .lbl { color: var(--text-muted); font-size: 11px; }
.mobile-data-card .mdc-detail-row .val { font-size: 12px; text-align: right; max-width: 60%; }
.mobile-data-card .mdc-actions {
    display: flex; gap: 8px; margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--card-border);
}
.mobile-data-card .mdc-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 8px; min-height: 38px; }

/* =====================================================
   SIDEBAR COLLAPSE — Desktop toggle (sticky bottom bar)
   ===================================================== */
.sidebar-toggle {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 0;
    background: rgba(0,0,0,0.35);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    z-index: 101;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    margin-top: 8px;
}
.sidebar-toggle .toggle-label {
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
}
.sidebar-toggle:hover {
    background: var(--accent);
    color: #fff;
}

/* Collapsed state */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
    overflow-y: auto;
    overflow-x: hidden;
}
body.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-w);
}
body.sidebar-collapsed .sidebar-header {
    padding: 10px 8px 15px;
}
body.sidebar-collapsed .sidebar-header h2 {
    font-size: 11px; letter-spacing: 1px;
}
body.sidebar-collapsed .sidebar-header .subtitle,
body.sidebar-collapsed .sidebar-header .classification,
body.sidebar-collapsed .sidebar-logo {
    display: none;
}
body.sidebar-collapsed .sidebar-toggle {
    padding: 10px 0;
    gap: 0;
}
body.sidebar-collapsed .sidebar-toggle .toggle-label {
    display: none;
}
body.sidebar-collapsed .nav-section {
    font-size: 0; padding: 4px 0; margin-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-left: 12px; margin-right: 12px;
}
body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    border-left: none;
    position: relative;
    font-size: 0;
}
body.sidebar-collapsed .nav-link .icon {
    font-size: 20px; width: auto;
}
body.sidebar-collapsed .nav-link .badge {
    position: absolute; top: 4px; right: 8px;
    font-size: 8px; padding: 1px 4px;
}
/* Campaign switcher hidden in collapsed */
body.sidebar-collapsed .sidebar > div[style*="padding:8px"] {
    display: none;
}
/* Sidebar user compact */
body.sidebar-collapsed .sidebar-user > div[style] {
    display: none;
}
body.sidebar-collapsed .sidebar-user .nav-link {
    font-size: 0;
}
body.sidebar-collapsed .sidebar-user .nav-link .icon {
    font-size: 20px;
}
/* Tooltip for collapsed sidebar — rendered via JS with fixed positioning */
.sidebar-tooltip {
    position: fixed;
    background: var(--dark); color: var(--text-bright);
    padding: 5px 12px; border-radius: 4px;
    font-size: 12px; white-space: nowrap;
    pointer-events: none; opacity: 0;
    transition: opacity 0.15s; z-index: 9999;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.sidebar-tooltip.visible {
    opacity: 1;
}

/* =====================================================
   Hide collapse toggle on mobile
   ===================================================== */
@media (max-width: 768px) {
    .sidebar-toggle { display: none !important; }
    body.sidebar-collapsed .sidebar { width: 280px; overflow-y: auto; overflow-x: hidden; }
    body.sidebar-collapsed .main { margin-left: 0; }
    body.sidebar-collapsed .nav-link { font-size: 13px; justify-content: flex-start; gap: 12px; padding: 10px 20px; }
    body.sidebar-collapsed .nav-section { font-size: 10px; padding: 8px 15px; border-top: none; margin: 0; }
    body.sidebar-collapsed .sidebar-header h2 { font-size: 16px; }
    body.sidebar-collapsed .sidebar-header .subtitle,
    body.sidebar-collapsed .sidebar-header .classification,
    body.sidebar-collapsed .sidebar-logo { display: block; }
    body.sidebar-collapsed .sidebar-header { padding: 15px 20px 25px; }
    body.sidebar-collapsed .sidebar-user > div[style] { display: block; }
    body.sidebar-collapsed .sidebar-user .nav-link { font-size: 13px; }
    body.sidebar-collapsed .nav-link::after { display: none; }
    body.sidebar-collapsed .sidebar > div[style*="padding:8px"] { display: block; }
}

/* Tablet collapsed */
@media (min-width: 769px) and (max-width: 1024px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
    body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed-w); padding: 15px; }
}

/* =====================================================
   RESPONSIVE — TABLET (≤1024px)
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .main { margin-left: 200px; padding: 15px; }
    .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================
   RESPONSIVE — MOBILE (≤768px)
   ===================================================== */
@media (max-width: 768px) {
    /* App shell */
    .mobile-header { display: flex; }
    .mobile-bottom-nav { display: flex; }

    /* Sidebar: off-canvas drawer */
    .sidebar {
        display: block;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }

    /* Main container — app viewport */
    .main {
        margin-left: 0;
        padding: 60px 10px 72px;
        min-height: 100vh;
        max-width: 100vw;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Page header: compact + vertical */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }
    .page-header h1 { font-size: 16px; }
    .page-header .breadcrumb { font-size: 10px; }

    /* Grids: single column */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 8px; }

    /* Stats: 2-column compact like app widgets */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 14px; }
    .stat-card {
        padding: 10px; gap: 8px; border-radius: 10px;
        flex-direction: column; align-items: flex-start; text-align: left;
    }
    .stat-icon { width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
    .stat-value { font-size: 18px; line-height: 1.1; }
    .stat-label { font-size: 9px; letter-spacing: 0.5px; margin-top: 0; }

    /* Cards: tighter */
    .card { padding: 12px 10px; margin-bottom: 10px; border-radius: 10px; overflow: hidden; }
    .card-header { flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 10px; padding-bottom: 8px; }
    .card-header h3 { font-size: 13px; }

    /* Tables: show on mobile for simple tables, hide for complex ones */
    .table-wrap { margin: 0 -10px; padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: 11px; }
    thead th { padding: 6px 8px; font-size: 9px; letter-spacing: 0.3px; }
    tbody td { padding: 7px 8px; font-size: 11px; }

    /* Mobile card list: visible, desktop table: hidden for tagged tables */
    .mobile-card-list { display: block; }
    .desktop-table { display: none; }

    /* Buttons: touch targets */
    .btn { padding: 10px 14px; font-size: 12px; min-height: 40px; border-radius: 8px; }
    .btn-sm { padding: 7px 10px; font-size: 11px; min-height: 34px; border-radius: 6px; }
    .btn-delete { padding: 7px 10px; min-height: 34px; border-radius: 6px; }

    /* Filter bar: full width, stacked */
    .filter-bar {
        gap: 6px;
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar > * { width: 100% !important; max-width: none !important; }
    .filter-bar select, .filter-bar input {
        padding: 10px 12px; font-size: 14px;
        min-height: 42px; width: 100%;
        border-radius: 8px;
    }

    /* Export bar: compact icon pills */
    .export-bar { flex-wrap: wrap; gap: 6px; }
    .export-bar a {
        padding: 7px 10px; font-size: 10px;
        min-height: 32px; display: inline-flex; align-items: center;
        border-radius: 6px;
    }

    /* Modals: full-screen drawer feel */
    .modal-overlay { align-items: flex-end; }
    .modal {
        width: 100%;
        max-width: none;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        padding: 20px 14px 30px;
        margin: 0;
    }
    .modal h3 { font-size: 15px; margin-bottom: 14px; }
    .modal .grid-2 { grid-template-columns: 1fr; gap: 8px; }

    /* Forms: mobile input sizing */
    .form-group { margin-bottom: 10px; }
    .form-group label { font-size: 11px; margin-bottom: 4px; letter-spacing: 0.5px; }
    .form-control {
        padding: 11px 12px;
        font-size: 16px; /* prevents iOS zoom */
        min-height: 44px;
        border-radius: 8px;
    }
    textarea.form-control { min-height: 70px; font-size: 14px; }
    select.form-control { font-size: 16px; }

    /* Phase timeline: vertical compact */
    .phase-timeline { flex-direction: column; gap: 2px; margin-bottom: 14px; }
    .phase-item {
        min-width: auto; padding: 8px 10px; display: flex;
        align-items: center; gap: 10px; text-align: left;
        border-radius: 8px; background: rgba(0,0,0,0.15);
    }
    .phase-item::after { display: none; }
    .phase-number { margin: 0; flex-shrink: 0; width: 30px; height: 30px; font-size: 12px; }
    .phase-name { font-size: 11px; }
    .phase-kpi { font-size: 9px; }

    /* Risk heatmap: horizontal scroll */
    .risk-heatmap { overflow-x: auto; }
    .heatmap-cell { padding: 6px; font-size: 9px; }

    /* Tabs: horizontal scroll, pill-style */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px; padding-bottom: 4px; border-bottom-width: 1px; }
    .tab { padding: 8px 14px; font-size: 11px; white-space: nowrap; flex-shrink: 0; border-radius: 6px 6px 0 0; }

    /* Alerts: compact */
    .alert { padding: 10px; font-size: 11px; gap: 6px; border-radius: 8px; }

    /* Influence meter */
    .influence-dot { width: 6px; height: 6px; }

    /* Sidebar user section */
    .sidebar-user { padding-bottom: env(safe-area-inset-bottom, 20px); }

    /* KPI */
    .kpi-indicator { padding: 6px 8px; border-radius: 8px; }
    .kpi-label { font-size: 9px; }
    .kpi-value { font-size: 11px; }

    /* Badges: slightly smaller */
    .badge { padding: 2px 7px; font-size: 10px; border-radius: 10px; }

    .quick-ops-item { padding: 8px; }
    .quick-ops-title { font-size: 12px; }
    .quick-ops-submeta { gap: 4px; }

    .timeline-control-bar > .form-control {
        width: 100% !important;
        max-width: none !important;
    }
    .timeline-icon-btn {
        min-width: 34px;
        min-height: 34px;
    }
    .timeline-priority-wrap {
        max-height: none;
        overflow: visible;
        border: none;
    }
    .risk-overview-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .risk-priority-wrap {
        max-height: none;
        overflow: visible;
        border: none;
    }
    .risk-icon-btn {
        min-width: 34px;
        min-height: 34px;
    }
    .risk-cell-subtext {
        font-size: 10px;
    }

    /* Network nodes */
    .network-node { font-size: 9px; padding: 3px 7px; }

    /* Truncate utility */
    .truncate { max-width: 120px; }

    /* ============================================
       INLINE STYLE OVERRIDES
       ============================================ */
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns:repeat(5"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(5"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    [style*="minmax(350px"],
    [style*="minmax(300px"] {
        grid-template-columns: 1fr !important;
    }
    .page-header > div[style*="display:flex"],
    .page-header > span[style*="display:flex"],
    div[style*="display:flex;gap:8px"],
    div[style*="display:flex;gap:10px"],
    div[style*="display:flex;gap:15px"] {
        flex-wrap: wrap !important;
    }
    input[style*="width:250px"],
    input[style*="width:200px"],
    input[style*="width: 250px"],
    input[style*="width: 200px"] {
        width: 100% !important;
        max-width: none !important;
    }
    div[style*="justify-content:space-between"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    div[style*="display:flex;gap:0;border-bottom"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    div[style*="display:flex;gap:0;border-bottom"] > a,
    div[style*="display:flex;gap:0;border-bottom"] > button {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-size: 11px !important;
        padding: 8px 12px !important;
    }

    /* Progress bar compact */
    .progress-bar { height: 6px; }
    .musdes-sim-grid { grid-template-columns: 1fr; gap: 10px; }
    .musdes-vote-row { gap: 8px; font-size: 12px; }
    .musdes-task-sticky { top: 62px; }
    .musdes-task-sticky-title { width: 100%; }

    /* Hide elements on mobile */
    .mobile-hide { display: none !important; }

    /* Risk summary counts: compact 3-col always */
    .risk-summary-counts { gap: 6px; }
    .risk-summary-counts > div { padding: 8px 4px !important; }
    .risk-summary-counts > div > div:first-child { font-size: 20px !important; }

    /* Campaign info: stack on mobile */
    .campaign-info-grid { grid-template-columns: 1fr !important; gap: 6px; }

    /* Strategic insights: stack on mobile */
    .strategic-insights-grid { grid-template-columns: 1fr !important; gap: 8px; }
    .strategic-insights-grid .alert { font-size: 11px; }

    /* Risk heatmap: scrollable with min-width */
    .risk-heatmap { min-width: 260px; overflow-x: auto; }
    .heatmap-cell { padding: 6px 4px; font-size: 9px; min-width: 55px; }

    /* Budget KPI: prevent overflow */
    .kpi-value { word-break: break-word; overflow-wrap: break-word; font-size: 11px; }

    /* Reminders grid override */
    [style*="minmax(250px"],
    [style*="minmax(200px"] {
        grid-template-columns: 1fr !important;
    }

    /* Narrative card action bars: stack on mobile */
    .card > div[style*="border-top"][style*="display:flex"] {
        flex-wrap: wrap !important;
    }
    .card > div[style*="border-top"] form[style*="display:flex"] {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    /* Narrative inline metrics: wrap */
    .card > div[style*="display:flex;gap:15px;font-size:11px"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Dashboard risk heatmap: force 3-col grid intact */
    .risk-heatmap {
        grid-template-columns: auto repeat(3, minmax(55px, 1fr)) !important;
    }
}

/* =====================================================
   RESPONSIVE — SMALL MOBILE (≤480px)
   ===================================================== */
@media (max-width: 480px) {
    .mobile-header { height: 48px; }
    .mobile-bottom-nav { height: 56px; }
    .main { padding: 56px 8px 66px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
    .stat-card { padding: 8px; }
    .stat-icon { width: 28px; height: 28px; font-size: 13px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 8px; }
    .page-header h1 { font-size: 14px; }
    .card { padding: 10px 8px; }
    .mobile-data-card { padding: 10px; }
    .mobile-data-card .mdc-name { font-size: 13px; }
    .badge { font-size: 9px; padding: 2px 6px; }
}

/* Risk summary count grid — always 3-col */
.risk-summary-counts {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

/* Campaign info grid */
.campaign-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

/* Strategic insights grid */
.strategic-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Dashboard log feed (mobile only) */
.dash-log-item {
    padding: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--accent);
}
.dash-log-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.dash-log-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.dash-log-action { font-size: 12px; margin-top: 4px; }
.dash-log-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Utility */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* Sidebar User Section */
.sidebar-user {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 10px;
    padding-top: 5px;
}

/* Export Buttons */
.export-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}
.export-bar a {
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-muted);
    transition: all 0.2s;
}
.export-bar a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-bright);
}

/* Delete Button */
.btn-delete {
    background: rgba(198,40,40,0.15);
    border: 1px solid rgba(198,40,40,0.3);
    color: #ef5350;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-delete:hover {
    background: rgba(198,40,40,0.3);
}
