:root {
    --ink: #152d32;
    --muted: #637578;
    --line: #dce5e2;
    --paper: #f3f6f2;
    --white: #fff;
    --teal: #176d68;
    --sun: #efbd37;
    --coral: #d8684f;
    --serif: "Newsreader", Georgia, serif;
    --sans: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.admin-header { height: 72px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); font-size: 12px; font-weight: 700; text-decoration: none; }
.brand img { width: 122px; height: auto; }
.brand span { padding-left: 18px; border-left: 1px solid var(--line); }
.nav-lock { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--teal); }
.nav-lock svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.public-link { color: var(--teal); font-size: 13px; font-weight: 700; text-decoration: none; }
.admin-main { width: min(1240px, 100% - 48px); margin: 0 auto; padding: 38px 0 64px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: var(--serif); font-weight: 500; }
h1 { font-size: 42px; line-height: 1.05; }
h1 span { color: var(--coral); }
h2 { font-size: 25px; line-height: 1.1; }
.login-panel { width: min(440px, 100%); margin: 32px auto 0; padding: 34px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--sun); }
.login-panel h1 { font-size: 38px; }
.save-modal { width: min(420px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); background: var(--white); color: var(--ink); box-shadow: 0 18px 60px rgba(21,45,50,.24); }
.save-modal::backdrop { background: rgba(21,45,50,.52); backdrop-filter: blur(2px); }
.save-modal-content { display: flex; flex-direction: column; align-items: center; padding: 32px 28px; text-align: center; }
.save-modal-indicator { width: 36px; height: 36px; margin-bottom: 16px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: save-modal-spin .8s linear infinite; }
.save-modal.is-success .save-modal-indicator { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--teal); animation: none; }
.save-modal.is-success .save-modal-indicator::after { display: block; width: 9px; height: 16px; margin: 5px 0 0 11px; border: solid white; border-width: 0 3px 3px 0; content: ""; transform: rotate(45deg); }
.save-modal.is-error .save-modal-indicator { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #a13a2b; animation: none; }
.save-modal.is-error .save-modal-indicator::after { display: block; color: white; content: "!"; font-size: 22px; font-weight: 700; line-height: 32px; }
.save-modal h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 26px; font-weight: 500; }
.save-modal p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.save-modal .secondary-button { margin-top: 20px; }
@keyframes save-modal-spin { to { transform: rotate(360deg); } }
.login-intro, .user-summary { color: var(--muted); line-height: 1.6; }
.login-intro { margin: 12px 0 25px; }
label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 700; }
input:not([type="checkbox"]), textarea, select { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #cbd8d4; border-radius: 0; background: white; color: var(--ink); outline: none; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(23,109,104,.13); }
.rich-text-editor { border: 1px solid #cbd8d4; }
.rich-text-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px; border-bottom: 1px solid #cbd8d4; background: #f8faf8; }
.rich-text-toolbar button { min-width: 34px; min-height: 32px; padding: 0 9px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 12px; }
.rich-text-toolbar button:hover, .rich-text-toolbar button:focus { border-color: var(--teal); color: var(--teal); }
.rich-text-content { min-height: 260px; max-height: 520px; overflow-y: auto; padding: 12px; outline: none; background: white; line-height: 1.6; overflow-wrap: anywhere; }
.rich-text-content:focus { box-shadow: inset 0 0 0 2px rgba(23,109,104,.13); }
.rich-text-content h2 { margin: 12px 0; font-size: 22px; }
.rich-text-content p { margin: 0 0 12px; }
.rich-text-content ul, .rich-text-content ol { padding-left: 24px; }
.primary-button, .secondary-button, .danger-button, .text-button, .icon-button { min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 0; font-size: 12px; font-weight: 700; }
.primary-button { background: var(--teal); color: white; }
.primary-button:hover { background: #105a55; }
.secondary-button { border-color: #cbd8d4; background: var(--white); color: var(--ink); }
.secondary-button:hover { border-color: var(--teal); color: var(--teal); }
.danger-button { border-color: #e5b7ae; background: white; color: #a13a2b; }
.danger-button:hover { background: #fff4f0; }
.text-button { min-height: 34px; margin-top: 8px; padding: 0; background: transparent; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.login-panel form .primary-button { width: 100%; margin-top: 20px; }
.status-message { min-height: 18px; margin: 8px 0; color: var(--teal); font-size: 12px; line-height: 1.5; }
.status-message[data-error="true"] { color: #a13a2b; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.user-summary { margin: 8px 0 0; font-size: 12px; }
.session-actions { display: flex; gap: 8px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 14px; border-bottom: 1px solid var(--line); }
.admin-tab { min-height: 42px; padding: 0 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.admin-tab:hover, .admin-tab.is-active { border-bottom-color: var(--teal); color: var(--teal); }
.editor-layout { display: grid; grid-template-columns: minmax(310px, .88fr) minmax(0, 1.12fr); align-items: start; gap: 18px; }
.editor-layout.is-list-view { grid-template-columns: 1fr; }
.editor-panel, .articles-panel { padding: 22px; background: var(--white); border: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.icon-button { width: 40px; padding: 0; border-color: var(--line); background: white; color: var(--teal); font-size: 22px; }
.icon-button:hover { border-color: var(--teal); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 16px 0; cursor: pointer; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--teal); }
.checkbox-row span { font-weight: 500; }
.editor-actions { display: flex; gap: 8px; margin-top: 18px; }
.admin-article-list { display: grid; gap: 8px; }
.admin-article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 12px; border: 1px solid var(--line); }
.admin-article h3 { margin: 0 0 5px; font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.2; }
.admin-article p { margin: 0; color: var(--muted); font-size: 11px; }
.admin-article-actions { display: flex; gap: 6px; }
.admin-article-actions button { min-height: 32px; padding: 0 9px; }
.list-empty { padding: 22px; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.admin-pagination button { min-height: 34px; padding: 0 12px; }
.admin-pagination button:disabled { cursor: not-allowed; opacity: .5; }
.admin-pagination span { color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 820px) {
    .editor-layout { grid-template-columns: 1fr; }
    .articles-panel { order: -1; }
}

@media (max-width: 560px) {
    .admin-header { height: 62px; padding: 0 18px; }
    .brand { gap: 10px; }
    .brand img { width: 100px; }
    .brand span { padding-left: 10px; font-size: 10px; }
    .admin-main { width: calc(100% - 32px); padding: 25px 0 44px; }
    .login-panel { margin-top: 18px; padding: 25px 20px; }
    .save-modal-content { padding: 28px 20px; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; }
    .session-actions { width: 100%; }
    .session-actions button { flex: 1; }
    .admin-tabs { gap: 0; }
    .admin-tab { flex: 1 1 auto; padding: 0 8px; font-size: 11px; }
    .editor-panel, .articles-panel { padding: 16px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .admin-article { grid-template-columns: 1fr; }
    .admin-article-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .save-modal-indicator { animation-duration: 1.8s; }
}