:root {
    color-scheme: light;
    --navy: #0b3158;
    --navy-dark: #061f38;
    --blue: #1d77c4;
    --cyan: #55c8eb;
    --green: #218456;
    --yellow: #d89b00;
    --red: #c83c3c;
    --ink: #10263a;
    --muted: #60788d;
    --line: #dce8f0;
    --surface: #ffffff;
    --background: #edf5fa;
    --shadow: 0 14px 36px rgba(3, 39, 72, .12);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button { padding: 10px 16px; color: white; background: var(--blue); border: 0; border-radius: 9px; font-weight: 800; cursor: pointer; }
button:hover { filter: brightness(.93); }
button.secondary { color: var(--navy); background: #e3eff7; }
.button-link { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; color: white; background: var(--blue); border-radius: 9px; font-size: .82rem; font-weight: 800; }
.button-link:hover { text-decoration: none; filter: brightness(.93); }
.button-link.secondary { color: var(--navy); background: #e3eff7; }
.eyebrow { color: var(--blue); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.alert { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; font-weight: 700; }
.alert.success { color: #075529; background: #dcf5e7; border: 1px solid #8bd2a9; }
.alert.error { color: #811e1e; background: #ffe3e3; border: 1px solid #e6a2a2; }

.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: linear-gradient(145deg, rgba(6,31,56,.86), rgba(29,119,196,.65)), url("../images/background1.jpg") center / cover; }
.auth-card { width: min(460px, 100%); padding: 34px; background: rgba(255,255,255,.95); border: 1px solid rgba(255,255,255,.65); border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-card h1 { margin: 5px 0 12px; font-size: 1.8rem; }
.auth-card p { color: var(--muted); }
.auth-card form { display: grid; gap: 15px; margin-top: 22px; }
.auth-card label, .password-form label { display: grid; gap: 6px; font-size: .83rem; font-weight: 800; }
.auth-card input, .password-form input { width: 100%; padding: 11px 12px; border: 1px solid #b9cfdd; border-radius: 9px; }
.back-link { display: block; margin-bottom: 22px; font-size: .8rem; font-weight: 800; }

.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px max(24px, calc((100% - 1500px) / 2)); color: white; background: linear-gradient(135deg, var(--navy-dark), var(--navy)); box-shadow: 0 4px 18px rgba(3,39,72,.22); }
.admin-header h1 { margin: 2px 0 0; font-size: clamp(1.35rem, 2.5vw, 2rem); }
.admin-header .eyebrow { color: var(--cyan); }
.admin-header nav { display: flex; align-items: center; gap: 12px; }
.admin-header nav a { color: white; font-size: .84rem; font-weight: 800; }
.admin-header nav form { margin: 0; }
.admin-main { width: min(1500px, calc(100% - 32px)); margin: 24px auto 60px; }
.admin-tabs { position: sticky; top: 8px; z-index: 20; display: flex; gap: 7px; margin-bottom: 18px; padding: 7px; overflow-x: auto; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.admin-tabs button { flex: 0 0 auto; padding: 10px 15px; color: var(--muted); background: transparent; border: 1px solid transparent; white-space: nowrap; }
.admin-tabs button:hover { color: var(--navy); background: #edf5fa; filter: none; }
.admin-tabs button.is-active { color: white; background: var(--navy); box-shadow: 0 5px 13px rgba(6,31,56,.2); }
.admin-tabs-ready .admin-tab-panel:not(.is-active) { display: none; }
.admin-tab-panel[hidden] { display: none; }
.admin-tab-panel > .panel:first-child { margin-top: 0; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; background: var(--surface); border-left: 5px solid var(--muted); border-radius: 13px; box-shadow: var(--shadow); }
.summary span { color: var(--muted); font-size: .79rem; font-weight: 800; text-transform: uppercase; }
.summary strong { font-size: 2rem; }
.summary.current { border-color: var(--green); }
.summary.delayed { border-color: var(--yellow); }
.summary.problem { border-color: var(--red); }
.summary.disabled { border-color: #8293a0; }

.panel { margin-top: 18px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 17px; }
.panel-heading h2 { margin: 0; font-size: 1.22rem; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.table-wrap { overflow-x: auto; }
.status-table { width: 100%; border-collapse: collapse; }
.status-table th { padding: 10px 12px; color: var(--muted); background: #f2f7fa; text-align: left; font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
.status-table td { padding: 13px 12px; border-top: 1px solid var(--line); font-size: .82rem; vertical-align: top; }
.status-table strong, .status-table small { display: block; }
.status-table small { margin-top: 2px; color: var(--muted); font-size: .7rem; max-width: 320px; }
.state { display: inline-block; padding: 4px 9px; color: white; background: #8293a0; border-radius: 999px; font-size: .7rem; font-weight: 900; }
.state-current { background: var(--green); }
.state-delayed { color: #4e3700; background: #f4c94b; }
.state-stale, .state-invalid, .state-error { background: var(--red); }
.state-disabled { background: #8293a0; }
.last-check { margin: 12px 0 0; color: var(--muted); text-align: right; font-size: .72rem; }

.profile-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.profile-grid label { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 8px; padding: 14px; background: #f4f9fc; border: 1px solid var(--line); border-radius: 11px; }
.profile-grid label > span { grid-column: 1 / -1; font-size: .75rem; font-weight: 900; }
.profile-grid input { width: 100%; padding: 8px; border: 1px solid #b9cfdd; border-radius: 7px; }
.profile-grid small { color: var(--muted); font-size: .68rem; }
.metric-profile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric-profile-grid label { display: grid; gap: 5px; padding: 11px; background: #f4f9fc; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.metric-profile-grid select { width: 100%; padding: 8px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 7px; }
.source-settings-heading { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.source-settings { display: grid; gap: 14px; }
fieldset { min-width: 0; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
fieldset legend { padding: 0 7px; font-weight: 900; }
fieldset legend code { margin-left: 6px; color: var(--muted); font-size: .72rem; font-weight: 600; }
fieldset > p { margin: 0 0 12px; color: var(--muted); font-size: .75rem; }
.toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: .78rem; font-weight: 900; }
.toggle input { width: 18px; height: 18px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.settings-grid label { display: grid; grid-template-columns: 1fr auto; gap: 5px 7px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.settings-grid label > input, .settings-grid label > select { grid-column: 1 / -1; width: 100%; padding: 9px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 8px; }
.settings-grid small { font-size: .65rem; }
details { margin-top: 13px; padding: 10px 12px; background: #f4f9fc; border-radius: 9px; }
details summary { color: var(--blue); font-size: .74rem; font-weight: 900; cursor: pointer; }
details ol { margin: 10px 0; padding-left: 24px; }
details li { margin: 4px 0; word-break: break-all; font-size: .7rem; }
details p { color: var(--muted); font-size: .7rem; }
code { color: #28516f; }
.source-candidate-details { padding: 12px; }
.source-candidate-editor { display: grid; gap: 10px; margin-top: 12px; }
.source-candidate-editor > p, .source-candidate-editor > small { margin: 0; color: var(--muted); font-size: .7rem; }
.source-candidate-list { display: grid; gap: 8px; }
.source-candidate-row { display: grid; grid-template-columns: 76px minmax(220px, 1fr) 38px 38px 82px; gap: 7px; align-items: center; padding: 8px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.candidate-priority { color: var(--navy); font-size: .7rem; font-weight: 900; white-space: nowrap; }
.source-candidate-row input { width: 100%; min-width: 0; padding: 8px 9px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 7px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; }
.source-candidate-row button { min-width: 0; height: 36px; padding: 0 8px; border-radius: 7px; }
.source-candidate-row button:disabled { cursor: not-allowed; opacity: .35; }
.source-candidate-row .candidate-remove { color: #8b2020; background: #f8dddd; font-size: .66rem; }
.candidate-add { justify-self: start; margin-top: 2px; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.form-actions span { color: var(--muted); font-size: .72rem; }
.password-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: end; gap: 12px; }
.dashboard-block-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dashboard-block-card { display: grid; align-content: start; gap: 10px; }
.dashboard-block-card > label:not(.toggle) { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.dashboard-block-card input[type="text"], .dashboard-block-card input[type="number"] { width: 100%; padding: 9px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 8px; }
.dashboard-block-card > p { margin: 0; color: var(--muted); font-size: .7rem; }
.live-item-editor { display: grid; gap: 8px; }
.live-item-head, .live-item-row { display: grid; grid-template-columns: 86px minmax(180px, 1.1fr) minmax(160px, 1fr) 110px 95px; gap: 9px; align-items: end; }
.live-item-head { padding: 0 10px; color: var(--muted); font-size: .66rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.live-item-row { padding: 10px; background: #f4f9fc; border: 1px solid var(--line); border-radius: 10px; }
.live-item-row > label:not(.compact-check) { display: grid; gap: 4px; color: var(--muted); font-size: .66rem; font-weight: 800; }
.live-item-row select, .live-item-row input[type="text"], .live-item-row input[type="number"] { width: 100%; min-width: 0; padding: 8px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 7px; }
.compact-check { display: flex; align-items: center; gap: 6px; min-height: 38px; font-size: .7rem; font-weight: 800; }
.compact-check input { width: 17px; height: 17px; }
.delete-check { color: var(--red); }
.live-item-row.is-deleted { opacity: .48; background: #f7e8e8; }
.selection-count { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 5px; padding: 8px 11px; color: var(--navy); background: #e3eff7; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.selection-count strong { font-size: 1rem; }
.warning-area-current { display: grid; gap: 3px; margin-bottom: 16px; padding: 14px 16px; color: var(--navy); background: #edf7fd; border-left: 5px solid var(--blue); border-radius: 10px; }
.warning-area-current span { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.warning-area-current strong { font-size: .9rem; }
.warning-area-groups { display: grid; gap: 16px; }
.warning-area-group { padding: 16px; }
.warning-area-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.warning-area-option { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; min-width: 0; padding: 11px; background: #f4f9fc; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.warning-area-option:hover { border-color: #91b9d5; }
.warning-area-option:has(input:checked) { background: #e3f2fc; border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.warning-area-option input { width: 19px; height: 19px; margin: 0; accent-color: var(--blue); }
.warning-area-option span, .warning-area-option strong, .warning-area-option small { display: block; min-width: 0; }
.warning-area-option strong { font-size: .78rem; line-height: 1.25; }
.warning-area-option small { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.warning-area-note { margin: 14px 0 0; color: var(--muted); font-size: .72rem; }

.content-settings-panel { overflow: hidden; }
.content-editor-box { padding: 20px; background: #f7fbfd; }
.content-option-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 13px; }
.content-option-row .toggle { margin: 0; }
.content-field-grid { display: grid; gap: 12px; margin-bottom: 15px; }
.content-field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content-field-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.content-field-grid label, .content-image-editor label { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.content-field-grid input, .content-field-grid select, .content-image-editor input { width: 100%; min-width: 0; padding: 9px; color: var(--ink); background: white; border: 1px solid #b9cfdd; border-radius: 8px; }
.rich-editor-label { display: grid; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px; background: #e8f1f7; border: 1px solid #bfd2df; border-bottom: 0; border-radius: 9px 9px 0 0; }
.rich-toolbar button { min-width: 34px; padding: 6px 9px; color: var(--navy); background: white; border: 1px solid #bfd2df; border-radius: 6px; font-size: .68rem; }
.rich-toolbar button:hover { background: #dff0fb; filter: none; }
.rich-editor { display: block; min-height: 145px; padding: 14px; overflow: auto; color: var(--ink); background: white; border: 1px solid #bfd2df; border-radius: 0 0 9px 9px; font-size: .86rem; font-weight: 400; line-height: 1.6; outline: none; }
.rich-editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,119,196,.13); }
.rich-editor > :first-child { margin-top: 0; }
.rich-editor > :last-child { margin-bottom: 0; }
.content-card-editor-list { display: grid; gap: 12px; }
.content-card-editor { margin: 0; padding: 0; overflow: hidden; background: #f7fbfd; border: 1px solid var(--line); border-radius: 12px; }
.content-card-editor > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 16px; color: var(--ink); background: white; cursor: pointer; list-style-position: inside; }
.content-card-editor > summary span { display: inline-grid; gap: 1px; margin-right: auto; }
.content-card-editor > summary strong { font-size: .86rem; }
.content-card-editor > summary small { color: var(--muted); font-size: .65rem; }
.publication-state { padding: 4px 8px; color: #6d4c00; background: #f7e4a2; border-radius: 999px; font-size: .62rem; white-space: nowrap; }
.publication-state.is-visible { color: #075529; background: #ccf0dc; }
.content-card-editor-body { padding: 17px; border-top: 1px solid var(--line); }
.content-card-editor.is-deleted { opacity: .5; background: #f7e8e8; }
.content-image-editor { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr); gap: 12px; margin-top: 15px; padding: 14px; background: #edf5fa; border-radius: 10px; }
.content-image-editor img { grid-column: 1 / -1; width: min(360px, 100%); max-height: 210px; object-fit: cover; border-radius: 9px; box-shadow: 0 8px 18px rgba(3,39,72,.12); }
.content-image-editor small { color: var(--muted); font-size: .62rem; }
.content-live-preview { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.content-preview-welcome.is-hidden { display: none; }
.content-preview-welcome { margin-bottom: 12px; }
.content-preview-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.content-preview-grid.is-empty { display: block; padding: 17px; color: var(--muted); background: #f4f9fc; border: 1px dashed #b9cfdd; border-radius: 10px; text-align: center; }
.content-preview-grid.is-empty p { margin: 0; }
.content-preview-card { grid-column: span 12; min-width: 0; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 8px 20px rgba(3,39,72,.08); }
.content-preview-card.width-half { grid-column: span 6; }
.content-preview-card.width-third { grid-column: span 4; }
.content-preview-card > small { color: var(--blue); font-size: .61rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.content-preview-card h3 { margin: 3px 0 7px; font-size: 1rem; }
.content-preview-card div { color: var(--muted); font-size: .75rem; }
.content-preview-card.preview-eyebrow-small > small { font-size: .55rem; }
.content-preview-card.preview-eyebrow-medium > small { font-size: .64rem; }
.content-preview-card.preview-eyebrow-large > small { font-size: .73rem; }
.content-preview-card.preview-title-small h3 { font-size: .88rem; }
.content-preview-card.preview-title-medium h3 { font-size: 1.08rem; }
.content-preview-card.preview-title-large h3 { font-size: 1.3rem; }
.content-preview-card.preview-body-small div { font-size: .68rem; }
.content-preview-card.preview-body-medium div { font-size: .78rem; }
.content-preview-card.preview-body-large div { font-size: .9rem; }
.content-preview-card div > :first-child { margin-top: 0; }
.content-preview-card div > :last-child { margin-bottom: 0; }

@media (max-width: 1000px) {
    .profile-grid { grid-template-columns: repeat(3, 1fr); }
    .metric-profile-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: repeat(2, 1fr); }
    .password-form { grid-template-columns: 1fr 1fr; }
    .dashboard-block-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .warning-area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-field-grid.three-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-item-head { display: none; }
    .live-item-row { grid-template-columns: 100px 1fr 1fr; align-items: end; }
    .source-candidate-row { grid-template-columns: 72px minmax(180px, 1fr) 38px 38px; }
    .source-candidate-row .candidate-remove { grid-column: 2 / -1; justify-self: end; width: auto; padding-inline: 12px; }
}
@media (max-width: 700px) {
    .admin-header { display: grid; padding: 16px; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .panel { padding: 16px; }
    .panel-heading { align-items: flex-start; }
    .profile-grid, .metric-profile-grid, .settings-grid, .password-form, .dashboard-block-grid, .live-item-row, .warning-area-grid, .content-field-grid.two-columns, .content-field-grid.three-columns, .content-image-editor { grid-template-columns: 1fr; }
    .content-preview-card.width-half, .content-preview-card.width-third { grid-column: span 12; }
    .source-candidate-row { grid-template-columns: 1fr 38px 38px; }
    .candidate-priority { grid-column: 1 / -1; }
    .source-candidate-row .candidate-remove { grid-column: 1 / -1; justify-self: stretch; }
    .form-actions { align-items: flex-start; flex-direction: column; }
    .admin-tabs { top: 4px; margin-inline: -4px; }
}
