:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e6eaf2;
    --text: #1b2430;
    --text-soft: #5b6678;
    --text-faint: #95a0af;
    --primary: #101820;
    --primary-soft: #1b2633;
    --accent: #2f6fed;
    --accent-soft: rgba(47, 111, 237, 0.12);
    --success: #148f63;
    --warning: #c77d17;
    --danger: #c0392b;
    --shadow: 0 12px 32px rgba(16, 24, 32, 0.06);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

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

.layout-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, #0f1720 0%, #141f2c 100%);
    color: #f3f5f8;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    padding: 10px 8px 18px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
}

.muted {
    color: rgba(243, 245, 248, 0.6);
    font-size: 13px;
}

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

.nav-link {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(243, 245, 248, 0.84);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 8px 8px;
}

.sidebar-pill {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.layout-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.topbar-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
}

.topbar-subtitle {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-soft);
}

.page-wrap {
    padding: 24px 32px 32px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-title {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--text-soft);
    max-width: 760px;
}

.page-actions,
.topbar-actions,
.inline-actions,
.field-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.compact-stats {
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card.compact {
    padding: 16px;
    border-radius: var(--radius-md);
}

.stat-label {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.panel-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 22px;
}

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

.two-columns-wide-left {
    grid-template-columns: 1.15fr 0.85fr;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.panel-narrow {
    max-width: 900px;
}

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

.panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.kpi-list,
.simple-list,
.content-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kpi-row,
.simple-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.kpi-row:last-child,
.simple-row:last-child {
    border-bottom: 0;
}

.text-link {
    color: var(--accent);
    font-weight: 600;
}

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

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

.table th,
.table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table th {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.empty-cell {
    color: var(--text-soft);
    text-align: center !important;
    padding: 24px !important;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.field span {
    font-size: 13px;
    font-weight: 600;
}

.field-help {
    color: var(--text-soft);
    font-size: 12px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

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

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(47, 111, 237, 0.45);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.button {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

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

.button-primary {
    background: var(--primary);
    color: #ffffff;
}

.button-secondary {
    background: #eef2f8;
    color: var(--text);
}

.button-danger {
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
}

.auth-page-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(47, 111, 237, 0.15), transparent 34%),
        linear-gradient(180deg, #eef3fb 0%, #f7f9fc 100%);
}

.auth-shell {
    width: 100%;
    max-width: 460px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: 0 22px 60px rgba(16, 24, 32, 0.12);
    padding: 28px;
}

.auth-eyebrow,
.topbar-user {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    background: #eef2f8;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.auth-title {
    margin: 14px 0 10px;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.auth-subtitle {
    margin: 0 0 24px;
    color: var(--text-soft);
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}

.legal-panel p {
    margin: 0 0 14px;
    line-height: 1.65;
    color: var(--text-soft);
}

.legal-panel p:last-child {
    margin-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-connected,
.badge-published,
.badge-approved,
.badge-active,
.badge-ready {
    background: rgba(20, 143, 99, 0.12);
    color: var(--success);
}

.badge-paused,
.badge-draft,
.badge-scheduled,
.badge-queued,
.badge-publishing,
.badge-retrying {
    background: rgba(47, 111, 237, 0.12);
    color: var(--accent);
}

.badge-failed,
.badge-error,
.badge-disconnected,
.badge-archived,
.badge-expired {
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
}

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

.account-card,
.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.account-card-top,
.content-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.account-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.account-meta,
.content-card p,
.content-meta,
.inline-error {
    color: var(--text-soft);
}

.account-info-list {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.account-info-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.account-info-list span {
    color: var(--text-soft);
}

.account-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.avatar-wrap {
    flex-shrink: 0;
}

.avatar {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    object-fit: cover;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: #eff3fa;
    color: var(--primary);
    font-weight: 700;
}

.content-card h4 {
    margin: 0 0 8px;
    font-size: 18px;
}

.content-card p {
    margin: 0;
    line-height: 1.5;
}

.content-meta {
    display: flex;
    gap: 8px 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 13px;
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.flash {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.flash-success {
    background: rgba(20, 143, 99, 0.10);
    border-color: rgba(20, 143, 99, 0.22);
    color: var(--success);
}

.flash-error {
    background: rgba(192, 57, 43, 0.10);
    border-color: rgba(192, 57, 43, 0.18);
    color: var(--danger);
}

.empty-state,
.large-empty {
    display: grid;
    place-items: center;
    min-height: 120px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-soft);
    background: #fcfdff;
    text-align: center;
    padding: 24px;
}

.large-empty {
    min-height: 260px;
}

.inline-filter select {
    min-width: 180px;
}

.chart-panel canvas {
    width: 100% !important;
    height: 320px !important;
}

@media (max-width: 1280px) {
    .stats-grid,
    .cards-grid,
    .two-columns,
    .two-columns-wide-left {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1040px) {
    .layout-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .page-wrap,
    .topbar {
        padding-left: 20px;
        padding-right: 20px;
    }

    .stats-grid,
    .cards-grid,
    .two-columns,
    .two-columns-wide-left,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar,
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .panel,
    .stat-card,
    .account-card,
    .content-card {
        padding: 16px;
        border-radius: 16px;
    }

    .page-title {
        font-size: 26px;
    }
}

