:root {
    color-scheme: light;
    --background: #f3f7f8;
    --surface: #ffffff;
    --text: #17313b;
    --muted: #617680;
    --border: #d8e3e7;
    --primary: #087f8c;
    --primary-dark: #056570;
    --success-bg: #e9f8f0;
    --success-border: #8bd0aa;
    --error-bg: #fff0f0;
    --error-border: #e7a0a0;
    --control-height: 38px;
    --control-radius: 8px;
    --toolbar-control-height: 44px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body.draft-editor-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
}

.desktop-editor-bars {
    flex: 0 0 78px;
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    background: #f7f9fa;
}

.desktop-editor-bars ~ main :is([id], section, input, button, textarea, select, [tabindex]) {
    scroll-margin-top: 90px;
}

.desktop-menu-bar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    width: 100%;
    height: 26px;
    border-bottom: 1px solid #c8d3d8;
    background: #f7f9fa;
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    user-select: none;
}

.desktop-secondary-bar {
    display: flex;
    align-items: center;
    width: 100%;
    height: 52px;
    padding: 0 10px;
    border-bottom: 1px solid #c8d3d8;
    background: #f7f9fa;
}
.desktop-secondary-bar .site-header-search {
    flex: 0 1 420px;
    min-width: 0;
    width: 100%;
    max-width: 420px;
}
.desktop-secondary-bar .site-header-search input {
    border-color: #aebfc5;
    border-radius: 999px;
}
.desktop-secondary-bar .site-header-search input:focus-visible {
    outline: 3px solid rgb(8 127 140 / 30%);
}

.desktop-menu-bar > ul {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    height: 100%;
    align-items: stretch;
    gap: 1px;
    margin: 0;
    padding: 0 6px;
    list-style: none;
}

.desktop-menu-bar > ul > li {
    display: flex;
    min-width: 0;
}

.desktop-menu-bar > ul > li > button {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-menu-status {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0 8px 0 6px;
    white-space: nowrap;
}

.desktop-menu-status [hidden] { display: none; }
.desktop-menu-status .status-draft,
.desktop-menu-status .status-published-badge {
    align-items: center;
    min-height: 18px;
    padding: 1px 7px;
    font-size: 11px;
    line-height: 16px;
    font-weight: 650;
}
.desktop-menu-status .status-draft { background: #eee9da; color: #665628; }
.desktop-menu-status .status-published-badge { background: #e3f0e8; color: #17613a; }
.desktop-menu-status [data-draft-status] { cursor: pointer; }
.desktop-menu-status [data-draft-status]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.desktop-status-tooltip {
    position: absolute;
    z-index: 40;
    top: 100%;
    right: 0;
    display: grid;
    gap: 6px;
    width: max-content;
    max-width: min(320px, calc(100vw - 12px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 9px 11px;
    border: 1px solid #b8c9d0;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 22px rgb(23 49 59 / 20%);
    color: var(--text);
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
}
.desktop-status-tooltip > span { display: block; }
.desktop-status-tooltip > [hidden] { display: none; }
.desktop-status-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.desktop-menu-item { position: relative; }

.desktop-menu-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 21;
    width: max-content;
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    border: 1px solid #b8c9d0;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 6px 18px rgb(23 49 59 / 20%);
}

.desktop-menu-popup[hidden] { display: none; }
.desktop-menu-popup li { display: block; }
.desktop-menu-popup .desktop-menu-separator {
    height: 0;
    margin: 4px 6px;
    border-top: 1px solid #d8e3e7;
}
.desktop-menu-bar .desktop-menu-popup button,
.desktop-menu-bar .desktop-menu-popup a {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 10px 4px 6px;
    text-align: left;
    white-space: normal;
}
.desktop-menu-bar .desktop-menu-popup a {
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
}
.desktop-menu-popup button:disabled { color: var(--muted); cursor: default; }
.desktop-menu-popup button:disabled:hover { background: transparent; }
.desktop-menu-check { width: 14px; flex: 0 0 14px; visibility: hidden; }
.desktop-menu-popup button[aria-checked="true"] .desktop-menu-check { visibility: visible; }

.desktop-menu-bar button {
    min-height: 0;
    padding: 0 9px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.desktop-menu-bar button:hover,
.desktop-menu-bar .desktop-menu-popup a:hover {
    background: #dce8ed;
}

.desktop-menu-bar button:focus-visible,
.desktop-menu-bar .desktop-menu-popup a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

@media (max-width: 520px) {
    .desktop-menu-bar { font-size: 11px; }
    .desktop-menu-bar > ul { padding: 0 2px; }
    .desktop-menu-bar button { padding-right: 4px; padding-left: 4px; }
    .desktop-menu-popup { position: fixed; top: 26px; left: 6px; }
    .desktop-menu-status { padding-right: 3px; padding-left: 0; }
    .desktop-menu-status .status-draft,
    .desktop-menu-status .status-published-badge { padding-right: 4px; padding-left: 4px; }
}

.admin-shell {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.admin-shell-wide {
    width: min(1500px, calc(100% - 32px));
}

main.admin-shell-wide { padding-top: 0; }
body.draft-editor-page main.admin-shell-wide {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0 0 20px;
}
body.draft-editor-page .draft-editor,
body.draft-editor-page .draft-table-area {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}
body.draft-editor-page .draft-editor-controls { flex: 0 0 auto; }
body.draft-editor-page .draft-table-wrap {
    flex: 1 1 auto;
    min-height: 140px;
    max-height: none;
}
body.draft-editor-page dialog {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}

@media (max-height: 420px) {
    body.draft-editor-page { height: auto; min-height: 100vh; min-height: 100dvh; }
    body.draft-editor-page main.admin-shell-wide { flex: 1 0 auto; }
    body.draft-editor-page .draft-table-wrap { flex: 0 0 220px; }
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding: 16px 20px;
    border-radius: 14px;
    background: #004e89;
}

.site-header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-header-brand span {
    color: #fff;
    font-size: 14px;
}
.site-header-logout { flex: 0 0 auto; margin: 0; }
.site-header-logout .button-secondary { border-color: rgb(255 255 255 / 70%); background: #fff; color: #004e89; }
.site-header-logout .button-secondary:hover { background: #eaf3fa; }
.site-header-link { flex: 0 0 auto; color: #fff; font-size: 14px; text-decoration: none; }
.site-header-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.site-header-link:focus-visible { outline: 3px solid rgb(255 255 255 / 45%); outline-offset: 3px; border-radius: 2px; }
.site-header-search { position: relative; flex: 1 1 320px; max-width: 420px; }
.site-header-search input {
    width: 100%;
    min-height: var(--control-height);
    padding: 7px 38px 7px 38px;
    border: 1px solid rgb(255 255 255 / 55%);
    border-radius: var(--control-radius);
    background: rgb(255 255 255 / 96%);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}
.site-header-search input:focus-visible { outline: 3px solid rgb(255 255 255 / 45%); outline-offset: 2px; }
.site-header-search input::-webkit-search-cancel-button { display: none; appearance: none; }
.site-header-search input::-ms-clear { display: none; }
.site-header-search-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    pointer-events: none;
    color: var(--muted);
    transform: translateY(-50%);
}
.site-header-search button {
    position: absolute;
    top: 50%;
    right: 5px;
    width: 30px;
    min-height: 30px;
    padding: 0;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
}
.site-header-search button:hover { background: #eaf1f3; color: var(--text); }
.site-header-search button[hidden] { display: none; }

.site-logo-picture { display: block; flex: 0 0 auto; }
.site-logo { display: block; width: 200px; max-width: 58vw; height: auto; }

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: clamp(25px, 4vw, 34px);
    line-height: 1.2;
}

h2 {
    margin-bottom: 18px;
    font-size: 20px;
}

.muted,
.hint {
    color: var(--muted);
}

.hint {
    margin: -4px 0 0;
    font-size: 14px;
}

.card,
.notice {
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgb(28 60 70 / 5%);
}

.login-card {
    max-width: 480px;
    margin-right: auto;
    margin-left: auto;
}

.notice.success {
    border-color: var(--success-border);
    background: var(--success-bg);
}

.notice.error {
    border-color: var(--error-border);
    background: var(--error-bg);
}

.toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}
.toolbar-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-links form { margin: 0; }
.reassurance { padding: 12px 14px; border-left: 4px solid var(--primary); background: #eef8f8; font-weight: 650; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0 0; padding-left: 22px; }
.steps li { padding-left: 6px; }
.steps span, .change-cards span, .change-cards small, .change-list span { display: block; color: var(--muted); }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.admin-main-toolbar { align-items: center; margin-bottom: 18px; }
.admin-main-toolbar h1 { margin-bottom: 0; }
.admin-main-toolbar form { margin: 0; }
.admin-main-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 24px; align-items: start; }
.primary-actions { min-width: 0; }
.primary-action-card { padding: 30px; }
.primary-action-card h2 { font-size: 23px; }
.primary-action-card > p:not(.reassurance) { color: var(--muted); }
.primary-action-card .button-link { min-width: 190px; }
.primary-action-card .form-stack button { justify-self: start; min-width: 190px; }
.primary-action-card .reassurance { margin: 18px 0 0; }
.upload-accordion { padding: 0; overflow: hidden; }
.upload-accordion-heading { margin: 0; }
.upload-accordion-toggle {
    display: flex;
    width: 100%;
    min-height: 0;
    justify-content: space-between;
    padding: 24px 30px;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
}
.upload-accordion-toggle:hover { background: #f2f7f8; }
.upload-accordion-toggle:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid rgb(8 127 140 / 25%);
    outline-offset: -3px;
}
.upload-accordion-chevron {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    margin: 4px 3px 0 18px;
    border-right: 2px solid currentcolor;
    border-bottom: 2px solid currentcolor;
    transform: rotate(45deg);
    transition: transform 160ms ease;
}
.upload-accordion-toggle[aria-expanded="true"] .upload-accordion-chevron { transform: rotate(225deg); }
.upload-accordion-content { padding: 0 30px 30px; border-top: 1px solid var(--border); }
.upload-accordion-content > p:first-child { margin-top: 24px; color: var(--muted); }
.upload-accordion-content[hidden] { display: none; }
.upload-check-status { display: flex; align-items: center; gap: 9px; margin: 2px 0 0; font-size: 14px; }
.upload-check-status[hidden] { display: none; }
.upload-check-status.is-checking { color: var(--muted); }
.upload-check-status.is-success { color: #087339; font-weight: 700; }
.upload-check-status.is-error { color: #a42626; font-weight: 700; }
.upload-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border: 2px solid rgb(8 127 140 / 22%);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: upload-spinner 700ms linear infinite;
}
.upload-spinner[hidden] { display: none; }
@keyframes upload-spinner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .upload-spinner { animation-duration: 1400ms; } }
.upload-review { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); }
.secondary-sidebar { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #f5f8f9; }
.secondary-sidebar > h2 { margin-bottom: 12px; color: var(--muted); font-size: 16px; }
.secondary-sidebar details { border-top: 1px solid var(--border); }
.secondary-sidebar details:last-child { border-bottom: 1px solid var(--border); }
.secondary-sidebar summary { padding: 15px 2px; font-weight: 700; cursor: pointer; }
.secondary-sidebar summary:focus-visible { outline: 3px solid rgb(8 127 140 / 25%); outline-offset: 2px; }
.details-content { padding: 0 2px 16px; }
.sidebar-stats { display: grid; gap: 12px; margin: 0 0 16px; }
.secondary-sidebar .version-row { align-items: stretch; flex-direction: column; }
.secondary-sidebar .version-actions { align-items: stretch; flex-direction: column; }
.secondary-sidebar .version-actions > * { width: 100%; }
.download-list { display: grid; gap: 8px; }

.form-stack {
    display: grid;
    gap: 16px;
}

label span,
dt {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9cbd1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.visually-hidden-file {
    position: absolute;
    width: 1px !important;
    height: 1px;
    padding: 0 !important;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0 !important;
}

.file-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-picker-button { margin: 0; }
.file-picker-name { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.visually-hidden-file:focus-visible + .file-picker-button {
    outline: 3px solid rgb(8 127 140 / 25%);
    outline-offset: 2px;
}

input:focus-visible,
button:focus-visible,
.button-link:focus-visible {
    outline: 3px solid rgb(8 127 140 / 25%);
    outline-offset: 2px;
}

button,
.button-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button-link:hover {
    background: var(--primary-dark);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.button-secondary:hover {
    background: #eaf1f3;
}

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

.status-grid div,
.result-grid div {
    min-width: 0;
}

dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.source-title {
    overflow-wrap: anywhere;
}

.warning-list {
    margin: 16px 0 0;
    padding-left: 20px;
}

.version-list { display: grid; gap: 10px; }
.version-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 9px; }
.version-row > div:first-child { display: grid; gap: 3px; }
.version-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.version-message { min-height: 1.4em; color: var(--muted); }
.version-message.has-errors { color: #a42626; font-weight: 700; }
.status-published { color: #087339; font-weight: 750; }

.eyebrow {
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-draft {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fff2c7;
    color: #735500;
    font-size: 13px;
}

.status-published-badge {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--success-bg);
    color: #087339;
    font-size: 13px;
}

.draft-editor-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 16px;
    margin-bottom: 12px;
}
.draft-summary {
    flex: 1 1 620px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.draft-summary[hidden], .draft-summary-list [hidden] { display: none !important; }
.draft-summary h2 { margin: 0 0 6px; font-size: 14px; }
.draft-summary-list { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.draft-summary-list .draft-stat { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.draft-summary-list dt { color: var(--muted); font-size: 12px; }
.draft-summary-list dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.draft-summary-list .leader { display: none; }
.change-positive { color: #087339; }
.change-negative { color: #b13b32; }

.draft-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}
.draft-actions button {
    min-height: 36px;
    padding: 6px 10px;
}
.draft-action-icon { color: inherit; }
[data-publish-prices] {
    gap: 8px;
}
.draft-actions button[hidden] { display: none; }

.export-dialog,
.exit-dialog,
.publish-dialog { width: min(100% - 32px, 560px); padding: 22px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.export-dialog::backdrop,
.exit-dialog::backdrop,
.publish-dialog::backdrop { background: rgb(13 39 46 / 55%); }
.export-dialog h2 { margin-top: 0; }
.export-dialog-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.exit-dialog h2 { margin-top: 0; }
.exit-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; margin-top: 20px; }
.exit-dialog-message { margin: 14px 0 0; color: var(--muted); }
.exit-dialog-message.has-errors { padding: 10px 12px; border: 1px solid var(--error-border); border-radius: 8px; background: var(--error-bg); color: #a42626; font-weight: 700; }
.exit-dialog-message[hidden] { display: none; }
.publish-dialog h2 { margin-top: 0; }
.publish-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.publish-dialog-message { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--error-border); border-radius: 8px; background: var(--error-bg); color: #a42626; font-weight: 700; }
.publish-dialog-message[hidden] { display: none; }

.draft-state {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.draft-state.is-modified {
    color: #875f00;
    font-weight: 700;
}

.draft-state.has-errors {
    color: #a42626;
    font-weight: 700;
}

.draft-save-message {
    flex: 1 0 100%;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.draft-save-message:empty { display: none; }

.draft-save-message.is-success {
    color: #087339;
    font-weight: 700;
}

.draft-save-message.has-errors {
    color: #a42626;
    font-weight: 700;
}

.draft-publication-state { margin: 0; color: var(--muted); font-size: 12px; font-weight: 400; }
.draft-publication-state[hidden] { display: none; }

.draft-table-wrap {
    margin-top: 8px;
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    position: relative;
    z-index: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    scrollbar-width: thin;
    scrollbar-color: rgb(23 50 67 / 35%) transparent;
}
.draft-table-wrap.is-scrolling,
.draft-table-wrap:focus-within { scrollbar-color: rgb(23 50 67 / 55%) transparent; }
@media (hover: hover) {
    .draft-table-wrap:hover { scrollbar-color: rgb(23 50 67 / 55%) transparent; }
}
.draft-table-wrap:focus-visible { outline: 3px solid rgb(8 127 140 / 30%); outline-offset: 2px; }

.draft-table-wrap::-webkit-scrollbar {
    width: 5px;
    height: 5px;
    background: transparent;
}

.draft-table-wrap::-webkit-scrollbar-track,
.draft-table-wrap::-webkit-scrollbar-corner {
    background: transparent;
}

.draft-table-wrap::-webkit-scrollbar-track:vertical {
    box-shadow: inset 2px 0 3px rgb(23 50 67 / 12%);
}

/* Let Chromium use the track styling instead of native scrollbar colors. */
@supports selector(::-webkit-scrollbar) {
    .draft-table-wrap,
    .draft-table-wrap:hover,
    .draft-table-wrap.is-scrolling,
    .draft-table-wrap:focus-within {
        scrollbar-width: auto;
        scrollbar-color: auto;
    }
}

.draft-table-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background-color: rgb(23 50 67 / 35%);
    box-shadow: -1px 1px 3px rgb(23 50 67 / 18%);
}

.draft-table-wrap.is-scrolling::-webkit-scrollbar-thumb,
.draft-table-wrap:focus-within::-webkit-scrollbar-thumb {
    background-color: rgb(23 50 67 / 55%);
}
@media (hover: hover) {
    .draft-table-wrap:hover::-webkit-scrollbar-thumb {
        background-color: rgb(23 50 67 / 55%);
    }
}
.draft-table-wrap::-webkit-scrollbar-thumb:hover {
    background-color: rgb(23 50 67 / 75%);
}

@media (prefers-reduced-motion: no-preference) {
    .draft-table-wrap::-webkit-scrollbar-thumb {
        transition: background-color 140ms ease;
    }
}
.draft-search-empty { margin: 0; padding: 28px 18px; color: var(--muted); text-align: center; }
.draft-search-empty[hidden] { display: none; }

.draft-table-area {
    min-width: 0;
    width: 100%;
}

.mass-price-percent-input {
    width: 100%;
    min-height: var(--control-height);
    padding: 6px 9px;
    border: 1px solid #aebfc5;
    border-radius: var(--control-radius);
    font: inherit;
}
.mass-price-percent-input:focus-visible { outline: 3px solid rgb(8 127 140 / 30%); outline-offset: 2px; }
.mass-price-percent-input[aria-invalid="true"] { border-color: #c33; box-shadow: 0 0 0 2px rgb(204 51 51 / 12%); }
.mass-price-message { min-height: 1.4em; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.mass-price-message:empty { display: none; }
.mass-price-message.has-errors { color: #b13b32; }

.mass-price-entry-dialog,
.mass-price-dialog,
.publish-dialog { max-width: min(440px, calc(100vw - 32px)); }

.mass-price-entry-dialog,
.mass-price-dialog {
    width: min(100% - 32px, 440px);
    margin: auto;
    padding: 28px;
    border: 1px solid rgb(216 227 231 / 90%);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 48px rgb(23 49 59 / 20%);
}
.mass-price-dialog { text-align: center; }
.mass-price-entry-dialog h2 { margin: 0 0 18px; }
.mass-price-entry-dialog label { display: block; margin-bottom: 6px; font-weight: 650; }
.mass-price-entry-note { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.mass-price-entry-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.mass-price-entry-actions button { min-width: 110px; }
.mass-price-entry-dialog::backdrop { background: rgb(18 47 56 / 28%); }
.mass-price-dialog::backdrop {
    background: rgb(18 47 56 / 28%);
    backdrop-filter: blur(2px);
}
.mass-price-dialog h2 { margin: 0 0 12px; }
.mass-price-dialog-message { margin: 0; }
.mass-price-dialog-note { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.mass-price-dialog-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 22px;
}
.mass-price-dialog-actions button { min-width: 124px; }

@media (prefers-reduced-motion: no-preference) {
    .mass-price-dialog[open] { animation: mass-price-dialog-in 180ms cubic-bezier(.2, .8, .2, 1) both; }
    .mass-price-dialog[open]::backdrop { animation: mass-price-backdrop-in 180ms ease-out both; }
    .mass-price-dialog.is-closing { animation: mass-price-dialog-out 150ms ease-in both; }
    .mass-price-dialog.is-closing::backdrop { animation: mass-price-backdrop-out 150ms ease-in both; }
}
@keyframes mass-price-dialog-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mass-price-dialog-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(4px) scale(.99); }
}
@keyframes mass-price-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes mass-price-backdrop-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.draft-price-info-row { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 13px; line-height: 1.45; }
.draft-price-info-row + .draft-price-info-row { margin-top: 5px; }
.meta-label { flex: 0 0 auto; color: var(--muted); font-weight: 600; }
.meta-value { min-width: 0; overflow-wrap: anywhere; }

.draft-price-info-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 48px rgb(23 49 59 / 20%);
}

.draft-price-info-dialog::backdrop {
    background: rgb(18 47 56 / 35%);
}

.draft-price-info-dialog h2 {
    margin: 0 0 18px;
}

.draft-price-info-dialog .draft-price-info-row {
    font-size: 14px;
}

.draft-price-info-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
}

.draft-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}

.draft-table th,
.draft-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.service-edit-row { transition: background-color 140ms ease; }
.service-edit-row:not(.price-invalid):focus-within { background: rgb(8 127 140 / 5%); }

@media (hover: hover) and (pointer: fine) {
    .service-edit-row:not(.price-invalid):hover { background: rgb(8 127 140 / 5%); }
}

.draft-table thead th {
    position: sticky;
    z-index: 8;
    top: 0;
    border-bottom: 1px solid #b8cbd1;
    background: #e9f1f3;
    box-shadow: 0 2px 5px rgb(28 60 70 / 8%);
    overflow-wrap: anywhere;
}

.draft-table thead th[data-resizable-column] { padding-right: 17px; }
.draft-column-resizer {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}
.draft-column-resizer[hidden] { display: none; }
.draft-column-resizer::before,
.draft-column-resizer::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 2px;
    height: 22px;
    border-radius: 2px;
    background: rgb(88 117 132 / 36%);
    transform: translateY(-50%);
    pointer-events: none;
}
.draft-column-resizer::before { left: 3px; }
.draft-column-resizer::after { right: 3px; }
.draft-column-resizer:hover,
.draft-column-resizer:focus-visible,
.draft-column-resizer.is-dragging { background: rgb(8 127 140 / 16%); }
.draft-column-resizer:hover::before,
.draft-column-resizer:hover::after,
.draft-column-resizer:focus-visible::before,
.draft-column-resizer:focus-visible::after,
.draft-column-resizer.is-dragging::before,
.draft-column-resizer.is-dragging::after { background: rgb(8 127 140 / 36%); }
.draft-column-resizer:focus-visible { outline: 2px solid #087f8c; outline-offset: -2px; }
body.draft-column-resizing,
body.draft-column-resizing * { user-select: none !important; cursor: col-resize !important; }

.draft-table .category-row th {
    text-align: center;
    padding: 10px 12px;
    background: #dcebed;
    color: #164650;
    font-size: 14px;
    text-transform: uppercase;
}

.service-code {
    font-size: 10px;
    overflow-wrap: anywhere;
}

.draft-table td.service-name {
    padding-left: 8px;
    overflow-wrap: anywhere;
}

.draft-table.is-compact-columns th,
.draft-table.is-compact-columns td { padding-right: 6px; padding-left: 6px; }
.draft-table.is-compact-columns thead th[data-resizable-column] { padding-right: 15px; }
.draft-table.is-compact-columns .price-input,
.draft-table.is-compact-columns .percent-input { padding-right: 4px; padding-left: 4px; }

.money-cell,
.price-input-cell,
.percent-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.draft-table td.money-cell {
    text-align: center;
}

.draft-table thead th:nth-child(7) {
    padding-right: 0;
    padding-left: 0;
    text-align: center;
    white-space: nowrap;
    font-size: 11px;
}

.draft-table thead th:nth-child(4),
.draft-table thead th:nth-child(5),
.draft-table thead th:nth-child(6) {
    text-align: center;
}

.draft-table .price-input,
.draft-table .percent-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 6px 8px;
    margin: 0;
    border: 1px solid #aebfc5;
    border-radius: 6px;
    box-sizing: border-box;
    font: inherit;
    line-height: 22px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    vertical-align: middle;
}

.draft-table .percent-input {
    appearance: textfield;
    color: inherit;
    font-weight: inherit;
}

.draft-table .percent-input::-webkit-inner-spin-button,
.draft-table .percent-input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.price-increased .percent-cell {
    color: #087339;
    font-weight: 750;
}

.price-decreased .percent-cell {
    color: #b13b32;
    font-weight: 750;
}

.price-unchanged .percent-cell {
    color: var(--muted);
}

.price-changed .price-input {
    background: #fff2c7;
}

.price-invalid {
    background: var(--error-bg);
}

.price-invalid .price-input,
.price-invalid .percent-input {
    border-color: #c33;
    box-shadow: 0 0 0 2px rgb(204 51 51 / 12%);
}

@media (prefers-reduced-motion: reduce) {
    .service-edit-row { transition: none; }
}

@media (max-width: 620px) {
    .admin-shell {
        width: min(100% - 20px, 920px);
        padding-top: 20px;
    }

    .toolbar {
        display: block;
    }

    .toolbar form {
        margin-top: 16px;
    }

    .toolbar-links { justify-content: flex-start; }

    .card,
    .notice {
        padding: 18px;
    }

    .status-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .steps { grid-template-columns: 1fr; }

    .primary-action-card { padding: 22px; }
    .upload-accordion { padding: 0; }
    .upload-accordion-toggle { padding: 20px 22px; }
    .upload-accordion-content { padding: 0 22px 22px; }
    .site-header > span { display: none; }
    .site-header { flex-wrap: wrap; }
    .site-header-brand { flex: 1 1 auto; }
    .site-header-search { flex: 1 0 100%; max-width: none; order: 3; }
}

@media (max-width: 980px) {
    .admin-main-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
    .site-logo { width: 48px; max-width: none; height: 48px; object-fit: contain; }
}

@media (max-width: 620px) {
    .site-logo { width: 38px; height: 38px; }
}

@media (max-width: 640px) {
    .draft-summary { flex-basis: 100%; }
    .draft-actions { justify-content: flex-start; margin-left: 0; }
}

.category-row th > span:first-child { display: inline-block; }
.category-row > .structure-action-cell { background: #dcebed; }
.structure-action-cell { position: relative; text-align: left; }
.structure-action-toggle {
    display: inline-flex;
    position: absolute;
    top: 50%;
    left: 50%;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #164650;
    font-size: 23px;
    line-height: 1;
    isolation: isolate;
}
.structure-action-toggle::before {
    position: absolute;
    z-index: -1;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 16px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: transparent;
    content: '';
    pointer-events: none;
}
.structure-action-toggle:hover { background: transparent; }
.structure-action-toggle:hover::before,
.structure-action-toggle[aria-expanded="true"]::before { background: rgb(22 70 80 / 12%); }
.structure-action-toggle:focus-visible { outline: none; }
.structure-action-toggle:focus-visible::before {
    background: rgb(22 70 80 / 12%);
    outline: 2px solid #087f8c;
    outline-offset: 2px;
}
.structure-action-menu button:focus-visible { outline: 3px solid #087f8c; outline-offset: -3px; }
.structure-action-menu {
    position: fixed;
    z-index: 40;
    display: grid;
    gap: 2px;
    min-width: 180px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    padding: 4px;
    border: 1px solid #b8c9d0;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 8px 22px rgb(23 49 59 / 20%);
}
.structure-action-menu[hidden] { display: none; }
.structure-action-menu button {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #164650;
    font: inherit;
    text-align: left;
    white-space: normal;
}
.structure-action-menu button:hover { background: #edf4f6; }
.structure-action-menu .structure-action-danger { color: #9a2f2f; }
.structure-action-menu .structure-action-danger:hover { background: #f9eeee; }
.pending-structure-row { background: #f2faf5; }
.pending-structure-category .category-row th { background: #dff1e5; }
.pending-structure-category .category-row > .structure-action-cell { background: #dff1e5; }

.structure-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 18px 48px rgb(23 49 59 / 20%);
}
.structure-dialog::backdrop { background: rgb(18 47 56 / 35%); }
.structure-dialog h2 { margin: 0 0 16px; }
.structure-dialog label { display: grid; gap: 5px; margin-top: 12px; font-weight: 650; }
.structure-dialog input {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #aebfc5;
    border-radius: 7px;
    font: inherit;
}
.structure-dialog fieldset {
    margin: 18px 0 0;
    padding: 0 14px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.structure-dialog legend { padding: 0 6px; font-weight: 750; }
.structure-dialog-category { margin: -8px 0 4px; color: var(--muted); }
.structure-dialog-error { min-height: 1.4em; margin: 10px 0 0; color: #a42626; }
.structure-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Compact editor controls share the 52px search toolbar. */
.desktop-secondary-bar { gap: 12px; }
.desktop-secondary-bar .site-header-search { flex: 0 1 320px; order: 0; }
.desktop-secondary-bar .draft-summary {
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    min-width: 0;
}
.desktop-secondary-bar .draft-summary-list { flex-wrap: nowrap; gap: 12px; }
.desktop-secondary-bar .draft-summary-details > summary { display: none; }
.desktop-secondary-bar .draft-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin: 0 0 0 auto;
}
.desktop-secondary-bar .draft-actions button { white-space: nowrap; }
.draft-editor-controls:has(.draft-save-message:empty) { display: none; }
@media (max-width: 1599px) {
    .desktop-secondary-bar .draft-summary { flex: 0 0 auto; position: relative; }
    .desktop-secondary-bar .draft-summary-details > summary {
        display: list-item;
        cursor: pointer;
        font-size: 13px;
        color: var(--text);
    }
    .desktop-secondary-bar .draft-summary-details[open] .draft-summary-list {
        position: absolute;
        top: calc(100% + 14px);
        left: 0;
        width: min(340px, calc(100vw - 24px));
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: #fff;
        display: grid;
        box-shadow: 0 8px 20px rgb(23 49 59 / 12%);
    }
}
@media (max-width: 760px) {
    .desktop-secondary-bar { gap: 6px; padding-inline: 6px; }
    .desktop-secondary-bar .site-header-search { flex: 1 1 120px; }
    .desktop-secondary-bar .draft-summary-details > summary { font-size: 11px; max-width: 64px; }
    .desktop-secondary-bar .draft-summary-details[open] .draft-summary-list {
        position: fixed;
        top: 78px;
        left: 8px;
        right: 8px;
        width: auto;
    }
    .desktop-secondary-bar .draft-actions { gap: 4px; }
    .desktop-secondary-bar .draft-actions button { padding: 4px 6px; font-size: 11px; max-width: 90px; white-space: normal; line-height: 1.15; }
}

.desktop-secondary-bar .draft-actions { align-items: center; gap: 8px; }
.desktop-secondary-bar .draft-actions :is(.draft-reset-action, .draft-save-action) {
    flex: 0 0 auto;
    height: 32px;
    min-height: 32px;
    max-width: none;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.desktop-secondary-bar .draft-reset-action { background: transparent; color: #536b79; }
.desktop-secondary-bar .draft-reset-action:hover:not(:disabled) { background: #e5edf2; color: #254c66; }
.desktop-secondary-bar .draft-reset-action:active:not(:disabled) { background: #d4e2ea; color: #173e5c; }
.desktop-secondary-bar .draft-save-action { background: #004e89; color: #fff; }
.desktop-secondary-bar .draft-save-action:hover:not(:disabled) { background: #1a659e; }
.desktop-secondary-bar .draft-save-action:active:not(:disabled) { background: #003f70; }
.desktop-secondary-bar .draft-actions :is(.draft-reset-action, .draft-save-action):focus-visible {
    outline: 2px solid #1a659e;
    outline-offset: 2px;
}
.desktop-secondary-bar .draft-actions :is(.draft-reset-action, .draft-save-action):disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 760px) {
    .desktop-secondary-bar .site-header-search { min-width: min(120px, 30vw); }
    .desktop-secondary-bar .draft-actions {
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 0;
        padding: 3px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
    }
}
