:root {
    --ink: #18303a;
    --muted: #637078;
    --paper: #fffdf8;
    --cream: #f5f1ea;
    --green: #1f6d5c;
    --green-dark: #164e43;
    --green-soft: #e4f2ed;
    --orange: #b33b18;
    --orange-soft: #fae9df;
    --navy: #142847;
    --line: #d9d9d2;
    --shadow: 0 16px 44px rgba(22, 47, 55, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--cream);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--cream); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.desk-header {
    min-height: 70px; padding: 0 max(4vw, 20px); display: flex; align-items: center; justify-content: space-between;
    gap: 18px; background: rgba(255, 253, 248, .96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(14px);
}
.desk-brand { color: var(--orange); text-decoration: none; font-size: 25px; font-weight: 900; letter-spacing: -.05em; text-transform: lowercase; }
.desk-brand span { color: #f36b2b; }
.desk-header-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-weight: 750; }
.desk-shell { width: min(1220px, calc(100% - 34px)); margin: 30px auto 90px; }
.desk-hero {
    min-height: 225px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 38px 42px;
    border-radius: 30px; color: white; overflow: hidden; position: relative;
    background: radial-gradient(circle at 88% 20%, rgba(246, 120, 72, .38), transparent 28%), linear-gradient(135deg, #123448 0%, #1f665b 70%, #84401f 125%);
    box-shadow: var(--shadow);
}
.desk-hero::after { content: ""; position: absolute; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; right: -95px; top: -170px; }
.desk-hero > * { position: relative; z-index: 1; }
.eyebrow { color: var(--orange); font-size: 11px; font-weight: 900; letter-spacing: .17em; margin: 0 0 8px; }
.desk-hero .eyebrow { color: #ffc5aa; }
.desk-hero h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 5vw, 62px); line-height: .98; letter-spacing: -.035em; margin: 0 0 15px; max-width: 690px; }
.desk-hero p:last-child { color: #e6f0ed; font-size: 18px; line-height: 1.55; max-width: 670px; margin: 0; }

.button { border: 1px solid transparent; border-radius: 13px; padding: 11px 16px; font-weight: 850; color: var(--ink); background: white; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-primary { color: white; background: var(--orange); }
.button-light { background: white; color: var(--green-dark); padding: 13px 19px; }
.button-quiet { border-color: var(--line); background: var(--paper); }
.button-danger { border-color: #d6947f; color: #953215; background: #fff7f2; }
.text-button { border: 0; background: none; color: var(--green); font-weight: 850; padding: 3px; }

.desk-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0 30px; padding: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 7px 23px rgba(27, 48, 55, .05); }
.desk-tabs button, .story-filter-row button, .preview-toggle button {
    border: 0; background: transparent; border-radius: 12px; color: var(--muted); padding: 12px; font-weight: 850;
}
.desk-tabs button.active, .story-filter-row button.active, .preview-toggle button.active { color: white; background: var(--green); }
.desk-notice { min-height: 22px; margin: -13px 3px 18px; color: var(--muted); font-weight: 700; }
.desk-notice.is-error { color: #9b3214; }
.desk-notice.is-success { color: var(--green); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin: 8px 2px 22px; }
.section-heading h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 4vw, 45px); letter-spacing: -.03em; margin: 0; line-height: 1.03; }
.section-heading > p { color: var(--muted); line-height: 1.5; max-width: 460px; margin: 0; }

.placement-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.placement-card { min-height: 230px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 23px; box-shadow: 0 9px 28px rgba(30, 52, 59, .05); }
.placement-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.surface-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 900; }
.status-pill { padding: 7px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-weight: 950; letter-spacing: .08em; }
.placement-empty .status-pill { color: #745930; background: #f6edda; }
.placement-card h3 { font-family: Georgia, "Times New Roman", serif; font-size: 27px; letter-spacing: -.025em; margin: 23px 0 9px; }
.placement-card p { color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.placement-card .placement-story-title { color: var(--ink); font-weight: 850; }
.placement-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.placement-meta span { padding: 6px 9px; border-radius: 9px; background: #f0eee8; color: var(--muted); font-size: 12px; font-weight: 800; }
.placement-live-item + .placement-live-item { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }

.story-filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 18px; }
.story-filter-row button { border: 1px solid var(--line); background: var(--paper); padding: 9px 13px; }
.story-library-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; }
.story-search { flex: 1; max-width: 540px; margin: 0; }
.story-search input { background: var(--paper); }
.story-library-count { color: var(--muted); font-size: 13px; font-weight: 800; white-space: nowrap; }
.story-list { display: grid; gap: 13px; }
.story-row { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 19px 21px; }
.story-row h3 { font-size: 20px; margin: 4px 0 5px; }
.story-row p { margin: 0; color: var(--muted); line-height: 1.4; }
.story-row-actions { display: flex; align-items: center; gap: 8px; }
.story-row-actions .button-danger { padding: 10px 13px; }
.story-state { color: var(--green); font-size: 11px; letter-spacing: .1em; font-weight: 950; text-transform: uppercase; }
.story-state.draft { color: #806039; }
.story-state.archived { color: #7b7f88; }
.story-pagination { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 18px; }
.story-pagination span { min-width: 92px; color: var(--muted); font-size: 13px; font-weight: 850; text-align: center; }

.editor-heading-row { align-items: center; }
.editor-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.editor-save-state { align-self: center; padding: 7px 9px; color: var(--green-dark); background: var(--green-soft); border-radius: 999px; font-size: 11px; font-weight: 900; }
.editor-save-state.is-dirty { color: #795421; background: #f6ead3; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 22px; align-items: start; }
.editor-form { display: grid; gap: 15px; }
.editor-card { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); padding: 21px; margin: 0; min-width: 0; }
.editor-card:disabled { opacity: .72; background: #f4f1ea; }
.editor-card > legend, .legend-row .fieldset-title { font-family: Georgia, "Times New Roman", serif; font-weight: 800; font-size: 23px; padding: 0 6px; }
.placement-editor-heading { margin-bottom: 14px; }
.placement-editor-list { display: grid; gap: 8px; margin-bottom: 18px; }
.placement-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: #f8f6f0; }
.placement-editor-row.is-active { border-color: var(--green); background: var(--mint); }
.placement-editor-row strong { display: block; }
.placement-editor-row span { color: var(--muted); font-size: 12px; }
.placement-editor-row button { min-height: 38px; }
.legend-row { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; margin-bottom: 10px; }
.legend-row .fieldset-title { margin: 0; }
.legend-row > span { color: var(--muted); font-size: 13px; }
label { display: grid; gap: 7px; margin: 15px 0; font-weight: 850; }
input, textarea, select { width: 100%; border: 1px solid #cbcfc9; border-radius: 12px; color: var(--ink); background: white; padding: 12px 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 109, 92, .12); }
textarea { resize: vertical; line-height: 1.5; }
.field-grid { display: grid; gap: 14px; }
.field-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.optional { color: var(--muted); font-weight: 600; font-size: 12px; }
.check-field { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.check-field input { width: 19px; height: 19px; accent-color: var(--green); flex: none; }
.field-help { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 7px 0 0; }
.image-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 5px; }
.upload-status { color: var(--muted); font-size: 12px; font-weight: 750; }
.destination-field { display: flex; align-items: center; gap: 20px; border: 0; padding: 0; margin: 13px 0; }
.destination-field legend { font-weight: 850; float: left; margin-right: 18px; }
.destination-field .check-field { margin: 0; }

.story-blocks { display: grid; gap: 11px; }
.block-editor { display: grid; grid-template-columns: 44px 1fr 38px; gap: 9px; align-items: start; padding: 12px; border: 1px solid #dddcd5; border-radius: 15px; background: #faf8f3; }
.block-badge { display: grid; place-items: center; min-height: 40px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 950; text-transform: uppercase; }
.block-fields label { margin: 0 0 9px; font-size: 13px; }
.block-fields label:last-child { margin-bottom: 0; }
.block-image-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.block-image-actions .button { padding: 8px 10px; font-size: 12px; }
.inline-format-toolbar { display: flex; align-items: center; gap: 6px; margin: -1px 0 8px; }
.inline-format-toolbar button { min-width: 34px; min-height: 31px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-family: Georgia, serif; }
.inline-format-toolbar button[data-format="bold"] { font-weight: 900; }
.inline-format-toolbar button[data-format="italic"] { font-style: italic; }
.inline-format-toolbar span { color: var(--muted); font-size: 11px; }
.block-remove { border: 0; border-radius: 10px; background: white; color: #9b3b20; min-height: 38px; font-weight: 900; }
.block-toolbar { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.block-toolbar button { border: 1px solid var(--line); background: white; color: var(--green-dark); padding: 8px 10px; border-radius: 10px; font-size: 13px; font-weight: 850; }
.selected-sources { display: grid; gap: 8px; }
.source-chip { display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; align-items: center; padding: 10px; background: #f2f5f2; border-radius: 13px; }
.source-chip img, .result-avatar { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: #e5e9e6; }
.source-chip strong, .source-chip span { display: block; }
.source-chip span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.source-chip button { border: 0; background: transparent; color: #9b3b20; font-weight: 900; }
.source-empty { color: var(--muted); padding: 13px; border: 1px dashed #cfd2cc; border-radius: 13px; }

.preview-sticky { position: sticky; top: 92px; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 13px; margin: 0 0 11px; }
.preview-toolbar h3 { margin: 0; font-size: 19px; }
.preview-toggle { display: flex; gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.preview-toggle button { padding: 7px 10px; font-size: 12px; }
.story-preview-frame { margin: 0 auto; overflow: hidden; background: #f3f0e9; border: 8px solid var(--ink); box-shadow: var(--shadow); transition: max-width .2s ease; }
.story-preview-frame.preview-mobile { max-width: 390px; border-radius: 36px; }
.story-preview-frame.preview-web { max-width: 100%; border-radius: 19px; }
.preview-chrome { display: flex; justify-content: space-between; align-items: center; min-height: 51px; padding: 0 17px; background: var(--paper); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .11em; }
.preview-chrome span:first-child { width: 23px; height: 7px; border-radius: 999px; background: var(--ink); opacity: .75; }
.story-preview { margin: 13px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow-wrap: anywhere; }
.story-preview.empty-preview { text-align: center; padding: 38px 22px; color: var(--muted); }
.preview-cover { width: calc(100% + 36px); max-height: 250px; object-fit: cover; margin: -18px -18px 17px; border-radius: 19px 19px 0 0; }
.preview-kicker { color: var(--orange); font-size: 10px; font-weight: 950; letter-spacing: .15em; text-transform: uppercase; }
.story-preview h2 { font-family: Georgia, "Times New Roman", serif; font-size: 29px; line-height: 1.04; margin: 8px 0 10px; letter-spacing: -.025em; }
.preview-dek { color: var(--muted); line-height: 1.5; font-size: 15px; }
.preview-byline { color: var(--green); font-weight: 850; font-size: 12px; margin: 12px 0 17px; }
.preview-body { padding-top: 14px; border-top: 1px solid var(--line); }
.preview-body h3 { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.preview-body p { line-height: 1.6; }
.preview-body blockquote { margin: 16px 0; padding: 4px 0 4px 15px; border-left: 4px solid var(--orange); color: var(--ink); font-family: Georgia, serif; font-size: 19px; line-height: 1.45; }
.preview-body figure { margin: 17px 0; }
.preview-body figure img { width: 100%; border-radius: 13px; }
.preview-body figcaption { color: var(--muted); font-size: 11px; margin-top: 6px; }
.preview-body a { color: var(--green); font-weight: 850; }
.preview-body li { margin: 7px 0; line-height: 1.5; }
.preview-body hr { border: 0; border-top: 1px solid var(--line); margin: 23px 0; }
.quote-attribution { display: block; color: var(--muted); font-family: Inter, sans-serif; font-size: 12px; margin-top: 8px; }
.preview-collapse-note { margin: 13px; padding: 13px; border-radius: 13px; color: #6b5a40; background: #f4e9d5; font-size: 12px; line-height: 1.4; text-align: center; }

.content-search { display: grid; grid-template-columns: 1fr auto; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 17px; padding: 10px; }
.content-search input { border: 0; margin: 0; }
.content-results { display: grid; gap: 18px; margin-top: 20px; }
.result-group { background: var(--paper); border: 1px solid var(--line); border-radius: 19px; padding: 17px; }
.result-group h3 { margin: 0 0 11px; font-family: Georgia, serif; font-size: 23px; text-transform: capitalize; }
.result-row { display: grid; grid-template-columns: 45px 1fr auto; gap: 11px; align-items: center; padding: 10px 0; border-top: 1px solid #e7e5df; }
.result-row:first-of-type { border-top: 0; }
.result-copy strong, .result-copy span { display: block; }
.result-copy span { color: var(--muted); font-size: 13px; margin-top: 3px; }
.permission-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.permission-pill { display: inline-flex !important; width: fit-content; padding: 5px 8px; border-radius: 999px; color: #6f5228 !important; background: #f6ead3; font-size: 10px !important; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.permission-pill.approved, .permission-pill.not-required { color: var(--green-dark) !important; background: var(--green-soft); }
.permission-pill.declined, .permission-pill.revoked, .permission-pill.reapproval-required, .permission-pill.source-unavailable { color: #8f3017 !important; background: var(--orange-soft); }
.permission-help { font-size: 11px !important; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.result-placeholder { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-weight: 950; }
.empty-state { display: grid; gap: 7px; place-items: center; text-align: center; padding: 45px 23px; border: 1px dashed #c8cbc5; border-radius: 19px; color: var(--muted); background: rgba(255, 253, 248, .65); }
.empty-state strong { color: var(--ink); font-size: 20px; }

.media-dialog { width: min(880px, calc(100% - 28px)); max-height: min(760px, calc(100vh - 42px)); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(15, 38, 45, .28); }
.media-dialog::backdrop { background: rgba(16, 35, 40, .64); backdrop-filter: blur(5px); }
.media-dialog-shell { padding: 24px; }
.media-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.media-dialog-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 31px; letter-spacing: -.025em; }
.media-dialog-close { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; font-size: 25px; line-height: 1; }
.media-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 5px; }
.media-library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-height: 500px; overflow-y: auto; padding: 4px 4px 4px 0; }
.media-library-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.media-library-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #edf0ed; }
.media-library-card-body { display: grid; gap: 7px; padding: 10px; }
.media-library-card-body span { color: var(--muted); font-size: 11px; }
.media-library-card-body .button { width: 100%; }

@media (max-width: 900px) {
    .editor-layout { grid-template-columns: 1fr; }
    .preview-column { order: -1; }
    .preview-sticky { position: static; }
    .story-preview-frame.preview-web { max-width: 660px; }
}

@media (max-width: 680px) {
    .desk-header { min-height: 62px; }
    #admin-name { display: none; }
    .desk-shell { width: min(100% - 22px, 1220px); margin-top: 16px; }
    .desk-hero { min-height: 265px; align-items: flex-start; flex-direction: column; padding: 28px 24px; border-radius: 23px; }
    .desk-hero h1 { font-size: 43px; }
    .desk-hero p:last-child { font-size: 16px; }
    .desk-tabs { overflow-x: auto; grid-template-columns: repeat(4, minmax(110px, 1fr)); }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .placement-board { grid-template-columns: 1fr; }
    .editor-heading-actions { justify-content: flex-start; }
    .field-grid-two { grid-template-columns: 1fr; gap: 0; }
    .destination-field { display: grid; gap: 8px; }
    .destination-field legend { float: none; }
    .block-editor { grid-template-columns: 38px 1fr 34px; padding: 9px; }
    .story-row { grid-template-columns: 1fr; }
    .story-row-actions { justify-content: flex-start; }
    .story-library-tools { align-items: stretch; flex-direction: column; }
    .story-search { max-width: none; }
    .story-library-count { white-space: normal; }
    .content-search { grid-template-columns: 1fr; }
    .result-row { grid-template-columns: 42px 1fr; }
    .result-row .button { grid-column: 1 / -1; }
    .placement-editor-row { grid-template-columns: 1fr 1fr; }
    .placement-editor-row > div { grid-column: 1 / -1; }
    .media-dialog-shell { padding: 18px; }
    .media-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
    .media-library-grid { grid-template-columns: 1fr; }
    .story-pagination { justify-content: space-between; }
}
