.site-main {
    align-items: flex-start;
}

#mainleft,
#mainright {
    flex: 0 0 auto;
}

#mainleft {
    width: 292px;
}

#mainmiddle {
    width: 100%;
    max-width: 950px;
    min-width: 0;
}

/* The document-level date highlight must not cover the active Add event button. */
#mainmiddle.calendar-day-action-raised {
    z-index: 3;
}

#mainright {
    width: 214px;
    padding: 0;
}

#mainMenuMobile,
.mobile-only {
    display: none;
}

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 1100;
    display: none;
    padding: 12px 16px;
    transform: translateX(-50%);
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: white;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.editor-sidebar-spacer,
.editor-actions-spacer {
    height: 105px;
}

.editor-options-heading {
    margin-bottom: 10px;
    padding: 0 12px;
}

.editor-options-heading .eyebrow {
    margin-bottom: 2px;
}

#options-header {
    font-size: 1.55rem;
}

.optionsMenuButton {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--color-ink);
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.optionsMenuButton:hover {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.optionsMenuButtonActive {
    border-color: #cbc9fb;
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    text-decoration: none;
}

.optionsMenuControl {
    display: none;
    margin: -1px 0 8px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.options-menu-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    transition: transform 150ms ease;
}

.optionsMenuButtonActive .options-menu-icon {
    transform: rotate(180deg);
}

.optionsMenuControl h3,
.optionsMenuControl h4 {
    margin-top: 0;
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
    margin-block: 10px;
}

.custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
    cursor: pointer;
}

.custom-select-trigger {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.custom-select-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--color-muted);
    transition: transform 150ms ease;
}

/* Rotating the chevron makes the custom control's open state immediately visible. */
.custom-select.open .custom-select-chevron {
    transform: rotate(180deg);
}

.custom-select-trigger .flag-icon,
.custom-option img.flag-icon {
    width: 20px;
    height: auto;
    margin-right: 10px;
}

.custom-select-search {
    width: calc(100% - 20px);
    margin: 10px;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    display: none;
    width: 100%;
    /* Use the available viewport before introducing a second scrollbar. */
    max-height: min(520px, calc(100dvh - 250px));
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.custom-select.open .custom-options {
    display: block;
}

.custom-option {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}

.custom-option:hover {
    background: var(--color-surface-subtle);
}

.custom-option.hidden {
    display: none;
}

.holiday-type-checkbox {
    flex: 0 0 auto;
    margin: 0;
}

.holiday-type-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.holiday-type-marker {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.holiday-type-marker--national {
    background: rgb(227, 38, 54);
}

.holiday-type-marker--local {
    background: rgb(34, 177, 76);
}

.holiday-type-option {
    margin-bottom: 3px;
}

.holiday-type-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
}

.holiday-type-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
}

.holiday-type-info:hover,
.holiday-type-info:focus-visible {
    color: var(--color-ink);
    background: var(--color-surface-subtle);
}

.holiday-type-info svg {
    display: block;
    width: 15px;
    height: 15px;
}

.holiday-type-hint {
    position: fixed;
    z-index: calc(var(--z-dialog-backdrop) - 1);
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    color: var(--color-ink);
    font-size: 0.8rem;
    line-height: 1.4;
    pointer-events: none;
}

.holiday-type-hint[hidden] {
    display: none;
}

#languageOptionsContainer label,
#holidayLanguageOptionsContainer label {
    color: var(--color-ink);
}

#languageOptionsContainer input[type="radio"]:not(:checked) + label,
#holidayLanguageOptionsContainer input[type="radio"]:not(:checked) + label {
    color: var(--color-muted);
}

.radio-group {
    margin-bottom: 20px;
}

.radio-group div {
    margin-bottom: 10px;
}

.radio-group label {
    margin-left: 5px;
}

#defaultEventHighlightColorHeader {
    transition: background-color 0.5s ease;
}

.editor-actions {
    display: grid;
    gap: 10px;
    user-select: none;
}

.mainMenuItem {
    width: 100%;
    display: inline-block;
    padding: 0;
    text-align: center;
}

.editor-action-button {
    width: 100%;
    min-height: 62px;
    justify-content: flex-start;
    padding: 12px;
    text-align: left;
    white-space: normal;
}

.editor-action-button svg {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
}

.editor-action-button span {
    display: grid;
    gap: 2px;
}

.editor-action-button small {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.78;
}

.calendar-type-tabs {
    width: fit-content;
    display: flex;
    gap: 4px;
    margin: 0 auto 12px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.tab .tablinks {
    float: none;
    min-height: 36px;
    padding: 6px 14px;
    border: 0;
    border-radius: 7px;
    color: var(--color-muted);
    font-weight: 700;
    cursor: pointer;
}

.tab .tablinks:hover {
    border: 0;
    background: var(--color-surface-subtle);
}

.tab .tablinks.active {
    border: 0;
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
}

.calendar-date-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.calendar-date-nav select {
    min-height: 38px;
    padding: 5px 32px 5px 10px;
}

.backForwardButton {
    height: 38px;
    min-width: 40px;
    padding: 5px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    font: inherit;
    vertical-align: middle;
    user-select: none;
    cursor: pointer;
}

.backButton,
.forwardButton {
    border-radius: var(--radius-sm);
}

.calendar-preview-shell {
    position: relative;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    box-shadow: 0 12px 30px rgba(24, 34, 58, 0.09);
    text-align: center;
}

.calendar-preview-status:not([hidden]) {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    width: max-content;
    max-width: calc(100% - 24px);
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-md);
}

#CalendarImageHolder {
    position: relative;
    width: 100%;
    display: inline-block;
    overflow: hidden;
    background: white;
}

/* Day shortcuts sit over the screen preview only; date clicks still open the event list. */
.calendar-day-actions {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.calendar-day-add {
    position: absolute;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
}

.calendar-day-add--active,
.calendar-day-add:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.calendar-day-add:hover { background: var(--color-surface-subtle); }
.calendar-day-add:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.calendar-day-add svg { width: 18px; height: 18px; }

/* A quiet date cue sits over the preview only, outside the printable SVG. */
.calendar-today-marker:not([hidden]) {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    border: 1px solid rgba(15, 159, 143, 0.55);
    border-radius: 2px;
    background: rgba(15, 159, 143, 0.04);
    pointer-events: none;
}

.calendar-today-marker span {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 0 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.88);
    color: #087e73;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

/* Yearly date cells are too narrow for text; the outline and accessible label remain. */
.calendar-today-marker--compact span { display: none; }

/* Photo outlines belong to the editor chrome, outside the rendered calendar. */
.photo-area-outline:not([hidden]) {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    border-radius: 3px;
    pointer-events: none;
}

.photo-area-outline--hover:not([hidden]) {
    border: 2px solid var(--color-primary);
    box-shadow: inset 0 0 0 1px white;
}

.photo-area-outline--selected:not([hidden]) {
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--color-primary);
}

.photo-drop-indicator:not([hidden]) {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-sm);
    background: rgba(245, 245, 255, .86);
    color: var(--color-primary);
    font-weight: 700;
    pointer-events: none;
}

.photo-drop-indicator svg { width: 20px; height: 20px; }

#CalendarImage {
    border-color: var(--color-border-strong) !important;
}

.calendar-output-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.calendar-output-toolbar select,
.calendar-output-toolbar .text-icon-button,
.calendar-output-toolbar .btn {
    min-height: 42px;
}

.orientation-switch {
    display: inline-flex;
    min-height: 42px;
    padding: 3px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
}

.orientation-switch__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 104px;
    padding: 6px 9px;
    border: 0;
    border-radius: calc(var(--radius-sm) - 3px);
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
}

.orientation-switch__option:hover {
    color: var(--color-ink);
}

.orientation-switch__option[aria-pressed="true"] {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.orientation-switch__option svg {
    width: 18px;
    height: 18px;
}

#svgPagesDiv {
    margin: 10px 0 15px;
    text-align: right;
}

#svgPagesDiv:empty {
    display: none;
}

.page-button {
    width: 100px;
    margin-left: 5px;
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
    color: var(--color-ink);
    cursor: pointer;
}

.page-button:hover {
    background: #e2e7f0;
}

.highlighted-page-button {
    border-color: var(--color-accent-hover);
    background: var(--color-accent);
    color: white;
}

#quickPrintButton {
    width: auto;
    margin: 0;
}

.calendar-zoom-controls {
    gap: 6px;
    justify-content: center;
}

/* Photo actions stay in one anchored group instead of following legacy hit rectangles. */
.photo-preview-toolbar:not([hidden]) {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transform: translateX(-50%);
}

.photo-preview-toolbar[hidden] { display: none; }

.photo-preview-toolbar button {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 5px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-ink);
    cursor: pointer;
}

.photo-preview-toolbar button:hover { background: var(--color-surface-subtle); }
.photo-preview-toolbar button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}
.photo-preview-toolbar button[data-photo-control="remove"] {
    margin-left: 2px;
    border-left: 1px solid var(--color-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-danger);
}
.photo-preview-toolbar svg { width: 18px; height: 18px; }


.events-table {
    width: 100%;
    margin-bottom: 8px;
    border-collapse: collapse;
    text-align: left;
}

.events-table th,
.events-table td {
    padding: 6px 4px;
    vertical-align: top;
}

.events-table th:first-child,
.events-table td:first-child {
    white-space: nowrap;
}

.events-actions-heading,
.events-actions {
    width: 72px;
    text-align: right;
    white-space: nowrap;
}

.event-action {
    width: 32px;
    height: 32px;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
}

.event-action svg {
    width: 18px;
    height: 18px;
}

.delete-event {
    color: var(--color-danger);
}

.multipleHighlight,
#HighLightDiv {
    box-sizing: border-box;
    border: 1px solid rgba(86, 83, 217, 0.42);
    border-radius: 3px;
    background: rgba(86, 83, 217, 0.14);
    opacity: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    transition: background-color 100ms ease, border-color 100ms ease, box-shadow 100ms ease;
    animation: calendar-highlight-in 90ms ease-out;
}

/* Event targets outline their clickable region without tinting the calendar artwork. */
#HighLightDiv.calendar-event-target {
    z-index: 5 !important;
    border: 3px solid #e5d500;
    background: transparent;
    box-shadow: none;
}

@keyframes calendar-highlight-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .multipleHighlight,
    #HighLightDiv {
        animation: none;
        transition: none;
    }
}

.pallet {
    max-width: 264px;
}

/* Palettes are portalled to the document root and must remain above responsive sheets/dialogs. */
#colourPopup {
    z-index: var(--z-dialog-nested) !important;
    max-width: calc(100vw - 16px);
}

#printDownload input[type="radio"] {
    margin-bottom: 15px;
}

#printDownload select {
    width: 150px;
    margin-bottom: 5px;
}

#printDownload .leftLabel {
    flex-basis: 200px;
}

/* Photo controls retain their workflow while using the shared surface treatment. */
.drop_file_zone {
    width: 100%;
    min-height: 148px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 3px dashed var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-subtle);
    font-size: 1rem;
}

.drag_upload_file {
    width: 100%;
    margin-inline: auto;
}

.drag_upload_file p {
    text-align: center;
}

.drag_upload_file .selectfile {
    display: none;
}

.gallery-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 6px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.gallery-thumbnail-grid--modal {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    max-height: 300px;
    margin-bottom: 10px;
}

.picturegallerypic,
.picturegallerypicnonmodal {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
    cursor: pointer;
}

.picturegallerypic img,
.picturegallerypicnonmodal img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.picturegallerypicnonmodal { cursor: grab; }
.picturegallerypicnonmodal:active { cursor: grabbing; }
.gallery-thumbnail-grid--delete-mode .picturegallerypicnonmodal { cursor: pointer; }

.gallery-thumbnail--selected {
    border-color: var(--color-primary);
}

.gallery-thumbnail-grid--delete-mode .gallery-thumbnail--selected {
    border-color: var(--color-danger);
}

.gallery-thumbnail--selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--color-primary);
    pointer-events: none;
}

.gallery-thumbnail-grid--delete-mode .gallery-thumbnail--selected::after {
    border-color: var(--color-danger);
}

.gallery-thumbnail__check {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
    place-items: center;
    width: 23px;
    height: 23px;
    border: 1px solid var(--color-primary);
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
}

.gallery-thumbnail__check svg { width: 15px; height: 15px; }
.gallery-thumbnail--selected .gallery-thumbnail__check { display: grid; }
.gallery-thumbnail-grid--delete-mode .gallery-thumbnail__check {
    display: grid;
    border-color: var(--color-border);
    background: rgba(255, 255, 255, .94);
    color: transparent;
}

.gallery-thumbnail-grid--delete-mode .gallery-thumbnail--selected .gallery-thumbnail__check {
    border-color: var(--color-danger);
    background: var(--color-danger);
    color: white;
}

.gallery-empty-state {
    grid-column: 1 / -1;
    margin: 0;
    padding: 12px 4px;
    color: var(--color-muted);
}

.gallery-management { margin: 8px 0 10px; }
.gallery-management__start { width: 100%; justify-content: center; }
.gallery-management__start[hidden], .gallery-delete-tools[hidden] { display: none; }
.gallery-delete-tools {
    display: grid;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
}
.gallery-delete-tools__heading,
.gallery-delete-tools__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.gallery-delete-tools__heading strong { font-size: .86rem; }
.gallery-delete-tools__heading .btn { padding: 3px 6px; }
.gallery-delete-tools__actions > span { color: var(--color-muted); font-size: .85rem; }
.gallery-delete-tools__actions .btn { padding: 6px 9px; }
.gallery-dialog-hint { margin: 0 0 10px; color: var(--color-muted); }

.galleryMessage {
    display: none;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: #e9faf7;
    color: #12675e;
}

.galleryMessage--error {
    background: #fff0ef;
    color: var(--color-danger);
}

/* Upload progress uses a separate status because transfer completion precedes image processing. */
.photo-upload-status:not([hidden]) {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 8px 10px;
    margin: 10px 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-subtle);
    color: var(--color-ink);
}

.photo-upload-status__icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9e8ff;
    color: var(--color-primary);
}

.photo-upload-status__icon svg {
    width: 18px;
    height: 18px;
}

.photo-upload-status__processing-icon { display: none; }
.photo-upload-status--processing .photo-upload-status__upload-icon { display: none; }
.photo-upload-status--processing .photo-upload-status__processing-icon {
    display: block;
    animation: photo-processing-spin 1.8s linear infinite;
}

.photo-upload-status__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.photo-upload-status__title {
    font-size: 0.92rem;
}

.photo-upload-status__detail {
    color: var(--color-muted);
    font-size: 0.82rem;
}

.photo-upload-status__track {
    grid-column: 1 / -1;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe3ee;
}

.photo-upload-status__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--color-primary);
    transition: width 150ms ease;
}

.photo-upload-status--processing .photo-upload-status__fill {
    width: 100%;
    background: var(--color-accent);
}

@keyframes photo-processing-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .photo-upload-status__icon svg,
    .photo-upload-status__fill { animation: none; transition: none; }
}

.tab {
    overflow: hidden;
}

.backForwardButton svg {
    width: 18px;
    height: 18px;
}

.backForwardButton:hover {
    background: var(--color-surface-subtle);
}

.tip {
    margin: 10px 0;
    padding: 10px;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--color-ink);
    font-size: 0.85rem;
}

.selectColourButton {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
}

.colourSchemeSelector {
    height: 100px;
    margin-right: 5px;
    opacity: 0.5;
    cursor: pointer;
}

.gridStyleSelector,
.fontThemeSelector {
    width: 44%;
    margin: 0 10px 10px 0;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    opacity: 0.5;
    vertical-align: top;
    cursor: pointer;
}

.gridStyleSelector {
    height: 90px;
}

.fontThemeSelector {
    height: 50px;
    color: var(--color-ink);
}

.quickChangeSelectorActive {
    border: 2px solid var(--color-ink) !important;
    opacity: 1 !important;
}

#countryMismatch {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
    box-shadow: var(--shadow-sm);
}

.editor-about {
    max-width: 950px;
    margin: 36px auto;
    padding: clamp(22px, 4vw, 42px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

/* Editor dialogs share the site shell while retaining the existing modal workflow. */
.modal--compact {
    max-width: 520px;
}

.modal--auth {
    max-width: 440px;
}

/* Nested workflows keep the focused dialog above the backdrop and dim their parent. */
.modal--nested {
    z-index: var(--z-dialog-nested);
}

.modal--backgrounded {
    z-index: calc(var(--z-dialog-backdrop) - 1);
}

.modal__header {
    padding-right: 34px;
    margin-bottom: var(--space-4);
}

.modal__header .eyebrow,
.modal__header h2 {
    margin-bottom: var(--space-2);
}

.modal__header p:last-child {
    margin-bottom: 0;
    color: var(--color-muted);
}

.modal__footer {
    justify-content: flex-end;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.modal__footer svg,
.modal-back svg,
.auth-submit svg {
    width: 18px;
    height: 18px;
}

.event-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: var(--space-4);
}

.event-title-field textarea {
    min-height: 92px;
}

.event-colour-field {
    display: grid;
    align-content: start;
    gap: var(--space-2);
}

.field-label,
.event-repeat-group legend {
    color: var(--color-ink);
    font-weight: 700;
}

.check-field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-muted);
    font-size: 0.9rem;
}

.event-repeat-group {
    margin: var(--space-2) 0 var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-subtle);
}

.event-repeat-group legend {
    padding-inline: var(--space-2);
}

.event-repeat-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.event-repeat-row select {
    flex: 1;
}

.event-repeat-frequency,
.event-repeat-frequency label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.event-repeat-frequency input,
.event-repeat-until input[type="number"] {
    width: 64px;
}

.event-repeat-until {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.print-start-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.print-start-year {
    width: 7rem;
}

.editor-field-error,
.dialog-status {
    margin: var(--space-2) 0 0;
    font-size: 0.88rem;
}

.editor-field-error {
    color: var(--color-danger);
}

.editor-field-error:empty,
.dialog-status:empty {
    display: none;
}

[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.google-signin-panel {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-3) 0;
    color: var(--color-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--color-border);
}

.auth-iframe {
    width: 100%;
    height: 275px;
    border: 0;
}

.auth-switch {
    margin: var(--space-2) 0 0;
    text-align: center;
    color: var(--color-muted);
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.text-button:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.auth-inline-panel[hidden],
.auth-status:empty {
    display: none;
}

.auth-inline-panel {
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-subtle);
}

.auth-inline-panel__header {
    margin-bottom: var(--space-4);
}

.auth-inline-panel__header h2,
.auth-inline-panel__header p:last-child {
    margin-bottom: var(--space-2);
}

.auth-inline-panel__header p:last-child {
    color: var(--color-muted);
}

.auth-status {
    margin-bottom: var(--space-3);
}

.auth-show-password {
    justify-content: flex-end;
}

.auth-submit .btn {
    width: 100%;
}

.modal-back {
    min-height: 34px;
    margin: -8px 0 var(--space-3) -8px;
    padding: 6px 8px;
}

@media (max-width: 480px) {
    .event-title-row {
        grid-template-columns: 1fr;
    }

    .event-repeat-row {
        align-items: stretch;
        flex-direction: column;
    }
}

.editor-about h1 {
    font-size: clamp(1.55rem, 3vw, 2rem);
}

.editor-about h2 {
    margin-top: 24px;
    font-size: 1.2rem;
}

.editor-about p {
    color: #46536c;
}

@media (max-width: 1000px) {
    .site-main {
        flex-direction: column;
    }

    #mainright,
    #mainmiddle,
    #mainleft {
        margin-inline: auto;
    }

    #mainleft {
        width: 100%;
        max-width: 600px;
        order: 3;
    }

    #mainmiddle {
        order: 2;
    }

    #mainright {
        display: none;
    }

    #mainMenuMobile {
        display: block;
    }

    .mobile-only {
        display: flex;
    }

    .hide-on-mobile,
    .desktopspacer {
        display: none;
    }

    #countryMismatch {
        margin-top: 40px;
        flex-direction: column;
    }

    #options-header,
    .optionsMenuButton {
        text-align: center;
    }

    #quickPrintButton {
        font-size: 0.875rem;
    }

    .editor-sidebar-spacer,
    .editor-actions-spacer {
        display: none;
    }

    .editor-options-heading {
        margin-top: 20px;
        padding: 0;
    }

    .editor-workspace {
        position: static;
    }

    .calendar-preview-shell {
        padding: 6px;
    }

    #mainMenuMobile .mainMenu {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 600px) {
    #printDownload .leftLabel {
        flex-basis: 140px;
    }

    #printDownload select {
        width: 135px;
    }
}

@media (max-width: 560px) {
    .calendar-type-tabs {
        width: 100%;
    }

    .tab .tablinks {
        flex: 1;
    }

    .calendar-date-nav select {
        min-width: 0;
        max-width: 34%;
    }

    .calendar-output-toolbar {
        justify-content: stretch;
    }

    #quickPrintButton {
        flex: 1 1 100%;
    }

    .editor-about {
        margin-block: 24px;
        padding: 20px;
    }
}

@media (max-width: 460px) {
    #printDownload .leftLabel {
        flex-basis: 110px;
    }
}

@media (max-width: 450px) {
    .tab .tablinks {
        padding-inline: 12px;
    }
}

/* The editor uses one persistent inspector instead of several independent accordions. */
#mainright {
    display: none;
}

#mainleft {
    width: 360px;
    align-self: flex-start;
}

#mainmiddle {
    align-self: stretch;
}

.editor-inspector-open,
.editor-inspector-scrim,
.editor-inspector-close {
    display: none;
}

.editor-inspector-toggle:focus-visible + .editor-inspector-open {
    outline: 3px solid rgba(86, 83, 217, 0.32);
    outline-offset: 3px;
}

.editor-inspector {
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.editor-inspector__header {
    min-height: 78px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(145deg, var(--color-surface), var(--color-primary-soft));
}

.editor-inspector .editor-inspector-close {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 0;
    border-radius: 8px;
    color: var(--color-muted);
    box-shadow: none;
}

.editor-inspector .editor-inspector-close svg {
    width: 15px;
    height: 15px;
}

.editor-inspector__header .editor-options-heading {
    margin: 0;
    padding: 0;
}

.editor-inspector__header .eyebrow,
.editor-inspector__header h2 {
    margin: 0;
}

.editor-inspector__content {
    max-height: calc(100vh - 110px);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    align-content: start;
    gap: 5px;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Destination ordering is independent of the legacy panel IDs used by editor requests. */
[data-inspector-tab="setup"] { order: 1; }
[data-inspector-tab="design"] { order: 2; }
[data-inspector-tab="holidays"] { order: 3; }
[data-inspector-tab="events"] { order: 4; }
[data-inspector-tab="photos"] { order: 5; }

[data-inspector-panel] {
    order: 10;
    grid-column: 1 / -1;
}

.PhotoSpecific {
    display: contents;
}

.editor-inspector .optionsMenuButton {
    width: 100%;
    min-width: 0;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 8px 3px 7px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}

.editor-inspector .optionsMenuButton > span {
    width: 100%;
    height: 18px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 18px;
}

.editor-inspector .optionsMenuButton > svg:not(.options-menu-icon) {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 20px;
    margin: 0;
}

.editor-inspector .options-menu-icon {
    display: none;
}

.editor-inspector .optionsMenuButton:hover {
    border-color: var(--color-border);
    background: var(--color-surface-subtle);
}

.editor-inspector .optionsMenuButtonActive {
    border-color: #cbc9fb;
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
}

/* Desktop can collapse the complete inspector when the preview needs more room. */
@media (min-width: 1101px) {
    .editor-inspector {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .editor-inspector__content {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* Stick the workspace column itself; a sticky child cannot travel inside a same-height parent. */
    #mainmiddle {
        position: sticky;
        top: 16px;
        align-self: flex-start;
    }

    /* Pin the shorter inspector while the longer workspace scrolls past it. */
    #mainleft.editor-inspector-host--sticky {
        position: sticky;
        top: 16px;
    }

    /* Keep the panel sticky when the host temporarily retains a taller section's height. */
    #mainleft.editor-inspector-host--sticky-child .editor-inspector {
        position: sticky;
        top: 16px;
    }

    #mainleft.editor-inspector-host--collapsed,
    .editor-inspector-prefers-hidden #mainleft {
        width: auto;
    }

    .editor-inspector-host--collapsed .editor-inspector,
    .editor-inspector-prefers-hidden .editor-inspector {
        display: none;
    }

    .editor-inspector-host--collapsed .editor-inspector-open,
    .editor-inspector-prefers-hidden .editor-inspector-open {
        display: inline-flex;
        width: 48px;
        min-width: 48px;
        min-height: 108px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 7px;
        padding: 8px 6px;
        font-size: 0.875rem;
        box-shadow: var(--shadow-sm);
    }

    .editor-inspector-host--collapsed .editor-inspector-open span,
    .editor-inspector-prefers-hidden .editor-inspector-open span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        line-height: 1;
        white-space: nowrap;
    }

    .editor-inspector-host--collapsed .editor-inspector-open svg,
    .editor-inspector-prefers-hidden .editor-inspector-open svg {
        width: 20px;
        height: 20px;
        margin: 0;
    }

    .editor-inspector-close {
        display: inline-flex;
        flex: 0 0 auto;
    }
}

.editor-inspector .optionsMenuControl {
    width: 100%;
    margin: 3px 0 0;
    padding: 16px;
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
    box-shadow: none;
}

.editor-inspector .optionsMenuControl > h3:first-child {
    margin-bottom: 14px;
}

.inspector-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.inspector-section h3,
.inspector-section h4 {
    margin-bottom: 10px;
}

.inspector-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.inspector-full-control,
.event-inspector-tools input,
.event-inspector-tools select {
    width: 100%;
}

.field-label {
    display: block;
    margin-bottom: 6px;
}

.design-scope,
.inspector-help,
.inspector-status,
.inspector-note,
.inspector-section__heading p {
    color: var(--color-muted);
    font-size: 0.82rem;
}

.inspector-note,
.inspector-notice {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
}

.inspector-notice {
    margin-top: 14px;
    border: 1px solid #cbc9fb;
}

#countryMismatch.inspector-notice {
    align-items: stretch;
    gap: 8px;
    margin-top: 14px;
}

.inspector-notice .inspector-inline-actions {
    justify-content: flex-start;
}

.design-scope {
    margin: 7px 0 14px;
}

.design-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
}

.design-mode-tab {
    min-height: 36px;
    padding: 6px 10px;
    border: 0;
    border-radius: calc(var(--radius-sm) - 3px);
    background: transparent;
    color: var(--color-muted);
    font-weight: 700;
    cursor: pointer;
}

.design-mode-tab:hover {
    background: var(--color-surface);
    color: var(--color-ink);
}

.design-mode-tab.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.design-mode-panel[hidden],
.design-control-group[hidden] {
    /* Legacy settings refreshes can write an inline display value; contextual selection wins. */
    display: none !important;
}

.design-mode-panel > h3:first-child {
    margin-bottom: 14px;
}

.design-mode-panel h4 {
    margin: 18px 0 10px;
}

.design-control-group {
    padding-top: 4px;
}

.design-control-row {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.design-choice-grid,
.photo-layout-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 14px;
}

.design-choice,
.colourSchemeSelector,
.gridStyleSelector,
.fontThemeSelector {
    width: 100%;
    height: auto;
    min-height: 60px;
    display: grid;
    place-items: center;
    gap: 6px;
    margin: 0;
    padding: 7px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    opacity: 0.72;
    cursor: pointer;
}

.design-choice img {
    width: 100%;
    height: 52px;
    display: block;
    object-fit: cover;
    border-radius: 4px;
}

.design-choice span {
    font-size: 0.76rem;
    font-weight: 700;
}

.design-choice--font {
    min-height: 50px;
}

.design-choice:hover,
.photo-layout-choice:hover {
    border-color: var(--color-primary);
    opacity: 1;
}

.quickChangeSelectorActive {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 2px var(--color-primary-soft);
}

.inspector-font-editor {
    display: block;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-subtle);
}

.inspector-font-editor[hidden] {
    display: none;
}

.font-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.font-family-control,
.font-colour-control {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 42px;
    align-items: start;
    gap: 8px;
}

.font-editor-grid .field-label {
    margin: 0;
    line-height: 1.4;
}

/* Native option rows preview their own calendar font where the browser supports option styling. */
#FontSelect option[value="Open Sans"] {
    font-family: "Open Sans", sans-serif;
    font-weight: 400;
}

#FontSelect option[value="Open Sans-Bold"] {
    font-family: "Open Sans", sans-serif;
    font-weight: 700;
}

#FontSelect option[value="Courier Prime"] {
    font-family: "Courier Prime", monospace;
}

#FontSelect option[value="Libre Baskerville"] {
    font-family: "Libre Baskerville", "Noto Serif", serif;
}

#FontSelect option[value="Kalam"] {
    font-family: Kalam, cursive;
}

#FontSelect option[value="Noto Serif"] {
    font-family: "Noto Serif", serif;
}

.font-colour-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.font-colour-control .colourPickerButton {
    width: 42px !important;
    height: 42px !important;
}

/* Miniature calendar diagrams show the scope of each target without changing the real preview. */
.design-target-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    text-align: left;
    cursor: pointer;
}
#designTargetName { flex: 1; font-weight: 650; font-size: 0.875rem; }
#designTargetThumbnail { width: 52px; flex: 0 0 52px; }
.design-target-change-label { display: flex; align-items: center; gap: 3px; font-size: 0.75rem; color: var(--color-primary); }
.design-target-change-label svg { width: 14px; height: 14px; }
.design-target-summary[aria-expanded="true"] .design-target-change-label svg { transform: rotate(180deg); }
#designTargetChoices[hidden], #designTargetSettings[hidden] { display: none !important; }
.design-target-group { margin-top: 18px; }
.design-target-group h4 { margin: 0 0 8px; font-size: 0.8rem; color: var(--color-muted); }
.design-target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.design-target-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 10px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    cursor: pointer;
}
.design-target-card:hover, .design-target-summary:hover { background: var(--color-surface-subtle); border-color: var(--color-primary); }
.design-target-card[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-soft); }
.design-target-label { font-size: 0.8rem; font-weight: 600; line-height: 1.35; text-align: center; }
.design-target-preview { display: block; width: 100%; max-width: 112px; height: auto; }
.design-target-check { display: none; position: absolute; right: 5px; top: 5px; width: 15px; height: 15px; color: var(--color-primary); }
.design-target-card[aria-pressed="true"] .design-target-check { display: block; }
.target-paper { fill: white; stroke: #d4dae4; }
.target-heading, .target-weekdays, .target-caption { fill: #c0c8d5; }
.target-weekend, .target-highlight { fill: #eef0f5; }
.target-grid { fill: none; stroke: #d4dae4; stroke-width: 0.8; }
.target-dates, .target-event-text { fill: none; stroke: #abb6c8; stroke-width: 1.5; }
.target-photo, .target-caption { display: none; }
[data-preview-target="grid"] .target-grid { stroke: var(--color-primary); fill: #f0efff; }
[data-preview-target="weekends"] .target-weekend,
[data-preview-target="events"] .target-highlight { fill: #b8b2fb; }
[data-preview-target="monthYearText"] .target-heading,
[data-preview-target="dayOfWeekText"] .target-weekdays { fill: var(--color-primary); }
[data-preview-target="dayOfMonthText"] .target-dates,
[data-preview-target="specialDayText"] .target-event-text { stroke: var(--color-primary); stroke-width: 2.5; }
[data-preview-target="captionText"] .target-photo,
[data-preview-target="titleText"] .target-photo { display: block; fill: #edf0f6; stroke: #c0c8d5; }
[data-preview-target="captionText"] .target-caption { display: block; fill: var(--color-primary); }
[data-preview-target="titleText"] .target-heading { fill: var(--color-primary); }
[data-preview-target="captionText"] .target-grid,
[data-preview-target="titleText"] .target-grid { stroke: #e5e8ef; }

.font-editor-preview {
    margin-top: 8px;
    padding: 12px;
    overflow-wrap: anywhere;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    text-align: center;
}

.inspector-inline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.event-inspector-tools {
    display: grid;
    gap: 8px;
}

.event-inspector-tools .btn,
#visibleEventsLoadMore {
    width: 100%;
}

#visibleEventsLoadMore {
    margin-top: 10px;
}

#visibleEventsLoadMore[hidden] {
    display: none;
}

#clearVisibleEventsDateFilter[hidden] {
    display: none;
}

.visible-events-list:empty {
    display: none;
}

.visible-event {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: start;
    gap: 9px;
    padding: 11px 0;
    border-bottom: 1px solid var(--color-border);
}

.visible-event__marker {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 50%;
}

.visible-event__content {
    min-width: 0;
    display: grid;
    gap: 2px;
    overflow-wrap: anywhere;
}

.visible-event__date,
.visible-event__content small {
    color: var(--color-muted);
    font-size: 0.78rem;
}

.visible-event__actions {
    display: flex;
}

[data-dialog-dismissible="false"] > .close-icon {
    display: none;
}

.inspector-status:not(:empty),
.visible-events-list:not(:empty) {
    margin-top: 12px;
}

.photo-layout-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-layout-choice {
    min-width: 0;
    padding: 5px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
}

.photo-layout-choice img {
    width: 100%;
    height: auto;
    display: block;
}

.inspector-section__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.inspector-section__heading p {
    margin: 0;
}

.inspector-section__heading .btn {
    flex: 0 0 auto;
    padding-inline: 10px;
}

.inspector-photo-list {
    max-height: 400px;
    margin-bottom: 10px;
    overflow-y: auto;
}

.photo-placement-controls:not([hidden]) {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
}

.photo-placement-controls .btn { justify-self: start; }

.photo-slot-actions:not([hidden]) {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.photo-slot-actions__label { font-weight: 700; }

.photo-slot-actions__areas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.photo-slot-choice {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}

.photo-slot-choice img {
    display: block;
    width: 100%;
    height: 66px;
    border-radius: 2px;
    background: var(--color-surface-subtle);
    object-fit: contain;
}

.photo-slot-choice[aria-pressed="true"] {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 700;
}

.photo-slot-choice:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.photo-slot-actions__buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.photo-slot-actions__buttons .btn {
    justify-content: flex-start;
    min-width: 0;
    padding: 7px 9px;
    font-size: 0.85rem;
}

.photo-slot-actions__buttons svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.inspector-empty-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 24px 12px;
    color: var(--color-muted);
    text-align: center;
}

.inspector-empty-state svg {
    width: 34px;
    height: 34px;
    color: var(--color-primary);
}

.inspector-empty-state h3,
.inspector-empty-state p {
    margin: 0;
}

.editor-toolbar {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 7px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
}

.editor-toolbar .calendar-type-tabs,
.editor-toolbar .calendar-date-nav {
    margin: 0;
}

.editor-toolbar .calendar-date-nav {
    justify-self: center;
}

/* All toolbar groups share one compact 40px rhythm despite their different control types. */
.editor-toolbar .calendar-type-tabs {
    min-height: 40px;
    padding: 3px;
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.editor-toolbar .tab .tablinks {
    min-height: 32px;
    padding: 4px 11px;
    border-radius: 6px;
}

.editor-toolbar .calendar-date-nav {
    gap: 5px;
}

.editor-toolbar .calendar-date-nav select,
.editor-toolbar .backForwardButton,
.editor-toolbar__actions .btn {
    height: 40px;
    min-height: 40px;
    border-radius: var(--radius-sm);
}

.editor-toolbar .calendar-date-nav select {
    padding-block: 5px;
}

.editor-toolbar .backForwardButton {
    width: 40px;
    min-width: 40px;
    padding: 7px;
}

.editor-toolbar__actions {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 6px;
}

.editor-toolbar__actions .btn {
    padding: 7px 13px;
}

.editor-toolbar__actions .editor-toolbar__share {
    width: 40px;
    padding: 7px;
}

.editor-toolbar__actions svg,
.editor-inspector-open svg,
.inspector-section__heading svg,
.event-inspector-tools svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 1250px) {
    .editor-toolbar {
        grid-template-columns: auto 1fr;
        gap: 9px 12px;
    }

    .editor-toolbar .calendar-date-nav {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/* Tablet uses a right-side sheet so the preview keeps its full working width. */
@media (max-width: 1100px) {
    .site-main {
        flex-direction: column;
    }

    #mainmiddle {
        order: 2;
        margin-inline: auto;
    }

    .editor-workspace {
        position: static;
    }

    body.editor-inspector-sheet-open {
        overflow: hidden;
    }

    #mainleft {
        width: 0;
        height: 0;
        order: 3;
        margin: 0;
    }

    .editor-inspector-open {
        position: fixed;
        right: 22px;
        bottom: 22px;
        z-index: 90;
        display: inline-flex;
        box-shadow: var(--shadow-md);
    }

    .editor-inspector-scrim {
        position: fixed;
        inset: 0;
        z-index: 94;
        display: block;
        visibility: hidden;
        background: rgba(14, 23, 48, 0.58);
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    .editor-inspector {
        width: min(430px, 92vw);
        height: 100dvh;
        max-height: none;
        position: fixed;
        top: 0;
        right: 0;
        z-index: 95;
        border-width: 0 0 0 1px;
        border-radius: 0;
        transform: translateX(105%);
        transition: transform 220ms ease;
    }

    .editor-inspector__content {
        max-height: calc(100dvh - 78px);
    }

    .editor-inspector-close {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .editor-inspector-toggle:checked ~ .editor-inspector-scrim {
        visibility: visible;
        opacity: 1;
    }

    .editor-inspector-toggle:checked ~ .editor-inspector {
        transform: translateX(0);
    }

    .editor-inspector-toggle:checked ~ .editor-inspector-open {
        visibility: hidden;
    }
}

@media (max-width: 1000px) {
    #countryMismatch.inspector-notice {
        margin-top: 14px;
        align-items: stretch;
    }
}

/* Phones use a bottom sheet that leaves enough preview context above it. */
@media (max-width: 640px) {
    .editor-inspector-open {
        right: 14px;
        bottom: 14px;
    }

    .editor-inspector {
        width: 100%;
        height: min(72dvh, 680px);
        top: auto;
        right: 0;
        bottom: 0;
        border-width: 1px 0 0;
        border-radius: 18px 18px 0 0;
        transform: translateY(105%);
    }

    .editor-inspector-toggle:checked ~ .editor-inspector {
        transform: translateY(0);
    }

    .editor-inspector__header {
        min-height: 68px;
        padding-block: 11px;
    }

    .editor-inspector__content {
        max-height: calc(min(72dvh, 680px) - 68px);
    }

    .editor-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 8px;
        padding: 9px;
    }

    .editor-toolbar .calendar-type-tabs,
    .editor-toolbar .calendar-date-nav,
    .editor-toolbar__actions {
        grid-column: 1;
        justify-self: stretch;
    }

    .editor-toolbar .calendar-type-tabs {
        grid-row: 1;
        margin-inline: auto;
    }

    .editor-toolbar .calendar-date-nav {
        grid-row: 2;
    }

    .editor-toolbar__actions {
        grid-row: 3;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-toolbar__actions .btn:only-child {
        grid-column: 1 / -1;
    }

    .editor-toolbar__actions .btn {
        min-width: 0;
        padding-inline: 9px;
        font-size: 0.86rem;
    }

}
.weekly-date-nav input[type="date"] {
    max-width: 10rem;
    min-width: 0;
}

.weekly-print-count {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
}

.weekly-writing-option {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    margin-block: var(--space-3, 0.75rem);
}

/* Legacy navigation and date inputs remain available to shared script helpers only. */
.calendar-date-nav[hidden], #printDownload [hidden] {
    display: none !important;
}

/* Keep all weekly date controls reachable on narrow phones. */
.weekly-date-nav { flex-wrap: wrap; }
