.hb-dialog, .hb-preview-page {
    --hb-bg: var(--ed-bg, #0a0a0c);
    --hb-surface: var(--ed-panel, #101013);
    --hb-surface-2: var(--ed-raised, #19191e);
    --hb-border: var(--ed-line, #29292f);
    --hb-border-strong: #666670;
    --hb-text: var(--ed-text, #ededf0);
    --hb-muted: var(--ed-muted, #a2a2ad);
    --hb-accent: var(--ed-accent, #bdd3c8);
    --hb-accent-strong: var(--ed-accent, #bdd3c8);
    --hb-success: var(--ed-accent, #bdd3c8);
    --hb-warning: #d5c39e;
    --hb-danger: #edb1a3;
    --hb-radius: 8px;
    --hb-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}

.hb-dialog {
    width: min(1180px, calc(100vw - 24px));
    max-width: 1180px;
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--hb-border);
    border-radius: 16px;
    color: var(--hb-text);
    background: var(--hb-bg);
    box-shadow: var(--hb-shadow);
}

.hb-dialog::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(5px); }
.hb-dialog [hidden] { display: none !important; }
.hb-dialog-inner { display: flex; flex-direction: column; min-height: min(760px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.hb-dialog-header, .hb-toolbar, .hb-panel-heading, .hb-subheading, .hb-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hb-dialog-header { padding: 20px 24px 12px; border-bottom: 1px solid var(--hb-border); }
.hb-eyebrow { margin: 0 0 3px; color: var(--hb-accent); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.hb-dialog-title, .hb-public-title { margin: 0; font: 700 25px/1.15 Inter, system-ui, sans-serif; letter-spacing: -.02em; }
.hb-toolbar { flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--hb-border); background: var(--hb-surface-2); }
.hb-toolbar-actions, .hb-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hb-status { min-width: 0; color: var(--hb-muted); font-size: 13px; line-height: 1.45; }
.hb-status-error { color: var(--hb-danger); }
.hb-status-success { color: var(--hb-success); }
.hb-status-warning { color: var(--hb-warning); }
.hb-dirty { padding: 4px 8px; border-radius: 999px; color: var(--hb-warning); background: rgba(213, 195, 158, .1); font-size: 12px; white-space: nowrap; }
.hb-button, .hb-tab, .hb-section-item, .hb-section-button, .hb-icon-button { font: inherit; cursor: pointer; }
.hb-button { min-height: 36px; padding: 8px 12px; border: 1px solid transparent; border-radius: 9px; color: var(--hb-text); font-size: 13px; font-weight: 650; transition: border-color .16s ease, background .16s ease, color .16s ease; }
.hb-button:hover, .hb-button:focus-visible { border-color: var(--hb-border-strong); }
.hb-button-primary { background: var(--hb-accent-strong); color: #18251e; border-color: var(--hb-accent-strong); }
.hb-button-primary:hover, .hb-button-primary:focus-visible { background: #abc6b8; color: #18251e; border-color: #abc6b8; }
.hb-button-secondary { border-color: var(--hb-border); background: var(--hb-surface-2); }
.hb-button-success { background: var(--hb-surface-2); border-color: var(--hb-border-strong); color: var(--hb-accent); }
.hb-button-warning { background: rgba(213, 195, 158, .1); border-color: rgba(213, 195, 158, .4); color: var(--hb-warning); }
.hb-button-quiet { padding-inline: 8px; color: var(--hb-muted); background: transparent; }
.hb-icon-button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--hb-border); border-radius: 8px; color: var(--hb-muted); background: transparent; font-size: 20px; line-height: 1; }
.hb-icon-button:hover, .hb-icon-button:focus-visible { border-color: var(--hb-danger); color: var(--hb-danger); }
.hb-close { flex: 0 0 auto; font-size: 24px; }
.hb-tabs { display: flex; gap: 3px; min-height: 50px; padding: 8px 24px 0; overflow-x: auto; border-bottom: 1px solid var(--hb-border); scrollbar-width: thin; }
.hb-tab { flex: 0 0 auto; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; color: var(--hb-muted); background: transparent; font-size: 13px; }
.hb-tab:hover, .hb-tab.is-active { color: var(--hb-text); border-bottom-color: var(--hb-accent); }
.hb-panel { flex: 1 1 auto; min-height: 0; padding: 20px 24px 28px; overflow: auto; }
.hb-panel-title { margin: 0; font-size: 18px; }
.hb-version { color: var(--hb-muted); font-size: 12px; }
.hb-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.hb-form-grid-compact { margin: 12px 0; }
.hb-field, .hb-fieldset, .hb-rows, .hb-links-editor { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.hb-fieldset { min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); }
.hb-fieldset legend { padding: 0 4px; color: var(--hb-muted); font-size: 12px; }
.hb-label { color: var(--hb-muted); font-size: 12px; font-weight: 650; }
.hb-help { color: var(--hb-muted); font-size: 11px; line-height: 1.35; }
.hb-field input, .hb-field textarea, .hb-field select, .hb-panel input, .hb-panel textarea, .hb-panel select, .hb-public-controls input, .hb-public-controls select, .hb-array-card input, .hb-array-card textarea, .hb-array-card select, .hb-report-card select, .hb-release-box select { box-sizing: border-box; width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--hb-border); border-radius: 8px; outline: 0; color: var(--hb-text); background: #0b0b0e; font: inherit; font-size: 13px; }
.hb-field textarea, .hb-array-card textarea { resize: vertical; }
.hb-panel input:focus, .hb-panel textarea:focus, .hb-panel select:focus, .hb-public-controls input:focus, .hb-public-controls select:focus { border-color: var(--hb-accent); box-shadow: 0 0 0 3px rgba(189, 211, 200, .13); }
.hb-check { display: inline-flex; align-items: center; gap: 8px; margin: 3px 0 14px; color: var(--hb-muted); font-size: 13px; }
.hb-check input { width: 17px !important; height: 17px; accent-color: var(--hb-accent); }
.hb-subheading { margin: 24px 0 12px; }
.hb-subheading h3, .hb-release-box h3 { margin: 0; font-size: 15px; }
.hb-section-layout { display: grid; grid-template-columns: minmax(185px, .32fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hb-section-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hb-section-item { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; padding: 11px 12px; border: 1px solid var(--hb-border); border-radius: 9px; color: var(--hb-muted); background: var(--hb-surface-2); text-align: left; }
.hb-section-item strong, .hb-section-item small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-section-item small { color: var(--hb-muted); font-size: 11px; }
.hb-section-item.is-selected { border-color: var(--hb-border-strong); color: var(--hb-text); background: #24242a; }
.hb-section-detail, .hb-block-card, .hb-array-card, .hb-release-box, .hb-report-card { min-width: 0; padding: 14px; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); background: var(--hb-surface); }
.hb-block-card + .hb-block-card, .hb-array-card + .hb-array-card, .hb-report-card + .hb-report-card { margin-top: 10px; }
.hb-block-head { margin-bottom: 8px; }
.hb-block-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-row-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 6px; margin-top: 6px; }
.hb-links-editor, .hb-rows { margin-top: 14px; }
.hb-empty { margin: 16px 0; color: var(--hb-muted); font-size: 13px; }
.hb-muted { color: var(--hb-muted); }
.hb-table-wrap { overflow-x: auto; }
.hb-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; }
.hb-table th, .hb-table td { padding: 9px 10px; border-bottom: 1px solid var(--hb-border); text-align: left; vertical-align: top; }
.hb-table th { color: var(--hb-muted); font-size: 11px; font-weight: 650; text-transform: uppercase; }
.hb-release-box { margin-top: 20px; }
.hb-release-box > * + * { margin-top: 10px; }
.hb-report-meta { color: var(--hb-muted); font-size: 12px; }
.hb-report-card p { margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hb-close-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 12px 24px; border-top: 1px solid rgba(213, 195, 158, .35); color: var(--hb-warning); background: var(--hb-surface-2); font-size: 13px; }
.hb-close-confirm span { flex: 1 1 220px; }
.hb-preview-surface { margin-top: 14px; padding: 0; }

/* Public projection / standalone preview */
.hb-preview-page { min-height: 100dvh; margin: 0; padding: 24px; color: var(--hb-text); background: var(--hb-bg); font-family: Inter, system-ui, sans-serif; }
.hb-preview-page-body { max-width: 980px; margin: 20px auto 0; }
.hb-standalone-toolbar { display: flex; max-width: 980px; margin: 0 auto; align-items: center; justify-content: space-between; gap: 12px; }
.hb-public { max-width: 980px; margin: 0 auto; }
.hb-public, .hb-public button, .hb-public input, .hb-public select { font-size: 16px; }
.hb-public-header { padding: 20px 0 16px; }
.hb-public-title { font-size: clamp(25px, 4vw, 40px); }
.hb-public-title, .hb-public-section h2, .hb-public-section h3 { overflow-wrap: anywhere; }
.hb-public-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hb-public-controls input, .hb-public-controls select { min-height: 44px; }
.hb-public-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 18px; }
.hb-public-tab { min-height: 44px; padding: 8px 12px; border: 1px solid var(--hb-border); border-radius: 8px; color: var(--hb-muted); background: var(--hb-surface-2); font: inherit; cursor: pointer; }
.hb-public-tab.is-active { border-color: var(--hb-border-strong); color: var(--hb-text); background: #24242a; }
.hb-public-controls .hb-search { flex: 1 1 240px; }
.hb-search-site, .hb-contact-filter { flex: 0 1 190px; }
.hb-public-sections { display: flex; flex: 1 1 100%; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
.hb-section-button { flex: 0 0 auto; min-height: 44px; padding: 8px 10px; border: 1px solid var(--hb-border); border-radius: 8px; color: var(--hb-muted); background: var(--hb-surface-2); font-size: 16px; }
.hb-section-button.is-active { border-color: var(--hb-border-strong); color: var(--hb-text); background: #24242a; }
.hb-public-alert { margin: 8px 0; padding: 13px 14px; border-left: 3px solid var(--hb-warning); border-radius: 8px; background: rgba(213, 195, 158, .08); }
.hb-public-alert p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hb-public-section { margin: 14px 0; padding: clamp(14px, 3vw, 24px); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); background: var(--hb-surface); }
.hb-public-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hb-newly-moved { margin: 14px 0 22px; padding: 16px; border: 1px solid var(--hb-border-strong); border-radius: var(--hb-radius); background: var(--hb-surface-2); }
.hb-newly-moved h2 { margin: 0 0 4px; font-size: 20px; }
.hb-newly-moved > .hb-public-cards { margin-top: 12px; }
.hb-public-card { min-width: 0; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); background: var(--hb-surface); }
.hb-card-button { display: flex; width: 100%; min-height: 160px; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border: 0; border-radius: inherit; color: var(--hb-text); background: transparent; text-align: left; cursor: pointer; }
.hb-card-button:hover, .hb-card-button:focus-visible { background: #222227; }
.hb-card-button h2 { margin: 0; font-size: 18px; }
.hb-card-short { margin: 0; color: var(--hb-text); line-height: 1.45; overflow-wrap: anywhere; }
.hb-card-date { color: var(--hb-muted); font-size: 11px; }
.hb-public-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hb-public-section h2 { margin: 0; font-size: clamp(19px, 3vw, 27px); }
.hb-public-section h3 { margin: 16px 0 6px; font-size: 16px; }
.hb-public-lead { color: var(--hb-text); font-size: 15px; line-height: 1.6; }
.hb-public-block { line-height: 1.65; overflow-wrap: anywhere; }
.hb-public-block p { white-space: pre-wrap; }
.hb-public-block ul, .hb-public-block ol { padding-left: 22px; }
.hb-public-block li + li { margin-top: 4px; }
.hb-public-block dl { display: grid; grid-template-columns: minmax(100px, .35fr) minmax(0, 1fr); margin: 10px 0; }
.hb-public-block dt, .hb-public-block dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--hb-border); }
.hb-public-block dt { color: var(--hb-muted); font-weight: 650; }
.hb-public-block dd { padding-left: 14px; }
.hb-public-links, .hb-public-sources { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.hb-public a { color: var(--hb-accent); text-decoration: underline; text-underline-offset: 2px; }
.hb-freshness { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.hb-freshness-current { color: var(--hb-accent); background: rgba(189, 211, 200, .1); }
.hb-freshness-due { color: var(--hb-warning); background: rgba(213, 195, 158, .1); }
.hb-contact-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hb-border); }
.hb-contact-line strong { margin-right: auto; }
.hb-contact-line span { color: var(--hb-muted); }
.hb-public .hb-button { min-height: 44px; }
.hb-public-hotline { margin: 24px 0 8px; padding: 16px; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); background: var(--hb-surface-2); }
.hb-public-hotline h2 { margin: 0 0 6px; font-size: 17px; }
.hb-public-hotline .hb-contact-line:last-child { border-bottom: 0; }

@media (max-width: 700px) {
    .hb-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 12px; }
    .hb-dialog-inner { min-height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); }
    .hb-dialog-header, .hb-toolbar, .hb-panel-heading, .hb-tabs, .hb-panel { padding-left: 14px; padding-right: 14px; }
    .hb-dialog-title { font-size: 21px; }
    .hb-toolbar { align-items: flex-start; }
    .hb-toolbar-actions { width: 100%; }
    .hb-toolbar-actions .hb-button { flex: 1 1 auto; }
    .hb-form-grid, .hb-section-layout { grid-template-columns: minmax(0, 1fr); }
    .hb-public-cards { grid-template-columns: minmax(0, 1fr); }
    .hb-section-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hb-row-editor { grid-template-columns: minmax(0, 1fr) 34px; }
    .hb-row-editor input:nth-child(2), .hb-row-editor input:nth-child(3) { grid-column: 1; }
    .hb-row-editor .hb-icon-button { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
    .hb-preview-page { padding: 14px; }
    .hb-standalone-toolbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 380px) {
    .hb-section-list { grid-template-columns: minmax(0, 1fr); }
    .hb-toolbar-actions .hb-button { padding-inline: 8px; font-size: 12px; }
    .hb-public-block dl { display: block; }
    .hb-public-block dd { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* The single text field reuses the public typography and VNX surfaces. */
.hb-dialog [data-hb-rich-editor] { min-height: 240px; overflow-wrap: anywhere; }
.hb-dialog [data-hb-rich-editor] table { width: 100%; table-layout: fixed; }
.hb-dialog [data-hb-rich-editor] td, .hb-dialog [data-hb-rich-editor] th { overflow-wrap: anywhere; }
.hb-dialog [data-hb-pending]:not([hidden]) { margin: 0; padding: 8px 24px; }
