/* =========================================================
   MR Socials — Agency Hub
   Brand-inspired design system
   Palette: near-black charcoal + neon lime + warm amber,
   matching the MR Socials attendance dashboard.
   Font: Poppins throughout via Google Fonts.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand colors */
    --bg-dark: #0d0e0d;
    --bg-dark-2: #181a19;
    --bg-panel: #222322;
    --bg-panel-hover: #292b24;
    --border-subtle: #353735;

    --accent: #cbea2d;
    --accent-2: #d7f438;
    --accent-gradient: linear-gradient(135deg, #d8f43a 0%, #b8db20 100%);

    --text-primary: #f5f3e9;
    --text-secondary: #b7bdc8;
    --text-muted: #7f8896;

    --success: #5fd485;
    --warning: #ffb547;
    --danger: #ff6868;
    --info: #73a7ff;

    --white: #ffffff;
    --light-bg: #171817;
    --light-panel: #222322;
    --light-border: #363836;
    --light-text: #f5f3e9;
    --light-text-secondary: #a9b0bd;

    --radius-sm: 9px;
    --radius-md: 13px;
    --radius-lg: 18px;
    --shadow-card: 0 18px 50px rgba(0,0,0,.38);
    --shadow-card-light: 0 10px 28px rgba(0,0,0,.16);

    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Poppins', sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--light-bg);
    color: var(--light-text);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; margin: 0 0 .5rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1.3rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .92rem;
    border: 1px solid transparent;
    transition: all .18s ease;
}
.btn-primary { background: var(--accent-gradient); color: #12140d; box-shadow: 0 8px 22px rgba(203,234,45,.16); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--light-border); color: var(--light-text); }
.btn-outline:hover { background: rgba(203,234,45,.07); border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Auth pages ---------- */
.auth-body {
    background:
        radial-gradient(circle at 18% 12%, rgba(203,234,45,.10), transparent 32%),
        radial-gradient(circle at 82% 88%, rgba(255,181,71,.07), transparent 28%),
        var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.auth-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-card), 0 0 0 1px rgba(203,234,45,.03) inset;
    color: var(--text-primary);
}
.auth-logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.75rem; justify-content: center; }
.auth-logo .mark {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-weight: 800; color: #12140d; font-size: 1.1rem;
}
.auth-logo .word { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; }
.auth-logo .word span { color: var(--accent-2); }
.auth-title { text-align: center; color: var(--text-primary); font-size: 1.3rem; margin-bottom: .25rem; }
.auth-sub { text-align: center; color: var(--text-secondary); font-size: .88rem; margin-bottom: 1.75rem; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .4rem; color: var(--text-secondary); }
.field input, .field select, .field textarea {
    width: 100%;
    background: var(--bg-dark-2);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: .7rem .85rem;
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-family: var(--font-body);
    transition: border-color .15s ease;
}
.field input::placeholder, .field textarea::placeholder { color: #68717d; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(203,234,45,.08);
}
.field-hint { font-size: .76rem; color: var(--text-muted); margin-top: .3rem; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .86rem; margin-bottom: 1rem; }
.alert-error { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.alert-info { background: rgba(59,130,246,.12); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    transition: transform .25s ease;
    z-index: 100;
    border-right: 1px solid var(--border-subtle);
}
.sidebar .brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.4rem 1.3rem;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar .brand .mark {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-weight: 800; color: #12140d;
}
.sidebar .brand .word { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
.sidebar .brand .word span { color: var(--accent-2); }

.sidebar nav { flex: 1; padding: 1rem .8rem; overflow-y: auto; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 1.1rem .6rem .4rem; }
.sidebar .nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .65rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .89rem; font-weight: 500;
    margin-bottom: .15rem;
}
.sidebar .nav-link .ic { width: 18px; text-align: center; opacity: .85; }
.sidebar .nav-link:hover { background: var(--bg-panel-hover); color: var(--text-primary); }
.sidebar .nav-link.active {
    background: rgba(203,234,45,.10);
    color: var(--accent);
    box-shadow: -3px 0 0 var(--accent);
}
.sidebar .nav-link.active .ic { opacity: 1; }

.sidebar .user-box {
    padding: 1rem 1.3rem;
    border-top: 1px solid var(--border-subtle);
    display: flex; align-items: center; gap: .7rem;
}
.sidebar .user-box .avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #12140d; font-size: .9rem; flex-shrink:0;
}
.sidebar .user-box .info { min-width: 0; flex: 1; }
.sidebar .user-box .info .name { font-size: .86rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-box .info .role { font-size: .74rem; color: var(--text-muted); }
.sidebar .user-box a.logout { color: var(--text-muted); flex-shrink: 0; }
.sidebar .user-box a.logout:hover { color: var(--danger); }

.main-content { margin-left: 250px; flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--light-bg); }

.topbar {
    background: var(--light-panel);
    border-bottom: 1px solid var(--light-border);
    padding: 1rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
}
.topbar h1 { font-size: 1.15rem; color: var(--light-text); }
.topbar .topbar-right { display: flex; align-items: center; gap: 1rem; }
.hamburger { display: none; background: none; border: none; font-size: 1.4rem; color: var(--light-text); }

.page-body { padding: 1.75rem; flex: 1; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: .28rem .65rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600;
}
.badge-admin { background: rgba(203,234,45,.12); color: var(--accent); }
.badge-manager { background: rgba(115,167,255,.14); color: #8db7ff; }
.badge-executive { background: rgba(95,212,133,.14); color: #71dc94; }
.badge-designer { background: rgba(255,181,71,.14); color: var(--warning); }
.badge-editor { background: rgba(255,104,104,.14); color: #ff8585; }
.badge-default { background: #303230; color: var(--text-secondary); }
.badge-active { background: rgba(95,212,133,.14); color: #71dc94; }
.badge-inactive { background: rgba(255,104,104,.14); color: #ff8585; }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.1rem; margin-bottom: 1.75rem; }
.stat-card {
    background: var(--light-panel); border: 1px solid var(--light-border);
    border-radius: var(--radius-md); padding: 1.3rem 1.4rem;
    box-shadow: var(--shadow-card-light);
}
.stat-card .stat-label { font-size: .8rem; color: var(--light-text-secondary); font-weight: 600; margin-bottom: .4rem; }
.stat-card .stat-value { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 700; }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(203,234,45,.12); color: var(--accent); margin-bottom: .8rem; font-size: 1.05rem;
}

.card {
    background: var(--light-panel); border: 1px solid var(--light-border);
    border-radius: var(--radius-md); padding: 1.5rem;
    box-shadow: var(--shadow-card-light); margin-bottom: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.card-header h2 { font-size: 1.05rem; }

/* ---------- Client monthly deals & dashboard overview ---------- */
.deal-form-section {
    padding: 1rem;
    margin: .25rem 0 1.1rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    background: #1b1d1b;
}
.deal-form-section .section-label {
    display: block;
    color: var(--light-text);
    font-size: .86rem;
    font-weight: 700;
    margin-bottom: .2rem;
}
.monthly-plan-inputs {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: .75rem;
    margin-top: .8rem;
}
.deal-count-inline { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 190px; }
.deal-count-inline span {
    padding: .2rem .45rem;
    border-radius: 999px;
    background: rgba(203,234,45,.09);
    color: var(--light-text-secondary);
    font-size: .72rem;
    white-space: nowrap;
}
.deal-count-inline strong { color: var(--accent); }

.dashboard-card-subtitle { margin: .15rem 0 0; font-size: .82rem; }
.client-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
}
.client-overview-card {
    min-width: 0;
    padding: 1.1rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
    background: #1d1f1d;
}
.client-overview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.client-overview-head h3 { margin: 0 0 .25rem; font-size: 1rem; }
.client-overview-logo { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.client-brand-details {
    margin: .85rem 0;
    color: var(--light-text-secondary);
    font-size: .82rem;
    line-height: 1.5;
}
.client-detail-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
    margin: 1rem 0;
}
.client-detail-list div { min-width: 0; }
.client-detail-list dt {
    margin-bottom: .2rem;
    color: var(--light-text-secondary);
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.client-detail-list dd {
    margin: 0;
    color: var(--light-text);
    font-size: .79rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.client-detail-list a { color: var(--accent); }
.monthly-deal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .9rem;
    margin-bottom: .65rem;
    border-top: 1px solid var(--light-border);
    font-size: .78rem;
}
.monthly-deal-head strong { font-size: .84rem; }
.monthly-deal-head div span { color: var(--light-text-secondary); margin-left: .35rem; }
.deliverable-count-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .45rem;
}
.deliverable-count {
    min-width: 0;
    padding: .55rem .45rem;
    border-radius: var(--radius-sm);
    background: rgba(203,234,45,.07);
    text-align: center;
}
.deliverable-count span {
    display: block;
    color: var(--light-text-secondary);
    font-size: .66rem;
    font-weight: 600;
}
.deliverable-count strong {
    display: block;
    margin: .1rem 0;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 1.25rem;
}
.deliverable-count small {
    display: block;
    color: var(--light-text-secondary);
    font-size: .61rem;
    white-space: nowrap;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data-table th {
    text-align: left; padding: .8rem 1rem; background: #1b1d1b;
    color: var(--light-text-secondary); font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--light-border);
}
table.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--light-border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: rgba(203,234,45,.035); }
.row-actions { display: flex; gap: .5rem; }
.avatar-sm {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent-gradient);
    color: #12140d; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.name-cell { display: flex; align-items: center; gap: .6rem; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,17,21,.55);
    display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--light-panel); border-radius: var(--radius-lg); width: 100%; max-width: 550px;
    padding: 1.75rem; box-shadow: var(--shadow-card);
    max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin-bottom: 1.2rem; }
.modal-close { float: right; background: none; border: none; font-size: 1.2rem; color: var(--light-text-secondary); }

/* ---------- Utility ---------- */
.text-muted { color: var(--light-text-secondary); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--light-text-secondary); }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.mb-0 { margin-bottom: 0; }

/* ---------- Content Calendar ---------- */
.cal-toolbar { display: flex; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.cal-toolbar .field { min-width: 200px; }
.cal-nav { display: flex; align-items: center; gap: .8rem; }
.cal-nav-label { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; min-width: 150px; text-align: center; }

.cal-legend { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: 1.2rem; font-size: .78rem; color: var(--light-text-secondary); }
.legend-chip { display: inline-flex; align-items: center; gap: .4rem; }
.legend-chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday { text-align: center; font-size: .74rem; font-weight: 700; color: var(--light-text-secondary); text-transform: uppercase; letter-spacing: .05em; padding-bottom: .4rem; }
.cal-cell {
    background: var(--light-panel);
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    min-height: 108px;
    padding: .5rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.cal-cell-empty { background: transparent; border: none; }
.cal-cell-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-cell-head { display: flex; align-items: center; justify-content: space-between; }
.cal-daynum { font-size: .82rem; font-weight: 700; color: var(--light-text); }
.cal-add-btn {
    width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--light-border);
    background: transparent; color: var(--light-text-secondary); font-size: .9rem; line-height: 1;
    display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s;
}
.cal-cell:hover .cal-add-btn { opacity: 1; }
.cal-add-btn:hover { background: var(--accent-gradient); color: #12140d; border-color: transparent; }
.cal-chips { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.cal-chip {
    display: flex; flex-direction: column; gap: 1px; padding: .3rem .45rem; border-radius: 6px;
    font-size: .72rem; line-height: 1.2; border-left: 3px solid transparent; background: #1a1c1a;
}
.cal-chip .chip-type { font-weight: 700; }
.cal-chip .chip-theme { color: var(--light-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SME self-scheduled posts (Patch 13): chip + small edit-pencil side by side */
.cal-chip-wrap { display: flex; align-items: stretch; gap: 3px; }
.cal-chip-wrap .cal-chip { flex: 1; min-width: 0; }
.cal-chip-edit {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 18px; border-radius: 6px; border: 1px solid var(--light-border);
    color: var(--light-text-secondary); font-size: .68rem; text-decoration: none;
}
.cal-chip-edit:hover { background: var(--accent-gradient); color: #12140d; border-color: transparent; }

/* Status colors (shared by chips, badges, legend dots) */
.status-draft, .badge.status-draft { border-color: #9ca3af; background: rgba(156,163,175,.14); color: #c4cad4; }
.legend-chip .dot.status-draft { background: #9ca3af; }
.status-content-added, .badge.status-content-added { border-color: #73a7ff; background: rgba(115,167,255,.13); color: #8db7ff; }
.legend-chip .dot.status-content-added { background: #3b82f6; }
.status-in-design-edit, .badge.status-in-design-edit { border-color: #ffb547; background: rgba(255,181,71,.13); color: #ffc368; }
.legend-chip .dot.status-in-design-edit { background: #f59e0b; }
.status-ready-for-approval, .badge.status-ready-for-approval { border-color: var(--accent); background: rgba(203,234,45,.11); color: var(--accent); }
.legend-chip .dot.status-ready-for-approval { background: var(--accent); }
.status-approved, .badge.status-approved { border-color: #5fd485; background: rgba(95,212,133,.13); color: #71dc94; }
.legend-chip .dot.status-approved { background: #22c55e; }
.status-rejected, .badge.status-rejected { border-color: #ff6868; background: rgba(255,104,104,.13); color: #ff8585; }
.legend-chip .dot.status-rejected { background: #ef4444; }
.status-published, .badge.status-published { border-color: #42c7ba; background: rgba(66,199,186,.13); color: #65d7cc; }
.legend-chip .dot.status-published { background: #0d9488; }

.modal-box-lg { max-width: 780px; }
.bulk-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .8rem;
    padding: .9rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    margin-bottom: .8rem;
}
.bulk-row-remove {
    position: absolute; top: .4rem; right: .5rem; background: none; border: none;
    font-size: 1rem; color: var(--light-text-secondary); line-height: 1;
}
.bulk-row-remove:hover { color: var(--danger); }

/* ---------- Creative Assets (Patch 5) ---------- */
.badge-final { background: rgba(203,234,45,.12); color: var(--accent); border-color: var(--accent); }
.asset-status-pending, .badge.asset-status-pending { border-color: #9ca3af; background: rgba(156,163,175,.14); color: #c4cad4; }
.asset-status-in-progress, .badge.asset-status-in-progress { border-color: #73a7ff; background: rgba(115,167,255,.13); color: #8db7ff; }
.asset-status-done, .badge.asset-status-done { border-color: #5fd485; background: rgba(95,212,133,.13); color: #71dc94; }
.asset-status-needs-revision, .badge.asset-status-needs-revision { border-color: #ff6868; background: rgba(255,104,104,.13); color: #ff8585; }

.asset-list { display: flex; flex-direction: column; gap: .7rem; }
.asset-row {
    display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
    padding: .75rem .9rem; border: 1px solid var(--light-border); border-radius: var(--radius-sm);
}
.asset-row-main { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.asset-version {
    flex-shrink: 0; font-family: var(--font-heading); font-weight: 700; font-size: .78rem;
    background: #191b19; border-radius: 6px; padding: .25rem .55rem; color: var(--light-text-secondary);
}
.asset-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.asset-meta { min-width: 0; }
.asset-row-status { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

/* ---------- Tabs (Patch 11) ---------- */
.tabs-bar { display: flex; gap: .3rem; border-bottom: 1px solid var(--light-border); margin: .8rem 0 1.2rem; overflow-x: auto; }
.tab-btn {
    background: none; border: none; padding: .65rem 1.1rem; font-size: .85rem; font-weight: 700;
    color: var(--light-text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
    white-space: nowrap; font-family: inherit;
}
.tab-btn:hover { color: var(--light-text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Admin calendar post details modal ---------- */
.post-detail-modal { padding: 1.6rem; }
.post-modal-heading { padding-right: 2rem; font-size: 1.12rem; }
.post-detail-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .35rem;
    margin: 1rem 0 1.2rem;
    padding: .3rem;
    border: 1px solid var(--light-border);
    border-radius: 11px;
    background: #181a18;
    overflow: visible;
}
.post-detail-tabs .tab-btn {
    width: 100%;
    padding: .65rem .75rem;
    border: 0;
    border-radius: 8px;
    text-align: center;
}
.post-detail-tabs .tab-btn:hover {
    background: rgba(203,234,45,.05);
    color: var(--accent);
}
.post-detail-tabs .tab-btn.active {
    background: rgba(203,234,45,.12);
    color: var(--accent);
    border-bottom-color: transparent;
    box-shadow: 0 0 0 1px rgba(203,234,45,.12) inset;
}
#postDetailTabs > .tab-panel { min-height: 190px; }
.post-overview-card {
    padding: 1rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    background: #1b1d1b;
}
.post-overview-card .post-summary-bar { margin-top: 0; }
.post-overview-card .post-summary-assignees { margin: .75rem 0 1rem; }
.post-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}
.post-edit-grid .field { min-width: 0; }
.post-detail-modal .edit-toggle-panel {
    padding: 1rem;
    margin-top: .85rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    background: #191b19;
}
.post-delete-form {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--light-border);
}
#postDetailTabs > .tab-panel[data-panel="content"] > .field {
    padding: .9rem 1rem;
    margin-bottom: .7rem;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    background: #1b1d1b;
}
#postDetailTabs > .tab-panel[data-panel="content"] > .field p {
    margin: .3rem 0 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.post-detail-modal .asset-row { background: #1b1d1b; }

/* ---------- Post summary + Edit toggle (Patch 11) ---------- */
.post-summary-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem;
    font-size: .85rem; color: var(--light-text-secondary); margin: .8rem 0;
}
.post-summary-bar strong { color: var(--light-text); }
.post-summary-assignees { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 .2rem; }
.assignee-chip {
    display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem;
    border: 1px solid var(--light-border); border-radius: 20px; font-size: .78rem;
}
.assignee-chip .role-tag { color: var(--light-text-secondary); }
.assignee-chip.unassigned { color: var(--light-text-secondary); border-style: dashed; }
.edit-toggle-panel {
    display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--light-border);
}
.edit-toggle-panel.open { display: block; }

/* ---------- "Assigned to me" chip badge (Patch 11) ---------- */
.chip-badge-mine {
    display: inline-block; margin-top: 2px; font-size: .6rem; font-weight: 700;
    padding: 1px 6px; border-radius: 20px; letter-spacing: .01em;
    background: rgba(34,197,94,.18); color: #16a34a; align-self: flex-start;
}

/* ---------- Client-wise tabs on My Calendar / Task Board (Patch 11) ---------- */
.client-tabs-bar { display: flex; gap: .4rem; flex-wrap: wrap; margin: .8rem 0 1.2rem; }
.client-tab-btn {
    background: #191b19; border: 1px solid var(--light-border); border-radius: 20px;
    padding: .45rem 1rem; font-size: .82rem; font-weight: 600; color: var(--light-text-secondary);
    cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: .4rem;
}
.client-tab-btn .count {
    background: rgba(203,234,45,.12); color: var(--accent); border-radius: 20px;
    font-size: .72rem; font-weight: 700; padding: 0 .4rem; min-width: 18px; text-align: center;
}
.client-tab-btn.active { background: var(--accent-gradient); color: #12140d; border-color: transparent; }
.client-tab-btn.active .count { background: rgba(18,20,13,.16); color: #12140d; }
.client-tab-panel { display: none; }
.client-tab-panel.active { display: block; }

/* ---------- Reference files gallery (Patch 11) ---------- */
.ref-gallery { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .6rem; }
.ref-item {
    position: relative; width: 92px; border: 1px solid var(--light-border); border-radius: 8px;
    overflow: hidden; background: #191b19;
}
.ref-item img { width: 92px; height: 92px; object-fit: cover; display: block; }
.ref-item-video {
    width: 92px; height: 92px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: .3rem; color: var(--light-text-secondary); font-size: .68rem; text-align: center;
}
.ref-item-video .play-ic { font-size: 1.3rem; }
.ref-item a.ref-link-overlay { position: absolute; inset: 0; }
.ref-item-remove {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: rgba(15,17,21,.65); color: #fff; border: none; font-size: .7rem; line-height: 1;
    display: flex; align-items: center; justify-content: center; z-index: 2;
}
.ref-uploader { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(15,17,21,.55); color: #fff; font-size: .58rem; padding: 1px 4px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
}
@media (max-width: 560px) {
    .page-body { padding: 1.1rem; }
    .topbar { padding: .9rem 1.1rem; }
    .auth-card { padding: 1.8rem 1.4rem; }
    .monthly-plan-inputs { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
    .client-overview-grid { grid-template-columns: minmax(0, 1fr); }
    .client-detail-list { grid-template-columns: 1fr; }
    .monthly-deal-head { align-items: flex-start; flex-direction: column; gap: .25rem; }
    .deliverable-count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .post-detail-modal { padding: 1.2rem; }
    .post-detail-tabs { grid-template-columns: 1fr; }
    .post-edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .cal-grid { grid-template-columns: repeat(7, minmax(70px, 1fr)); overflow-x: auto; }
    .cal-weekday, .cal-cell { min-width: 70px; }
    .cal-cell { min-height: 88px; }
    .cal-chip .chip-theme { display: none; }
    .bulk-row { grid-template-columns: 1fr; }
}

/* ---------- Client Approval Portal (Patch 6) ---------- */
.portal-body { background: var(--light-bg); margin: 0; }
.portal-header {
    background: var(--bg-dark);
    color: #fff;
    padding: 1.2rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.portal-header .logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.portal-header .brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: #fff; }
.portal-header .brand-sub { font-size: .78rem; color: var(--text-secondary); }
.portal-container { max-width: 860px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.portal-back { display: inline-block; font-size: .85rem; color: var(--light-text-secondary); margin-bottom: 1rem; }
.portal-back:hover { color: var(--accent); }

.asset-preview, .asset-preview-video {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: #0f1115;
}

.comment-list { display: flex; flex-direction: column; gap: 1rem; }
.comment-item { border-left: 3px solid var(--light-border); padding: .3rem 0 .3rem 1rem; }
.comment-item.action-approve { border-color: var(--success); }
.comment-item.action-reject { border-color: var(--danger); }
.comment-item.action-edit_after_approval { border-color: var(--warning); }
.comment-item p { font-size: .9rem; margin: .3rem 0 0; }
.comment-meta { font-size: .76rem; color: var(--light-text-secondary); }
.comment-action-label { font-weight: 700; color: var(--light-text); }
.comment-action-label.approve { color: #16a34a; }
.comment-action-label.reject { color: #dc2626; }

@media (max-width: 560px) {
    .portal-header { padding: 1rem 1.1rem; }
    .portal-container { padding: 1.1rem 1rem 2.5rem; }
}

/* ---------- Notifications (Patch 7) ---------- */
.notif-bell { position: relative; font-size: 1.15rem; color: var(--light-text-secondary); display: inline-flex; }
.notif-bell:hover { color: var(--accent); }
.notif-badge {
    position: absolute; top: -6px; right: -9px;
    background: var(--danger); color: #fff;
    font-size: .64rem; font-weight: 700; line-height: 1;
    min-width: 16px; height: 16px; padding: 0 3px;
    border-radius: 999px; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--light-panel);
}

.notif-list { display: flex; flex-direction: column; gap: .6rem; }
.notif-item {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: .9rem 1rem; border-radius: var(--radius-sm);
    border: 1px solid var(--light-border); background: var(--light-panel);
    transition: background .15s;
}
.notif-item.unread { background: rgba(203,234,45,.06); border-color: rgba(203,234,45,.26); }
.notif-item .notif-icon { font-size: 1.15rem; line-height: 1; margin-top: .1rem; }
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-message { font-size: .9rem; color: var(--light-text); margin: 0; }
.notif-item .notif-meta { font-size: .76rem; color: var(--light-text-secondary); margin-top: .25rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.notif-item .notif-type-tag { font-weight: 600; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: .4rem; }
.notif-item form { margin: 0; }

/* ---------- Analytics (Patch 8) ---------- */
.report-toolbar { display: flex; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.report-toolbar .field { min-width: 180px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.1rem; margin-bottom: 1.75rem; }
.report-grid .card { margin-bottom: 0; }

.chart-bars { display: flex; flex-direction: column; gap: .85rem; }
.chart-bar-row { display: grid; grid-template-columns: 130px 1fr 64px; align-items: center; gap: .7rem; }
.chart-bar-label {
    font-size: .82rem; font-weight: 600; color: var(--light-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chart-bar-track { background: var(--light-border); border-radius: 999px; height: 10px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 999px; background: var(--accent-gradient); }
.chart-bar-fill.fill-success { background: var(--success); }
.chart-bar-fill.fill-danger { background: var(--danger); }
.chart-bar-fill.fill-warning { background: var(--warning); }
.chart-bar-value { font-size: .8rem; font-weight: 700; color: var(--light-text-secondary); text-align: right; }

.member-chart-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.5rem; }
.member-chart-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--light-text-secondary); margin-bottom: .8rem; }

.rate-summary { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.rate-stat { text-align: center; }
.rate-stat .rate-value { font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; }
.rate-stat .rate-value.success { color: var(--success); }
.rate-stat .rate-value.danger { color: var(--danger); }
.rate-stat .rate-caption { font-size: .78rem; color: var(--light-text-secondary); margin-top: .2rem; }

.stage-table td, .stage-table th { white-space: nowrap; }
.stage-count { color: var(--light-text-secondary); font-size: .78rem; }

/* ---------- Settings (Patch 9) ---------- */
.mark-img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.auth-logo .mark-img { width: 42px; height: 42px; border-radius: 11px; }

.settings-section { margin-bottom: 1.75rem; }
.settings-section:last-child { margin-bottom: 0; }
.settings-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.settings-row .field { flex: 1 1 220px; }

.logo-preview-box { flex: 0 0 auto; text-align: center; }
.logo-preview-box img, .logo-preview-box .avatar-sm {
    width: 84px; height: 84px; border-radius: 16px; object-fit: cover; margin-bottom: .6rem;
}
.logo-preview-box .avatar-sm { width: 84px; height: 84px; font-size: 1.9rem; display: flex; }

.pref-list { display: flex; flex-direction: column; gap: .2rem; }
.pref-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem .2rem; border-bottom: 1px solid var(--light-border);
}
.pref-row:last-child { border-bottom: none; }
.pref-row-label { font-size: .88rem; font-weight: 600; color: var(--light-text); }
.pref-row-desc { font-size: .78rem; color: var(--light-text-secondary); margin-top: .15rem; }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--light-border); border-radius: 999px; transition: background .15s;
}
.toggle-slider::before {
    content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-gradient); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Patch 16: Read-only "My Clients" overview — shared by Executive, Designer,
   and Editor roles via includes/_client_overview_*.php. Deliberately distinct
   class names from .client-overview-* (used by the Admin/Manager dashboard)
   to avoid overriding that unrelated layout. */
.ro-client-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem;
}
.ro-client-card {
    display: flex; align-items: center; gap: .9rem; padding: 1rem;
    background: var(--light-panel); border: 1px solid var(--light-border); border-radius: 12px;
    text-decoration: none; color: inherit; transition: border-color .15s, transform .1s;
}
.ro-client-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ro-client-card-logo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.ro-client-card-name { font-weight: 700; font-size: .98rem; margin-bottom: .15rem; }