:root { --ink: #1b1b1f; --muted: #6b6b75; --line: #e6e4df; --paper: #f7f6f2; --card: #fff; --gold: #e7b96a; --gold-d: #b98a2e; --ok: #1f7a4d; --bad: #b3261e; --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--paper); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.top { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; }
.top__in { display: flex; align-items: center; gap: 14px; min-height: 58px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand span { color: var(--gold); }
.brand small { font-weight: 400; color: #bbb; margin-left: 4px; }
.top__site { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top__site b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.top__site a { color: var(--gold); text-decoration: none; white-space: nowrap; }
.top__act { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { font-size: .85rem; color: #cfcfd6; }
.btn { font: 600 .95rem/1 var(--font); padding: 0 16px; min-height: 42px; border-radius: 999px; border: 0; cursor: pointer; background: #fff; color: var(--ink); }
.btn--go { background: var(--gold); color: var(--ink); }
.btn--go:disabled { opacity: .45; cursor: default; }
.btn--ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn--line { background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); }

.login { max-width: 420px; margin: 48px auto; background: var(--card); padding: 28px; border-radius: 18px; box-shadow: 0 20px 50px -30px rgba(0,0,0,.35); }
.login h1 { margin: 0 0 8px; font-size: 1.6rem; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; }
.login input { font: inherit; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.err { color: var(--bad); min-height: 1.4em; margin: 0 0 10px; font-size: .92rem; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 22px 0 120px; }
.editor > *, .field__head > * { min-width: 0; }
@media (min-width: 900px) { .editor { grid-template-columns: 240px minmax(0, 1fr); align-items: start; } .toc { position: sticky; top: 72px; } }
.toc { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 899px) {
  .toc { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: none; position: sticky; top: 58px; z-index: 10; background: var(--paper); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { white-space: nowrap; background: #fff; flex: none; }
  .toc .toc__page { display: none; }
}
.toc a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: .95rem; }
.toc a:hover, .toc a.is-on { background: #fff; }
.toc .toc__page { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 4px; }

.group { background: var(--card); border-radius: 18px; padding: 18px 18px 8px; margin-bottom: 18px; scroll-margin-top: 80px; }
.group h2 { margin: 0 0 12px; font-size: 1.15rem; }
.field { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.field > * { min-width: 0; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.field__label { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.field__tag { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field.is-changed { background: #fffaf0; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.field.is-changed .field__label::before { content: "● "; color: var(--gold-d); }
.field input, .field textarea, .field .rich { font: inherit; width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.field textarea { min-height: 90px; resize: vertical; }
.field .rich { min-height: 60px; outline: none; }
.field .rich:focus, .field input:focus, .field textarea:focus { border-color: var(--gold-d); }
.rich em, .rich i { font-style: italic; } .rich strong, .rich b { font-weight: 700; }
.rich span + span::before { content: " "; } /* headings split into lines read as words, not glued */
.richbar { display: flex; gap: 6px; }
.richbar button { font: 600 .8rem/1 var(--font); min-width: 34px; min-height: 30px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.field__foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reset { font: .8rem var(--font); color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.img { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: center; }
.img img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; background: #eee; }
.img__act { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.img__alt { font-size: .85rem; color: var(--muted); }
.img input[type=file] { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: calc(100vw - 32px); z-index: 30; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
@media (max-width: 719px) {
  .top__act { width: 100%; justify-content: flex-end; }
  .top__site b { max-width: 60vw; }
  .img { grid-template-columns: 96px 1fr; }
  .img img { width: 96px; height: 72px; }
}
