:root {
    --editor-bg: #f4f0e8;
    --editor-panel: #fffdf8;
    --editor-ink: #17262b;
    --editor-muted: #607078;
    --editor-teal: #0f766e;
    --editor-teal-dark: #0a5752;
    --editor-gold: #d8a72d;
    --editor-line: rgba(23, 38, 43, 0.13);
    --editor-red: #a53a31;
    --editor-shadow: 0 18px 48px rgba(31, 45, 48, 0.11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.editor-page {
    margin: 0;
    min-width: 300px;
    overflow-x: hidden;
    color: var(--editor-ink);
    background:
        radial-gradient(circle at 5% 0%, rgba(15, 118, 110, 0.10), transparent 24rem),
        linear-gradient(180deg, #faf7f0, var(--editor-bg));
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.editor-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 9px max(14px, calc((100vw - 1180px) / 2));
    color: #fff;
    background: rgba(8, 75, 70, 0.97);
    border-bottom: 3px solid var(--editor-gold);
}

.editor-topbar a { color: #fff; text-decoration: none; font-weight: 700; }
.editor-topbar__title { min-width: 0; margin: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-topbar__state { color: #f7d97b; font-size: 0.85rem; }

.editor-shell { width: min(1180px, 100%); margin: 0 auto; padding: 22px 18px 110px; }
.editor-page.is-access-check .editor-tabs,
.editor-page.is-access-check .editor-columns,
.editor-page.is-access-check .editor-savebar,
.editor-page.is-access-denied .editor-tabs,
.editor-page.is-access-denied .editor-columns,
.editor-page.is-access-denied .editor-savebar { display: none; }
.editor-access-link { color: var(--editor-teal-dark); font-weight: 800; }

.editor-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--editor-line);
    border-radius: 20px;
    background: rgba(255, 253, 248, 0.86);
    box-shadow: var(--editor-shadow);
    min-width: 0;
}
.editor-intro h1 { margin: 0 0 7px; font-size: clamp(1.55rem, 3vw, 2.25rem); overflow-wrap: anywhere; }
.editor-intro p { max-width: 760px; margin: 0; color: var(--editor-muted); line-height: 1.6; }
.editor-anon { flex: 0 0 250px; padding: 12px 14px; border-radius: 12px; color: #634700; background: #fff3c8; font-size: 0.9rem; line-height: 1.45; }
.editor-page.is-access-denied .editor-anon { color: #7b2c27; background: #fae9e7; }
.editor-anon a { color: var(--editor-teal-dark); font-weight: 800; }

.editor-tabs { display: none; margin-bottom: 12px; padding: 4px; border-radius: 13px; background: #e1e9e7; }
.editor-tab { flex: 1; min-height: 42px; border: 0; border-radius: 10px; color: var(--editor-muted); background: transparent; font: inherit; font-weight: 700; }
.editor-tab.is-active { color: #fff; background: var(--editor-teal); }

.editor-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor-language { min-width: 0; }
.editor-language__heading { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 9px; }
.editor-language__heading h2 { margin: 0; font-size: 1.15rem; }
.editor-language__heading span { color: var(--editor-muted); font-size: 0.82rem; }

.editor-card { margin-bottom: 13px; padding: 17px; border: 1px solid var(--editor-line); border-radius: 16px; background: var(--editor-panel); box-shadow: 0 5px 18px rgba(31, 45, 48, 0.07); }
.editor-card h3 { margin: 0 0 13px; color: var(--editor-teal-dark); font-size: 0.98rem; text-transform: capitalize; }
.editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.editor-field { min-width: 0; }
.editor-field--wide { grid-column: 1 / -1; }
.editor-field label { display: block; margin-bottom: 6px; color: var(--editor-muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.035em; text-transform: uppercase; }
.editor-field input,
.editor-field textarea {
    display: block;
    width: 100%;
    min-width: 0;
    border: 1px solid #cbd7d5;
    border-radius: 11px;
    padding: 10px 11px;
    color: var(--editor-ink);
    background: #fff;
    font: inherit;
    line-height: 1.45;
    resize: vertical;
}
.editor-field textarea { min-height: 48px; }
.editor-field input:focus,
.editor-field textarea:focus { outline: 0; border-color: var(--editor-teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12); }
.editor-field input.is-changed,
.editor-field textarea.is-changed { border-color: var(--editor-gold); background: #fffaf0; box-shadow: inset 4px 0 0 var(--editor-gold); }
.editor-empty { padding: 28px; border: 1px dashed #b9c8c5; border-radius: 16px; color: var(--editor-muted); text-align: center; }

.editor-savebar {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 25;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 24px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px 11px 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    color: #fff;
    background: rgba(23, 38, 43, 0.96);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
}
.editor-savebar__count { font-weight: 800; }
.editor-savebar__hint { display: block; margin-top: 2px; color: #bcd0cd; font-size: 0.78rem; font-weight: 400; }
.editor-actions { display: flex; gap: 8px; }
.editor-btn { min-height: 42px; border: 0; border-radius: 11px; padding: 9px 15px; font: inherit; font-weight: 800; cursor: pointer; }
.editor-btn--primary { color: #fff; background: var(--editor-teal); }
.editor-btn--secondary { color: #dbe8e6; background: rgba(255, 255, 255, 0.11); }
.editor-btn:disabled { opacity: 0.45; cursor: default; }

.editor-review {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 24, 27, 0.62);
}
.editor-review.is-open { display: flex; }
.editor-review__panel { width: min(760px, 100%); max-height: min(82vh, 760px); overflow: auto; border-radius: 22px; background: var(--editor-panel); box-shadow: var(--editor-shadow); }
.editor-review__head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; background: var(--editor-panel); border-bottom: 1px solid var(--editor-line); }
.editor-review__head h2 { margin: 0; font-size: 1.2rem; }
.editor-review__close { border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; }
.editor-review__body { padding: 18px 20px 22px; }
.editor-diff { margin-bottom: 12px; padding: 12px; border-radius: 12px; background: #f2f6f5; }
.editor-diff__path { margin-bottom: 7px; color: var(--editor-teal-dark); font-size: 0.78rem; font-weight: 800; }
.editor-diff del,
.editor-diff ins { display: block; padding: 7px 9px; border-radius: 7px; text-decoration: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-diff del { margin-bottom: 5px; color: #7b2c27; background: #fae9e7; }
.editor-diff ins { color: #185d3a; background: #e5f5ea; }
.editor-note { width: 100%; min-height: 90px; margin: 8px 0 12px; padding: 11px; border: 1px solid #cbd7d5; border-radius: 11px; font: inherit; }
.editor-message { display: none; margin-bottom: 12px; padding: 11px 13px; border-radius: 10px; }
.editor-message.is-error { display: block; color: #7b2c27; background: #fae9e7; }
.editor-message.is-success { display: block; color: #185d3a; background: #e5f5ea; }

.review-shell { width: min(1060px, 100%); margin: 0 auto; padding: 22px 18px 80px; }
.review-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.review-tools select { min-height: 42px; padding: 8px 11px; border: 1px solid var(--editor-line); border-radius: 10px; background: #fff; font: inherit; }
.review-list { display: grid; gap: 14px; }
.review-card { padding: 18px; border: 1px solid var(--editor-line); border-radius: 17px; background: var(--editor-panel); box-shadow: 0 7px 24px rgba(31, 45, 48, 0.08); }
.review-card__head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.review-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.review-card__meta { color: var(--editor-muted); font-size: 0.84rem; }
.review-status { align-self: flex-start; padding: 5px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.review-status--pending { color: #735300; background: #fff0b8; }
.review-status--approved { color: #185d3a; background: #e5f5ea; }
.review-status--rejected { color: #7b2c27; background: #fae9e7; }
.review-status--conflict { color: #77400b; background: #ffe0bc; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.review-conflict { margin-top: 10px; padding: 10px; border-radius: 10px; color: #77400b; background: #fff0d8; }

@media (max-width: 820px) {
    .editor-intro { display: block; padding: 18px; }
    .editor-anon { margin-top: 14px; }
    .editor-tabs { display: flex; }
    .editor-columns { display: block; }
    .editor-language { display: none; }
    .editor-language.is-active { display: block; }
}

@media (max-width: 560px) {
    .editor-topbar { padding: 8px 12px; }
    .editor-topbar__title { font-size: 0.9rem; }
    .editor-topbar__state { display: none; }
    .editor-shell, .review-shell { padding: 14px 10px 105px; }
    .editor-intro { border-radius: 15px; box-shadow: 0 4px 16px rgba(31, 45, 48, 0.09); }
    .editor-fields { grid-template-columns: 1fr; }
    .editor-field--wide { grid-column: auto; }
    .editor-card { padding: 14px; border-radius: 14px; }
    .editor-savebar { bottom: 8px; padding-left: 13px; }
    .editor-savebar__hint { display: none; }
    .editor-btn { padding: 8px 11px; }
    .editor-review { padding: 0; }
    .editor-review__panel { max-height: 92vh; border-radius: 20px 20px 0 0; }
    .review-card__head { display: block; }
    .review-status { display: inline-block; margin-top: 8px; }
}
