:root {
    --bg: #070a11;
    --panel: rgba(13, 18, 31, 0.78);
    --panel-strong: #0f172a;
    --line: rgba(148, 163, 184, 0.15);
    --text: #f8fafc;
    --muted: #94a3b8;
    --blue: #38bdf8;
    --green: #34d399;
    --violet: #a78bfa;
    --amber: #fbbf24;
    --danger: #fb7185;
    --radius: 8px;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 19% 0%, rgba(56, 189, 248, 0.14), transparent 28%),
        radial-gradient(circle at 92% 12%, rgba(52, 211, 153, 0.1), transparent 30%),
        linear-gradient(135deg, #070a11 0%, #0b1020 52%, #070a11 100%);
    background-size: 42px 42px, 42px 42px, auto, auto, auto;
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(8, 11, 18, 0.9), rgba(8, 11, 18, 0.66));
    backdrop-filter: blur(18px);
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(56, 189, 248, 0.48);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(56, 189, 248, 0.28), rgba(52, 211, 153, 0.18)),
        #0f172a;
    color: #e0f2fe;
    font-family: Sora, sans-serif;
    font-weight: 700;
}

.brand strong,
h1,
h2,
h3 {
    font-family: Sora, Inter, sans-serif;
    letter-spacing: 0;
}

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

.nav {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.nav a,
.ghost-button,
.icon-button,
.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: 160ms ease;
}

.nav a {
    justify-content: flex-start;
    padding: 0 12px;
    color: #cbd5e1;
}

.nav a:hover,
.nav a.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(52, 211, 153, 0.05));
    border-color: rgba(56, 189, 248, 0.26);
    color: #f8fafc;
}

.nav svg,
button svg,
a svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.sidebar-panel {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(15, 23, 42, 0.72);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.1);
}

.content {
    padding: 30px;
    max-width: 1480px;
    width: 100%;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 34px;
}

h2 {
    margin-bottom: 0;
    font-size: 19px;
}

h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

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

.icon-button,
.ghost-button,
.secondary-button {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.68);
    border-color: var(--line);
}

.icon-button {
    width: 42px;
}

.ghost-button,
.secondary-button,
.primary-button {
    padding: 0 14px;
    cursor: pointer;
}

.primary-button {
    color: #031118;
    border: 0;
    background: linear-gradient(135deg, var(--blue), var(--green));
    font-weight: 800;
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
    border-color: rgba(56, 189, 248, 0.32);
    transform: translateY(-1px);
}

.danger-button {
    color: #fecdd3;
}

.danger-button:hover {
    border-color: rgba(251, 113, 133, 0.36);
    color: #ffe4e6;
}

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

.metric-card,
.panel,
.account-card,
.post-card,
.login-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.metric-card {
    min-height: 132px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -28px;
    top: -28px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    opacity: 0.18;
    background: currentColor;
}

.metric-card span,
.metric-card small,
.table-row small,
.post-card p,
.event-item p,
label span,
dt {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 14px 0 8px;
    font-size: 38px;
    font-family: Sora, sans-serif;
}

.metric-card.blue { color: var(--blue); }
.metric-card.green { color: var(--green); }
.metric-card.violet { color: var(--violet); }
.metric-card.amber { color: var(--amber); }

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
    gap: 16px;
}

.panel {
    padding: 22px;
    min-width: 0;
}

.panel.large {
    min-height: 420px;
}

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

.table-list,
.event-list,
.check-list {
    display: grid;
    gap: 10px;
}

.table-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    min-height: 66px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(90deg, rgba(2, 6, 23, 0.36), rgba(15, 23, 42, 0.28));
}

.table-row:hover,
.post-card:hover,
.account-card:hover {
    border-color: rgba(56, 189, 248, 0.28);
    transform: translateY(-1px);
}

.table-row.campaign {
    grid-template-columns: minmax(0, 1fr) 90px 74px auto 44px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #dbeafe;
    background: rgba(148, 163, 184, 0.12);
    font-size: 12px;
    font-weight: 800;
}

.pill.ok {
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.12);
}

.pill.soft {
    color: #cbd5e1;
}

.event-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

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

.event-item time {
    color: var(--green);
    font-weight: 800;
}

.event-item p {
    margin: 4px 0 0;
    line-height: 1.45;
}

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid rgba(56, 189, 248, 0.26);
    border-radius: var(--radius);
    background: rgba(56, 189, 248, 0.09);
    color: #dbeafe;
}

.notice.warn {
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.1);
}

.account-grid,
.post-grid,
.settings-grid,
.form-grid,
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
}

.account-card,
.post-card {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.account-card {
    grid-template-columns: 54px minmax(0, 1fr) auto;
}

.avatar,
.post-thumb {
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: rgba(56, 189, 248, 0.1);
    color: var(--blue);
    font-weight: 900;
}

.avatar {
    width: 54px;
    height: 54px;
}

.account-card dl {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0;
}

dt {
    font-size: 12px;
}

dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.post-card {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
}

.post-thumb {
    width: 92px;
    height: 92px;
    overflow: hidden;
    position: relative;
    flex: 0 0 auto;
}

.post-thumb.has-media {
    display: block;
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: rgba(2, 6, 23, 0.5);
}

.post-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

a.post-thumb.has-media:hover {
    border-color: rgba(56, 189, 248, 0.46);
}

.post-body {
    min-width: 0;
}

.post-card h3 {
    display: -webkit-box;
    margin: 8px 0 6px;
    overflow: hidden;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-card p {
    margin-bottom: 0;
}

.post-card > .pill {
    align-self: start;
    justify-self: end;
    white-space: nowrap;
}

.tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-row span {
    color: #bae6fd;
    font-size: 12px;
    font-weight: 800;
}

label {
    display: grid;
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(2, 6, 23, 0.42);
    outline: none;
}

textarea {
    min-height: 140px;
    padding-top: 12px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56, 189, 248, 0.58);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
}

.copy-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 8px;
}

.copy-field button {
    display: grid;
    place-items: center;
    min-height: 46px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius);
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.76);
    cursor: pointer;
}

.copy-field button:hover {
    border-color: rgba(56, 189, 248, 0.46);
    color: #e0f2fe;
}

.setup-panel {
    margin-top: 16px;
}

.setup-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.setup-steps article {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    min-height: 144px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(2, 6, 23, 0.3);
}

.setup-steps article > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    color: #031118;
    background: linear-gradient(135deg, var(--blue), var(--green));
    font-weight: 900;
}

.setup-steps p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.env-snippet {
    margin: 16px 0 0;
    padding: 16px;
    overflow-x: auto;
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: var(--radius);
    color: #dbeafe;
    background: rgba(2, 6, 23, 0.56);
}

.inline-notice {
    margin: 14px 0 0;
}

.wide-label {
    margin-top: 14px;
}

.check-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.check-list input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--blue);
}

.chart-shell {
    display: flex;
    align-items: end;
    gap: 16px;
    height: 260px;
    padding: 20px;
    border-radius: var(--radius);
    background: rgba(2, 6, 23, 0.35);
}

.chart-shell div {
    flex: 1;
    min-width: 34px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--blue), var(--green));
}

.auth-screen {
    display: grid;
    place-items: center;
    padding: 32px;
}

.legal-page {
    width: min(880px, calc(100% - 36px));
    margin: 0 auto;
    padding: 42px 0;
}

.legal-panel {
    margin-top: 22px;
}

.legal-panel h1 {
    margin-bottom: 22px;
}

.legal-panel p {
    color: #cbd5e1;
    line-height: 1.75;
}

.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 420px;
    gap: 22px;
    width: min(1040px, 100%);
}

.auth-hero,
.login-card {
    padding: 28px;
}

.auth-hero {
    min-height: 560px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius);
}

.auth-hero h1 {
    max-width: 620px;
    margin: 22px 0 16px;
    font-size: clamp(36px, 5vw, 68px);
    line-height: 1.02;
}

.auth-hero p {
    max-width: 560px;
    color: #cbd5e1;
    line-height: 1.65;
}

.auth-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.auth-grid span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(15, 23, 42, 0.56);
}

.login-card {
    align-self: center;
    display: grid;
    gap: 18px;
}

.login-card h2 {
    font-size: 25px;
}

.form-error {
    padding: 12px;
    border-radius: var(--radius);
    color: #ffe4e6;
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.24);
}

@media (max-width: 980px) {
    .shell,
    .auth-wrap {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar-panel {
        position: static;
        margin-top: 20px;
    }

    .metric-grid,
    .two-column,
    .account-grid,
    .post-grid,
    .settings-grid,
    .form-grid,
    .config-grid,
    .setup-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .content,
    .sidebar,
    .auth-screen {
        padding: 14px;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand {
        margin-bottom: 12px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .brand small {
        display: none;
    }

    .nav {
        display: flex;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav a {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }

    .nav svg {
        width: 16px;
        height: 16px;
    }

    .sidebar-panel {
        display: none;
    }

    .topbar,
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-row,
    .table-row.campaign,
    .account-card {
        grid-template-columns: 1fr;
    }

    .table-row.campaign form {
        justify-self: start;
    }

    .post-card {
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 12px;
        min-height: 106px;
        padding: 12px;
        align-items: center;
    }

    .post-thumb {
        grid-row: 1 / span 2;
        width: 74px;
        height: 74px;
        aspect-ratio: 1 / 1;
    }

    .post-body {
        grid-column: 2;
    }

    .post-card h3 {
        font-size: 14px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }

    .post-card p {
        font-size: 12px;
    }

    .post-card > .pill {
        grid-column: 2;
        justify-self: start;
        min-height: 24px;
        padding: 0 9px;
        font-size: 11px;
    }

    h1 {
        font-size: 28px;
    }

    .panel {
        padding: 14px;
    }
}
