/* =========================================================
   SOCIAL SAAS - AUTHENTICATION UI
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #f5f7fb;
    color: #172033;
}

/* =========================================================
   AUTH PAGE
   ========================================================= */

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(124, 92, 255, 0.08),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #f8f9fd 0%,
            #f1f3f9 100%
        );
}

.auth-shell {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 40px 20px;
}

/* =========================================================
   AUTH CARD
   ========================================================= */

.auth-card {
    width: 100%;
    max-width: 520px;

    background: #ffffff;

    border: 1px solid #e5e8f0;

    border-radius: 24px;

    padding: 42px 48px 40px;

    box-shadow:
        0 30px 70px rgba(24, 32, 56, 0.10),
        0 8px 25px rgba(24, 32, 56, 0.05);
}

/* =========================================================
   BRAND
   ========================================================= */

.auth-brand {
    display: flex;
    align-items: center;

    gap: 13px;

    margin-bottom: 38px;
}

.brand-icon {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 13px;

    background: linear-gradient(
        135deg,
        #6d4aff,
        #9257ff
    );

    color: #ffffff;

    font-size: 21px;
    font-weight: 800;

    box-shadow:
        0 10px 25px rgba(111, 74, 255, 0.28);
}

.brand-content {
    display: flex;
    flex-direction: column;

    gap: 3px;
}

.brand-name {
    font-size: 19px;
    font-weight: 800;

    line-height: 1.2;

    color: #172033;
}

.brand-tagline {
    font-size: 13px;

    line-height: 1.3;

    color: #8991a5;
}

/* =========================================================
   LOGIN CONTENT
   ========================================================= */

.login-content {
    width: 100%;
}

.eyebrow {
    margin-bottom: 10px;

    color: #7557ff;

    font-size: 13px;
    font-weight: 700;

    letter-spacing: 0.03em;
}

.login-content h1 {
    margin: 0;

    font-size: 40px;
    line-height: 1.15;

    font-weight: 800;

    color: #111827;
}

.login-description {
    margin: 12px 0 30px;

    font-size: 15px;
    line-height: 1.6;

    color: #7d879c;
}

/* =========================================================
   FORM
   ========================================================= */

.login-form {
    display: flex;
    flex-direction: column;

    gap: 21px;
}

.form-group {
    display: flex;
    flex-direction: column;

    gap: 9px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;

    color: #172033;
}

.form-group input {
    width: 100%;

    height: 54px;

    padding: 0 16px;

    border: 1px solid #dfe3ec;

    border-radius: 12px;

    background: #ffffff;

    color: #172033;

    font-size: 15px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.form-group input::placeholder {
    color: #a6adbc;
}

.form-group input:focus {
    border-color: #7757ff;

    box-shadow:
        0 0 0 4px rgba(119, 87, 255, 0.10);

    background: #ffffff;
}

/* =========================================================
   BUTTON
   ========================================================= */

.login-button {
    width: 100%;

    height: 54px;

    margin-top: 3px;

    border: 0;

    border-radius: 12px;

    background: linear-gradient(
        135deg,
        #7050ff,
        #8b55f6
    );

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 12px 24px rgba(111, 80, 255, 0.25);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.login-button:hover {
    transform: translateY(-1px);

    box-shadow:
        0 15px 28px rgba(111, 80, 255, 0.32);
}

.login-button:active {
    transform: translateY(0);
}

/* =========================================================
   LINKS
   ========================================================= */

.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 25px;
}

.auth-links a {
    color: #6850ee;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    padding: 12px 14px;

    margin-bottom: 20px;

    border-radius: 10px;

    font-size: 14px;
}

.alert-error {
    color: #a61b2b;

    background: #fff1f2;

    border: 1px solid #fecdd3;
}

.alert-success {
    color: #166534;

    background: #f0fdf4;

    border: 1px solid #bbf7d0;
}

/* =========================================================
   VALIDATION
   ========================================================= */

.errors {
    margin-bottom: 20px;

    padding: 12px 15px;

    border-radius: 10px;

    background: #fff1f2;

    color: #a61b2b;

    font-size: 14px;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .auth-shell {
        padding: 20px 14px;
    }

    .auth-card {
        padding: 30px 24px;

        border-radius: 20px;
    }

    .auth-brand {
        margin-bottom: 30px;
    }

    .login-content h1 {
        font-size: 34px;
    }

    .auth-links {
        gap: 15px;
    }
}

/* =========================================================
   SOCIALFLOW APPLICATION UI
   ========================================================= */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #fafbff;
    --text: #172033;
    --muted: #7d879c;
    --line: #e7e9f1;
    --primary: #6d4aff;
    --primary-dark: #5a38e8;
    --purple-soft: #f0ecff;
    --green: #18a66a;
    --orange: #ed8a2f;
    --blue: #367cf5;
    --danger: #dc3545;
    --shadow: 0 16px 40px rgba(27, 36, 65, .07);
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

/* APP SHELL */

.shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    background: #fff;
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 25px;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    color: #fff;
    font-weight: 800;
    font-size: 19px;
    background: linear-gradient(135deg, #6545f5, #9156ff);
    box-shadow: 0 10px 24px rgba(109, 74, 255, .25);
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand b {
    font-size: 17px;
    line-height: 1.2;
}

.brand small,
.top small,
.top-user small {
    color: var(--muted);
    font-size: 12px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 12px;
    border-radius: 10px;
    color: #5f687d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: .18s ease;
}

.nav span:first-child {
    width: 19px;
    text-align: center;
    font-size: 16px;
}

.nav:hover,
.nav.active {
    color: var(--primary);
    background: var(--purple-soft);
}

.nav-label {
    margin: 22px 12px 6px;
    color: #a1a8b7;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.trial {
    margin-top: auto;
    padding: 15px;
    border-radius: 14px;
    background: linear-gradient(145deg, #f5f1ff, #fbfaff);
    border: 1px solid #e7defe;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trial b {
    font-size: 13px;
}

.trial small {
    color: var(--muted);
    font-size: 11px;
}

.trial a {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.main {
    min-width: 0;
    flex: 1;
}

.top {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 34px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
}

.top > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.top > div:first-child b {
    font-size: 15px;
}

.top-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-user > span:nth-child(2) {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.top-user > a {
    margin-left: 12px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6d4aff, #8f5bff);
    font-weight: 800;
}

.page {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 34px;
}

/* PAGE HERO */

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.hero h1 {
    margin: 5px 0 8px;
    color: #111827;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.12;
    letter-spacing: -.025em;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

/* BUTTONS */

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 17px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #4f586b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(31, 39, 63, .08);
}

.btn.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #6d4aff, #8654ff);
    box-shadow: 0 10px 22px rgba(109, 74, 255, .20);
}

.btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #7945ed);
}

.btn.wide {
    width: 100%;
}

/* CARDS */

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    position: relative;
    min-height: 155px;
    padding: 21px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.cards .stat {
    display: flex;
    flex-direction: column;
}

.stat .icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border-radius: 11px;
    font-weight: 800;
}

.icon.purple {
    color: #6845ed;
    background: #f0ebff;
}

.icon.orange {
    color: #d9781d;
    background: #fff1e5;
}

.icon.green {
    color: #15905c;
    background: #e7f8f0;
}

.icon.blue {
    color: #2d6bd7;
    background: #eaf2ff;
}

.stat small {
    color: var(--muted);
    font-size: 12px;
}

.stat strong {
    margin: 4px 0 2px;
    color: #121a2a;
    font-size: 29px;
    line-height: 1;
}

.stat em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
}

/* PANELS */

.grid2 {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 18px;
}

.grid2 > div {
    min-width: 0;
}

.panel {
    margin-bottom: 18px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.panel-head small {
    color: var(--muted);
    font-size: 12px;
}

.badge {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f0ebff;
    color: #6544df;
    font-size: 11px;
    font-weight: 800;
}

/* DETAILS */

.health,
.details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line);
}

.health > div,
.details > div {
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 14px;
    background: #fff;
}

.health span,
.details span {
    color: var(--muted);
    font-size: 11px;
}

.health b,
.details b {
    color: #182135;
    font-size: 15px;
}

/* PLAN / QUICK ACTION CARDS */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.plan-card {
    display: block;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: .18s ease;
}

.plan-card:hover {
    border-color: #d8cdfd;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(28, 35, 58, .07);
}

.plan-card h3 {
    margin: 8px 0 7px;
    font-size: 15px;
}

.plan-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.plan-price {
    margin: 12px 0;
    font-size: 27px;
    font-weight: 800;
}

.plan-price small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

/* TABLE */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

th {
    color: #8a93a5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

td b,
td small {
    display: block;
}

td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.status {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    background: #f0f2f7;
    color: #667085;
    font-size: 11px;
    font-weight: 800;
}

.status.published,
.status.active,
.status.approved {
    background: #e9f8f1;
    color: #16865a;
}

.status.scheduled,
.status.pending,
.status.trialing {
    background: #fff4e8;
    color: #bf6b1c;
}

.status.draft {
    background: #eef2ff;
    color: #5369b8;
}

.status.failed,
.status.cancelled {
    background: #fff0f1;
    color: #bd2d3d;
}

/* EMPTY STATE */

.empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: #f1efff;
    color: var(--primary);
    font-size: 20px;
}

.empty b,
.empty small {
    display: block;
}

.empty b {
    margin-bottom: 5px;
    color: #293248;
}

.empty small {
    font-size: 12px;
}

/* FORMS */

.form-panel {
    max-width: 100%;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #30394d;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #dfe3ec;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #172033;
    font-size: 14px;
    transition: .18s ease;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #9c87f7;
    box-shadow: 0 0 0 3px rgba(109, 74, 255, .10);
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check input {
    width: auto;
    min-height: auto;
}

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.flash.success {
    color: #166534;
    background: #effbf4;
    border: 1px solid #b9ebcd;
}

.flash.error {
    color: #a61b2b;
    background: #fff1f2;
    border: 1px solid #fecdd3;
}

.errors {
    margin-bottom: 18px;
    padding: 12px 15px;
    border-radius: 10px;
    background: #fff1f2;
    color: #a61b2b;
    font-size: 13px;
}

.errors ul,
.alert ul {
    margin: 0;
    padding-left: 18px;
}

/* TIMELINE */

.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 18px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
    border-bottom: 0;
}

.timeline-item time {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.timeline-item b,
.timeline-item span {
    display: block;
}

.timeline-item span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .sidebar {
        width: 220px;
        flex-basis: 220px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-label {
        grid-column: 1 / -1;
        margin-top: 12px;
    }

    .trial {
        margin-top: 18px;
    }

    .top {
        height: auto;
        min-height: 70px;
        padding: 15px 18px;
    }

    .top-user > span:nth-child(2) {
        display: none;
    }

    .page {
        padding: 22px 16px;
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .cards,
    .plan-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .full {
        grid-column: auto;
    }

    .health,
    .details {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}

/* =========================================================
   ACCESSIBILITY / POLISH
   ========================================================= */

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background: var(--purple-soft);
    color: var(--primary-dark);
}

* {
    scrollbar-color: #cfd3e6 transparent;
}

.btn[disabled] {
    cursor: not-allowed;
    opacity: .55;
}

.btn[disabled]:hover {
    transform: none;
    box-shadow: none;
}

.btn.sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #f1f2f8;
    color: #4c3fb0;
    font-size: 11px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* =========================================================
   BADGES (variants)
   ========================================================= */

.badge.sm {
    padding: 4px 8px;
    font-size: 10px;
}

.badge.lg {
    padding: 9px 14px;
    font-size: 13px;
}

.badge.success {
    background: #e6f8ef;
    color: #158c56;
}

.badge.warn {
    background: #fff2e0;
    color: #b4680f;
}

.badge.info {
    background: #eaf2ff;
    color: #2d6bd7;
}

/* =========================================================
   METERS / USAGE
   ========================================================= */

.usage-panel .panel-head {
    margin-bottom: 12px;
}

.meter {
    height: 10px;
    margin: 10px 0 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #eef0f7;
}

.meter.sm {
    height: 7px;
    margin: 6px 0 0;
}

.meter-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #8f5bff);
    transition: width .3s ease;
}

.meter-fill.full {
    background: linear-gradient(90deg, #ed8a2f, #dc3545);
}

.meter-note {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.meter-note a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.meter-note.error {
    color: #a61b2b;
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 6px;
}

.usage-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.usage-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.usage-item-head b {
    color: #182135;
    font-size: 13px;
}

.feature-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.feature-pill.on {
    background: #e6f8ef;
    color: #158c56;
}

.feature-pill.off {
    background: #f4f5f9;
    color: #9aa1b3;
}

/* =========================================================
   PROVIDER / CONNECT CARDS
   ========================================================= */

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.provider-card {
    display: flex;
    flex-direction: column;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: .18s ease;
}

.provider-card:not(.is-disabled):hover {
    border-color: #d8cdfd;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(28, 35, 58, .07);
}

.provider-card.is-disabled {
    background: var(--surface-soft);
}

.provider-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.provider-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--purple-soft);
    color: var(--primary);
    font-weight: 800;
}

.provider-card h3 {
    margin: 2px 0 4px;
    font-size: 15px;
}

.provider-card p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    flex: 1;
}

.provider-hint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

/* =========================================================
   PLAN CARD BADGE (billing)
   ========================================================= */

.plan-card {
    position: relative;
}

.plan-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 5px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6d4aff, #8654ff);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    box-shadow: 0 8px 18px rgba(109, 74, 255, .25);
}

.plan-card.selected {
    border-color: #c8b8ff;
    box-shadow: 0 0 0 3px rgba(109, 74, 255, .12);
}

.current-plan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(145deg, #faf8ff, #ffffff);
    box-shadow: var(--shadow);
}

.current-plan h2 {
    margin: 4px 0 6px;
    font-size: 24px;
}

.current-plan p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.current-plan .price {
    font-size: 30px;
    font-weight: 800;
    color: #182135;
    text-align: right;
}

.current-plan .price small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

/* =========================================================
   CONNECTED ACCOUNT LIST (dashboard)
   ========================================================= */

.account-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 8px;
    border-radius: 10px;
    transition: background .15s ease;
}

.account-row:hover {
    background: var(--surface-soft);
}

.account-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--purple-soft);
    color: var(--primary);
    font-weight: 800;
    font-size: 13px;
}

.account-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-meta b {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-meta small {
    color: var(--muted);
    font-size: 11px;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 8px;
    border-radius: 10px;
    transition: background .15s ease;
}

.member-row:hover {
    background: var(--surface-soft);
}

/* =========================================================
   MEDIA LIBRARY
   ========================================================= */

.dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    margin-bottom: 16px;
    padding: 20px;
    border: 2px dashed #d7dbe8;
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: .18s ease;
}

.dropzone:hover {
    border-color: #b8a6ff;
    color: var(--primary);
    background: var(--purple-soft);
}

.dropzone input {
    display: none;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.media-tile {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.media-tile img {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: cover;
    background: var(--surface-soft);
}

.media-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    background: var(--purple-soft);
    color: var(--primary);
    font-size: 22px;
}

.media-tile-meta {
    padding: 9px 10px;
}

.media-tile-meta b {
    display: block;
    overflow: hidden;
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.media-tile-meta small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

/* =========================================================
   LIVE INDICATOR
   ========================================================= */

.hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 rgba(24, 166, 106, .5);
    animation: live-pulse 2s infinite;
}

.live-indicator.is-stale .live-dot {
    background: #cbd0dd;
    animation: none;
}

@keyframes live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 166, 106, .45);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(24, 166, 106, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(24, 166, 106, 0);
    }
}

/* =========================================================
   MOBILE SIDEBAR TOGGLE
   ========================================================= */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 20;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
    font-size: 17px;
}

@media (max-width: 760px) {
    .sidebar-toggle {
        display: flex;
    }

    .sidebar nav {
        display: none;
    }

    .shell.sidebar-open .sidebar nav {
        display: grid;
    }

    .trial {
        display: none;
    }

    .shell.sidebar-open .trial {
        display: flex;
    }

    .usage-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .current-plan {
        flex-direction: column;
        align-items: flex-start;
    }

    .current-plan .price {
        text-align: left;
    }

    .provider-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .usage-grid,
    .provider-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================================
   SOCIALFLOW v3 — DESIGN SYSTEM ENHANCEMENTS
   Dark mode, off-canvas mobile nav, SVG icons, composer, calendar grid,
   charts, AI studio. Appended last so it overrides earlier rules.
   ========================================================================= */

:root {
    --surface-2: #f3f4f9;
    --input-bg: #ffffff;
    --input-line: #dfe3ec;
    --heading: #121a2a;
    --radius: 16px;
    --ring: 0 0 0 3px rgba(109, 74, 255, .18);
    --fb: #1877f2; --ig: #e1306c; --li: #0a66c2; --xx: #111111;
    --tt: #00a7a0; --yt: #ff0000; --pi: #e60023; --th: #333333;
}

[data-theme="dark"] {
    --bg: #0e111a;
    --surface: #161a26;
    --surface-soft: #1b2030;
    --surface-2: #1f2536;
    --text: #e6e9f2;
    --heading: #f4f6fb;
    --muted: #8f98ad;
    --line: #272d3f;
    --purple-soft: #261f4a;
    --input-bg: #11151f;
    --input-line: #2d3447;
    --shadow: 0 16px 40px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .sidebar,
[data-theme="dark"] .top,
[data-theme="dark"] .panel,
[data-theme="dark"] .stat,
[data-theme="dark"] .plan-card,
[data-theme="dark"] .provider-card,
[data-theme="dark"] .btn:not(.primary):not(.danger),
[data-theme="dark"] .icon-btn { background: var(--surface); color: var(--text); border-color: var(--line); }
[data-theme="dark"] .hero h1,
[data-theme="dark"] .panel h3,
[data-theme="dark"] .top b,
[data-theme="dark"] .brand b,
[data-theme="dark"] .stat strong,
[data-theme="dark"] .details b,
[data-theme="dark"] .health b,
[data-theme="dark"] td b,
[data-theme="dark"] .empty b { color: var(--heading); }
[data-theme="dark"] .nav { color: #b4bccd; }
[data-theme="dark"] .nav:hover,
[data-theme="dark"] .nav.active { background: var(--purple-soft); color: #c9bcff; }
[data-theme="dark"] .trial { background: var(--surface-soft); border-color: var(--line); }
[data-theme="dark"] .trial b { color: var(--heading); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--input-bg); border-color: var(--input-line); color: var(--text); }
[data-theme="dark"] table th { color: var(--muted); }
[data-theme="dark"] table td,
[data-theme="dark"] table th { border-color: var(--line); }
[data-theme="dark"] .details > div,
[data-theme="dark"] .health > div { border-color: var(--line); }
[data-theme="dark"] .badge { background: var(--purple-soft); color: #c9bcff; }
[data-theme="dark"] .status.draft { background: #262c3d; color: #aab3c7; }
[data-theme="dark"] .status.published, [data-theme="dark"] .status.active, [data-theme="dark"] .status.approved, [data-theme="dark"] .status.connected { background: #12352a; color: #5ad69f; }
[data-theme="dark"] .status.scheduled, [data-theme="dark"] .status.pending, [data-theme="dark"] .status.trialing, [data-theme="dark"] .status.pending_approval { background: #3a2a14; color: #f2b46a; }
[data-theme="dark"] .status.failed, [data-theme="dark"] .status.cancelled, [data-theme="dark"] .status.rejected { background: #3b1a20; color: #f48a98; }
[data-theme="dark"] .flash.success { background: #12352a; color: #8ee6bd; border-color: #1e5a43; }
[data-theme="dark"] .flash.error { background: #3b1a20; color: #f8a5b0; border-color: #6a2a35; }
[data-theme="dark"] .account-row:hover { background: var(--surface-soft); }
[data-theme="dark"] code { background: var(--surface-2); color: #c9bcff; }

/* ---------- Icons ---------- */
.i { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.btn .i { width: 16px; height: 16px; }
.only-dark { display: none; }
[data-theme="dark"] .only-dark { display: inline-block; }
[data-theme="dark"] .only-light { display: none; }

/* ---------- Sidebar: full height, scrolls on short screens ---------- */
.sidebar {
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar nav { gap: 2px; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav .nav-text { flex: 1; }
.nav-count {
    min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-size: 11px; font-weight: 800;
}
.nav-label { text-transform: uppercase; }
.trial { margin-top: auto; }

/* ---------- Top bar ---------- */
.top { gap: 16px; position: sticky; top: 0; z-index: 15; backdrop-filter: saturate(1.2) blur(8px); }
.top-title { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.top-title b { font-size: 16px; }
.top-title small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-user { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
    cursor: pointer; transition: .15s ease; text-decoration: none;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.top-user > a.icon-btn { padding: 0; }
.sidebar-toggle { display: none; position: static; box-shadow: none; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: opacity .4s ease; }
.flash.info { background: #eef4ff; color: #2d5bb8; border: 1px solid #cddcfb; }
.flash.fade { opacity: 0; }
.flash-close { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.xs { min-height: 28px; padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: #fff0f1; color: #bd2d3d; border: 1px solid #fecdd3; }
.btn.success { background: #e9f8f1; color: #16865a; border: 1px solid #b9ebcd; }
[data-theme="dark"] .btn.danger { background: #3b1a20; color: #f8a5b0; border-color: #6a2a35; }
[data-theme="dark"] .btn.success { background: #12352a; color: #8ee6bd; border-color: #1e5a43; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------- Toolbar: tabs + search ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.tab {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px;
    color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none;
}
.tab em { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--text); }
.tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(20, 30, 60, .08); }
.search { position: relative; min-width: 240px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 36px; min-height: 40px; }

/* ---------- Table polish ---------- */
td small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
td .platform-dots { display: flex; gap: 4px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn { padding: 0; width: 32px; min-height: 32px; justify-content: center; }
tr:hover td { background: var(--surface-soft); }
.status.pending_approval, .status.queued, .status.processing { background: #fff4e8; color: #bf6b1c; }
.status.rejected { background: #fff0f1; color: #bd2d3d; }
.status.connected { background: #e9f8f1; color: #16865a; }

/* ---------- Platform chips ---------- */
.pchip {
    width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: #fff; background: var(--primary);
}
.pchip.facebook { background: var(--fb); } .pchip.instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.pchip.linkedin { background: var(--li); } .pchip.x { background: var(--xx); } .pchip.tiktok { background: var(--tt); }
.pchip.youtube { background: var(--yt); } .pchip.pinterest { background: var(--pi); } .pchip.threads { background: var(--th); }

/* ---------- Composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); gap: 20px; align-items: start; }
.composer .panel { margin: 0; }
.composer-side { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; font-size: 13px; font-weight: 700; color: var(--text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.editor-wrap { border: 1px solid var(--input-line); border-radius: 12px; background: var(--input-bg); transition: .15s ease; }
.editor-wrap:focus-within { border-color: #9c87f7; box-shadow: var(--ring); }
.editor-wrap textarea { border: 0; box-shadow: none !important; background: transparent; min-height: 190px; border-radius: 12px 12px 0 0; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.editor-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.editor-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.account-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.account-option {
    display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; transition: .15s ease; margin: 0 !important;
}
.account-option input { width: auto; min-height: 0; margin: 0; accent-color: var(--primary); }
.account-option:has(input:checked) { border-color: var(--primary); background: var(--purple-soft); }
.account-option small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 12px; gap: 4px; }
.segmented label { margin: 0 !important; display: block !important; }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(20, 30, 60, .1); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

.limits { display: flex; flex-direction: column; gap: 9px; }
.limit-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; font-size: 12px; font-weight: 600; }
.limit-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; grid-column: 2 / 4; margin-top: -4px; }
.limit-bar i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .2s ease, background .2s ease; }
.limit-row.warn .limit-bar i { background: var(--orange); }
.limit-row.over .limit-bar i { background: var(--danger); }
.limit-row.over .limit-count { color: var(--danger); }

.preview-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); }
.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.preview-head .avatar { width: 38px; height: 38px; }
.preview-head b { display: block; font-size: 14px; }
.preview-head small { color: var(--muted); font-size: 12px; }
.preview-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.55; min-height: 48px; }
.preview-body .tag { color: var(--blue); font-weight: 600; }
.preview-body.placeholder { color: var(--muted); font-style: italic; }
.preview-media { margin-top: 12px; height: 150px; border-radius: 10px; background: linear-gradient(135deg, var(--purple-soft), var(--surface-2)); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.preview-foot { display: flex; gap: 18px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }

.ai-assist { display: flex; flex-direction: column; gap: 10px; }
.ai-result { white-space: pre-wrap; font-size: 13px; line-height: 1.55; padding: 12px; border-radius: 10px; background: var(--surface-2); max-height: 240px; overflow: auto; }
.ai-result.error { background: #fff0f1; color: #a61b2b; }
[data-theme="dark"] .ai-result.error { background: #3b1a20; color: #f8a5b0; }

/* ---------- Calendar month grid ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h3 { margin: 0; font-size: 20px; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow { padding: 10px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 118px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; position: relative; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.muted { background: var(--surface-soft); }
.cal-day.muted .cal-num { opacity: .45; }
.cal-num { font-size: 12px; font-weight: 800; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.cal-day.today .cal-num span { background: var(--primary); color: #fff; border-radius: 99px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-add { opacity: 0; color: var(--primary); text-decoration: none; font-size: 16px; font-weight: 800; line-height: 1; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-event {
    display: block; padding: 4px 7px; border-radius: 7px; font-size: 11.5px; font-weight: 700; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid currentColor;
    background: var(--purple-soft); color: var(--primary);
}
.cal-event time { font-weight: 600; opacity: .8; margin-right: 4px; }
.cal-event.scheduled, .cal-event.queued { background: #fff4e8; color: #bf6b1c; }
.cal-event.published { background: #e9f8f1; color: #16865a; }
.cal-event.failed, .cal-event.cancelled { background: #fff0f1; color: #bd2d3d; }
.cal-event.draft { background: var(--surface-2); color: var(--muted); }
.cal-event.pending_approval { background: #eef2ff; color: #4757c0; }
[data-theme="dark"] .cal-event.scheduled { background: #3a2a14; color: #f2b46a; }
[data-theme="dark"] .cal-event.published { background: #12352a; color: #5ad69f; }
[data-theme="dark"] .cal-event.failed { background: #3b1a20; color: #f48a98; }
[data-theme="dark"] .cal-event.pending_approval { background: #222a4d; color: #a9b4ff; }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 700; padding-left: 4px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .area { fill: url(#chartFill); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line2 { fill: none; stroke: var(--orange); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; font-weight: 700; color: var(--muted); }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 3px; margin-right: 6px; vertical-align: middle; background: var(--primary); }
.chart-legend i.alt { background: var(--orange); }
.trend { font-style: normal; font-size: 12px; font-weight: 800; }
.trend.up { color: var(--green); } .trend.down { color: var(--danger); }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; }
.bar-item .track { grid-column: 2 / 4; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: -4px; }
.bar-item .track i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- Mini list (dashboard upcoming) ---------- */
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.mini-item:last-child { border-bottom: 0; }
.mini-date { text-align: center; border-radius: 10px; background: var(--purple-soft); color: var(--primary); padding: 6px 0; line-height: 1.1; }
.mini-date b { display: block; font-size: 17px; }
.mini-date small { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.mini-item strong { display: block; font-size: 14px; }
.mini-item span { color: var(--muted); font-size: 12px; }

/* ---------- Approval cards ---------- */
.approval-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.approval-card:last-child { border-bottom: 0; }
.approval-card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.approval-card .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.approval-actions { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.approval-actions textarea { min-height: 60px; font-size: 13px; }

/* ---------- Kbd ---------- */
kbd { font: 700 11px/1 ui-monospace, monospace; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .composer { grid-template-columns: 1fr; }
    .composer-side { position: static; }
}

@media (max-width: 1100px) {
    .sidebar { height: 100vh; }
}

@media (max-width: 960px) {
    .shell { display: block; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: 270px; min-height: 100vh;
        transform: translateX(-100%); transition: transform .22s ease; border-right: 1px solid var(--line); border-bottom: 0;
    }
    .sidebar nav { display: flex !important; flex-direction: column; }
    .trial { display: flex !important; }
    .shell.sidebar-open .sidebar { transform: none; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(10, 14, 25, .45); }
    .shell.sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-toggle { display: inline-flex !important; }
    .main { width: 100%; }
}

@media (max-width: 760px) {
    .hide-sm { display: none !important; }
    .cal-day { min-height: 74px; padding: 5px; }
    .cal-event { font-size: 0; padding: 0; height: 6px; border-left: 0; border-radius: 99px; }
    .cal-event time { display: none; }
    .field-row { grid-template-columns: 1fr; }
    .approval-card { grid-template-columns: 1fr; }
    .search { min-width: 0; width: 100%; }
    .row-actions { justify-content: flex-start; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Fixes ---------- */
/* Respect the HTML hidden attribute even on elements styled with display:flex/grid. */
[hidden] { display: none !important; }

/* Keep the sidebar column visually continuous on tall pages. */
@media (min-width: 961px) {
    .shell { background: linear-gradient(to right, var(--surface) 259px, var(--line) 259px, var(--line) 260px, var(--bg) 260px); }
}

/* Recent activity feed */
.activity { display: flex; flex-direction: column; }
.activity-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item .dot { width: 8px; height: 8px; border-radius: 99px; background: var(--primary); margin-top: 6px; box-shadow: 0 0 0 4px var(--purple-soft); }
.activity-item b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--text); }
.activity-item small { color: var(--muted); font-size: 11.5px; }
.activity-item time { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-weight: 600; }

/* Plan feature list: the ✓ / ✕ marks replace bullets */
.plan-card ul { list-style: none; padding-left: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.plan-card ul li::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 99px; background: var(--primary); margin-right: 9px; vertical-align: middle; opacity: .5; }
.plan-card ul li:nth-last-child(-n+2)::before { display: none; }

/* Dark mode: grid cells and remaining white surfaces */
.health > div, .details > div { background: var(--surface); }
[data-theme="dark"] .health, [data-theme="dark"] .details { background: var(--line); border-color: var(--line); }
[data-theme="dark"] .health span, [data-theme="dark"] .details span { color: var(--muted); }
[data-theme="dark"] .plan-card.selected { background: var(--surface-soft); }
[data-theme="dark"] .stat .icon { filter: saturate(1.2) brightness(.9); }
[data-theme="dark"] .empty-icon { background: var(--purple-soft); }
[data-theme="dark"] .mini-date { background: var(--purple-soft); color: #c9bcff; }
[data-theme="dark"] .top { background: rgba(22, 26, 38, .9); }
