:root {
  --brand: #4f46e5;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 440px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; justify-content: center;
}
button:hover, .btn:hover { border-color: #cbd5e1; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--brand); color: #fff; border-color: transparent; }
.primary:hover { filter: brightness(1.08); }
.danger { color: var(--bad); }
.ghost { background: transparent; border-color: transparent; }
.big { padding: 14px 22px; font-size: 1.1rem; border-radius: 14px; }
.block { width: 100%; }

label { display: block; font-size: .9rem; }
.lbl { display: block; font-weight: 600; margin-bottom: 4px; }
input, textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink);
}
input[type=color] { padding: 2px; height: 38px; }
input[type=range] { padding: 0; }
input[type=checkbox] { width: auto; }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 12px; }

.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: #e2e8f0; color: #334155; }
.badge.draft { background: #e2e8f0; }
.badge.submitted { background: #fef3c7; color: #92400e; }
.badge.published, .badge.live { background: #d1fae5; color: #065f46; }
.badge.bad { background: #fee2e2; color: #991b1b; }

.notice { padding: 10px 12px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-size: .92rem; }
.notice.warn { background: #fef3c7; color: #92400e; }
.notice.bad { background: #fee2e2; color: #991b1b; }
.err { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 1000; font-size: .95rem; max-width: 90vw; }

.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 900; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); padding: 20px; width: min(480px, 100%); max-height: 90vh; overflow: auto; }

.topbar { background: var(--brand); color: #fff; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.topbar a, .topbar button { color: #fff; }
.topbar button { background: rgba(255,255,255,.15); border-color: transparent; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; opacity: .85; font-weight: 600; }
.tabs a.on { background: rgba(255,255,255,.2); opacity: 1; }

.thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #e2e8f0; display: block; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; letter-spacing: .15em; font-weight: 800; }
table { border-collapse: collapse; width: 100%; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: .92rem; }
