/* ── Muse — Social Media Post Generator ─────────────────────────── */
/* COLONOS MEDIA GROUP • 2026                                        */

/* ── Reset & Variables ──────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0e0e0e;
    --bg2: #161616;
    --bg3: #1e1e1e;
    --bg4: #282828;
    --green: #00e676;
    --green-d: #00c853;
    --orange: #ff9100;
    --blue: #2979ff;
    --red: #ef5350;
    --white: #f5f5f5;
    --muted: #999;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.07);
    --radius: 5px;
    --transition: .25s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'Cascadia Code', 'Consolas', monospace;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--white);
    line-height: 1.6;
}

a {
    color: var(--green);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Authenticated layout: sidebar + content */
.page-shell.has-sidebar {
    flex-direction: row;
}

.content-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: .8rem;
    border-top: 1px solid var(--border);
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    z-index: 100;
    transition: width .22s ease, min-width .22s ease;
}

/* Collapsed state — icon-only rail */
.sidebar.collapsed {
    width: 56px;
    min-width: 56px;
}

/* Brand row */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem .75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
    color: var(--white);
    letter-spacing: .5px;
    white-space: nowrap;
    overflow: hidden;
    min-height: 56px;
}

.sidebar-brand img {
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    transition: opacity .15s ease;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Collapse toggle button inside brand row */
.sidebar-collapse-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: .9rem;
    padding: .2rem .3rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color .15s;
    line-height: 1;
}

.sidebar-collapse-btn:hover {
    color: var(--white);
}

.sidebar.collapsed .sidebar-collapse-btn {
    margin-left: 0;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .75rem .5rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.snav-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: .85rem;
    text-decoration: none;
    transition: var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    white-space: nowrap;
    overflow: hidden;
}

.snav-link .nav-icon {
    flex-shrink: 0;
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.snav-link .nav-label {
    transition: opacity .15s ease;
}

.sidebar.collapsed .snav-link .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.snav-link:hover {
    color: var(--white);
    background: var(--glass);
    text-decoration: none;
}

.snav-link.active {
    color: var(--green);
    background: rgba(0, 230, 118, .08);
}

/* Tooltip on collapsed sidebar */
.sidebar.collapsed .snav-link {
    position: relative;
    justify-content: center;
}

.sidebar.collapsed .snav-link:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--white);
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 300;
}

/* Bottom section */
.sidebar-bottom {
    border-top: 1px solid var(--border);
    padding: .6rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    padding: .4rem .65rem .5rem;
    overflow: hidden;
}

.sidebar-username {
    font-size: .85rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    transition: opacity .15s;
}

.sidebar-role {
    font-size: .75rem;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    transition: opacity .15s;
}

.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .sidebar-role {
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding: 0;
}

.sidebar.collapsed .sidebar-user {
    padding: 0;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.signout-form {
    display: contents;
}

.snav-signout {
    color: var(--red);
}

.snav-signout:hover {
    color: var(--red);
    background: rgba(239, 83, 80, .1);
}

/* Mobile toggle button (hamburger) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 200;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--white);
    padding: .4rem .6rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 220px !important;
        min-width: 220px !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, .5);
    }

    /* Always show labels on mobile */
    .sidebar.open .snav-link .nav-label,
    .sidebar.open .brand-text,
    .sidebar.open .sidebar-username,
    .sidebar.open .sidebar-role {
        opacity: 1;
        width: auto;
        height: auto;
    }

    .content-wrap {
        padding-top: 3rem;
    }
}

/* ── Dashboard quick-links grid ─────────────────────────────────── */
.dash-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dash-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1.4rem 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
    cursor: pointer;
}

.dash-nav-card .dnc-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.dash-nav-card:hover {
    border-color: var(--green);
    color: var(--white);
    background: rgba(0, 230, 118, .05);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 230, 118, .08);
}

/* ── Header / Nav ───────────────────────────────────────────────── */
.hero {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.hero-icon {
    font-size: 2rem;
}

.eyebrow {
    font-size: .75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--green);
    font-weight: 600;
}

.hero h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

nav {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--muted);
    font-size: .85rem;
    padding: .3rem .6rem;
    border-radius: var(--radius);
    transition: var(--transition);
    text-decoration: none;
}

nav a:hover {
    color: var(--white);
    background: var(--glass);
}

.nav-user {
    font-size: .8rem;
    color: var(--muted);
    margin-left: .5rem;
}

.nav-user small {
    color: var(--green);
}

.inline-form {
    display: inline;
}

.inline-form button,
.theme-toggle {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--white);
    padding: .3rem .7rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .8rem;
    transition: var(--transition);
}

.inline-form button:hover,
.theme-toggle:hover {
    background: var(--bg4);
}

/* ── Flash Messages ─────────────────────────────────────────────── */
.flash-stack {
    padding: .5rem 2rem;
}

.flash {
    padding: .8rem 1.2rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: .4rem;
    transition: opacity .4s;
}

.flash-success {
    background: rgba(0, 230, 118, .12);
    color: var(--green);
    border: 1px solid rgba(0, 230, 118, .2);
}

.flash-error {
    background: rgba(239, 83, 80, .12);
    color: var(--red);
    border: 1px solid rgba(239, 83, 80, .2);
}

.flash-info {
    background: rgba(41, 121, 255, .12);
    color: var(--blue);
    border: 1px solid rgba(41, 121, 255, .2);
}

/* ── Panel / Card ───────────────────────────────────────────────── */
.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.panel-heading {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-heading h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: .6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--green);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--green-d);
    box-shadow: 0 4px 16px rgba(0, 230, 118, .3);
}

.btn-secondary {
    background: var(--glass);
    color: var(--white);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg4);
}

.btn-success {
    background: rgba(0, 230, 118, .15);
    color: var(--green);
    border: 1px solid rgba(0, 230, 118, .2);
}

.btn-danger {
    background: rgba(239, 83, 80, .15);
    color: var(--red);
    border: 1px solid rgba(239, 83, 80, .2);
}

.btn-ai {
    background: rgba(41, 121, 255, .15);
    color: var(--blue);
    border: 1px solid rgba(41, 121, 255, .2);
}

.btn-sm {
    padding: .3rem .7rem;
    font-size: .78rem;
}

.btn-full {
    width: 100%;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.stack-form label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.stack-form label span {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 500;
}

input,
select,
textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--white);
    padding: .65rem .8rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .9rem;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(0, 230, 118, .15);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.stack-form button[type="submit"] {
    background: var(--green);
    color: var(--bg);
    padding: .7rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    font-size: .9rem;
    transition: var(--transition);
}

.stack-form button[type="submit"]:hover {
    background: var(--green-d);
}

/* ── Login ──────────────────────────────────────────────────────── */
.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

/* ── Data Tables ────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.data-table th {
    padding: .7rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.data-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, .02);
}

.data-table a {
    color: var(--green);
}

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: .3rem;
    align-items: center;
}

/* ── Stats Grid ─────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: .2rem;
}

.stat-label {
    font-size: .8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-draft .stat-number {
    color: var(--muted);
}

.stat-scheduled .stat-number {
    color: var(--blue);
}

.stat-published .stat-number {
    color: var(--green);
}

/* ── Quick Actions ──────────────────────────────────────────────── */
.quick-actions {
    display: flex;
    gap: .8rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.platform-badge {
    padding: .2rem .6rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.platform-all {
    background: rgba(255, 255, 255, .08);
    color: var(--white);
}

.platform-instagram {
    background: rgba(225, 48, 108, .15);
    color: #e1306c;
}

.platform-facebook {
    background: rgba(24, 119, 242, .15);
    color: #1877f2;
}

.platform-x {
    background: rgba(255, 255, 255, .08);
    color: var(--white);
}

.platform-linkedin {
    background: rgba(0, 119, 181, .15);
    color: #0077b5;
}

.platform-tiktok {
    background: rgba(255, 0, 80, .12);
    color: #ff0050;
}

.platform-youtube {
    background: rgba(255, 0, 0, .12);
    color: #ff0000;
}

.status-badge {
    padding: .2rem .6rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft {
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
}

.status-scheduled {
    background: rgba(41, 121, 255, .12);
    color: var(--blue);
}

.status-publishing {
    background: rgba(255, 145, 0, .12);
    color: var(--orange);
}

.status-published {
    background: rgba(0, 230, 118, .12);
    color: var(--green);
}

.status-failed {
    background: rgba(239, 83, 80, .12);
    color: var(--red);
}

.status-planning {
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
}

.status-active {
    background: rgba(0, 230, 118, .12);
    color: var(--green);
}

.status-completed {
    background: rgba(41, 121, 255, .12);
    color: var(--blue);
}

.status-paused {
    background: rgba(255, 145, 0, .12);
    color: var(--orange);
}

.category-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 50px;
    font-size: .7rem;
    background: rgba(41, 121, 255, .1);
    color: var(--blue);
    margin-bottom: .5rem;
}

.action-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 3px;
    font-size: .75rem;
    background: var(--glass);
    font-family: var(--mono);
}

/* ── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: .4rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-chip {
    padding: .35rem .8rem;
    border-radius: 50px;
    font-size: .8rem;
    color: var(--muted);
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
}

.filter-chip:hover {
    color: var(--white);
    border-color: rgba(255, 255, 255, .15);
}

.filter-chip.active {
    background: var(--green);
    color: var(--bg);
    border-color: var(--green);
    font-weight: 600;
}

.filter-sep {
    color: var(--border);
    margin: 0 .3rem;
}

/* ── Chips ──────────────────────────────────────────────────────── */
.campaign-chips {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    padding: 1rem;
}

.chip {
    padding: .4rem 1rem;
    border-radius: 50px;
    font-size: .82rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    color: var(--white);
}

.chip:hover {
    border-color: var(--green);
}

.chip small {
    display: block;
    font-size: .7rem;
    color: var(--muted);
}

/* ── Page Header ────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.4rem;
}

/* ── Composer ───────────────────────────────────────────────────── */
.composer-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.composer-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.composer-main label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.composer-main label span {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 500;
}

.composer-main textarea {
    min-height: 200px;
    font-size: .95rem;
}

.char-counter {
    text-align: right;
    font-size: .75rem;
    color: var(--muted);
    margin-top: .2rem;
}

.char-counter.over-limit {
    color: var(--red);
    font-weight: 700;
}

.composer-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.sidebar-section label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.sidebar-section label span {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 500;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.current-media {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .5rem;
}

/* ── AI Section ─────────────────────────────────────────────────── */
.ai-section {
    background: var(--bg2);
    border: 1px solid rgba(41, 121, 255, .15);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.ai-section h3 {
    font-size: .95rem;
    margin-bottom: .8rem;
}

.ai-controls {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.ai-controls input {
    flex: 1;
    min-width: 200px;
}

.ai-controls select {
    width: auto;
}

.ai-result {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg3);
    border-radius: var(--radius);
    border: 1px solid rgba(0, 230, 118, .1);
}

.ai-result #aiContent {
    white-space: pre-wrap;
    font-size: .9rem;
    margin-bottom: .8rem;
}

/* ── Templates Grid ─────────────────────────────────────────────── */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
}

.template-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    transition: var(--transition);
}

.template-card:hover {
    border-color: rgba(255, 255, 255, .12);
}

.template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

.template-header h3 {
    font-size: 1rem;
}

.template-preview {
    background: var(--bg3);
    padding: .8rem;
    border-radius: 3px;
    font-size: .82rem;
    color: var(--muted);
    margin: .5rem 0;
    white-space: pre-wrap;
    max-height: 120px;
    overflow: hidden;
    font-family: var(--font);
}

.template-hashtags {
    font-size: .78rem;
    color: var(--blue);
    margin-bottom: .5rem;
}

.template-actions {
    display: flex;
    gap: .4rem;
}

/* ── Campaigns Grid ─────────────────────────────────────────────── */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.2rem;
}

.campaign-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.campaign-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

.campaign-header h3 {
    font-size: 1rem;
}

.campaign-desc {
    font-size: .88rem;
    color: var(--muted);
    margin-bottom: .5rem;
}

.campaign-dates {
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .8rem;
}

.campaign-dates span {
    margin-right: .5rem;
}

.campaign-actions {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

/* ── Settings ───────────────────────────────────────────────────── */
.settings-info {
    padding: 1.2rem;
    font-size: .9rem;
}

.settings-info ul {
    padding-left: 1.5rem;
    margin: .5rem 0;
}

.settings-info li {
    margin-bottom: .3rem;
}

.settings-info code {
    background: var(--bg3);
    padding: .1rem .4rem;
    border-radius: 3px;
    font-family: var(--mono);
    font-size: .85rem;
}

.text-muted {
    color: var(--muted);
    font-size: .85rem;
}

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

/* ── Modal (dialog) ─────────────────────────────────────────────── */
dialog.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--white);
    max-width: 500px;
    width: 90%;
    padding: 0;
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, .6);
}

dialog.modal .stack-form h3 {
    margin-bottom: .5rem;
}

.modal-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .composer-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    nav {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .templates-grid,
    .campaigns-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: .78rem;
    }

    .data-table th,
    .data-table td {
        padding: .5rem .6rem;
    }
}

/* ── CEO Dashboard ──────────────────────────────────────────────── */
.ceo-page .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ceo-page .header-actions {
    display: flex;
    gap: .5rem;
}

.ceo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.ceo-half {
    min-width: 0;
}

.ceo-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.2rem;
}

.ceo-metric {
    text-align: center;
}

.ceo-metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

.ceo-metric-label {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.text-green {
    color: var(--green) !important;
}

.text-red {
    color: var(--red) !important;
}

.ceo-engagement-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    padding: 0 1.2rem 1.2rem;
}

.ceo-eng-item {
    font-size: .8rem;
    color: var(--muted);
    text-align: center;
    background: var(--bg3);
    padding: .5rem;
    border-radius: var(--radius);
}

/* Bar chart */
.ceo-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: 1.2rem;
    height: 200px;
}

.ceo-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.ceo-bar {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(180deg, var(--green), var(--green-d));
    border-radius: var(--radius) var(--radius) 0 0;
    min-height: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.ceo-bar-val {
    font-size: .7rem;
    font-weight: 700;
    color: var(--bg);
    padding-top: 2px;
}

.ceo-bar-label {
    font-size: .7rem;
    color: var(--muted);
    margin-top: .3rem;
}

/* Platform bars */
.ceo-platform-bars {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.ceo-plat-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.ceo-plat-bar-bg {
    flex: 1;
    height: 8px;
    background: var(--bg3);
    border-radius: 4px;
    overflow: hidden;
}

.ceo-plat-bar {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width .4s ease;
}

.ceo-plat-count {
    font-size: .8rem;
    color: var(--muted);
    min-width: 24px;
    text-align: right;
}

/* Strategy result */
.strategy-result {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-top: .5rem;
}

.strategy-result h4 {
    color: var(--green);
    margin-bottom: .5rem;
    font-size: 1rem;
}

.strategy-result p {
    font-size: .85rem;
    margin-bottom: .4rem;
}

.strategy-result ul {
    margin-left: 1.2rem;
    font-size: .85rem;
    margin-bottom: .5rem;
}

.strategy-result li {
    margin-bottom: .2rem;
}

/* Role badge */
.role-badge {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: .15rem .5rem;
    border-radius: var(--radius);
    font-size: .75rem;
    text-transform: capitalize;
}

@media (max-width: 900px) {
    .ceo-row {
        grid-template-columns: 1fr;
    }

    .ceo-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .ceo-engagement-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Tablet (≤ 768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {
    main {
        padding: 1.2rem;
    }

    .flash-stack {
        padding: .5rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .8rem;
    }

    .page-header .btn,
    .page-header a.btn {
        width: 100%;
        text-align: center;
    }

    /* Tables: horizontal scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.2rem;
        padding: 0 1.2rem;
    }

    .data-table {
        min-width: 600px;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .7rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    /* Quick actions wrap */
    .quick-actions {
        gap: .5rem;
    }

    .quick-actions .btn {
        flex: 1;
        min-width: 0;
    }

    /* Dashboard nav grid */
    .dash-nav-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: .7rem;
    }

    .dash-nav-card {
        padding: 1rem .6rem;
        font-size: .78rem;
    }

    .dash-nav-card .dnc-icon {
        font-size: 1.3rem;
    }

    /* Filter chips scroll */
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: .4rem;
    }

    .filter-chip {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Templates */
    .templates-grid {
        grid-template-columns: 1fr;
    }

    /* Campaigns */
    .campaigns-grid {
        grid-template-columns: 1fr;
    }

    /* CEO bar chart */
    .ceo-bar-chart {
        height: 160px;
    }
}

/* ── Mobile (≤ 480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    main {
        padding: .8rem;
    }

    .flash-stack {
        padding: .4rem .8rem;
    }

    .flash {
        font-size: .82rem;
        padding: .6rem .8rem;
    }

    /* Page header */
    .page-header h2 {
        font-size: 1.15rem;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: .5rem;
    }

    .stat-card {
        padding: .8rem .6rem;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: .68rem;
    }

    /* Dashboard nav */
    .dash-nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .5rem;
    }

    .dash-nav-card {
        padding: .8rem .5rem;
        font-size: .72rem;
    }

    /* Composer */
    .composer-main textarea {
        min-height: 150px;
    }

    .ai-controls {
        flex-direction: column;
    }

    .ai-controls input,
    .ai-controls select {
        min-width: 0;
        width: 100%;
    }

    /* Buttons */
    .btn {
        padding: .5rem .8rem;
        font-size: .8rem;
    }

    .btn-sm {
        padding: .25rem .5rem;
        font-size: .72rem;
    }

    /* Campaign actions */
    .campaign-actions {
        flex-direction: column;
    }

    .campaign-actions form {
        display: contents;
    }

    .campaign-actions .btn {
        width: 100%;
    }

    /* Settings connect buttons */
    .platform-buttons {
        flex-direction: column;
    }

    .btn-platform {
        min-width: 0;
        width: 100%;
    }

    /* Panel */
    .panel-heading {
        padding: .8rem;
    }

    .settings-info {
        padding: .8rem;
    }

    /* CEO */
    .ceo-metrics {
        grid-template-columns: 1fr 1fr;
        gap: .5rem;
        padding: .8rem;
    }

    .ceo-metric-value {
        font-size: 1.2rem;
    }

    .ceo-engagement-grid {
        grid-template-columns: 1fr 1fr;
        gap: .4rem;
        padding: 0 .8rem .8rem;
    }

    .ceo-bar-chart {
        height: 130px;
        padding: .8rem;
    }

    .ceo-platform-bars {
        padding: .8rem;
    }

    /* Empty state */
    .empty-state {
        padding: 2rem .8rem;
    }

    /* Login */
    .login-card {
        max-width: 100%;
    }

    .stack-form {
        padding: 1rem;
    }

    /* Modal */
    dialog.modal {
        width: 95%;
        max-width: 95vw;
    }
}