/* ================================================================
   LWA Marketing Dashboard -- Brand Tokens & Layout
   ================================================================ */

:root {
    --lwa-primary: #385B4F;
    --lwa-accent: #BD8B65;
    --lwa-background: #F2F0EB;
    --lwa-white: #FFFFFF;
    --font-heading: 'League Spartan', sans-serif;
    --font-subtitle: 'Raleway', sans-serif;
    --font-body: 'Arimo', sans-serif;
    --sidebar-width: 240px;
    --sidebar-bg: var(--lwa-primary);
    --content-bg: var(--lwa-background);
}

/* ── Reset ── */

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

/* ── Base ── */

body {
    font-family: var(--font-body);
    background: var(--content-bg);
    color: #333;
    line-height: 1.5;
}

/* ── Typography ── */

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--lwa-primary);
}

h4, h5, h6 {
    font-family: var(--font-subtitle);
    font-weight: 700;
}

a {
    color: var(--lwa-primary);
    text-decoration: none;
}

/* ── Sidebar ── */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 160px;
    height: auto;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--lwa-accent);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* ── Content Area ── */

.content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
    background: var(--content-bg);
}

/* ── Sidebar Toggle Button ── */

.sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    background: var(--lwa-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    display: none;
}

/* ── Sidebar Overlay ── */

.sidebar-overlay {
    display: none;
}

/* ── Responsive: Tablet and Below ── */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 99;
    }
}

/* ── Desktop ── */

@media (min-width: 1025px) {
    .sidebar-toggle {
        display: none;
    }
}

/* ── KPI Cards ── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.kpi-card .kpi-label {
    font-family: var(--font-subtitle);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 4px;
}

.kpi-card .kpi-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--lwa-primary);
}

.kpi-card .kpi-icon {
    font-size: 20px;
    color: var(--lwa-accent);
    margin-bottom: 8px;
}

.kpi-card .kpi-change {
    font-size: 13px;
    margin-top: 4px;
}

.kpi-card .kpi-change.positive {
    color: #2e7d32;
}

.kpi-card .kpi-change.negative {
    color: #c62828;
}

/* ── Login Page ── */

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    display: block;
    max-width: 120px;
    height: auto;
    margin: 0 auto 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: var(--font-body);
}

.form-group input:focus {
    outline: none;
    border-color: var(--lwa-primary);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--lwa-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-family: var(--font-subtitle);
    font-weight: 700;
}

.btn-primary:hover {
    background: #2d4a40;
}

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

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

/* ── Page Header ── */

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

/* ── Settings Page ── */

.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.platform-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-card h3 {
    font-size: 16px;
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-subtitle);
}

.status-badge.disconnected {
    background: #eee;
    color: #888;
}

.status-badge.connected {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-connect {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-subtitle);
    font-weight: 700;
    color: #888;
    align-self: flex-start;
}

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

/* ── Utility ── */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #888;
    font-size: 14px;
}

/* ── Date Controls Bar ── */

.date-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--lwa-background);
}

.date-presets {
    display: flex;
    gap: 6px;
}

.btn-preset {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #e0ddd8;
    background: var(--lwa-white);
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.btn-preset:hover {
    background: var(--lwa-background);
}

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

.date-picker-input {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e0ddd8;
    font-size: 0.85rem;
    width: 220px;
}

/* ── Stale Data Warning Banner ── */

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #856404;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Chart Container ── */

.chart-container {
    background: var(--lwa-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chart-container h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--lwa-primary);
}

/* ── Metrics Table ── */

.metrics-table { width: 100%; border-collapse: collapse; }
.metrics-table th { font-family: 'Raleway', sans-serif; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #888; padding: 8px 16px; text-align: left; }
.metrics-table th.num { text-align: right; }
.metrics-table td { font-family: 'Arimo', sans-serif; font-size: 14px; color: #333; padding: 12px 16px; border-bottom: 1px solid #F2F0EB; }
.metrics-table td.num { text-align: right; }
.metrics-table .platform-row { cursor: pointer; }
.metrics-table .platform-row:hover { background: #F2F0EB; }
.metrics-table .platform-row.expanded { background: #F2F0EB; }
.metrics-table .platform-row .chevron { transition: transform 0.3s ease-out; display: inline-block; margin-right: 8px; color: #888; font-size: 12px; }
.metrics-table .platform-row.expanded .chevron { transform: rotate(90deg); }

/* ── Campaign Drill-down ── */

.campaign-drilldown { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: #FAFAF7; }
.campaign-drilldown.expanded { max-height: 1000px; }
.campaign-drilldown table { width: 100%; border-collapse: collapse; }
.campaign-drilldown td { font-size: 12px; font-family: 'Raleway', sans-serif; color: #666; padding: 8px 16px 8px 48px; border-bottom: 1px solid #F2F0EB; }
.campaign-drilldown td.num { text-align: right; padding-left: 16px; }

/* ── Not Connected Row ── */

.not-connected { color: #888; font-style: italic; }
.not-connected .fa-link-slash { color: #ccc; margin-right: 8px; }

/* ── Chart Grid ── */

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 1024px) { .chart-grid { grid-template-columns: 1fr; } }

/* ── Empty State ── */

.empty-state { text-align: center; padding: 48px 16px; }
.empty-state .empty-icon { font-size: 48px; color: #ccc; }
.empty-state h3 { font-family: 'League Spartan', sans-serif; font-size: 17.6px; font-weight: 700; color: #385B4F; margin-top: 16px; }
.empty-state p { font-family: 'Arimo', sans-serif; font-size: 14px; color: #888; margin-top: 8px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* ── Section Heading ── */

.section-heading { font-family: 'League Spartan', sans-serif; font-size: 17.6px; font-weight: 700; color: #385B4F; margin-bottom: 16px; margin-top: 24px; }

/* ── Keyword Table ── */

.keyword-table { width: 100%; border-collapse: collapse; }
.keyword-table th { font-family: 'Raleway', sans-serif; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #888; padding: 8px 16px; text-align: left; cursor: pointer; }
.keyword-table th.num { text-align: right; }
.keyword-table th.active-sort { color: #BD8B65; }
.keyword-table th .sort-icon { margin-left: 4px; }
.keyword-table td { font-family: 'Arimo', sans-serif; font-size: 14px; color: #333; padding: 12px 16px; border-bottom: 1px solid #F2F0EB; }
.keyword-table td.num { text-align: right; }
.keyword-table .position-good { color: #2e7d32; }
.keyword-table .position-mid { color: #BD8B65; }
.keyword-table .position-low { color: #888; }
.keyword-table .truncation-note { font-size: 12px; color: #888; padding: 8px 16px; font-style: italic; }

/* ── Platform Metric Cards (Organic Social) ── */

.platform-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 992px) {
    .platform-metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .platform-metric-grid { grid-template-columns: 1fr; }
}
.platform-metric-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.platform-metric-card h3 {
    font-family: 'League Spartan', sans-serif;
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.platform-metric-card .metric-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.platform-metric-card .metric-value {
    font-weight: 600;
}
.platform-metric-card .not-connected-state {
    color: #888;
    font-style: italic;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.platform-metric-card .not-connected-state .fa-link-slash { color: #ccc; }
.platform-metric-card .connect-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--lwa-primary);
    text-decoration: underline;
}

/* ── Settings Tabs ── */

.settings-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 24px;
    gap: 4px;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab-btn.active {
    color: var(--lwa-primary);
    border-bottom-color: var(--lwa-primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Sync Log Table ── */

.sync-log-table { width: 100%; border-collapse: collapse; }
.sync-log-table th,
.sync-log-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 13px; }
.sync-log-table th { font-weight: 600; color: #555; font-family: 'Raleway', sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Status Badges (extended) ── */

.status-badge.success { background: #d4edda; color: #155724; }
.status-badge.error { background: #f8d7da; color: #721c24; }

/* ── Error Count Badge ── */

.error-count-badge { display: inline-block; background: #dc3545; color: #fff; border-radius: 50%; width: 20px; height: 20px; text-align: center; line-height: 20px; font-size: 11px; font-weight: 700; margin-left: 8px; }

/* ── Toast Notification ── */

.toast {
    position: fixed; bottom: 20px; right: 20px; padding: 12px 24px;
    border-radius: 8px; color: #fff; font-size: 14px; z-index: 1000;
    animation: toastFadeIn 0.3s ease;
}
.toast.success { background: var(--lwa-primary); }
.toast.error { background: #dc3545; }
@keyframes toastFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Disconnect Button ── */

.btn-disconnect { color: #c00; border-color: #c00; }

/* Collapsible nav group */
.nav-group .nav-sub-items {
    display: none;
    padding-left: 0;
}
.nav-group.open .nav-sub-items {
    display: block;
}
.nav-group-header {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.nav-group-header .nav-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}
.nav-group.open .nav-group-header .nav-chevron {
    transform: rotate(180deg);
}
.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--lwa-background);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.nav-sub-item:hover {
    background: rgba(255,255,255,0.1);
}
.nav-sub-item.active {
    background: rgba(255,255,255,0.15);
    font-weight: 600;
}
.nav-sub-item i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
}

/* Post tile grid */
.post-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 1024px) {
    .post-tile-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .post-tile-grid { grid-template-columns: 1fr; }
}
.post-tile {
    background: var(--lwa-white);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e2dc;
    transition: box-shadow 0.15s;
    cursor: pointer;
}
.post-tile:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.post-tile-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f0ede8;
}
.post-tile-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: #f0ede8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 2rem;
}
.post-tile-body {
    padding: 0.75rem;
}
.post-tile-caption {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    max-height: 3.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.post-tile-metrics {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: #888;
}
.post-tile-metrics i {
    margin-right: 0.2rem;
}
.post-tile-date {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.4rem;
}
.sponsored-badge {
    display: inline-block;
    background: var(--lwa-accent);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

/* Platform tabs */
.platform-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e2dc;
    margin-bottom: 1.5rem;
}
.platform-tab {
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font-body);
}
.platform-tab:hover {
    color: var(--lwa-primary);
}
.platform-tab.active {
    color: var(--lwa-primary);
    border-bottom-color: var(--lwa-primary);
    font-weight: 600;
}

/* AI insight cards */
.ai-insight-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
    .ai-insight-cards { grid-template-columns: 1fr; }
}
.ai-insight-card {
    background: var(--lwa-white);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #e5e2dc;
}
.ai-insight-card h4 {
    font-family: var(--font-subtitle);
    font-size: 0.85rem;
    color: var(--lwa-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ai-insight-card p {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
}

/* Social overview platform cards */
.social-platform-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.social-platform-card {
    background: var(--lwa-white);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid #e5e2dc;
    transition: box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.social-platform-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.social-platform-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.social-platform-card-header i {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
}
.social-platform-card-header h3 {
    font-family: var(--font-subtitle);
    font-size: 1rem;
    margin: 0;
}
.social-platform-card-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: auto;
}
.status-connected {
    background: #e6f4ea;
    color: #1a7f37;
}
.status-disconnected {
    background: #fef0e5;
    color: #b35900;
}
.social-platform-card-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
.social-platform-card-metric {
    text-align: center;
}
.social-platform-card-metric .value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--lwa-primary);
}
.social-platform-card-metric .label {
    font-size: 0.75rem;
    color: #888;
}

/* ── Generic Button Base ── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: background 0.15s, color 0.15s;
}
.btn.btn-primary {
    width: auto;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: normal;
}
.btn-outline {
    background: transparent;
    color: var(--lwa-primary);
    border: 1px solid var(--lwa-primary);
}
.btn-outline:hover {
    background: var(--lwa-primary);
    color: white;
}
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

/* ── Modal ── */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--lwa-white);
    border-radius: 12px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e2dc;
}
.modal-header h3 {
    margin: 0;
    font-family: var(--font-heading);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
    padding: 0;
    line-height: 1;
}
.modal-close:hover {
    color: #333;
}
.modal-body {
    padding: 1.25rem;
}

/* ── Content Calendar — Plann-style Redesign ──────────────────── */

/* Toolbar */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.cal-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cal-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cal-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin: 0;
    color: var(--lwa-primary);
}
.cal-view-toggle {
    display: flex;
    background: #f0ede8;
    border-radius: 6px;
    overflow: hidden;
}
.cal-view-btn {
    padding: 0.4rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.8rem;
    font-family: var(--font-subtitle);
    cursor: pointer;
    color: #666;
    transition: all 0.15s;
}
.cal-view-btn.active {
    background: var(--lwa-primary);
    color: white;
}
.cal-view-btn:hover:not(.active) {
    background: #e5e2dc;
}

/* Month & Week Navigation */
.month-nav, .week-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.month-label, .week-label {
    font-family: var(--font-subtitle);
    font-size: 1.1rem;
    margin: 0;
    min-width: 160px;
    text-align: center;
}

/* Month Grid */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e2dc;
    border: 1px solid #e5e2dc;
    border-radius: 8px;
    overflow: hidden;
}
.month-grid-header {
    background: #f8f6f2;
    padding: 0.5rem;
    text-align: center;
    font-family: var(--font-subtitle);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
}
.month-cell {
    background: var(--lwa-white);
    min-height: 120px;
    padding: 0.35rem;
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
}
.month-cell:hover {
    background: #faf9f7;
}
.month-cell.outside {
    background: #f8f6f2;
    opacity: 0.5;
}
.month-cell.today {
    box-shadow: inset 0 0 0 2px var(--lwa-primary);
}
.month-cell.drag-over {
    background: rgba(56, 91, 79, 0.08);
}
.month-cell-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 0.25rem;
}
.month-cell.today .month-cell-date {
    color: var(--lwa-primary);
    font-weight: 700;
}
.month-cell-add {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px dashed #ccc;
    background: none;
    cursor: pointer;
    font-size: 0.6rem;
    color: #bbb;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.month-cell:hover .month-cell-add {
    display: flex;
}
.month-cell-add:hover {
    border-color: var(--lwa-primary);
    color: var(--lwa-primary);
}

/* Month Chip (post in month cell) */
.month-chip {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
    cursor: pointer;
    background: #f8f6f2;
    border-left: 3px solid #ccc;
    transition: box-shadow 0.15s;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.month-chip:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.month-chip-thumb {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.month-chip-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.month-chip-time {
    font-size: 0.6rem;
    color: #999;
    flex-shrink: 0;
}
.month-chip-platforms {
    display: flex;
    gap: 0.15rem;
    font-size: 0.55rem;
    color: #aaa;
    flex-shrink: 0;
}
.month-cell-more {
    font-size: 0.65rem;
    color: var(--lwa-primary);
    cursor: pointer;
    padding: 0.1rem 0;
    font-weight: 500;
}

/* Week View (client-side rendered) */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    min-height: 400px;
}
.day-column {
    background: var(--lwa-white);
    border-radius: 8px;
    border: 1px solid #e5e2dc;
    overflow: hidden;
}
.day-column.day-today {
    border-color: var(--lwa-primary);
    border-width: 2px;
}
.day-header {
    padding: 0.5rem;
    text-align: center;
    background: #f8f6f2;
    border-bottom: 1px solid #e5e2dc;
}
.day-today .day-header {
    background: var(--lwa-primary);
    color: white;
}
.day-name {
    display: block;
    font-family: var(--font-subtitle);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.day-date {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
}
.day-items {
    padding: 0.4rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.day-items.drag-over {
    background: rgba(56, 91, 79, 0.05);
}
.day-add-btn {
    border: 1px dashed #ddd;
    background: none;
    border-radius: 6px;
    padding: 0.3rem;
    cursor: pointer;
    color: #bbb;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.day-add-btn:hover {
    border-color: var(--lwa-primary);
    color: var(--lwa-primary);
}

/* Grid Preview */
.grid-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.grid-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f0ede8;
    transition: transform 0.15s;
}
.grid-tile:hover {
    transform: scale(1.02);
}
.grid-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.grid-tile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ccc;
}
.grid-tile-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
}
.grid-tile-title {
    font-size: 0.7rem;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.grid-tile-meta {
    font-size: 0.6rem;
    opacity: 0.8;
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.grid-tile-pillar {
    position: absolute;
    top: 0.3rem;
    left: 0.3rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Content cards (used in week view and unscheduled) */
.content-card {
    background: var(--lwa-white);
    border-radius: 6px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: box-shadow 0.15s;
    overflow: hidden;
}
.content-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.content-card.dragging {
    opacity: 0.5;
}
.content-card-thumb {
    height: 50px;
    background-size: cover;
    background-position: center;
}
.content-card-body {
    padding: 0.4rem;
    position: relative;
}
.content-card-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    position: absolute;
    top: 0.5rem;
    right: 0.4rem;
}
.content-card-status.status-idea { background: #aaa; }
.content-card-status.status-draft { background: #E8A838; }
.content-card-status.status-scheduled { background: #5B9BD5; }
.content-card-status.status-published { background: #70AD47; }

.content-card-pillar {
    display: inline-block;
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-weight: 600;
    color: white;
    margin-bottom: 0.2rem;
}
.content-card-pillar[data-pillar="family-bts"] { background: #E88D67; }
.content-card-pillar[data-pillar="educational"] { background: #5B9BD5; }
.content-card-pillar[data-pillar="case-study"] { background: #70AD47; }
.content-card-pillar[data-pillar="rural-crime"] { background: #C00000; }
.content-card-pillar[data-pillar="team-spotlight"] { background: #7030A0; }
.content-card-pillar[data-pillar="industry-seasonal"] { background: #BD8B65; }

.content-card-title {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.content-card-platforms {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
    font-size: 0.65rem;
    color: #888;
}

/* Unscheduled Section */
.unscheduled-bar {
    margin-top: 1.5rem;
    background: var(--lwa-white);
    border: 1px solid #e5e2dc;
    border-radius: 8px;
    overflow: hidden;
}
.unscheduled-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    cursor: pointer;
    background: #f8f6f2;
    user-select: none;
}
.unscheduled-header h4 {
    margin: 0;
    font-size: 0.85rem;
    font-family: var(--font-subtitle);
}
.unscheduled-badge {
    display: inline-block;
    background: var(--lwa-primary);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.4rem;
}
.unscheduled-chevron {
    transition: transform 0.2s;
    font-size: 0.75rem;
    color: #888;
}
.unscheduled-bar.collapsed .unscheduled-chevron {
    transform: rotate(-90deg);
}
.unscheduled-bar.collapsed .unscheduled-cards {
    display: none;
}
.unscheduled-cards {
    padding: 0.75rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.unscheduled-cards .content-card {
    width: 180px;
    flex-shrink: 0;
}

/* Trend Scout Drawer */
.trend-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1000;
}
.trend-drawer-overlay.open {
    display: block;
}
.trend-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: 90vw;
    background: var(--lwa-white);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}
.trend-drawer.open {
    transform: translateX(0);
}
.trend-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #e5e2dc;
}
.trend-drawer-header h3 {
    margin: 0;
    font-size: 1rem;
}
.trend-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
.trend-card {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--lwa-white);
    border-radius: 8px;
    border: 1px solid #e5e2dc;
    margin-bottom: 0.5rem;
}
.trend-score {
    background: var(--lwa-primary);
    color: white;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    min-width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.trend-body {
    flex: 1;
    min-width: 0;
}
.trend-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lwa-primary);
    text-decoration: none;
    display: block;
    line-height: 1.3;
}
.trend-title:hover {
    text-decoration: underline;
}
.trend-source {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 0.15rem;
}
.trend-angle {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
    font-style: italic;
}
.trend-angle i {
    color: var(--lwa-accent);
    margin-right: 0.2rem;
}

/* Mobile FAB */
.cal-fab {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--lwa-primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 900;
    align-items: center;
    justify-content: center;
}

/* Mobile Day Panel */
.mobile-day-panel {
    background: var(--lwa-white);
    border: 1px solid #e5e2dc;
    border-radius: 8px;
    margin-top: 1rem;
    overflow: hidden;
}
.mobile-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f6f2;
    border-bottom: 1px solid #e5e2dc;
}
.mobile-day-header h4 { margin: 0; font-size: 0.9rem; }
.mobile-day-items {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Empty state */
.cal-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #888;
}
.cal-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.3;
}

/* View transitions */
.cal-view {
    animation: calFadeIn 0.2s ease;
}
@keyframes calFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Mobile Responsive (< 768px) ─────────────────────────────── */
@media (max-width: 768px) {
    .cal-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .cal-toolbar-left { width: 100%; justify-content: space-between; }
    .cal-toolbar-right { width: 100%; justify-content: flex-end; }
    .cal-title { font-size: 1.1rem; }
    .cal-hide-mobile { display: none; }

    /* Month grid becomes mini-cal with dots */
    .month-grid { gap: 0; }
    .month-cell {
        min-height: 44px;
        padding: 0.2rem;
        text-align: center;
    }
    .month-cell-date { font-size: 0.7rem; text-align: center; }
    .month-chip { display: none; }
    .month-cell-more { display: none; }
    .month-cell-add { display: none !important; }
    .month-cell-dots {
        display: flex;
        gap: 2px;
        justify-content: center;
        margin-top: 2px;
    }
    .month-cell-dot {
        width: 5px;
        height: 5px;
        border-radius: 50%;
    }

    /* Week view stacks */
    .week-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Grid preview 2-col */
    .grid-preview {
        grid-template-columns: repeat(2, 1fr);
    }

    /* FAB visible */
    .cal-fab { display: flex; }

    /* Trend drawer from bottom on mobile */
    .trend-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .trend-drawer.open {
        transform: translateY(0);
    }

    /* Modal full-screen on mobile */
    .modal-content {
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    /* Platform filter smaller */
    .cal-platform-filter select { font-size: 0.75rem; }

    /* Mobile week strip (togglable view) */
    .mobile-week-strip {
        display: flex;
        gap: 0.25rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0.5rem;
    }
    .mobile-week-day {
        text-align: center;
        padding: 0.3rem 0.5rem;
        border-radius: 6px;
        border: 1px solid #e5e2dc;
        background: var(--lwa-white);
        cursor: pointer;
        min-width: 50px;
        flex-shrink: 0;
        font-size: 0.75rem;
    }
    .mobile-week-day.active {
        background: var(--lwa-primary);
        color: white;
        border-color: var(--lwa-primary);
    }
    .mobile-week-day .day-dots {
        display: flex;
        gap: 2px;
        justify-content: center;
        margin-top: 2px;
    }
}

/* Desktop dots hidden */
@media (min-width: 769px) {
    .month-cell-dots { display: none; }
    .mobile-day-panel { display: none !important; }
    .mobile-week-strip { display: none; }
}

/* ── Post Preview (Mobile/Desktop mockup) ─────────────────────── */

.modal-tabs {
    display: flex;
    gap: 0;
    margin-left: 1rem;
}
.modal-tab {
    padding: 0.4rem 0.75rem;
    border: none;
    background: #f0ede8;
    font-size: 0.8rem;
    font-family: var(--font-subtitle);
    cursor: pointer;
    color: #666;
    transition: all 0.15s;
}
.modal-tab:first-child { border-radius: 6px 0 0 6px; }
.modal-tab:last-child { border-radius: 0 6px 6px 0; }
.modal-tab.active {
    background: var(--lwa-primary);
    color: white;
}
.modal-tab:hover:not(.active) {
    background: #e5e2dc;
}

.preview-panel {
    padding: 1rem 1.5rem;
}
.preview-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.preview-device-toggle {
    display: flex;
    background: #f0ede8;
    border-radius: 6px;
    overflow: hidden;
}
.preview-device-btn {
    padding: 0.35rem 0.7rem;
    border: none;
    background: none;
    font-size: 0.78rem;
    font-family: var(--font-subtitle);
    cursor: pointer;
    color: #666;
    transition: all 0.15s;
}
.preview-device-btn.active {
    background: var(--lwa-primary);
    color: white;
}
.preview-device-btn:hover:not(.active) {
    background: #e5e2dc;
}

.preview-frame {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    min-height: 400px;
}
.preview-mockup {
    transition: width 0.25s ease;
}

/* Mobile phone frame */
.preview-mockup.device-mobile {
    width: 375px;
    max-width: 100%;
    border: 2px solid #333;
    border-radius: 24px;
    overflow: hidden;
    background: white;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
/* Desktop frame */
.preview-mockup.device-desktop {
    width: 100%;
    max-width: 600px;
    border: 1px solid #e5e2dc;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Shared mockup inner styles */
.pm-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #eee;
}
.pm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--lwa-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.pm-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #262626;
}
.pm-meta {
    font-size: 0.65rem;
    color: #999;
}
.pm-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f0ede8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pm-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-image-placeholder {
    color: #ccc;
    font-size: 3rem;
}
.pm-actions {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    font-size: 1.1rem;
    color: #262626;
}
.pm-likes {
    padding: 0 0.75rem 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
}
.pm-caption {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #262626;
    word-wrap: break-word;
}
.pm-caption .pm-caption-name {
    font-weight: 600;
    margin-right: 0.3rem;
}
.pm-time {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
}

/* Facebook-specific desktop */
.pm-fb-text {
    padding: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #1c1e21;
    word-wrap: break-word;
}
.pm-fb-reactions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    color: #65676b;
    border-bottom: 1px solid #eee;
}
.pm-fb-action-bar {
    display: flex;
    justify-content: space-around;
    padding: 0.3rem 0;
    border-top: 1px solid #eee;
}
.pm-fb-action-bar button {
    flex: 1;
    background: none;
    border: none;
    padding: 0.4rem;
    font-size: 0.8rem;
    color: #65676b;
    cursor: default;
    font-family: var(--font-body);
}

/* TikTok mockup */
.pm-tiktok-frame {
    background: #000;
    color: white;
    position: relative;
    min-height: 500px;
}
.pm-tiktok-image {
    width: 100%;
    min-height: 400px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pm-tiktok-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-tiktok-sidebar {
    position: absolute;
    right: 0.5rem;
    bottom: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.pm-tiktok-sidebar i {
    font-size: 1.5rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.pm-tiktok-sidebar span {
    font-size: 0.65rem;
}
.pm-tiktok-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 3rem;
    padding: 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}
.pm-tiktok-caption .pm-name {
    color: white;
    font-size: 0.8rem;
}
.pm-tiktok-caption p {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* LinkedIn mockup */
.pm-li-text {
    padding: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(0,0,0,0.9);
    word-wrap: break-word;
}
.pm-li-reactions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    color: rgba(0,0,0,0.6);
    border-bottom: 1px solid #e0dfdc;
}
.pm-li-action-bar {
    display: flex;
    justify-content: space-around;
    padding: 0.2rem 0;
}
.pm-li-action-bar button {
    flex: 1;
    background: none;
    border: none;
    padding: 0.4rem;
    font-size: 0.75rem;
    color: rgba(0,0,0,0.6);
    cursor: default;
    font-family: var(--font-body);
}

/* YouTube mockup */
.pm-yt-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: #0f0f0f;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.pm-yt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-yt-play {
    position: absolute;
    width: 48px;
    height: 34px;
    background: rgba(255,0,0,0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}
.pm-yt-info {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
}
.pm-yt-info .pm-avatar {
    width: 36px;
    height: 36px;
    background: #c00;
}
.pm-yt-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: #0f0f0f;
}
.pm-yt-channel {
    font-size: 0.7rem;
    color: #606060;
    margin-top: 0.15rem;
}

/* Form styles for content modal */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    background: var(--lwa-white);
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.form-input:focus {
    outline: none;
    border-color: var(--lwa-primary);
}
.form-textarea {
    resize: vertical;
    min-height: 100px;
}
.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group {
    flex: 1;
}

.platform-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    accent-color: var(--lwa-primary);
}

.image-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}
.image-upload-area:hover {
    border-color: var(--lwa-primary);
}

.modal-actions {
    display: flex;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e5e2dc;
    margin-top: 1rem;
}

/* Overview charts layout */
.overview-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}
@media (max-width: 768px) {
    .overview-charts-row { grid-template-columns: 1fr; }
}
.chart-half {
    background: var(--lwa-white);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #e5e2dc;
}
.chart-half canvas {
    max-height: 280px !important;
}
.chart-half h4 {
    font-family: var(--font-subtitle);
    font-size: 0.9rem;
    color: var(--lwa-primary);
    margin: 0 0 0.75rem 0;
}

/* Label badges */
.label-badge {
    display: inline-block;
    background: #f0ede8;
    color: var(--lwa-primary);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 0.2rem;
}

/* KPI sub-value */
.kpi-sub {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.2rem;
}

/* ── Ads Intelligence Hub ─────────────────────────────── */

/* Alert banner (amber, dismissable) */
.ad-alert-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #856404;
    font-size: 0.9rem;
}
.ad-alert-banner .alert-icon {
    background: var(--lwa-accent);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.ad-alert-banner .alert-content { flex: 1; }
.ad-alert-banner .alert-title {
    font-family: var(--font-subtitle);
    font-weight: 700;
    font-size: 0.85rem;
    color: #856404;
}
.ad-alert-banner .alert-body {
    font-size: 0.85rem;
    margin-top: 2px;
}
.ad-alert-banner .alert-time {
    font-size: 0.75rem;
    color: #a68b00;
    flex-shrink: 0;
}
.ad-alert-banner .alert-dismiss {
    background: none;
    border: none;
    color: #856404;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    flex-shrink: 0;
}

/* AI Recommendation cards */
.ai-recommendations {
    background: var(--lwa-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-top: 3px solid var(--lwa-primary);
}
.ai-recommendations .rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.ai-recommendations .rec-title {
    font-family: var(--font-heading);
    font-size: 17.6px;
    font-weight: 700;
    color: var(--lwa-primary);
}
.ai-recommendations .rec-time {
    font-size: 0.75rem;
    color: #888;
    margin-left: 8px;
}
.rec-card {
    background: var(--lwa-background);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-left: 3px solid #ccc;
}
.rec-card.winning { border-left-color: #2e7d32; }
.rec-card.watch { border-left-color: var(--lwa-accent); }
.rec-card.insight { border-left-color: var(--lwa-primary); }
.rec-card .rec-category {
    font-family: var(--font-subtitle);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.rec-card.winning .rec-category { color: #2e7d32; }
.rec-card.watch .rec-category { color: var(--lwa-accent); }
.rec-card.insight .rec-category { color: var(--lwa-primary); }
.rec-card .rec-body {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.5;
}

/* Lead quality panels */
.lead-quality-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.lead-quality-panel {
    background: var(--lwa-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.lead-quality-panel .panel-title {
    font-family: var(--font-subtitle);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 12px;
}
.lead-quality-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.lead-quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lead-quality-label {
    flex: 1;
    font-size: 0.85rem;
    color: #555;
}
.lead-quality-count {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--lwa-primary);
}

/* Sidebar alert badge */
.nav-badge {
    background: #c62828;
    color: #fff;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    margin-left: 6px;
    min-width: 16px;
    text-align: center;
}

/* Refresh button (inline) */
.btn-refresh {
    background: var(--lwa-background);
    border: 1px solid #e0ddd8;
    border-radius: 8px;
    padding: 6px 14px;
    font-family: var(--font-subtitle);
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-refresh:hover {
    background: #e5e2dc;
}

/* Empty state for AI section */
.ai-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: #888;
    font-size: 0.9rem;
}

/* Campaign table enhancements */
.campaign-table { width: 100%; border-collapse: collapse; }
.campaign-table th {
    font-family: var(--font-subtitle);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e2dc;
}
.campaign-table td {
    padding: 12px;
    font-size: 0.85rem;
    color: #333;
    border-bottom: 1px solid #f0ede8;
}
.campaign-table .campaign-name {
    font-weight: 600;
    color: var(--lwa-primary);
}
.campaign-table .campaign-date {
    font-size: 0.75rem;
    color: #999;
}
.campaign-table .metric-spend { color: var(--lwa-accent); font-weight: 600; }
.campaign-table .metric-leads { color: #2e7d32; font-weight: 700; }
.campaign-table .metric-cpl { color: var(--lwa-primary); }
.campaign-table th.sortable { cursor: pointer; }
.campaign-table th.sortable:hover { color: var(--lwa-primary); }

/* Platform comparison (overview page) */
.platform-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* Responsive */
@media (max-width: 992px) {
    .lead-quality-grid { grid-template-columns: 1fr; }
}

/* ── Chatbot Panel ────────────────────────────────────── */

.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--lwa-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s, background 0.2s;
}
.chat-fab:hover {
    transform: scale(1.08);
    background: #2d4a40;
}

.chat-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--lwa-white);
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.chat-panel.open {
    right: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e2dc;
    background: var(--lwa-primary);
    color: #fff;
}
.chat-header-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}
.chat-header-actions {
    display: flex;
    gap: 8px;
}
.chat-header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--font-subtitle);
    transition: background 0.15s;
}
.chat-header-btn:hover {
    background: rgba(255,255,255,0.25);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--lwa-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--lwa-background);
    color: #333;
    border-bottom-left-radius: 4px;
}
.chat-bubble.typing {
    color: #999;
    font-style: italic;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e5e2dc;
    background: var(--lwa-white);
}
.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    resize: none;
    outline: none;
}
.chat-input:focus {
    border-color: var(--lwa-primary);
}
.chat-send {
    background: var(--lwa-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}
.chat-send:hover {
    background: #2d4a40;
}
.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chat history list */
.chat-history-list {
    padding: 12px 20px;
    overflow-y: auto;
    flex: 1;
}
.chat-history-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.chat-history-item:hover {
    background: var(--lwa-background);
}
.chat-history-item .preview {
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-history-item .date {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
}

/* ── Faults & Upgrades Page ───────────────────────────── */

.faults-filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}
.faults-filter-tab {
    padding: 8px 16px;
    border: 1px solid #e0ddd8;
    border-radius: 8px;
    background: var(--lwa-white);
    cursor: pointer;
    font-family: var(--font-subtitle);
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    transition: all 0.15s;
}
.faults-filter-tab.active {
    background: var(--lwa-primary);
    color: #fff;
    border-color: var(--lwa-primary);
}

.fault-card {
    background: var(--lwa-white);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.fault-card .fault-type-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.fault-card .fault-type-icon.fault {
    background: #fef2f2;
    color: #c62828;
}
.fault-card .fault-type-icon.upgrade {
    background: #eff6ff;
    color: #1565c0;
}
.fault-card .fault-body { flex: 1; }
.fault-card .fault-title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--lwa-primary);
    margin-bottom: 4px;
}
.fault-card .fault-meta {
    font-size: 0.75rem;
    color: #999;
}
.fault-card .fault-description {
    font-size: 0.85rem;
    color: #555;
    margin-top: 8px;
}
.fault-status-badge {
    font-family: var(--font-subtitle);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.fault-status-badge.new { background: #fff3cd; color: #856404; }
.fault-status-badge.in_progress { background: #d1ecf1; color: #0c5460; }
.fault-status-badge.done { background: #d4edda; color: #155724; }

.fault-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.fault-priority-dot.high { background: #c62828; }
.fault-priority-dot.medium { background: #f59e0b; }
.fault-priority-dot.low { background: #22c55e; }

/* Fault modal */
.fault-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.fault-modal-overlay.open { display: flex; }
.fault-modal {
    background: var(--lwa-white);
    border-radius: 12px;
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.fault-modal h3 {
    font-family: var(--font-heading);
    color: var(--lwa-primary);
    margin-top: 0;
    margin-bottom: 16px;
}
.fault-modal label {
    display: block;
    font-family: var(--font-subtitle);
    font-size: 0.8rem;
    font-weight: 700;
    color: #666;
    margin-bottom: 4px;
    margin-top: 12px;
}
.fault-modal input,
.fault-modal textarea,
.fault-modal select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    box-sizing: border-box;
}
.fault-modal textarea { resize: vertical; min-height: 80px; }
.fault-modal .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}
.fault-modal .btn-save {
    background: var(--lwa-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-family: var(--font-subtitle);
    font-weight: 700;
}
.fault-modal .btn-cancel {
    background: var(--lwa-background);
    border: 1px solid #e0ddd8;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-family: var(--font-subtitle);
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-panel {
        width: 100vw;
        right: -100vw;
    }
}
