/* ==========================================================
   Psupera Impulsa-T — app.css
   Colors: #FFFFFF / #E6007E / #009FE3
   Font: Montserrat
   ========================================================== */

:root {
    --white: #ffffff;
    --pink: #e6007e;
    --pink-600: #c70070;
    --pink-50: #fdecf5;
    --blue: #009fe3;
    --blue-600: #0085bf;
    --blue-50: #e7f6fd;
    --text: #1a1f2d;
    --text-muted: #6b7280;
    --bg: #f7f8fb;
    --bg-alt: #eef1f6;
    --border: #e5e7ef;
    --danger: #dc2626;
    --danger-50: #fee2e2;
    --success: #0f9d58;
    --shadow-sm: 0 2px 6px rgba(20, 25, 50, 0.05);
    --shadow: 0 8px 24px rgba(20, 25, 50, 0.08);
    --shadow-lg: 0 20px 48px rgba(20, 25, 50, 0.12);
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--pink); text-decoration: none; }
a:hover { color: var(--pink-600); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
code, pre, .code-block { font-family: ui-monospace, 'Cascadia Code', Menlo, monospace; }
.muted { color: var(--text-muted); font-size: 0.9em; }
.error { color: var(--danger); font-size: 0.85em; display: block; margin-top: 4px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- Brand mark ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-mark {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--blue) 100%);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.brand-text { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    background: var(--bg-alt);
    color: var(--text);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--pink); color: var(--white); }
.btn-secondary { background: var(--blue-600); color: var(--white); }
.btn-secondary:hover { background: var(--pink); color: var(--white); }
.btn-outline { background: transparent; border-color: var(--blue); color: var(--blue); }
.btn-outline:hover { background: var(--pink); border-color: var(--pink); color: var(--white); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.85em; }
.btn-link-danger:hover { text-decoration: underline; }

/* ---------- Chips / badges ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 600;
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
}
.chip-pink  { background: var(--pink-50); color: var(--pink-600); border-color: transparent; }
.chip-blue  { background: var(--blue-50); color: var(--blue-600); border-color: transparent; }
.chip-muted { background: var(--bg-alt); color: var(--text-muted); }
.role-badge {
    background: var(--pink); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; margin-left: 8px;
}

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea, input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="file"], select, textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text);
    transition: all 0.15s ease;
}
textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-bottom: 8px; cursor: pointer; }
.check input { width: auto; margin: 0; }
.check.align-end { align-self: end; padding-bottom: 12px; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; padding: 4px 0; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px; }
.fieldset legend { font-weight: 700; padding: 0 8px; }
.form-stack > * + * { margin-top: 0; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 18px; }
.input-lg { font-size: 1.8rem; font-weight: 800; text-align: center; letter-spacing: 0.4em; padding: 14px; }

/* ---------- Public navbar & footer ---------- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: var(--text); font-weight: 600; }
.footer { background: var(--white); border-top: 1px solid var(--border); padding: 24px 0; margin-top: 80px; }
.footer p { text-align: center; color: var(--text-muted); margin: 0; font-size: 0.88em; }

/* ---------- Hero ---------- */
.hero { padding: 70px 0 60px; background: linear-gradient(180deg, var(--white) 0%, var(--bg) 100%); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 60px; align-items: center; }
.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--blue-600); background: var(--blue-50); padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero-text h1 { font-size: 3rem; line-height: 1.1; margin-bottom: 18px; }
.hero-text .lead { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 28px; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.accent-pink { color: var(--pink); }
.accent-blue { color: var(--blue); }

.hero-visual { position: relative; min-height: 380px; }
.hero-card {
    position: absolute; width: 260px; background: var(--white);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.hero-card-1 { top: 20px; left: 20px; transform: rotate(-3deg); }
.hero-card-2 { bottom: 10px; right: 10px; transform: rotate(3deg); }
.hero-card-head { height: 110px; background: linear-gradient(135deg, var(--pink), #ff4fa4); }
.hero-card-head-2 { background: linear-gradient(135deg, var(--blue), #4fcffb); }
.hero-card-body { padding: 18px; }
.hero-card-body h4 { margin: 8px 0 4px; font-size: 1rem; }
.hero-card-body p { font-size: 0.85em; color: var(--text-muted); margin: 0; }

/* ---------- Features ---------- */
.features { padding: 80px 0; background: var(--white); }
.features h2 { text-align: center; font-size: 2rem; margin-bottom: 48px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.feature { text-align: center; padding: 20px; }
.feature-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; margin: 0 auto 14px; color: var(--white);
}
.feature-icon-pink { background: var(--pink); }
.feature-icon-blue { background: var(--blue); }
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: 0.9em; }

/* ---------- Auth ---------- */
.auth-shell {
    min-height: calc(100vh - 72px - 90px);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(ellipse at top, var(--pink-50), transparent 60%),
                radial-gradient(ellipse at bottom, var(--blue-50), transparent 60%);
}
.auth-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%; max-width: 440px;
}
.auth-card h1 { margin-bottom: 6px; }
.auth-alt { text-align: center; color: var(--text-muted); font-size: 0.9em; margin-top: 20px; }
.error-card { text-align: center; max-width: 520px; }
.error-code { display: block; font-size: 5rem; font-weight: 800; color: var(--pink); line-height: 1; margin-bottom: 12px; }

/* ---------- App shell (private + admin) ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-section {
    text-transform: uppercase; font-size: 0.7rem; font-weight: 700;
    color: var(--blue-600); letter-spacing: 0.08em;
    padding: 18px 10px 6px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    position: relative;
}
.sidebar-section:first-child { border-top: 0; margin-top: 0; padding-top: 4px; }
.sidebar-divider {
    height: 1px; background: var(--border);
    margin: 10px 4px;
}
.sidebar-link {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    display: block;
    transition: all 0.15s ease;
}
.sidebar-link:hover { background: var(--blue-50); color: var(--blue-600); }
.sidebar-link.is-active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.sidebar-link-admin { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.sidebar-link-admin:hover { background: var(--blue-50); color: var(--blue); }
.sidebar-empty { padding: 10px 12px; font-size: 0.85em; color: var(--text-muted); }
.sidebar-admin { background: linear-gradient(180deg, var(--white), var(--bg)); }

.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 40;
}
.topbar-spacer { flex: 1; }
.topbar-title { font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.user-chip img, .avatar-fallback {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--pink), var(--blue));
    color: var(--white); font-weight: 700;
    overflow: hidden;
}
.content { padding: 32px; flex: 1; }
.hamburger {
    display: none; width: 40px; height: 40px; border: none; background: transparent; cursor: pointer;
    flex-direction: column; gap: 4px; justify-content: center; align-items: center;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); }
.inline { display: inline; }

/* ---------- Page head / sections ---------- */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 20px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 4px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input, .search-form select { padding: 8px 12px; font-size: 0.85rem; min-width: 180px; }

.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.card h2, .card h3 { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-2col { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.form-side { display: flex; flex-direction: column; }
.form-side .card { margin-bottom: 16px; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat-label { display: block; font-size: 0.8em; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { display: block; font-size: 2.1rem; font-weight: 800; margin-top: 4px; color: var(--pink); }
.stat-card:nth-child(even) .stat-value { color: var(--blue); }

.subscription-card {
    background: linear-gradient(135deg, var(--blue-50), var(--pink-50));
    padding: 18px 22px; border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 2px; min-width: 240px;
}
.subscription-card strong { font-size: 1.05rem; }
.subscription-block { padding: 14px 0; }
.subscription-block h3 { margin: 10px 0 4px; }
.history-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.85em; color: var(--text-muted); }

/* ---------- Post grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.post-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    color: var(--text); display: block;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); color: var(--text); }
.post-card-image { position: relative; aspect-ratio: 16/9; background: var(--bg-alt); overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; }
.post-card-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--pink-50), var(--blue-50)); }
.post-card-body { padding: 16px 18px 20px; }
.post-card-body h3 { margin-bottom: 6px; font-size: 1rem; }
.post-card-body p { color: var(--text-muted); font-size: 0.88em; margin: 0 0 6px; }
.media-chip {
    position: absolute; top: 12px; left: 12px;
    background: rgba(0, 0, 0, 0.7); color: var(--white);
    padding: 3px 10px; border-radius: 999px; font-size: 0.72em; font-weight: 700;
}
.post-card-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--pink); color: var(--white);
    padding: 3px 10px; border-radius: 999px; font-size: 0.72em; font-weight: 700;
    letter-spacing: 0.03em;
}
.post-card.is-read { opacity: 0.72; }
.post-card.is-read .post-card-body h3 { font-weight: 600; }
.post-card.is-unread { border-left: 3px solid var(--blue); }

/* ---------- Dashboard hero ---------- */
.dash-hero {
    display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--pink) 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.dash-hero::after {
    content: ''; position: absolute; inset: auto -50px -50px auto;
    width: 260px; height: 260px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    pointer-events: none;
}
.dash-eyebrow {
    display: inline-block; font-size: 0.78em; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    opacity: 0.85; margin-bottom: 8px;
}
.dash-hero h1 { font-size: 2.4rem; margin: 0 0 10px; color: var(--white); }
.dash-lead { font-size: 1.05rem; opacity: 0.92; margin: 0 0 22px; max-width: 520px; }
.dash-lead strong { color: var(--white); font-weight: 700; }

.dash-progress { max-width: 460px; }
.dash-progress-head {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 0.88em; margin-bottom: 6px;
}
.dash-progress-head strong { font-size: 1.1em; font-weight: 700; }
.dash-progress-bar {
    height: 10px; background: rgba(255,255,255,0.25); border-radius: 999px; overflow: hidden;
}
.dash-progress-fill {
    height: 100%; background: var(--white); border-radius: 999px;
    transition: width 0.4s ease;
}
.dash-progress .muted { color: rgba(255,255,255,0.75); }

.dash-hero-side { position: relative; z-index: 1; }
.dash-sub-card {
    background: rgba(255,255,255,0.14);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius);
    padding: 18px 20px;
    color: var(--white);
}
.dash-sub-card .chip { background: rgba(255,255,255,0.25); color: var(--white); border-color: transparent; margin-bottom: 10px; }
.dash-sub-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dash-sub-card li { font-size: 0.92em; }
.dash-sub-card li strong { display: block; }
.dash-sub-card li small { opacity: 0.85; }
.dash-warn {
    margin-top: 12px; padding: 10px 12px;
    background: rgba(255, 220, 100, 0.22);
    border-left: 3px solid #ffd666;
    border-radius: 6px; font-size: 0.88em;
}

/* ---------- Dashboard counters ---------- */
.dash-counters {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px;
}
.dash-counter {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}
.dash-counter:hover { transform: translateY(-2px); }
.dash-counter-icon {
    font-size: 1.6rem;
    width: 48px; height: 48px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--blue-50); color: var(--blue-600);
}
.dash-counter small { display: block; color: var(--text-muted); font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-counter strong { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.dash-counter-read .dash-counter-icon { background: #dcfce7; color: var(--success); }
.dash-counter-unread .dash-counter-icon { background: var(--pink-50); color: var(--pink-600); }

/* ---------- Split: continue + featured ---------- */
.dash-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 36px;
}
.dash-split:has(> :only-child) { grid-template-columns: 1fr; }
.continue-card {
    display: grid; grid-template-rows: 180px auto;
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.continue-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--text); }
.continue-image { position: relative; background: linear-gradient(135deg, var(--pink-50), var(--blue-50)); }
.continue-image img { width: 100%; height: 100%; object-fit: cover; }
.continue-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--pink), var(--blue)); }
.continue-tag {
    position: absolute; bottom: 12px; left: 12px;
    background: var(--white); color: var(--pink);
    padding: 5px 12px; border-radius: 999px;
    font-size: 0.75em; font-weight: 700;
}
.continue-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.continue-body h2 { font-size: 1.2rem; margin: 0; }
.continue-body .btn { align-self: flex-start; margin-top: 6px; }

/* ---------- Category tiles ---------- */
.cat-tiles {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
}
.cat-tile {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    color: var(--text); display: block;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.cat-tile:hover { border-color: var(--blue); transform: translateY(-2px); color: var(--text); }
.cat-tile-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.cat-tile-head strong { font-size: 1em; }
.cat-tile-unread {
    background: var(--pink); color: var(--white);
    font-size: 0.72em; font-weight: 700;
    padding: 2px 10px; border-radius: 999px;
}
.cat-tile-progress { display: flex; align-items: center; gap: 10px; }
.cat-tile-bar { flex: 1; height: 6px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.cat-tile-fill { height: 100%; background: var(--blue); border-radius: 999px; }
.cat-tile-progress small { flex-shrink: 0; font-size: 0.8em; }

/* ---------- Legacy featured card (still used) ---------- */
.featured-card {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 1.2fr;
    gap: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--text);
    margin-bottom: 36px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.featured-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--text); }
.featured-image { position: relative; min-height: 240px; background: linear-gradient(135deg, var(--blue-50), var(--pink-50)); }
.featured-image img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.featured-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--blue), var(--pink)); }
.featured-tag {
    position: absolute; top: 16px; left: 16px;
    background: var(--pink); color: var(--white);
    padding: 5px 14px; border-radius: 999px;
    font-size: 0.78em; font-weight: 700; letter-spacing: 0.03em;
}
.featured-body { padding: 28px 32px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.featured-body h2 { font-size: 1.55rem; line-height: 1.25; margin: 0; }
.featured-body p { color: var(--text-muted); margin: 0; }
.featured-body .btn { align-self: flex-start; margin-top: 8px; }
.featured-empty { text-align: center; padding: 36px; margin-bottom: 36px; }
.featured-card.is-compact { grid-template-columns: 1fr; grid-template-rows: 180px auto; margin-bottom: 0; }
.featured-card.is-compact .featured-body { padding: 20px 22px; }
.featured-card.is-compact .featured-body h2 { font-size: 1.25rem; }
@media (max-width: 960px) {
    .dash-hero { grid-template-columns: 1fr; padding: 28px; }
    .dash-hero h1 { font-size: 1.9rem; }
    .dash-counters { grid-template-columns: repeat(2, 1fr); }
    .dash-split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .featured-card { grid-template-columns: 1fr; }
    .featured-image { min-height: 180px; }
    .dashboard-stats { grid-template-columns: 1fr; }
}

/* ---------- Post show ---------- */
.post-show { max-width: 860px; margin: 0 auto; }
.back-link { display: inline-block; color: var(--text-muted); font-weight: 600; margin-bottom: 16px; font-size: 0.9em; }
.back-link:hover { color: var(--pink); }
.post-header h1 { font-size: 2.1rem; line-height: 1.2; margin-bottom: 12px; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-muted); font-size: 0.88em; margin-bottom: 18px; }
.post-lead { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 24px; }
.post-cover img { width: 100%; max-height: 450px; object-fit: cover; border-radius: var(--radius); }
.video-wrap {
    position: relative; width: 100%; aspect-ratio: 16/9;
    border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; background: #000;
}
.video-wrap iframe,
.video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.audio-wrap { margin: 24px 0 28px; }
.audio-wrap audio { width: 100%; }

/* ---------- Subscriptions panel (admin user form) ---------- */
.subs-card { margin-top: 24px; }
.subs-card .section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.subs-list { display: flex; flex-direction: column; gap: 12px; }
.subs-row {
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    align-items: stretch;
    padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg);
}
.subs-row-main {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1.4fr auto auto;
    gap: 10px; align-items: end;
}
.subs-row-main .field { margin: 0; }
.subs-status { display: flex; flex-direction: column; gap: 4px; }
.subs-row-remove { display: flex; align-items: end; }
.subs-add { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.subs-add h3 { margin-bottom: 10px; }
.field-row-5 { grid-template-columns: 1.1fr 1fr 1fr 1.4fr auto; }
.subscription-list { margin: 8px 0 0; padding-left: 18px; }
.subscription-list li { margin-bottom: 4px; font-size: 0.92em; }
@media (max-width: 960px) {
    .subs-row { grid-template-columns: 1fr; }
    .subs-row-main { grid-template-columns: 1fr 1fr; }
    .field-row-5 { grid-template-columns: 1fr 1fr; }
}
.video-source { display: grid; gap: 8px; margin-top: 8px; }
.video-source .field { margin: 0; }
.video-source input[type="url"],
.video-source input[type="file"],
.video-source textarea { margin-bottom: 4px; }
.video-source code { background: rgba(0,0,0,0.05); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; }
.video-source [data-video-field] { display: none; }
.video-source [data-video-field].is-visible { display: block; }
.post-content { line-height: 1.7; font-size: 1.02rem; }
.post-content h2, .post-content h3 { margin-top: 28px; }
.post-content p { margin: 0 0 1em; }
.post-content a { text-decoration: underline; }
.post-content img { border-radius: var(--radius-sm); margin: 16px 0; }
.post-content blockquote {
    border-left: 3px solid var(--pink);
    padding: 6px 18px; margin: 16px 0; color: var(--text-muted); font-style: italic;
}

.post-docs { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.doc-list.small { gap: 6px; font-size: 0.88em; }
.doc-list a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg); border-radius: var(--radius-sm);
    color: var(--text); border: 1px solid var(--border);
}
.doc-list a:hover { border-color: var(--pink); background: var(--pink-50); }
.doc-icon { font-size: 1.2rem; }
.doc-name { flex: 1; font-weight: 600; }
.doc-list small { color: var(--text-muted); }

/* ---------- Comments ---------- */
.post-comments { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.comment-form textarea { min-height: 90px; }
.comment-form button { align-self: flex-end; }
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 14px; padding: 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.comment-avatar img, .comment-avatar .avatar-fallback { width: 40px; height: 40px; }
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.comment-body p { margin: 0 0 8px; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: left; padding: 10px 12px; font-size: 0.78em;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

/* ---------- Flash / Pagination / Empty ---------- */
.flash-stack { position: fixed; top: 80px; right: 28px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.flash {
    background: var(--white); border-left: 4px solid var(--blue);
    padding: 14px 18px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
    font-size: 0.9em; animation: slideIn 0.3s ease;
}
.flash-success { border-left-color: var(--success); }
.flash-error { border-left-color: var(--danger); }
.flash-warning { border-left-color: #f59e0b; }
.flash-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); padding: 0; line-height: 1; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; }
.pagination .page {
    padding: 8px 14px; border-radius: var(--radius-sm);
    background: var(--white); border: 1px solid var(--border);
    color: var(--text); font-weight: 600;
}
.pagination .page.is-active { background: var(--pink); color: var(--white); border-color: var(--pink); }

.empty-state {
    padding: 60px 20px; text-align: center; color: var(--text-muted);
    background: var(--white); border-radius: var(--radius); border: 1px dashed var(--border);
}

.featured-preview, .avatar-preview { border-radius: var(--radius-sm); max-width: 200px; margin-top: 10px; }
.code-editor { font-family: ui-monospace, 'Cascadia Code', Menlo, monospace; font-size: 0.88em; }
.code-block { background: var(--bg); padding: 14px; border-radius: var(--radius-sm); font-size: 0.85em; white-space: pre-wrap; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 15, 30, 0.6); backdrop-filter: blur(4px); }
.modal-dialog {
    position: relative; background: var(--white); border-radius: var(--radius-lg);
    width: 100%; max-width: 460px; box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 0; }
.modal-head h3 { margin: 0; color: var(--danger); }
.modal-close { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 18px 26px; }
.modal-text { color: var(--text-muted); margin: 0 0 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 26px 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.modal-error { color: var(--danger); margin: 8px 0 0; font-size: 0.85em; }
.confirm-box {
    background: var(--danger-50); border-radius: var(--radius-sm);
    padding: 16px; text-align: center; margin-bottom: 16px;
}
.confirm-label { display: block; font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--danger); margin-bottom: 6px; }
.confirm-code { font-size: 2.4rem; font-weight: 800; color: var(--danger); letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero-text h1 { font-size: 2.2rem; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .form-2col { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
        transform: translateX(-100%); transition: transform 0.25s ease;
        width: 280px; box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { transform: translateX(0); }
    .hamburger { display: flex; }
    .content { padding: 20px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .stat-row { grid-template-columns: 1fr 1fr; }
    .user-name { display: none; }
    .feature-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .data-table { font-size: 0.85em; }
    .data-table thead { display: none; }
    .data-table tbody td { display: block; border-bottom: none; padding: 4px 0; }
    .data-table tbody tr { display: block; padding: 14px 0; border-bottom: 1px solid var(--border); }
    .row-actions { justify-content: flex-start; margin-top: 8px; }
    .flash-stack { right: 12px; left: 12px; max-width: none; }
}

/* =========================================================
   WYSIWYG editor
   ========================================================= */
.wysiwyg {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wysiwyg:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 159, 227, 0.12);
}
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    background: #fafbfd;
    border-bottom: 1px solid var(--border);
}
.wysiwyg-btn {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 34px;
    font-size: 14px;
    font-family: inherit;
    color: #2b3447;
    cursor: pointer;
    line-height: 1;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.wysiwyg-btn:hover {
    background: #eef2f9;
    border-color: #e0e6f2;
}
.wysiwyg-btn:active,
.wysiwyg-btn.is-active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.wysiwyg-sep {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.wysiwyg-content {
    min-height: 280px;
    max-height: 640px;
    overflow-y: auto;
    padding: 16px 18px;
    font-size: 15px;
    line-height: 1.6;
    color: #1d2330;
    outline: none;
}
.wysiwyg-content:focus { outline: none; }
.wysiwyg-content p { margin: 0 0 12px; }
.wysiwyg-content h2 { margin: 20px 0 10px; font-size: 1.4em; font-weight: 700; color: var(--pink); }
.wysiwyg-content h3 { margin: 16px 0 8px;  font-size: 1.2em; font-weight: 600; }
.wysiwyg-content ul, .wysiwyg-content ol { margin: 0 0 12px; padding-left: 24px; }
.wysiwyg-content li { margin-bottom: 4px; }
.wysiwyg-content blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--pink);
    background: #fdf3f8;
    color: #4a5267;
    font-style: italic;
}
.wysiwyg-content a { color: var(--blue); text-decoration: underline; }
.wysiwyg-source {
    display: block;
    width: 100%;
    min-height: 280px;
    padding: 14px 16px;
    border: 0;
    outline: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #0f172a;
    color: #e2e8f0;
    resize: vertical;
}

/* =========================================================
   AJAX pagination states
   ========================================================= */
[data-ajax-container] {
    position: relative;
    transition: opacity 0.15s;
}
[data-ajax-container].is-loading {
    opacity: 0.5;
    pointer-events: none;
}
[data-ajax-container].is-loading::after {
    content: "";
    position: absolute;
    top: 40px;
    left: 50%;
    width: 36px;
    height: 36px;
    margin-left: -18px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--pink);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin: 24px 0 8px;
}
.pagination a, .pagination span {
    display: inline-block;
    min-width: 38px;
    padding: 8px 12px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    text-decoration: none;
    color: #2b3447;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.1s;
}
.pagination a:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.pagination .is-current {
    background: var(--pink);
    border-color: var(--pink);
    color: #fff;
}
.pagination .is-disabled {
    opacity: 0.4;
    pointer-events: none;
}
