:root {
    --sidebar-width: 220px;
    --sidebar-bg: #0f1117;
    --topbar-bg: #151820;
    --card-bg: #181c25;
    --card-border: rgba(255, 255, 255, 0.06);
    --accent: #4f8cff;
    --accent-glow: rgba(79, 140, 255, 0.15);
}

body {
    min-height: 100vh;
    background: #111318;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-brand i {
    font-size: 1.3rem;
    color: var(--accent);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 9px 14px;
    margin-bottom: 1px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--accent-glow);
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ---- Main ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    height: 52px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--card-border);
}

.content-area {
    width: 100%;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}

.card-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 12px 20px;
}

.card-body { padding: 20px; }

/* ---- Stat cards ---- */
.stat-card {
    border-radius: 10px;
    padding: 18px 22px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.stat-total::before { background: var(--accent); }
.stat-card.stat-published::before { background: #22c55e; }
.stat-card.stat-progress::before { background: #f59e0b; }
.stat-card.stat-failed::before { background: #ef4444; }
.stat-card.stat-today::before { background: #8b5cf6; }
.stat-card.stat-week::before { background: #06b6d4; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    font-size: 1.8rem;
    opacity: 0.1;
    position: absolute;
    top: 14px; right: 18px;
}

/* ---- Tables ---- */
.table { font-size: 0.85rem; }

.table td, .table th {
    vertical-align: middle;
    padding: 10px 14px;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid var(--card-border);
}

/* ---- Badges ---- */
.status-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---- Auth ---- */
.auth-wrapper {
    background: radial-gradient(ellipse at top, #1a1f2e 0%, #111318 70%);
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-logo {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 8px;
}

/* ---- Article content ---- */
.article-content {
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 6px 0;
}

/* ---- Task items ---- */
.task-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-item:last-child { border-bottom: none; }
a.task-item:hover { background: rgba(255,255,255,0.04); }

.task-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ---- Statistics dashboard ---- */
.stats-dashboard {
    max-width: 1400px;
    margin: 0 auto;
}

.stats-hero {
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a2235 0%, #12161f 45%, #0d1118 100%);
    border: 1px solid var(--card-border);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stats-hero-inner {
    padding: 28px 32px 24px;
    position: relative;
}

.stats-hero-inner::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -5%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(79, 140, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.stats-hero-kicker {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
}

.stats-hero-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.stats-hero-lead {
    font-size: 0.88rem;
    line-height: 1.55;
    max-width: 36rem;
}

.stats-clock {
    padding: 16px 22px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stats-clock-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}

.stats-clock-time {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stats-clock-tz {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 4px;
}

.stats-summary-row .stats-pill {
    border-radius: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    height: 100%;
}

.stats-pill-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.38);
    margin-bottom: 6px;
}

.stats-pill-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.dash-metric-card {
    border-radius: 14px;
    padding: 22px 22px 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.dash-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 14px 0 0 14px;
}

.dash-accent-cyan::before { background: linear-gradient(180deg, #22d3ee, #0891b2); }
.dash-accent-green::before { background: linear-gradient(180deg, #4ade80, #16a34a); }
.dash-accent-violet::before { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.dash-accent-amber::before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.dash-accent-blue::before { background: linear-gradient(180deg, #60a5fa, var(--accent)); }

.dash-metric-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.dash-metric-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.55);
}

.dash-accent-cyan .dash-metric-icon-wrap { color: #22d3ee; background: rgba(34, 211, 238, 0.1); }
.dash-accent-green .dash-metric-icon-wrap { color: #4ade80; background: rgba(74, 222, 128, 0.1); }
.dash-accent-violet .dash-metric-icon-wrap { color: #a78bfa; background: rgba(167, 139, 250, 0.1); }
.dash-accent-amber .dash-metric-icon-wrap { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.dash-accent-blue .dash-metric-icon-wrap { color: #60a5fa; background: rgba(96, 165, 250, 0.12); }

.dash-metric-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.dash-metric-sublabel {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.38);
    margin: 0;
    line-height: 1.35;
}

.dash-metric-block-title {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.32);
    margin-bottom: 6px;
}

.dash-metric-number {
    font-size: 2.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.03em;
}

.dash-metric-number-api {
    color: #7dd3fc;
}

.dash-bar {
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    margin-top: 10px;
    overflow: hidden;
}

.dash-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.dash-bar-pub {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.5));
}

.dash-bar-api {
    background: linear-gradient(90deg, #38bdf8, var(--accent));
}

.dash-api-split {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-api-chip {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dash-api-openai {
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
}

.dash-api-wp {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

.stats-footnote.card {
    border-radius: 12px;
}

.stats-reset-at {
    font-size: 0.88rem;
}

.stats-session-metric-label {
    display: block;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}

.stats-session-metric-value {
    font-size: 1.65rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stats-session-totals {
    padding: 12px 0;
}

.stats-spoiler-btn {
    border-radius: 12px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.stats-spoiler-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.stats-spoiler-chevron {
    transition: transform 0.25s ease;
}

.stats-spoiler-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { width: 56px; padding: 8px !important; }
    .sidebar-brand span, .sidebar .nav-link span { display: none; }
    .main-content { margin-left: 56px; width: calc(100% - 56px); }
}
