:root {
    --bg: #10131a;
    --bg-elevated: #171b24;
    --surface: #1e2430;
    --border: #313846;
    --text: #f4f1ea;
    --muted: #a7b0c0;
    --accent: #f97316;
    --accent-dark: #c2410c;
    --on-accent: #1a1008;
    --ok: #3dd68c;
    --danger: #f07178;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    --side: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip {
    position: absolute; left: 0.5rem; top: -3rem; background: var(--accent); color: var(--on-accent);
    padding: 0.4rem 0.7rem; z-index: 20;
}
.skip:focus { top: 0.5rem; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.45rem; }
.lead, .hint { color: var(--muted); }
.hint { font-size: 0.92rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: 999px; padding: 0.55rem 0.95rem; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-small { padding: 0.28rem 0.55rem; font-size: 0.85rem; }
.row-actions { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.alert { border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0 0 1rem; }
.alert-success { background: rgba(61, 214, 140, 0.12); color: var(--ok); }
.alert-error { background: rgba(240, 113, 120, 0.12); color: var(--danger); }
.badge {
    display: inline-block; border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.78rem;
    background: var(--surface); border: 1px solid var(--border);
}
.badge-published, .badge-admin { color: var(--ok); }
.badge-draft, .badge-editor { color: var(--muted); }
.count {
    display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 0.3rem;
    border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 0.75rem; font-weight: 700;
}

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 8% -10%, rgba(249, 115, 22, 0.2), transparent 55%),
        var(--bg);
}
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card, .panel {
    width: min(480px, 100%);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.auth-card-wide { width: min(680px, 100%); }
.dash-card { width: min(880px, 100%); }
.dash-nav { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 1.1rem; }
.dash-nav a {
    color: var(--text); text-decoration: none; border: 1px solid var(--border); border-radius: 999px;
    padding: 0.35rem 0.75rem; font-size: 0.92rem;
}
.dash-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.dash-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.dash-choice {
    display: grid; gap: 0.35rem; text-decoration: none; color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; background: var(--bg);
}
.dash-choice span { color: var(--muted); }
.panel { width: auto; margin: 0 0 1.2rem; }
.auth-brand, .brand { display: flex; gap: 0.75rem; align-items: center; }
.auth-brand { margin-bottom: 1rem; }
.brand { color: var(--text); text-decoration: none; padding: 0.2rem 0.35rem 1rem; }
.brand-mark, .brand-logo {
    min-width: 42px; height: 42px; display: grid; place-items: center; padding: 0 0.45rem;
    background: var(--accent); color: var(--on-accent); font-weight: 800; border-radius: 12px;
}
.brand-logo { width: 48px; height: 48px; object-fit: contain; background: transparent; padding: 0; border-radius: 0; }
.brand-name { font-weight: 700; }
.stack { display: grid; gap: 0.8rem; }
.narrow { max-width: 520px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; }
input, select, textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.7rem;
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 0.45rem; }
.check input { width: auto; }
.checks { list-style: none; padding: 0; margin: 0 0 1rem; }
.checks li { padding: 0.25rem 0 0.25rem 1.2rem; position: relative; }
.checks li::before { position: absolute; left: 0; }
.checks .ok::before { content: "✓"; color: var(--ok); }
.checks .bad::before { content: "!"; color: var(--danger); }

.app { min-height: 100vh; }
.side {
    position: fixed; inset: 0 auto 0 0; width: var(--side); background: #0c0f15;
    border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; padding: 0.8rem;
}
.side-nav, .side-foot { display: grid; gap: 0.2rem; }
.side-nav { margin-top: 0.4rem; }
.side-foot { margin-top: auto; padding-top: 1rem; }
.side-link {
    color: var(--text); text-decoration: none; border-radius: 10px; padding: 0.45rem 0.6rem;
}
.side-link:hover, .side-link.is-active { background: var(--surface); }
.main-col { margin-left: var(--side); min-height: 100vh; }
.admin-top {
    display: flex; align-items: center; gap: 0.8rem; min-height: 60px; padding: 0.6rem 1.2rem;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(16, 19, 26, 0.92);
}
.admin-top-title { margin: 0; font-weight: 700; }
.admin-main { padding: 1.3rem 1.4rem 3rem; max-width: 1100px; }
.nav-toggle { display: none; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.table tr.is-unpaid td { background: rgba(240, 113, 120, 0.08); }
.inline-form { display: inline-block; margin: 0 0.35rem 0.35rem 0; }
.is-unread a { font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.stat {
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem;
}
.stat span { color: var(--muted); display: block; font-size: 0.85rem; }
.stat strong { font-size: 1.6rem; }
.update-banner, .message-body {
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.message-body { white-space: pre-wrap; }

.rte { display: grid; gap: 0.45rem; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.rte-color { display: flex; align-items: center; gap: 0.35rem; }
.rte-color input { width: 2.4rem; padding: 0; border: 0; background: transparent; }
.rte-area {
    min-height: 220px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem;
}
.rte-area:focus { outline: 2px solid var(--accent); }
.picker { margin-top: 0.4rem; }
.picker-grid, .media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.7rem; }
.picker-btn, .media-card {
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.4rem; color: inherit;
}
.picker-btn img, .media-card img { height: 90px; width: 100%; object-fit: cover; border-radius: 8px; }
.logo-preview { width: 88px; height: 88px; object-fit: contain; border-radius: 0; background: transparent; }
.block-row, .menu-row {
    display: grid; gap: 0.6rem; padding: 0.8rem; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 0.6rem;
}
.upload-bar { grid-template-columns: 1.4fr 1fr auto; align-items: end; }
@media (max-width: 800px) {
    .upload-bar { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    .side { transform: translateX(-105%); transition: transform 0.2s ease; }
    body.nav-open .side { transform: none; }
    .main-col { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
