:root {
  color-scheme: dark;
  --bg: #0f0f13;
  --panel: #1a1a2e;
  --panel-soft: #20203a;
  --line: #2e2e45;
  --text: #e2e2e8;
  --muted: #8d8d9c;
  --accent: #6d5dfc;
  --accent-soft: #27235a;
  --danger: #ef4444;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
.topbar { min-height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(15, 15, 19, 0.96); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.nav { display: flex; gap: 6px; align-items: center; flex: 1; overflow-x: auto; }
.nav-link { color: var(--muted); padding: 8px 10px; border-radius: 7px; font-size: 14px; white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--accent-soft); }
.logout { color: var(--muted); font-size: 14px; }
.shell { max-width: 1180px; margin: 0 auto; padding: 28px 22px 56px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
p { margin: 0; color: var(--muted); line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.card, .empty-state, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px; min-height: 110px; }
.card:hover { border-color: var(--accent); background: var(--panel-soft); }
.card-title { font-weight: 650; }
.card-meta { color: var(--muted); font-size: 13px; }
.empty-state { padding: 28px; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.message { border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; background: var(--panel); color: var(--text); }
.message.error { border-color: rgba(239, 68, 68, .45); color: #fecaca; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 26px; }
.login-card h1 { margin-bottom: 8px; }
.login-form { display: grid; gap: 10px; margin-top: 20px; }
.login-form label { color: var(--muted); font-size: 13px; }
.login-form input { width: 100%; border: 1px solid var(--line); background: #0b0b10; color: var(--text); border-radius: 7px; padding: 11px 12px; font-size: 15px; }
.login-form button { border: 0; background: var(--accent); color: white; border-radius: 7px; padding: 11px 14px; font-weight: 650; cursor: pointer; }
@media (max-width: 760px) {
  .topbar { align-items: stretch; flex-direction: column; padding: 14px 16px; gap: 10px; }
  .nav { width: 100%; }
  .shell { padding: 22px 16px 42px; }
}

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input { min-width: min(360px, 100%); border: 1px solid var(--line); background: #0b0b10; color: var(--text); border-radius: 7px; padding: 10px 12px; font-size: 14px; }
.toolbar button, .button { border: 0; background: var(--accent); color: #fff; border-radius: 7px; padding: 10px 13px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; min-height: 38px; }
.button.secondary { background: var(--panel-soft); color: var(--text); border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #151524; }
tr:last-child td { border-bottom: 0; }
.row-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; color: var(--muted); font-size: 12px; }
.empty-cell { color: var(--muted); text-align: center; padding: 28px; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--muted); flex-wrap: wrap; }

.button.compact { min-height: 30px; padding: 6px 9px; font-size: 12px; }
.edit-form { display: grid; gap: 16px; max-width: 920px; }
.form-row { display: grid; gap: 7px; }
.form-row label { color: var(--muted); font-size: 13px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; border: 1px solid var(--line); background: #0b0b10; color: var(--text); border-radius: 7px; padding: 10px 12px; font: inherit; }
.form-row textarea { resize: vertical; line-height: 1.55; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 8px; }
.form-actions button { border: 0; background: var(--accent); color: #fff; border-radius: 7px; padding: 10px 13px; font-weight: 650; cursor: pointer; }
.message.success { border-color: rgba(34, 197, 94, .45); color: #bbf7d0; }

.toolbar select { border: 1px solid var(--line); background: #0b0b10; color: var(--text); border-radius: 7px; padding: 10px 12px; font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.row-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.danger { border: 1px solid rgba(239, 68, 68, .45); background: rgba(127, 29, 29, .45); color: #fecaca; border-radius: 7px; padding: 10px 13px; font-weight: 650; cursor: pointer; }
.danger.compact { min-height: 30px; padding: 6px 9px; font-size: 12px; }

.help { font-size: 13px; margin-bottom: 4px; }
.code-textarea { min-height: 430px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; }
.preview-source { margin-top: 22px; }
.preview-source pre { white-space: pre-wrap; overflow-x: auto; background: #0b0b10; border: 1px solid var(--line); border-radius: 7px; padding: 14px; color: #c4c4d0; font-size: 12px; line-height: 1.55; }

.satellite-row { background: rgba(109, 93, 252, .05); }
.satellite-mark { display: inline-flex; margin-right: 6px; background: #2e1a5e; color: #c4b5fd; border-radius: 4px; padding: 2px 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.form-grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.article-body { min-height: 360px; }
.schema-textarea { min-height: 180px; }
.form-actions.split { justify-content: space-between; }
.secondary-submit { border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); border-radius: 7px; padding: 10px 13px; font-weight: 650; cursor: pointer; }
@media (max-width: 760px) { .form-grid.two { grid-template-columns: 1fr; } }

.sync-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.sync-panel h2 { margin: 0 0 14px; font-size: 17px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.status-grid div { background: #0b0b10; border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.status-grid dt { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.status-grid dd { margin: 0; font-weight: 650; }
.action-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.action-grid form { margin: 0; }
.action-grid button { border: 0; background: var(--accent); color: #fff; border-radius: 7px; padding: 10px 13px; font-weight: 650; cursor: pointer; }
.action-grid button:disabled { opacity: .55; cursor: not-allowed; }
.compact-table { margin-top: 14px; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.step { color: var(--muted); padding: 7px 10px; border-radius: 7px; background: transparent; }
.step.active { color: var(--text); background: var(--accent-soft); }
.step.done { color: #86efac; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.source-list { display: grid; gap: 14px; }
.source-card { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 14px; display: grid; gap: 8px; }
.source-card label { color: var(--muted); font-size: 12px; }
.source-card input, .source-card textarea { width: 100%; border: 1px solid var(--line); background: #0b0b10; color: var(--text); border-radius: 7px; padding: 9px 10px; font: inherit; }

.theme-card { cursor: pointer; }
.theme-card input { width: auto; margin-right: 8px; }
.theme-card p { margin-top: 6px; }


.shell-wide { max-width: none; width: 100%; padding-left: 18px; padding-right: 18px; }
.compact-head { margin-bottom: 14px; }
.dense-toolbar { margin-bottom: 14px; }
.dense-toolbar input { min-width: min(330px, 100%); }
.icon-button { justify-content: center; min-width: 42px; padding: 9px 12px; font-size: 17px; line-height: 1; }
.full-table { width: 100%; }
.products-table { min-width: 1120px; }
.products-table th, .products-table td { padding: 10px 12px; }
.products-table .title-cell { width: 30%; }
.muted-cell, .date-cell { color: var(--muted); font-size: 12px; }
.date-cell.uploaded { color: #22c55e; }
.state-icon { display: inline-flex; width: 22px; justify-content: center; font-size: 18px; line-height: 1; font-weight: 800; }
.state-icon.ok { color: #22c55e; }
.state-icon.bad { color: #ef4444; }
.pill.status-active { color: #86efac; border-color: rgba(34, 197, 94, .35); background: rgba(22, 101, 52, .18); }
.pill.status-draft { color: #fbbf24; border-color: rgba(245, 158, 11, .35); background: rgba(120, 53, 15, .18); }
.pill.status-archived { color: #c4c4d0; }
.button.warning { background: #9a4b16; color: #fff; }
.icon-actions { gap: 6px; flex-wrap: nowrap; }
.icon-actions form { display: inline-flex; }
.icon-action { min-width: 31px; min-height: 28px; justify-content: center; padding: 5px 8px; line-height: 1; }
button.icon-action { border: 0; font: inherit; font-weight: 650; cursor: pointer; }
@media (max-width: 760px) {
  .shell-wide { padding-left: 12px; padding-right: 12px; }
  .icon-actions { flex-wrap: wrap; }
}
.collections-table { min-width: 1040px; }
.collections-table th, .collections-table td { padding: 10px 12px; }
.collections-table .title-cell { width: 38%; }
.toolbar-count { color: var(--muted); font-size: 13px; }
.toolbar-tail { margin-left: auto; }
.articles-table { min-width: 1180px; }
.articles-table th, .articles-table td { padding: 10px 12px; }
.articles-table .title-cell { width: 43%; }
.article-title-wrap { display: flex; align-items: flex-start; gap: 7px; }
.article-title-line { display: flex; align-items: center; gap: 6px; }
.satellite-indent { color: var(--muted); flex: 0 0 auto; margin-top: 1px; }
.gas-action { color: #c4b5fd; border-color: #4c3a7a; }
.rewrite-action { min-width: 31px; }
@media (max-width: 760px) { .toolbar-tail { margin-left: 0; } }
.redirects-table { min-width: 1180px; }
.redirects-table th, .redirects-table td { padding: 9px 12px; }
.redirects-table .path-cell { width: 36%; overflow-wrap: anywhere; }
.redirects-table .icon-actions { justify-content: flex-start; }
