/* Админка SOTA AI. Те же токены, что на сайте, но плотнее: это рабочий
   инструмент, а не витрина. Один файл, без сборки. */

:root {
  --text: #17181c;
  --text-2: #5e626b;
  --text-3: #8b8f97;
  --bg: #ffffff;
  --bg-soft: #f5f5f3;
  --tile: #efefed;
  --line: #e7e7e4;
  --brand: #2346e0;
  --ok: #1e9e6a;
  --bad: #d9483b;
  --warn: #b7791f;
  --radius: 12px;
}

* { box-sizing: border-box }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--text);
  font: 15px/1.5 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand) }
a:not(:hover) { text-decoration: none }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px }
h2 { font-size: 17px; letter-spacing: -.01em; margin: 0 0 12px }
code { font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--tile); padding: 1px 5px; border-radius: 5px }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px }

/* Шапка */
.top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10 }
.bar { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; gap: 22px }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); letter-spacing: .01em }
.brand b { font-weight: 700 }
.brand span { color: var(--text-3); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; margin-left: 4px }
.nav { display: flex; gap: 4px; flex-wrap: wrap }
.nav a { padding: 7px 11px; border-radius: 8px; color: var(--text-2); font-size: 14.5px }
.nav a:hover { background: var(--tile); color: var(--text) }
.nav a[aria-current] { background: var(--text); color: #fff }
.me { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2) }

/* Сетка страницы */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 64px }
.wrap.wide { max-width: 1180px }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap }
.page-head > :last-child:not(:first-child) { margin-left: auto }
.row-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px }
.muted { color: var(--text-2) }
.small { font-size: 13px }
.strong { font-weight: 600; color: var(--text) }
.nowrap { white-space: nowrap }
.grow { flex: 1 }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px }
.tile b { display: block; font-size: 30px; letter-spacing: -.02em; line-height: 1.1 }
.tile span { display: block; margin-top: 6px; font-size: 13px; color: var(--text-2) }

/* Сообщения */
.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-size: 14.5px }
.flash.ok { background: #e8f6ef; color: #14684a }
.flash.bad { background: #fdecea; color: #93251a }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px }
.form.row { flex-direction: row; align-items: flex-end; flex-wrap: wrap }
.form.row .field { flex: 1; min-width: 200px }
.field { display: flex; flex-direction: column; gap: 6px }
.label { font-size: 13px; font-weight: 500; color: var(--text-2) }
.label i { font-style: normal; color: var(--text-3); font-weight: 400 }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], textarea, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%;
}
textarea { resize: vertical; line-height: 1.55 }
#body { font: 14.5px/1.65 ui-monospace, Menlo, Consolas, monospace }
input:focus, textarea:focus, select:focus { border-color: var(--text-3); outline: none }
.hint { font-size: 12.5px; color: var(--text-3) }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14.5px; line-height: 1.4 }
.check input { margin-top: 2px }
.check .hint { display: block }
.checks { display: flex; flex-direction: column; gap: 8px }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 10px;
  background: var(--text); color: #fff; border: 1px solid var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none }
.btn:hover { opacity: .9 }
.btn[disabled] { opacity: .45; cursor: default }
.btn-line { background: transparent; color: var(--text); border-color: var(--line) }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline }
.danger-link { color: var(--bad) }
.inline { display: inline }
.danger { margin-top: 24px }

/* Таблицы */
.table { width: 100%; border-collapse: collapse; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line) }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top }
.table tr:last-child td { border-bottom: 0 }

.status { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap }
.status-live { background: #e8f6ef; color: #14684a }
.status-draft { background: var(--tile); color: var(--text-2) }
.status-planned { background: #fdf3e2; color: #8a5a10 }

.chip { display: inline-block; font-size: 12.5px; padding: 3px 9px; margin-right: 4px; border-radius: 8px; background: var(--tile); color: var(--text) }
.chip-todo { background: #fdf3e2; color: #8a5a10 }
.chip-empty { border: 1px dashed var(--line); background: transparent; color: var(--text-3); cursor: pointer; font: inherit; font-size: 12.5px; padding: 3px 9px; border-radius: 8px }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 }
.chips li { background: var(--tile); border-radius: 8px; padding: 5px 10px; font-size: 13px }

ul.plain { margin: 0; padding-left: 18px }
ul.plain li { margin: 4px 0 }

/* Редактор */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start }
.editor-main { margin: 0 }
.editor-side { display: flex; flex-direction: column }
.editor-side .card { margin-bottom: 16px }
.editor-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0;
  background: var(--bg-soft); padding: 12px 0; border-top: 1px solid var(--line) }
.help { margin-top: 12px; font-size: 13.5px; color: var(--text-2) }
.help summary { cursor: pointer; color: var(--brand) }
.cover-preview { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-top: 4px }
.counter { font-size: 12.5px; color: var(--text-3) }
.counter.over { color: var(--bad) }

.snippet { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft) }
.snippet-url { font-size: 12.5px; color: #3c7a3c }
.snippet-title { color: #1a0dab; font-size: 17px; line-height: 1.3; margin-top: 2px }
.snippet-text { font-size: 13px; color: var(--text-2); margin-top: 3px }

/* Таблица SEO: правим все строки сразу */
.table-seo td { vertical-align: top }
.table-seo td:first-child { width: 26% }
.table-seo textarea { font-size: 13.5px; line-height: 1.45 }
.table-seo textarea::placeholder { color: var(--text-3) }
.table-seo .counter { display: block; margin-top: 2px }
.row-changed td:first-child { box-shadow: inset 3px 0 0 var(--brand) }
.chip-on { background: var(--text); color: #fff }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.editor-main h2 { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line) }
.visual-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 14px }

/* Тексты страниц */
.texts { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start }
.texts-menu { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; position: sticky; top: 74px; max-height: 80vh; overflow: auto }
.texts-menu a { padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 14px; display: flex; justify-content: space-between; gap: 8px }
.texts-menu a:hover { background: var(--tile); color: var(--text) }
.texts-menu a[aria-current] { background: var(--text); color: #fff }
.texts-menu a[aria-current] .muted { color: #c8ccd4 }
.text-row { padding: 12px 0; border-top: 1px solid var(--line) }
.text-row:first-of-type { border-top: 0 }
.text-todo .text-now { color: var(--warn) }
.text-key { display: flex; gap: 8px; align-items: center; margin-bottom: 4px }
.text-key code { font-size: 11.5px; color: var(--text-3); background: none; padding: 0 }
.text-now { font-size: 14.5px; line-height: 1.5; margin-bottom: 6px; white-space: pre-wrap }
.text-edit textarea { font-size: 14.5px }

/* Медиа */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px }
.media-card { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden }
.media-card img { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--tile) }
.media-card figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px }
.copy { cursor: pointer; word-break: break-all }

/* Журнал сборки */
.log { background: #14161a; color: #e6e8ec; padding: 14px; border-radius: 10px; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap; max-height: 420px; overflow: auto }

/* Вход */
.login { max-width: 380px; margin: 60px auto }
.login h1 { margin-bottom: 6px }

@media (max-width: 900px) {
  .editor, .texts { grid-template-columns: minmax(0, 1fr) }
  .grid-2 { grid-template-columns: 1fr }
  .texts-menu { position: static; max-height: 260px }
  .cols { grid-template-columns: 1fr }
  .bar { height: auto; padding: 10px 16px; flex-wrap: wrap }
  .me { width: 100%; margin-left: 0 }
}
