:root {
    --ink: #17211c;
    --ink-soft: #3c463f;
    --muted: #6b7267;
    --line: #d9d5c9;
    --line-soft: #e7e3d8;
    --bg: #f3f1ea;
    --paper: #ffffff;
    --green: #14532d;
    --green-dark: #0f3f23;
    --green-soft: #e7efe8;
    --gold: #b98a1f;
    --gold-soft: #f6edd6;
    --red: #a5302a;
    --red-soft: #f8e9e7;
    --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --serif: 'Source Serif 4', Georgia, serif;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

h1, h2, h3, h4, p {
    margin: 0;
}

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    background: #14532d;
    color: var(--ink);
}

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 22px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.login-brand img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.login-brand span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #e7ddc4;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fffdf8;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 3px;
    padding: 30px 30px 24px;
    box-shadow: 0 24px 60px rgba(6, 28, 18, .35);
}

.login-card__kicker {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
}

.login-card h1 {
    font-family: var(--serif);
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--green-dark);
}

.login-card__lead {
    margin: 6px 0 20px;
    font-size: 13px;
    color: var(--muted);
}

.login-card .field {
    margin-bottom: 14px;
}

.login-captcha {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.login-captcha__image {
    flex: 0 0 170px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-captcha__image img {
    display: block;
    width: 170px;
    height: 55px;
    border: 1px solid #c9c4b5;
    border-radius: 3px;
    background: #f7f4ed;
}

.login-captcha__image button {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--green);
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: underline;
    cursor: pointer;
}

.login-captcha__image button:hover {
    color: var(--green-dark);
}

.login-captcha .field {
    flex: 1 1 140px;
    min-width: 0;
    margin-bottom: 0;
}

.login-captcha .field input {
    min-width: 0;
}

.login-alert {
    margin-bottom: 16px;
    padding: 10px 12px;
    font-size: 12.5px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
}

.login-error {
    margin-top: 12px;
    padding: 9px 11px;
    font-size: 12.5px;
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid #e9c9c5;
    border-left: 3px solid var(--red);
}

.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 18px;
    font-size: 12.5px;
    color: var(--ink-soft);
    cursor: pointer;
}

.checkline input {
    width: 15px;
    height: 15px;
    accent-color: var(--green);
}

.login-card__foot {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    font-size: 12.5px;
}

.login-card__foot a {
    color: var(--green);
    font-weight: 600;
}

.login-card__foot a:hover {
    text-decoration: underline;
}

.login-copy {
    font-size: 11px;
    letter-spacing: .08em;
    color: rgba(231, 221, 196, .55);
    text-transform: uppercase;
}

/* ---------- Shell ---------- */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-side {
    width: 236px;
    flex: none;
    background: #10382a;
    color: #d6d2c4;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 90;
    overflow-y: auto;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.admin-brand img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex: none;
}

.admin-brand strong {
    display: block;
    font-family: var(--serif);
    font-size: 15.5px;
    font-weight: 600;
    color: #fffdf8;
    line-height: 1.2;
}

.admin-brand small {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #9fae9f;
    margin-top: 3px;
}

.admin-nav {
    padding: 10px 10px 22px;
}

.admin-nav__label {
    margin: 14px 8px 4px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #7f9385;
}

.admin-nav a,
.admin-nav__logout button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: #d3d0c2;
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.admin-nav a svg,
.admin-nav__logout svg {
    flex: none;
    color: #93a596;
}

.admin-nav a:hover,
.admin-nav__logout button:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.admin-nav a.is-active {
    background: rgba(255, 255, 255, .09);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold);
}

.admin-nav a.is-active svg {
    color: var(--gold);
}

.admin-nav__count {
    margin-left: auto;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--gold);
    color: #1f1a0c;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-nav__logout {
    margin-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 6px;
}

.admin-nav__logout button {
    color: #e6c9c4;
}

.admin-main {
    flex: 1;
    margin-left: 236px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-top {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    padding: 0 22px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.admin-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 3px;
    color: var(--ink);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.admin-top__title span {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-top__title strong {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.admin-top__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    margin: -5px -6px;
    border-radius: 3px;
    color: inherit;
}

a.admin-user:hover {
    background: #f0ede4;
    color: var(--ink);
}

.admin-user__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: none;
}

.admin-user__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.admin-user__name {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
}

.admin-user__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-user__role {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-content {
    width: 100%;
    max-width: 1180px;
    padding: 24px 22px 60px;
}

/* ---------- Alerts ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    border-radius: 2px;
    background: var(--paper);
    font-size: 13px;
}

.alert svg {
    flex: none;
    margin-top: 2px;
}

.alert--success {
    border-left-color: #2f7d4b;
    background: #f0f6ef;
    color: #1d4a2c;
}

.alert--error {
    border-left-color: var(--red);
    background: var(--red-soft);
    color: #7d2320;
}

/* ---------- Page head ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.page-head__kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 4px;
}

.page-head h1 {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--green-dark);
    line-height: 1.2;
}

.page-head p {
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--muted);
    max-width: 560px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex: none;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--green);
    border-radius: 3px;
    background: var(--green);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.btn svg {
    flex: none;
}

.btn--sm {
    height: 29px;
    padding: 0 10px;
    font-size: 11.5px;
}

.btn--block {
    width: 100%;
    height: 38px;
}

.btn--ghost {
    background: var(--paper);
    color: var(--ink-soft);
    border-color: #c8c3b4;
}

.btn--ghost:hover {
    background: #f6f4ee;
    border-color: #b4ae9d;
    color: var(--ink);
}

.btn--gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #221a06;
}

.btn--gold:hover {
    background: #a87c19;
    border-color: #a87c19;
}

.btn--danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn--danger:hover {
    background: #8a2722;
    border-color: #8a2722;
}

.btn--link {
    background: transparent;
    border-color: transparent;
    color: var(--green);
    padding: 0 6px;
    height: auto;
}

.btn--link:hover {
    background: transparent;
    text-decoration: underline;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

button.link-danger {
    border: 0;
    background: none;
    padding: 0;
    color: var(--red);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

button.link-danger:hover {
    text-decoration: underline;
}

/* ---------- Panels ---------- */

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 3px;
    margin-bottom: 18px;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
}

.panel__head h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.panel__head a {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--green);
}

.panel__body {
    padding: 16px;
}

.panel__body--flush {
    padding: 0;
}

.panel--muted {
    background: #faf8f2;
}

/* ---------- Tables ---------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.8px;
}

table.data th {
    padding: 9px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    background: #fbfaf6;
    white-space: nowrap;
}

table.data td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

table.data tbody tr:hover {
    background: #fbfaf6;
}

table.data td.num {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.data td.actions {
    text-align: right;
    white-space: nowrap;
}

.cell-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.cell-title img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 2px;
    flex: none;
}

.cell-title__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--green-soft);
    color: var(--green-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.cell-title img.cell-title__avatar {
    border-radius: 50%;
}

.cell-title strong {
    display: block;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}

.cell-title small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge--green {
    background: var(--green-soft);
    color: #1d5a33;
}

.badge--gray {
    background: #eeebe2;
    color: #5d5c53;
}

.badge--gold {
    background: var(--gold-soft);
    color: #7a5a10;
}

.badge--red {
    background: var(--red-soft);
    color: #8a2722;
}

.badge--dark {
    background: #22302a;
    color: #e9e5d7;
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

.form-grid--tight {
    gap: 12px 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field > label,
.group-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea,
.input {
    width: 100%;
    min-height: 35px;
    padding: 7px 10px;
    border: 1px solid #c9c4b5;
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13px;
    line-height: 1.4;
}

.field textarea {
    resize: vertical;
    min-height: 120px;
}

.field textarea.code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
    outline: 0;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(20, 83, 45, .12);
}

.field__error {
    font-size: 11.5px;
    color: var(--red);
}

.role-locked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 35px;
}

.role-locked .help {
    flex-basis: 100%;
}

.help {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.5;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}

.checkline input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--green);
    flex: none;
}

.checkrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    padding: 10px 0 2px;
}

.checkrow .checkline {
    font-weight: 500;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--line-soft);
    flex-wrap: wrap;
}

.form-actions .spacer {
    flex: 1;
}

/* ---------- Media field ---------- */

.media-field {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px;
    border: 1px dashed #c9c4b5;
    border-radius: 3px;
    background: #fbfaf6;
}

.media-field__preview {
    width: 132px;
    height: 96px;
    flex: none;
    border: 1px solid var(--line);
    background: #f0ede4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--muted);
}

.media-field__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-field__preview--square {
    width: 96px;
    height: 120px;
}

.media-field__preview--logo {
    width: 96px;
    height: 96px;
}

.media-field__preview--logo img {
    object-fit: contain;
    padding: 6px;
}

.media-field__preview--avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .02em;
}

.media-field__initials {
    line-height: 1;
}

.media-field__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-field input[type="file"] {
    font-size: 12px;
    max-width: 100%;
}

.media-field input[type="file"]::file-selector-button {
    height: 30px;
    padding: 0 10px;
    margin-right: 10px;
    border: 1px solid #c9c4b5;
    border-radius: 3px;
    background: #fff;
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.thumb {
    width: 60px;
    height: 46px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #f0ede4;
}

.thumb--square {
    width: 52px;
    height: 64px;
}

/* ---------- Profil ---------- */

.profile-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.profile-main {
    min-width: 0;
}

.profile-card {
    padding: 22px 20px 20px;
    text-align: center;
}

.profile-card__avatar {
    width: 112px;
    height: 112px;
    margin: 0 auto 14px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--green);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--line);
}

.profile-card__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-card__kicker {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold);
}

.profile-card h2 {
    margin: 4px 0 8px;
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--green-dark);
}

.profile-card__facts {
    margin: 18px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--line-soft);
    display: grid;
    gap: 10px;
    text-align: left;
}

.profile-card__facts dt {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.profile-card__facts dd {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--ink-soft);
    word-break: break-word;
}

.profile-card__note {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--muted);
    text-align: left;
}

/* ---------- Editor toolbar ---------- */

.editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 5px;
    border: 1px solid #c9c4b5;
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
    background: #f6f4ee;
}

.editor-tools button {
    min-width: 30px;
    height: 27px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
}

.editor-tools button:hover {
    background: #fff;
    border-color: var(--line);
}

.editor-tools button i {
    font-style: italic;
    font-family: var(--serif);
}

.editor-wrap textarea {
    border-radius: 0 0 3px 3px !important;
    min-height: 320px;
}

/* ---------- Rich text editor ---------- */

.rich-editor {
    border: 1px solid #c9c4b5;
    border-radius: 3px;
    background: var(--paper);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.rich-editor:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(20, 83, 45, .08);
}

.rich-editor__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
    background: #f6f4ee;
    border-radius: 2px 2px 0 0;
}

.rich-editor__group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding-right: 7px;
    margin-right: 5px;
    border-right: 1px solid var(--line);
}

.rich-editor__group--first {
    gap: 4px;
}

.rich-editor__select {
    height: 28px;
    border: 1px solid #c9c4b5;
    border-radius: 2px;
    background: #fff;
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    padding: 0 4px;
    cursor: pointer;
}

.rich-editor__select--font {
    width: 126px;
}

.rich-editor__select--size {
    width: 70px;
}

.rich-editor__select:focus {
    outline: 0;
    border-color: var(--green);
}

.rich-editor__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.rich-editor__btn:hover {
    background: #fff;
    border-color: var(--line);
}

.rich-editor__btn[aria-pressed="true"] {
    background: var(--green-soft);
    border-color: rgba(20, 83, 45, .28);
    color: var(--green);
}

.rich-editor__btn--icon {
    padding: 0;
}

.rich-editor__btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rich-editor__table-wrap {
    position: relative;
    display: inline-flex;
}

.rich-editor__link-wrap {
    position: relative;
    display: inline-flex;
}

.rich-editor__pop--link {
    width: 236px;
}

.rich-editor__pop-field {
    display: block;
    margin-bottom: 9px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.rich-editor__pop-field input {
    width: 100%;
    height: 30px;
    margin-top: 4px;
    padding: 0 7px;
    border: 1px solid #c9c4b5;
    border-radius: 2px;
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 400;
}

.rich-editor__pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    width: 216px;
    padding: 12px;
    border: 1px solid #c9c4b5;
    border-radius: 3px;
    background: var(--paper);
    box-shadow: 0 12px 26px rgba(23, 33, 28, .16);
}

.rich-editor__pop[hidden] {
    display: none;
}

.rich-editor__pop-title {
    margin: 0 0 9px !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.rich-editor__pop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 9px;
}

.rich-editor__pop-grid label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.rich-editor__pop-grid input {
    width: 100%;
    height: 30px;
    margin-top: 4px;
    padding: 0 7px;
    border: 1px solid #c9c4b5;
    border-radius: 2px;
    font-family: var(--sans);
    font-size: 12.5px;
}

.rich-editor__pop .checkline {
    margin: 0 0 9px;
    font-size: 12px;
}

.rich-editor__pop .btn {
    width: 100%;
    justify-content: center;
}

.rich-editor__status {
    margin-left: auto;
    padding-left: 8px;
    font-size: 11.5px;
    color: var(--muted);
}

.rich-editor__canvas {
    min-height: 420px;
    padding: 16px 20px 22px;
    outline: 0;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.75;
    color: var(--ink);
    overflow-wrap: break-word;
}

.rich-editor__canvas:empty::before {
    content: attr(data-placeholder);
    color: #8b9087;
    pointer-events: none;
}

.rich-editor__canvas > * + * {
    margin-top: .9em;
}

.rich-editor__canvas h2 {
    font-size: 22px;
    line-height: 1.35;
    color: var(--green);
    margin-top: 1.3em;
}

.rich-editor__canvas h3 {
    font-size: 18px;
    line-height: 1.4;
    color: var(--green);
}

.rich-editor__canvas ul,
.rich-editor__canvas ol {
    padding-left: 1.4em;
    margin: .8em 0;
}

.rich-editor__canvas li {
    margin-bottom: .35em;
}

.rich-editor__canvas blockquote {
    margin: 1.2em 0;
    padding: 2px 0 2px 14px;
    border-left: 3px solid var(--gold);
    color: var(--ink-soft);
}

.rich-editor__canvas a {
    color: var(--red);
    text-decoration: underline;
}

.rich-editor__canvas img {
    display: inline-block;
    max-width: 100%;
    height: auto;
    margin: 6px 0;
    border: 1px solid var(--line);
    vertical-align: middle;
}

.rich-editor__canvas table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
    font-size: 13.5px;
}

.rich-editor__canvas th,
.rich-editor__canvas td {
    min-width: 42px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.rich-editor__canvas th {
    background: var(--ivory, #f7f4ea);
    font-weight: 600;
}

.rich-editor__source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Tabs / filters ---------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tabs {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
    background: var(--paper);
}

.tabs a {
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    border-right: 1px solid var(--line);
}

.tabs a:last-child {
    border-right: 0;
}

.tabs a:hover {
    background: #f6f4ee;
}

.tabs a.is-active {
    background: var(--green);
    color: #fff;
}

.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form .input {
    height: 32px;
    min-height: 32px;
    width: auto;
    min-width: 190px;
}

.filter-form select.input {
    min-width: 130px;
}

/* ---------- Stat tiles ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 13px 14px 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat strong {
    font-family: var(--serif);
    font-size: 25px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--green-dark);
}

.stat small {
    font-size: 11px;
    color: var(--muted);
}

.stat--accent {
    background: var(--green);
    border-color: var(--green);
}

.stat--accent span,
.stat--accent small {
    color: #cfe0d2;
}

.stat--accent strong {
    color: #fffdf8;
}

.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mini-list li {
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.mini-list li:last-child {
    border-bottom: 0;
}

.mini-list a {
    font-weight: 600;
    color: var(--ink);
}

.mini-list a:hover {
    color: var(--green);
}

.mini-list span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

/* ---------- Empty ---------- */

.empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.empty strong {
    display: block;
    font-family: var(--serif);
    font-size: 18px;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 16px 0 0;
    list-style: none;
    padding: 0;
    font-size: 12px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--paper);
    color: var(--ink-soft);
    font-weight: 600;
}

.pagination a:hover {
    border-color: var(--green);
    color: var(--green);
}

.pagination .is-current {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.pagination .is-disabled {
    color: #a9a697;
    background: #f6f4ee;
}

/* ---------- Modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal__veil {
    position: absolute;
    inset: 0;
    background: rgba(12, 25, 18, .55);
}

.modal__box {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--paper);
    border-radius: 3px;
    padding: 22px 22px 18px;
    box-shadow: 0 24px 60px rgba(10, 20, 14, .28);
}

.modal__box h2 {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 6px;
}

.modal__box p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---------- Gallery admin ---------- */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.photo-card {
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #fbfaf6;
    padding: 7px;
}

.photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line-soft);
}

.photo-card input[type="text"] {
    width: 100%;
    margin-top: 6px;
    min-height: 29px;
    padding: 4px 7px;
    border: 1px solid #c9c4b5;
    border-radius: 2px;
    font-size: 11.5px;
}

.photo-card__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 10.5px;
    color: var(--muted);
}

.muted {
    font-size: 11.5px;
    color: var(--muted);
}

.msg-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px 18px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.msg-meta span {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
}

.msg-meta strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.msg-body {
    max-width: 68ch;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-soft);
}

.settings-section {
    margin-bottom: 18px;
}

.settings-section > h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 9px;
}

/* ---------- Backup database ---------- */

.backup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.backup-copy {
    margin-bottom: 14px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--muted);
}

.backup-meta {
    border-top: 1px solid var(--line-soft);
}

.backup-meta > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
}

.backup-meta dt {
    flex: none;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.backup-meta dd {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    text-align: right;
    word-break: break-word;
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.backup-help {
    margin-top: 10px;
}

.backup-warning {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #e6ddc8;
    border-left: 3px solid var(--gold);
    border-radius: 2px;
    background: #fbf7ea;
    color: #6a5521;
    font-size: 12px;
    line-height: 1.55;
}

.backup-warning svg {
    flex: none;
    margin-top: 1px;
}

.backup-confirm {
    align-items: flex-start;
    margin: 12px 0 0;
    line-height: 1.5;
}

.backup-confirm input {
    margin-top: 2px;
}

.backup-latest {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid #c9dece;
    border-left: 3px solid #2f7d4b;
    border-radius: 2px;
    background: #f0f6ef;
}

.backup-latest strong {
    display: block;
    font-size: 12.5px;
    color: #1d4a2c;
}

.backup-latest span {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: #486a55;
    word-break: break-all;
}

.panel__head > span {
    font-size: 11.5px;
    color: var(--muted);
}

.backup-file-icon {
    width: 34px;
    height: 34px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #f3f1ea;
    color: var(--green);
}

.cell-title > div {
    min-width: 0;
}

.backup-filename {
    word-break: break-all;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .admin-side {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .2);
        width: 250px;
    }

    body.side-open .admin-side {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-menu-btn {
        display: inline-flex;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .admin-content {
        padding: 16px 14px 50px;
    }

    .admin-top {
        padding: 0 14px;
    }

    .admin-user__meta {
        display: none;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .backup-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .backup-latest {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-card {
        text-align: left;
    }

    .profile-card__avatar {
        margin-left: 0;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-actions .spacer {
        display: none;
    }
}