/* Native vector text remains sharp at every screen size and zoom level. */
#notice-preview-vector {display:block;width:100%;height:auto}
#notice-preview-canvas[hidden] {display:none!important}
.notice-zoom-open {width:100%;min-height:44px;padding:10px 16px;margin-top:14px;background:#f4f5ec;border:1px solid #cdd8c2;border-radius:6px;color:#285642;font-weight:600;cursor:pointer}
.notice-mobile-tabs,.notice-mobile-tabs[hidden] {display:none}
.notice-zoom-dialog {padding:0;border:1px solid #d7decf;border-radius:12px;width:min(920px,calc(100vw - 24px));max-width:calc(100vw - 24px);height:min(92dvh,1000px);max-height:94dvh;background:#f1f3eb;color:#254938;box-shadow:0 18px 70px #0003;overflow:hidden}
.notice-zoom-dialog::backdrop {background:#13251dd9}
.notice-zoom-toolbar {display:flex;gap:10px;align-items:center;padding:12px 16px;background:#fff;border-bottom:1px solid #d9e0d2}
.notice-zoom-toolbar strong {margin-right:auto;font-size:15px}
.notice-zoom-toolbar button {min-height:44px;padding:8px 12px;border:1px solid #c9d6bf;background:white;border-radius:5px;color:#27503d;cursor:pointer;font-size:13px}
.notice-zoom-help {margin:0;padding:8px 16px;font-size:12px;color:#657660}
.notice-zoom-stage {height:calc(100% - 110px);overflow:auto;padding:16px;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-x pan-y pinch-zoom}
.notice-zoom-stage svg {display:block;width:min(100%,600px);height:auto;margin:0 auto;background:#fff;box-shadow:0 4px 20px #213a2415}
.notice-zoom-stage.is-magnified svg {width:720px;max-width:none;margin:0 auto}
.notice-mobile-tabs button:focus-visible,.notice-zoom-open:focus-visible,.notice-zoom-toolbar button:focus-visible {outline:3px solid #ac9058;outline-offset:3px}
@media(max-width:992px) {
    .notice-tabs-ready .notice-mobile-tabs {display:grid;grid-template-columns:1fr 1fr;gap:5px;position:sticky;top:var(--notice-header-height,112px);z-index:20;background:#f5f6ee;padding:6px;border:1px solid #d5dfce;border-radius:8px;margin:16px 0}
    .notice-mobile-tabs button {border:0;border-radius:5px;min-height:46px;padding:10px;color:#5c725b;background:transparent;font-size:14px;font-weight:700;cursor:pointer}
    .notice-mobile-tabs button[aria-pressed=true] {background:#25533f;color:#fff;box-shadow:0 2px 5px #234c2917}
    .notice-tabs-ready[data-notice-pane=form] #notice-preview-panel,.notice-tabs-ready[data-notice-pane=preview] #generator-form {display:none}
    .notice-tabs-ready[data-notice-pane=preview] .generator-wrapper {margin-top:12px}
    #notice-preview-panel {position:static}
    .notice-tabs-ready #notice-preview-box {max-width:420px}
    .notice-tabs-ready .preview-box-wrapper {padding:12px 0}
    .notice-tabs-ready .preview-outer {padding:14px}
    .preview-title-bar {gap:10px;align-items:start}
    #preview-lunar-status {max-width:150px;text-align:right}
}
@media print {
    .notice-mobile-tabs,.notice-zoom-open,.notice-zoom-dialog {display:none!important}
    .notice-tabs-ready #generator-form {display:none!important}
    .notice-tabs-ready #notice-preview-panel {display:block!important}
    #notice-preview-vector {display:none!important}
    #notice-preview-canvas[hidden] {display:block!important}
}
/* Override generic public button sizing only inside these controls. */
.hkf-public-design .notice-zoom-toolbar {gap:8px}
.hkf-public-design .notice-zoom-toolbar strong {white-space:nowrap;flex:1 0 auto;font-size:14px}
.hkf-public-design .notice-zoom-toolbar button {width:auto!important;flex:0 0 auto;min-width:0;padding:8px 10px!important;background:#fff!important;color:#28523e!important;box-shadow:none!important;font-size:12px!important}
@media(max-width:992px) {
    .hkf-public-design .notice-mobile-tabs button[aria-pressed=false] {background:transparent!important;color:#62775d!important;box-shadow:none!important}
    .hkf-public-design .notice-mobile-tabs button[aria-pressed=true] {background:#25533f!important;color:white!important}
    #preview-lunar-status {max-width:125px;font-size:11px!important;line-height:1.7}
}
/* The global theme's five :not() selectors require ID-scoped overrides here. */
#notice-toggle-zoom,#notice-close-zoom {background:#fff!important;color:#28523e!important;border-color:#c9d6bf!important}
@media(max-width:992px) {
    #top .notice-mobile-tabs button[aria-pressed=false] {background:transparent!important;color:#62775d!important;border-color:transparent!important}
    #top .notice-mobile-tabs button[aria-pressed=true] {background:#25533f!important;color:white!important}
}
#preview-lunar-status {text-wrap:balance}
.notice-religion-consent {margin-top:16px;align-items:flex-start;font-size:13px;line-height:1.8}
#notice-religious-wording {width:18px;height:18px;flex:0 0 18px;margin-top:3px;accent-color:#25533f}
.notice-optional-fields {border-top:1px solid #e0e5d9;padding-top:14px;margin-top:18px;font-size:13px}
.notice-optional-fields summary {cursor:pointer;color:#305441;padding:8px 0}
.notice-optional-fields label {display:block;margin-top:12px;margin-bottom:6px}

/* Fit the live preview to the viewport; export dimensions remain unchanged. */
@media screen {
    #notice-preview-panel {top:calc(var(--notice-header-height,112px) + 8px);gap:0;min-height:0}
    #notice-preview-panel .preview-outer {box-sizing:border-box;width:100%;height:calc(100dvh - var(--notice-header-height,112px) - 20px);padding:14px;min-height:0;overflow:auto}
    #notice-preview-panel .preview-title-bar {flex-shrink:0;margin-bottom:8px;padding-bottom:8px}
    #notice-preview-panel .preview-box-wrapper {flex:1 1 0;min-height:60px;padding:8px;box-sizing:border-box;overflow:hidden}
    #notice-preview-panel #notice-preview-box {height:100%;width:100%;max-width:none;background:transparent;box-shadow:none}
    #notice-preview-panel #notice-preview-vector {height:100%;width:100%;object-fit:contain}
    #notice-preview-panel .notice-zoom-open {flex-shrink:0;margin-top:8px;min-height:40px;padding:6px 12px}
    #notice-preview-panel .notice-size-caption {flex-shrink:0;margin:6px 0;font-size:11px}
    #notice-preview-panel .action-grid {flex-shrink:0;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:4px}
    #notice-preview-panel .btn-action {grid-column:auto;white-space:normal;overflow-wrap:anywhere;min-width:0;min-height:44px;padding:7px 8px!important;font-size:13px}
    #notice-preview-panel .note-warning {max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;flex-shrink:0;margin-top:8px;padding:6px;font-size:11px}
    #notice-preview-panel .notice-preview-link {flex-shrink:0;margin-top:6px}
    #notice-preview-panel .export-status:empty {display:none}
}
@media screen and (max-width:992px) {
    #notice-preview-panel {position:static}
    .notice-tabs-ready #notice-preview-panel .preview-outer {height:calc(100dvh - var(--notice-header-height,112px) - 92px);padding:10px}
    #notice-preview-panel .note-warning,#notice-preview-panel .notice-size-caption {display:none}
    #notice-preview-panel .btn-action {font-size:12px}
}
/* Compact family editor; details are edited in one accessible native dialog. */
.notice-family-toolbar,.notice-draft-actions {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0}
.notice-family-toolbar label {margin:0;font-size:14px}
.notice-family-toolbar select {width:auto;max-width:100%;padding:8px;border:1px solid #ced9ce;background:#fff;border-radius:5px;color:#244e40;font:inherit}
.notice-family-toolbar button,.notice-draft-actions button {width:auto!important;min-height:40px;padding:7px 12px!important;border:1px solid #cbd7cd!important;border-radius:5px;background:#f5f6ef!important;color:#24513f!important;font:inherit;font-size:14px!important;cursor:pointer}
.notice-family-list {list-style:none;margin:0!important;padding:0!important;display:grid;gap:8px}
.notice-family-person {display:flex;gap:8px;align-items:center;padding:10px;border:1px solid #d9e1d5;border-radius:8px;background:#fafbf7;min-width:0}
.notice-family-person-text {flex:1;min-width:0;display:grid;gap:3px;overflow-wrap:anywhere}
.notice-family-person-text strong {font-size:16px;color:#214d3e}
.notice-family-person-text span,.notice-family-person-text small {font-size:13px;line-height:1.5;color:#5a6b5e}
.notice-family-person button {width:auto!important;min-height:40px;min-width:36px;padding:6px 8px!important;border:1px solid #d3ddcf!important;border-radius:5px;background:white!important;color:#2c5544!important;font:inherit;font-size:13px!important;cursor:pointer}
.notice-family-person .notice-family-handle {cursor:grab;border:0!important;background:transparent!important;color:#8c997e!important}
.notice-family-actions {display:flex;gap:4px;flex-wrap:wrap;justify-content:end}
.notice-family-person button:disabled {opacity:.4;cursor:default}
.notice-family-empty {font-size:14px;color:#627361}
.notice-family-dialog {padding:0;width:min(480px,calc(100vw - 24px));max-height:calc(100dvh - 24px);border:1px solid #cbd8cb;border-top:3px solid #b39b65;border-radius:12px;color:#214d3e;background:#fbfaf6;overflow:auto;box-shadow:0 18px 60px #132d2826}
.notice-family-dialog::backdrop {background:#183d347d}
.notice-family-dialog header,.notice-family-dialog footer {padding:14px 18px;background:white}
.notice-family-dialog header {border-bottom:1px solid #dce3d7}
.notice-family-dialog h2 {font-size:20px;margin:0}
.notice-family-dialog-body {padding:16px 18px;display:grid;gap:8px}
.notice-family-dialog-body label {font-size:15px;font-weight:600}
.notice-family-dialog-body input:not([type=checkbox]),.notice-family-dialog-body select,.notice-family-dialog-body textarea {width:100%;box-sizing:border-box;min-height:44px;border:1px solid #c5d4c3;border-radius:5px;padding:9px;color:#234e40;background:#fff;font:inherit}
.notice-family-dialog footer {position:sticky;bottom:0;display:flex;justify-content:end;gap:8px;border-top:1px solid #dce3d7}
.notice-family-dialog footer button {min-height:44px;border:1px solid #becfbe;border-radius:5px;padding:8px 16px;color:#24513f;background:white;font:inherit;cursor:pointer}
.notice-family-dialog footer button:last-child {background:#24513f;color:white}
.notice-family-dialog [hidden] {display:none!important}
.notice-family-dialog button:focus-visible,.notice-family-person button:focus-visible,.notice-family-toolbar :focus-visible,.notice-draft-actions button:focus-visible {outline:3px solid #af945b;outline-offset:2px}
.notice-family-dialog #notice-family-error {color:#a23527;margin:0}
.notice-quality-confirm {display:flex;gap:10px;align-items:start;line-height:1.6}
.notice-quality-confirm input {margin-top:5px;flex-shrink:0;accent-color:#24513f}
#notice-quality-issues {padding-left:20px;margin:0 0 10px;font-size:15px;line-height:1.8}
#notice-content-format {margin-bottom:12px}
@media(max-width:520px) {.notice-family-person {flex-wrap:wrap}.notice-family-person-text {flex-basis:calc(100% - 55px)}.notice-family-actions {width:100%;padding-left:36px}.notice-family-actions button {min-height:44px;flex:1}.notice-family-toolbar select {flex:1}.notice-draft-actions span {flex-basis:100%}}
@media print {.notice-family-dialog {display:none!important}}
/* Font measurements must not sample an in-flight font-size/height transition. */
#generator-form *,#notice-preview-panel *,.notice-family-dialog * {transition-property:color,background-color,border-color,box-shadow!important}

/* A4 geometry is independent of the chosen stationery. */
.background-picker {display:grid;grid-template-columns:repeat(auto-fit,minmax(76px,1fr));gap:10px}
.background-picker button {width:100%;height:auto;min-height:104px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:7px 4px!important;border:2px solid #d3d9cf!important;background:#fff!important;color:#334c3d!important;box-shadow:none!important}
.background-picker img {width:42px;height:auto;aspect-ratio:210/297;object-fit:contain}
.background-picker span {font-size:12px;line-height:1.5}
.background-picker button[aria-pressed=true] {border-color:#285641!important;background:#f0f5ec!important;outline:2px solid #285641;outline-offset:2px}
.background-picker button:focus-visible {outline:3px solid #a58548;outline-offset:3px}
#notice-example-label,#notice-zoom-example-label {margin:4px 0 10px;color:#75613c;font-size:13px;line-height:1.6;flex-shrink:0}
#notice-zoom-example-label {padding:0 16px;margin:4px 0}
@media screen {
    #notice-preview-panel .preview-box-wrapper {flex:0 0 auto;overflow:visible;padding:10px;width:100%}
    #notice-preview-panel #notice-preview-box {width:100%;height:auto;max-width:560px;aspect-ratio:210/297;margin:auto;flex:none;background:#fff;box-shadow:0 4px 20px #27372b18}
    #notice-preview-panel #notice-preview-vector {width:100%;height:auto;aspect-ratio:210/297}
}
@media print {
    @page {size:A4 portrait;margin:0}
    html,body,main.container {width:210mm!important;margin:0!important;padding:0!important;background:#fff!important}
    .preview-outer,.preview-box-wrapper,#notice-preview-panel {height:auto!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important}
    #notice-example-label,#preview-lunar-status,.notice-resume-banner,main.container>p {display:none!important}
    #notice-preview-box {width:210mm!important;height:297mm!important;max-width:none!important;margin:0!important;padding:0!important;aspect-ratio:210/297;break-inside:avoid}
    #notice-preview-canvas[hidden] {display:block!important;width:210mm!important;height:297mm!important;print-color-adjust:exact;-webkit-print-color-adjust:exact}
    body.notice-example-active .generator-wrapper {display:none!important}
}
/* Sample label and toolbar share the dialog height; the paper retains its own scroll area. */
.notice-zoom-dialog[open] {display:flex;flex-direction:column}
.notice-zoom-toolbar,.notice-zoom-help {flex-shrink:0}
.notice-zoom-stage {flex:1 1 auto;min-height:0;height:auto;width:100%;box-sizing:border-box}

/* One editor and one completion state, shared across desktop and mobile. */
.notice-tabs-ready .notice-mobile-tabs {display:flex;gap:8px;margin:16px 0;padding:5px;background:#f3f5ed;border:1px solid #d8dfd1;border-radius:7px}
.notice-mobile-tabs button {flex:1;min-height:44px;padding:8px 12px;border:0;border-radius:4px;background:transparent;color:#365744;font:inherit;cursor:pointer}
.notice-mobile-tabs button[aria-pressed=true] {background:#285641;color:#fff}
.notice-tabs-ready[data-notice-pane=form] #notice-preview-panel {display:block}
#generator-form[hidden],#notice-template-picker[hidden],#notice-edit-controls[hidden],#notice-completion-controls[hidden] {display:none!important}
.notice-tabs-ready[data-notice-pane=preview] .generator-wrapper {grid-template-columns:minmax(0,680px);justify-content:center}
#notice-template-picker {width:100%;padding:12px 0;flex-shrink:0}
#notice-template-heading {font-size:14px;margin:0 0 10px;color:#365744;font-weight:600}
#notice-template-picker .background-picker {grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
#notice-template-picker .background-picker button {min-height:88px;padding:5px 3px!important}
#notice-template-picker .background-picker img {width:34px;height:auto}
#notice-edit-controls,#notice-completion-controls {width:100%;flex-shrink:0;margin-top:12px;text-align:center}
#notice-edit-controls .btn-action,#notice-completion-controls .btn-action {width:100%;min-height:48px}
#notice-preview-panel .notice-text-action,#generator-form .notice-text-action {display:inline-block;width:auto!important;min-height:40px;padding:8px 2px!important;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;color:#5c7062!important;font-size:13px;font-weight:400;line-height:1.8;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
#notice-preview-panel #notice-open-zoom {margin-top:6px;flex-shrink:0}
#generator-form .notice-reset-action {margin-top:16px;color:#777568!important}
#notice-return-edit {margin-top:8px}
.notice-text-action:focus-visible {outline:3px solid #a58548;outline-offset:3px}
@media print {
    #notice-template-picker,#notice-edit-controls,#notice-completion-controls,#obituary-export-status {display:none!important}
}
#top .notice-mobile-tabs button[aria-pressed=false] {background:transparent!important;color:#62775d!important;box-shadow:none!important;border-color:transparent!important}
#top .notice-mobile-tabs button[aria-pressed=true] {background:#25533f!important;color:#fff!important;box-shadow:none!important;border-color:transparent!important}
/* Style is a design choice over one form, independent of the current locale. */
#notice-style-controls {display:flex;gap:6px;padding:5px;margin-bottom:14px;border:1px solid #d4dccf;border-radius:8px;background:#f2f5ed}
#notice-style-controls button {flex:1;min-height:44px;padding:9px 12px!important;border:0!important;border-radius:5px;background:transparent!important;color:#42604b!important;box-shadow:none!important;font:inherit;font-size:15px;cursor:pointer}
#notice-style-controls button[aria-pressed=true] {background:#285641!important;color:#fff!important}
#notice-style-controls button:focus-visible {outline:3px solid #a58548;outline-offset:2px}
#notice-western-fields[hidden],#notice-template-picker button[hidden] {display:none!important}
#notice-western-fields label {display:block;margin:12px 0 6px}
#notice-western-fields textarea {resize:vertical}
#western-portrait-file {max-width:100%;font-size:13px}
#western-portrait-status {font-size:13px;line-height:1.6}
#notice-template-picker .notice-open-swatch {display:block;box-sizing:border-box;width:34px;height:48px;background:#fff;border:1px solid #d7dbd3;box-shadow:0 1px 3px #0001;padding:0}

.is-draft-locked>#notice-style-controls {opacity:.65}
/* Reserve both picker rows so switching between eight Chinese and four Western choices does not move the completion action. */
#notice-template-picker .background-picker {min-height:216px;grid-template-rows:repeat(2,minmax(104px,1fr));align-content:stretch}
.notice-time-fields{border:0;margin:0;padding:0;min-width:0}
.notice-time-fields legend{padding:0;font-size:14px;font-weight:600;margin-bottom:8px}
.notice-time-selectors{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.notice-time-selectors label{display:grid;gap:5px;font-size:13px}
.notice-time-selectors select{width:100%;min-height:44px;padding:8px;border:1px solid #cbd5cb;border-radius:5px;background:#fff;color:#234b3b;font:inherit}
.notice-time-fields p[hidden]{display:none!important}
.notice-time-fields p span{display:block;white-space:pre-wrap;overflow-wrap:anywhere}

.notice-family-dialog-body textarea { resize:vertical; min-height:84px; }

.notice-sample-controls {display:flex;align-items:center;justify-content:center;gap:10px;margin:10px 0 4px}
.notice-sample-controls[hidden] {display:none}
.notice-sample-controls button {flex:none;width:44px;height:44px;border:1px solid #9caf9e;border-radius:6px;background:#fffdf8;color:#294e3c;font-size:28px;line-height:1;cursor:pointer}
#notice-sample-position {min-width:0;text-align:center;font-size:14px;font-weight:600}
.notice-sample-controls button:focus-visible {outline:3px solid #9c752a;outline-offset:2px}
/* The fixed action follows actual stacked layout geometry, not a phone model. */
#notice-mobile-preview{position:fixed;z-index:45;inset:auto 16px max(12px,env(safe-area-inset-bottom));width:calc(100% - 32px);min-height:48px;padding:12px;border:1px solid #54745e;border-radius:8px;background:#254d40;color:#fff;font:600 16px/1.4 system-ui;box-shadow:0 4px 20px #15372930;cursor:pointer}
#notice-mobile-preview[hidden]{display:none!important}.notice-has-preview-action{padding-bottom:80px!important}.notice-has-preview-action .public-floating-support:not(.assistant-open){display:none!important}
#notice-zoom-dialog[open]{display:flex;flex-direction:column}#notice-zoom-dialog .notice-zoom-stage{flex:1;min-height:0;height:auto;box-sizing:border-box}#notice-zoom-dialog .notice-zoom-toolbar{flex-wrap:wrap;flex-shrink:0}#notice-zoom-dialog.is-mobile-notice-preview{inset:0;margin:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}#notice-zoom-dialog .notice-zoom-stage svg{max-height:none}#notice-zoom-dialog #notice-zoom-example-label[hidden]{display:none}
.notice-device-guidance{color:#526a59;font-size:14px;line-height:1.7;margin:16px 0}
@media print{#notice-mobile-preview{display:none!important}}
