/* Админка всегда светлая — независимо от темы системы: с ней работают
   в дневное время, и светлый фон ближе к тому, как выглядят сами сайты. */
:root {
    color-scheme: light;
    --bg: #f4f5f7;
    --panel: #ffffff;
    --ink: #1f2328;
    --dim: #5d6673;
    --line: #dfe3e8;
    --accent: #174a83;
    --accent-ink: #ffffff;
    --ok-bg: #e6f4ea;
    --ok-ink: #1a6b34;
    --err-bg: #fcecec;
    --err-ink: #9e1c1c;
    --warn: #b45309;
    --ins: #d7f2dd;
    --del: #fbdedd;
    --code-bg: #f7f8fa;
    --radius: 10px;
}

* { box-sizing: border-box; }

/* иначе класс с display перебивает атрибут и скрытый блок остаётся видимым */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--accent); }

/* --------------------------------------------------------------- шапка */
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.topbar__inner {
    max-width: 940px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
    margin-right: auto;
}
.topbar__logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--code-bg);
}
.topbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar__actions .btn {
    padding: 5px 11px;
    font-size: 14px;
    background: transparent;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }

/* ---------------------------------------------------------------- сетка */
.page { max-width: 940px; margin: 0 auto; padding: 28px 24px 60px; }

/* экран входа: одна колонка по центру — логотип, форма и подпись */
.page--signin { max-width: 380px; padding-top: 12vh; }
.signin { text-align: center; }
.signin__logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--code-bg);
}
.signin__title { font-size: 26px; margin: 14px 0 2px; }
.signin__sub { color: var(--dim); margin: 0 0 22px; }
.signin .card { text-align: left; }
.signin .field { margin-bottom: 16px; }
.signin__note { color: var(--dim); font-size: 14px; margin-top: 20px; line-height: 1.5; }
h1 { font-size: 30px; margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 10px; }
.lead { color: var(--dim); margin: 0 0 22px; }
.breadcrumbs { color: var(--dim); font-size: 15px; margin-bottom: 14px; }
.breadcrumbs a { text-decoration: none; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--sites { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* превью сайта: его собственная главная страница, уменьшенная под карточку */
.thumb {
    display: block;
    position: relative;
    height: 190px;
    margin: -6px 0 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.thumb__frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 900px;
    border: 0;
    transform: scale(0.27);
    transform-origin: top left;
    pointer-events: none;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.card--narrow { max-width: 420px; margin: 40px auto; }
.card--link { text-decoration: none; color: inherit; display: block; }
.card--link:hover { border-color: var(--accent); }
.card__meta { margin: 6px 0 0; font-size: 15px; }
.card__meta--dim { color: var(--dim); }

/* -------------------------------------------------------------- таблица */
.table { width: 100%; border-collapse: collapse; background: var(--panel);
         border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); }
.table tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------------- кнопки */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn--ghost { background: transparent; }
.btn--warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn--link { border: none; background: none; color: var(--accent); padding: 0; }
.btn--small { padding: 6px 12px; font-size: 14px; }
.btn--wide { width: 100%; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0 22px; }

/* ---------------------------------------------------------- уведомления */
.notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.notice--ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice--err { background: var(--err-bg); color: var(--err-ink); }

.hint { color: var(--dim); font-size: 15px; margin: 8px 0 0; }
.hint--warn { color: var(--warn); }
.hint--inline { margin: 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }

/* ---------------------------------------------------------------- формы */
.form { display: block; }
.field { display: block; margin-bottom: 18px; }
.field__label { display: block; margin-bottom: 6px; font-size: 15px; color: var(--dim); }
.field__input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
}
.field__input--area { resize: vertical; line-height: 1.5; }
.field__input:focus, .rich:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.editor-head .row-actions { margin: 0; }

.zone {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.zone__title { font-size: 17px; margin-bottom: 12px; }

.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar button {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}
.toolbar button:hover:not(:disabled) { border-color: var(--accent); }
.toolbar button:disabled { opacity: .4; cursor: default; }
.toolbar button.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toolbar__sep { width: 1px; background: var(--line); margin: 2px 4px; }

.rich {
    min-height: 140px;
    max-height: 60vh;
    overflow: auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.rich table { max-width: 100%; }
.rich img, .rich iframe { max-width: 100%; }

/* режим просмотра и правки HTML */
.code {
    display: block;
    width: 100%;
    min-height: 240px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--code-bg);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.55;
    tab-size: 4;
    /* длинные строки переносим: горизонтальная прокрутка в текстовом поле
       мешает читать разметку */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    resize: vertical;
}
.code:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.publish {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

/* --------------------------------------------------------------- правки */
.change { background: var(--panel); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.change__title { font-size: 17px; }
.change__inline { line-height: 1.7; }
.change__inline ins { background: var(--ins); text-decoration: none; padding: 1px 3px; border-radius: 3px; }
.change__inline del { background: var(--del); padding: 1px 3px; border-radius: 3px; }
.change__details { margin-top: 14px; }
.change__details summary { cursor: pointer; color: var(--accent); }
.change__cols { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.change__cols h3 { font-size: 14px; text-transform: uppercase; color: var(--dim); margin: 0 0 6px; }
@media (max-width: 700px) { .change__cols { grid-template-columns: 1fr; } }

.pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 14px;
    margin: 0;
    max-height: 50vh;
    overflow: auto;
}
.pre--diff { white-space: pre; }

.restore { margin-top: 26px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* --------------------------------------------------------- фотографии */
.files { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.file {
    margin: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
}
.file img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center;
    background: var(--code-bg);
    border-radius: 6px;
}
.file figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.file figcaption .mono { word-break: break-all; }
.file__usage { margin: 6px 0 10px; line-height: 1.4; }
.file__replace label { display: inline-block; cursor: pointer; }

.foot { max-width: 940px; margin: 0 auto; padding: 0 24px 40px; color: var(--dim); font-size: 14px; }
