/* One board palette for desktop, dialogs, menus, and touch controls. */
body.hn-themed {background:var(--theme-board);color:var(--theme-ink);--accent:var(--theme-accent);--accent-dark:var(--theme-accent)}
body.hn-dark {
  --shadow:0 8px 22px rgba(8,13,17,.42),0 1px 3px rgba(8,13,17,.48);
  --shadow-lg:0 22px 65px rgba(5,9,13,.56);
  --ui-shadow:0 16px 48px rgba(5,9,13,.5),0 2px 8px rgba(5,9,13,.34);
}
body.hn-dark .card:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card):not(.selected) {
  box-shadow:var(--shadow)!important;
}
body.hn-dark .card:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card):hover:not(.selected) {
  box-shadow:var(--shadow-lg)!important;
}
body.hn-dark .card.selected:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card) {
  box-shadow:0 0 0 var(--hn-selection-width) #6a9875,0 0 0 calc(var(--hn-selection-width) + 5px) #70a0750c,0 7px 22px rgba(5,9,13,.48)!important;
}
body.hn-dark .topbar {box-shadow:0 2px 12px rgba(5,9,13,.32)!important}
body.hn-dark :is(.hn-rail-flyout,.text-format-toolbar) {
  box-shadow:var(--ui-shadow)!important;
}
/* Milanote's light tonal hierarchy, with the same steps translated to slate at night. */
body.hn-light .card[data-theme-surface=neutral]:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card) {background:var(--theme-surface)!important;color:var(--theme-ink);--column-color:var(--theme-surface);--planner-color:var(--theme-surface)}
body.hn-light .column-entry[data-theme-surface=neutral] {background:var(--theme-raised)!important}
body.hn-dark .column-card .drag-handle {color:var(--theme-muted)!important;border-color:var(--theme-border)!important}
body.hn-dark .column-card :is(.column-title,.column-count,.collapse-column) {color:var(--theme-ink)!important}
body.hn-themed :is(.topbar,.topbar.dark-board-background,.project-settings-menu,.selection-tools,.text-format-toolbar,.board-menu,.export-menu) {--ui-ink:var(--theme-ink);--ui-muted:var(--theme-muted);--ui-surface:var(--theme-surface);--ui-border:var(--theme-border);--ui-accent-soft:var(--theme-hover)}
body.hn-themed :is(dialog,.modal,.project-start-card,.project-settings-menu,.selection-tools,.selection-align-popover,.text-format-toolbar,.canvas-context-menu,.board-menu,.export-menu,.color-dropdown-menu,.color-dropdown-popover,.favorite-boards-panel,.planner-event-editor,.board-icon-picker,.image-preview-toolbar,.export-preview-controls,.export-preview-dialog>header,.export-preview-dialog>footer,.hn-mobile-sheet,.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-editor-header) {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(dialog,.modal,.project-settings-menu,.selection-tools,.selection-align-popover,.text-format-toolbar,.canvas-context-menu,.board-menu,.export-menu,.favorite-boards-panel,.planner-event-editor,.hn-mobile-sheet,.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-editor-header) :is(button,summary,select,label,h1,h2,h3,strong) {color:var(--theme-ink)!important}
body.hn-themed :is(dialog,.modal,.project-settings-menu,.board-menu,.export-menu,.favorite-boards-panel,.hn-mobile-sheet) :is(button,select) {background-color:transparent;border-color:var(--theme-border)!important}
body.hn-themed :is(dialog,.modal,.project-settings-menu,.selection-tools,.text-format-toolbar,.canvas-context-menu,.board-menu,.export-menu,.hn-mobile-sheet,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-header) :is(button,summary):hover:not(:disabled),body.hn-themed .hn-mobile-sheet .is-current {background-color:var(--theme-hover)!important}
body.hn-themed :is(.web-fields,.scene-dialog,.modal,.hn-mobile-sheet,.planner-event-editor,.favorite-boards-panel,.project-file-dialog) :is(input,textarea,select),body.hn-themed :is(.scene-field,.export-preview-margin-field) {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}

body.hn-themed :is(.web-save-badge,.collaboration-peers,.collaboration-status button,.canvas-hint,.favorite-board-row,.favorite-boards-header,.project-version-row,.collaboration-comparison pre,.scene-layout-preview,.export-preview-pages,.scene-field) {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(.web-save-badge.error,.web-error,.export-preview-error,.scene-selection-menu .selection-tools>#delete-item-btn) {color:var(--theme-danger)!important}
/* Warning states must stay distinct from the shared surfaces painted above, in both themes. */
body.hn-themed .collaboration-status button.collaboration-review {background:var(--theme-warning-bg)!important;color:var(--theme-warning)!important;border-color:var(--theme-warning-border)!important}
body.hn-themed .web-project-row.damaged {background:var(--theme-warning-bg)!important;border-color:var(--theme-warning-border)!important}
body.hn-themed .web-project-row.damaged small {color:var(--theme-warning)!important}
body.hn-themed :is(.hn-mobile-add,.hn-mobile-done,.web-dialog button[type=submit],.modal-confirm,.scene-primary,.export-preview-save) {background:var(--theme-action)!important;color:var(--theme-action-ink)!important;border-color:var(--theme-action)!important}
body.hn-themed :is(.hn-mobile-settings-close,.card.selected:not(.board-card)>.drag-handle,.card.scene-compact .scene-read-more) {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed .hn-mobile-editor-header,body.hn-themed.hn-mobile-editing .canvas-area {background:var(--theme-surface)!important}
body.hn-themed :is(.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-editor-header) button {color:inherit}
body.hn-themed :is(.board-title,.breadcrumb-btn,.folder-up-btn,.zoom-controls button,.board-card .board-name,.board-card .board-folder-name,.heading-card textarea) {color:var(--theme-ink)!important}
body.hn-themed .connection-label {fill:var(--theme-ink);stroke:var(--theme-board)}
body.hn-themed .topbar .zoom-controls button:hover {background:var(--theme-hover)!important}
/* The language button shows the language it switches to: EN, or ع in English. */
body.hn-themed .topbar .language-toggle-code {display:block;font:600 12px/1 var(--ui-font);letter-spacing:.02em}
body.hn-themed .topbar .language-toggle-code:lang(ar) {font-size:16px;letter-spacing:0;transform:translateY(-4px)}
body.hn-themed .topbar .language-toggle {display:grid;place-items:center}
.hn-mobile-background-swatch {display:inline-block;width:20px;height:20px;border:1px solid var(--theme-border);border-radius:5px;margin-inline-end:10px;vertical-align:middle}
body.hn-dark .card[data-theme-surface=neutral]:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card) {background:var(--theme-surface)!important;color:var(--theme-ink);--column-color:var(--theme-surface);--planner-color:var(--theme-surface)}
body.hn-dark .card[data-theme-surface=neutral] :is(.rich-text-editor,textarea,input[type=text],.planner-title,.column-title,.column-check-title,.monthplan-title) {color:var(--theme-ink)!important;background-color:transparent}
body.hn-dark .card[data-theme-surface=neutral] :is(.column-entry,.monthplan-section,.calendar-day,.calendar-header,.planner-header,.planner-time-column,.planner-grid):not([style*="background-color"]) {background-color:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-border)}
body.hn-dark .card[data-theme-surface=neutral] :is(.drag-handle,.column-add-note,.add-check,.planner-time-label,.calendar-weekday,.calendar-month-select,.calendar-year-select,.monthplan-section-title) {color:var(--theme-muted);border-color:var(--theme-border)}
body.hn-dark :is(input,textarea)::placeholder {color:var(--theme-muted);opacity:1}
/* Interface direction changes independently from the direction of saved text. */
html[lang=en] :is(.workspace,.scene-selection-menu>.selection-tools,.scene-dialog,.web-dialog,.modal,.project-settings-menu,.board-menu,.export-menu,.canvas-context-menu,.favorite-boards-panel,.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-editor-header,.hn-mobile-sheet,.web-save-badge,.collaboration-status,.export-preview-dialog,.toast-region) {direction:ltr}
/* The toolbar keeps the same physical positions in both languages. English
   labels and inputs retain their own text direction. */
html[lang=en] .topbar,
html[lang=en] .topbar-center-tools {direction:rtl}
html[lang=en] :is(.hn-mobile-sheet button,.project-settings-menu button,.board-menu button,.export-menu button,.canvas-context-menu button,.web-project-row) {text-align:start}
html[lang=en] .scene-selection-menu #selection-align-menu>summary::after {content:"Alignment"}
html[lang=en] .scene-selection-menu #color-swatches::after {content:"Item color"}
html[lang=en] .favorite-boards-panel.favorite-drop-active::after {content:"Drop board to add to favorites"}
html[lang=en] .scene-selection-menu>.selection-tools {width:420px!important}

/* Legacy popovers are identified by their shared class, not their element ID. */
body.hn-themed :is(.popover,.scene-selection-menu>summary,.top-timeline-toolbar,.search-results) {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(.popover,.search-results) :is(button,input,textarea,strong,small) {color:var(--theme-ink)!important}
body.hn-themed :is(.popover,.search-results) button:hover {background:var(--theme-hover)!important}
body.hn-themed :is(.collaboration-people,.column-empty) {background:var(--theme-raised)!important;color:var(--theme-muted)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(.board-card .folder-card-title,.selection-count,.selection-align-popover>span) {color:var(--theme-ink)!important}
body.hn-themed .folder-title-input[contenteditable=true],body.hn-themed .folder-title-input:focus {background:var(--theme-raised)!important}
body.hn-themed :is(.popover,.canvas-context-menu,.modal,.project-settings-menu) .danger-text {color:var(--theme-danger)!important}
body.hn-themed :is(.primary-btn,.scene-dialog .primary) {background:var(--theme-action)!important;color:var(--theme-action-ink)!important;border-color:var(--theme-action)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.collapse-column,.column-count,.column-add-note,.column-note) {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed .card[data-theme-surface=custom]:not(.board-card):not(.heading-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card) {color:var(--item-ink)}
body.hn-themed .card[data-theme-surface=custom] :is(.rich-text-editor,textarea,input[type=text],.column-title,.column-check-title) {color:var(--item-ink)}
body.hn-themed .card[data-theme-surface=custom] :is(input,textarea)::placeholder {color:var(--item-muted)}
html[lang=en] :is(.popover,.collaboration-people,.search-results) {direction:ltr}
html[lang=en] .popover button,html[lang=en] #search-input {text-align:start;direction:ltr}

/* Nested notes and explicitly colored table cells keep their own contrast. */
body.hn-themed [data-theme-surface] {--content-ink:var(--item-ink);--content-muted:var(--item-muted)}
body.hn-dark [data-theme-surface=neutral] {--content-ink:var(--theme-ink);--content-muted:var(--theme-muted)}
body.hn-dark .column-entry[data-theme-surface=neutral] {background:var(--theme-raised)!important}
body.hn-themed .column-entry[data-theme-surface=custom] {background:var(--entry-background)!important}
body.hn-themed .card[data-theme-surface] :is(.rich-text-editor,textarea,input[type=text],.column-title,.column-check-title) {color:var(--content-ink)!important}
/* Headings are transparent, so their text follows the board rather than the unused item fill. */
body.hn-themed .card.heading-card[data-theme-surface] .heading-text {color:var(--theme-ink)!important}
body.hn-themed .card[data-theme-surface] :is(input,textarea)::placeholder {color:var(--content-muted)!important}
body.hn-themed .card .table-cell-colored :is(input,textarea),body.hn-themed .card :is(.planner-event-title,.planner-event-time) {color:var(--content-ink)!important}
body.hn-themed :is(.favorite-boards-panel,.favorite-boards-header,.scene-layout-controls,.scene-layout-modes button,.favorite-add-current,.toast-region>div,.toast) {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(.favorite-boards-panel,.favorite-boards-header,.scene-layout-controls) :is(button,h2,h3,strong) {color:var(--theme-ink)!important}
body.hn-themed .favorite-add-current:disabled {color:var(--theme-muted)!important;opacity:.68}
body.hn-dark .card[data-theme-surface=neutral] :is(.calendar-days button,.calendar-header button,.planner-day-header,.planner-time-spacer,.planner-hour-label,.planner-controls button,.planner-controls select,.planner-day-grid,.monthplan-section) {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.calendar-days button.selected,.planner-controls button.active) {background:var(--theme-action)!important;color:var(--theme-action-ink)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.calendar-weekdays,.monthplan-section-title,.planner-weekday) {color:var(--theme-muted)!important}
body.hn-themed :is(.timeline-date-picker,.timeline-point-toolbar) {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed :is(.text-format-toolbar,.timeline-point-toolbar,.top-timeline-toolbar,.timeline-date-picker) :is(button,input,select,textarea) {background-color:var(--theme-raised);color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.month-plan-section,.month-plan-selector,.planner-grid-header,.planner-time-label) {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.calendar-month-title,.month-plan-title,.month-plan-add,.column-folder-title) {color:var(--theme-ink)!important}
html[lang=en] :is(.calendar-weekdays,.calendar-days,.calendar-tasks,.timeline-date-picker,.timeline-date-picker-grid,.month-plan-header,.month-plan-sections,.planner-controls,.planner-grid) {direction:ltr}
body.hn-dark .card[data-theme-surface=neutral] .calendar-tasks {border-color:var(--theme-border)}
body.hn-dark .card[data-theme-surface=neutral] .calendar-tasks-date {color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] :is(.calendar-tasks-count,.calendar-tasks-hint,.calendar-task-add) {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .calendar-task-add:hover {background:var(--theme-hover);color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] .calendar-day-marks i {background:#e09a66}
body.hn-dark .card[data-theme-surface=neutral] .calendar-days button.tasks-done .calendar-day-marks i {background:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .calendar-days button.selected .calendar-day-marks i {background:var(--theme-action-ink)}
body.hn-dark .card[data-theme-surface=neutral] .calendar-days button.task-row-drop-target {box-shadow:inset 0 0 0 2px var(--theme-action)!important}
/* Production schedule in Dark mode: view-only tints, saved colours never change. */
body.hn-dark .card[data-theme-surface=neutral] .schedule-grid {--schedule-line:color-mix(in srgb,var(--theme-border) 55%,transparent);--schedule-name-bg:var(--theme-surface);--schedule-frame:var(--theme-border);--schedule-month-line:color-mix(in srgb,var(--theme-ink) 34%,transparent);--schedule-head-bg:var(--theme-raised)}
body.hn-dark .card[data-theme-surface=neutral] :is(.schedule-month,.schedule-day,.schedule-milestone .schedule-bar-label) {color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] :is(.schedule-total,.schedule-phase-meta,.schedule-task-edit,.schedule-hint,.schedule-task-add,.schedule-phase-add,.schedule-phase-toggle,.schedule-day small,.schedule-day.weekend) {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] :is(.schedule-task-edit,.schedule-task-add,.schedule-phase-add,.schedule-phase-toggle):hover {background:var(--theme-hover);color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-zoom {background:var(--theme-raised)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-zoom button {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-zoom button.active {background:var(--theme-surface);color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-who {background:var(--theme-raised);color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-month-year {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-range label {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-range .schedule-date-field {background:var(--theme-raised);border-color:var(--theme-border);color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-date-field .schedule-date-pick {color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-date-field .schedule-date-pick:hover {background:var(--theme-hover);color:var(--theme-ink)}
body.hn-dark .schedule-date-native {color-scheme:dark}
/* The schedule panel keeps a filled Save and a red Delete under the themed dialog buttons. */
body.hn-themed .hn-schedule-dialog .hn-schedule-save {background-color:var(--theme-action)!important;border-color:transparent!important;color:var(--theme-action-ink)!important}
body.hn-themed .hn-schedule-dialog .hn-schedule-danger {color:#b4473d!important}
body.hn-dark .hn-schedule-dialog .hn-schedule-danger {color:#e38b80!important}
body.hn-dark .card[data-theme-surface=neutral] .schedule-weekend {background:rgba(255,255,255,.045)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-bar {background:color-mix(in srgb,var(--schedule-color) 42%,var(--theme-surface));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--schedule-color) 70%,transparent);color:var(--theme-ink)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-bar.done {background:var(--theme-raised);box-shadow:inset 0 0 0 1px var(--theme-border);color:var(--theme-muted)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-milestone-mark {box-shadow:0 0 0 2px var(--theme-surface)}
body.hn-dark .card[data-theme-surface=neutral] .schedule-task-row.done .schedule-task-name {color:var(--theme-muted)!important}
html[lang=en] .card :is(.schedule-header,.schedule-footer) {direction:ltr}
body.hn-dark :is(.timeline-note,.timeline-checklist,.timeline-date-marker)[data-theme-surface=neutral] {background:var(--theme-surface)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-themed .timeline-date-marker[data-theme-surface=custom] {color:var(--item-ink)!important}
body.hn-dark .card[data-theme-surface=neutral] :is(.month-plan-name,.month-plan-section h3,.month-plan-year) {color:var(--theme-ink)!important}
body.hn-themed .card .column-entry[data-theme-surface=custom] {background:var(--entry-background)!important;color:var(--content-ink)!important}
body.hn-themed .card[data-theme-surface] :is(input[type=number]) {color:var(--content-ink)!important}

body.hn-dark .card[data-theme-surface=neutral] .month-plan-year,body.hn-themed .timeline-endpoint-date {background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
body.hn-dark .timeline-floating-title {color:var(--theme-ink)!important}
/* Dark mode tints saved card colours toward the surface instead of showing bright pastels.
   View only: saved colours, Light mode, colour pickers, table cells and planner events keep
   their real colours. --entry-background is each item's own saved colour (theme.js decorate). */
body.hn-dark .card[data-theme-surface=custom]:not(.board-card):not(.heading-card):not(.image-card):not(.frame-card):not(.timeline-card,.section-card,.ink-card),
body.hn-dark .card :is(.column-entry,.timeline-note,.timeline-checklist)[data-theme-surface=custom] {
  --hn-dark-tint:color-mix(in srgb,var(--entry-background) 22%,var(--theme-surface));
  --item-ink:var(--theme-ink)!important;--item-muted:var(--theme-muted)!important;
  --column-color:var(--hn-dark-tint)!important;--planner-color:var(--hn-dark-tint)!important;
  background-color:var(--hn-dark-tint)!important;color:var(--theme-ink);
}


/* The table's controls follow the shared light/dark palette without making
   the column headings look like separate raised cards. */















