/*
 * SYS Bridge appearance layer
 * Kept separate from the operational stylesheet so theme changes cannot affect
 * yacht data, permissions or application workflows.
 */

.appearance-control {
  position: relative;
  z-index: 96;
  flex: 0 0 auto;
}

.appearance-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  padding: 0;
}

.appearance-toggle:hover,
.appearance-toggle:focus-visible,
.appearance-toggle[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.18);
}

.appearance-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.appearance-toggle .appearance-icon--sun,
.appearance-toggle[data-resolved-theme="dark"] .appearance-icon--moon {
  display: block;
}

.appearance-toggle .appearance-icon--moon,
.appearance-toggle[data-resolved-theme="dark"] .appearance-icon--sun {
  display: none;
}

.appearance-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 110;
  width: 254px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 22px 58px rgba(7, 31, 53, 0.28);
  color: var(--ink);
  padding: 12px;
}

.appearance-menu__heading {
  margin: 0 0 10px;
  color: var(--steel);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.appearance-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mist);
  padding: 4px;
}

.appearance-options button {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--steel);
  font-size: 12px;
  font-weight: 900;
  padding: 0 8px;
}

.appearance-options button:hover,
.appearance-options button:focus-visible {
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  color: var(--ink);
}

.appearance-options button.is-selected {
  background: var(--navy);
  box-shadow: 0 5px 14px rgba(7, 31, 53, 0.2);
  color: #fff;
}

.login-appearance {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 100;
}

.login-appearance .appearance-toggle {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(7, 31, 53, 0.74);
  box-shadow: 0 10px 30px rgba(7, 31, 53, 0.22);
}

html[data-theme="dark"] {
  --ink: #edf3f7;
  --steel: #afbfcb;
  --muted: #8fa1af;
  --gold-soft: rgba(209, 170, 71, 0.15);
  --cream: #091823;
  --white: #13293a;
  --paper: #102331;
  --mist: #1a3344;
  --line: rgba(220, 233, 241, 0.12);
  --line-strong: rgba(220, 233, 241, 0.22);
  --green: #72b696;
  --red: #e07a74;
  --shadow: 0 28px 84px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(3, 14, 23, 0.96), rgba(8, 30, 45, 0.92)),
    url("../assets/images/home-hero.jpg") center / cover fixed;
  color: var(--ink);
}

html[data-theme="dark"] .app-shell {
  background: #091923;
}

html[data-theme="dark"] :is(input, select, textarea) {
  border-color: var(--line-strong);
  background: #0c1d29;
  color: var(--ink);
  color-scheme: dark;
}

html[data-theme="dark"] :is(select option, select optgroup, datalist option) {
  background: #0c1d29;
  color: var(--ink);
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #748896;
  opacity: 1;
}

html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.78);
}

html[data-theme="dark"] :is(.login-panel, .login-aside, .sheet-card) {
  border-color: var(--line-strong);
}

html[data-theme="dark"] .login-panel {
  background: rgba(10, 28, 40, 0.97);
}

html[data-theme="dark"] .login-aside {
  background:
    linear-gradient(180deg, rgba(5, 20, 31, 0.28), rgba(3, 15, 24, 0.93)),
    url("../assets/images/deck-hero.jpg") center / cover;
}

html[data-theme="dark"] :is(.secondary-button, .ghost-button--light, .table-link, .close-button) {
  border-color: var(--line-strong);
  background: #182f40;
  color: var(--ink);
}

html[data-theme="dark"] :is(.secondary-button, .ghost-button--light, .table-link, .close-button):hover {
  background: #203d50;
}

html[data-theme="dark"] :is(.ghost-button, .inline-button):not(.primary-button, .danger-button) {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(.ghost-button, .inline-button):not(.primary-button, .danger-button):hover,
html[data-theme="dark"] :is(.ghost-button, .inline-button):not(.primary-button, .danger-button):focus-visible {
  background: #203d50 !important;
}

html[data-theme="dark"] :is(.primary-button, .primary-button *) {
  color: #071f35 !important;
}

html[data-theme="dark"] :is(
  .toolbar,
  .view-tabs,
  .nav-group,
  .sheet-card,
  .table-wrap,
  .permissions-panel,
  .notification-panel,
  .bridge-mate-panel,
  .desktop-sync-centre-panel,
  .detail-page,
  .detail-drawer,
  .drawer-panel,
  .modal-panel,
  .modal-card,
  .dialog-panel,
  .popover-panel,
  .files-workspace,
  .files-column,
  .files-inspector,
  .planner-calendar,
  .planner-agenda,
  .calendar-shell,
  .calendar-grid,
  .bridge-home,
  .bridge-home__composer,
  .bridge-home__result,
  .bridge-home-review,
  .bridge-mate-answer,
  .bridge-mate-source,
  .bridge-mate-suggestion
) {
  border-color: var(--line);
  background-color: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .bridge-mate-form,
  .bridge-home-composer,
  .bridge-home-composer__field
) {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .bridge-mate-mode,
  .bridge-home-composer__mode
) {
  border-color: var(--line);
  background: #0b1d29;
}

html[data-theme="dark"] :is(
  .bridge-mate-prompts button,
  .bridge-home-starters button,
  .bridge-home-live__item,
  .bridge-home-composer__attachment > button
) {
  border-color: var(--line-strong);
  background: #182f40;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .bridge-mate-prompts button,
  .bridge-home-starters button,
  .bridge-home-live__item,
  .bridge-home-composer__attachment > button
):hover,
html[data-theme="dark"] :is(
  .bridge-mate-prompts button,
  .bridge-home-starters button,
  .bridge-home-live__item,
  .bridge-home-composer__attachment > button
):focus-visible {
  border-color: rgba(209, 170, 71, 0.68);
  background: #203d50;
}

html[data-theme="dark"] .bridge-home-composer__attachment {
  border-top-color: var(--line);
}

html[data-theme="dark"] :is(
  [class$="-card"],
  [class$="__card"],
  [class$="-panel"],
  [class$="__panel"],
  [class$="-drawer"],
  [class$="__drawer"],
  [class$="-tile"],
  [class$="__tile"],
  [class$="-cell"],
  [class$="__cell"],
  [class$="-item"],
  [class$="__item"],
  [class$="-row"],
  [class$="__row"],
  [class$="-section"],
  [class$="__section"]
) {
  border-color: var(--line);
}

html[data-theme="dark"] :is(
  [class$="-card"],
  [class$="__card"],
  [class$="-panel"],
  [class$="__panel"],
  [class$="-drawer"],
  [class$="__drawer"],
  [class$="-tile"],
  [class$="__tile"]
):not(
  .topbar,
  .bridge-mate-panel__heading,
  .login-aside,
  .primary-button,
  .danger-button
) {
  background-color: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  table,
  thead,
  tbody,
  tfoot,
  tr,
  th,
  td,
  .data-table,
  .register-table,
  .compact-table
) {
  border-color: var(--line);
}

html[data-theme="dark"] :is(thead, th, .table-heading, .table-header, .register-heading) {
  background-color: #172c3b;
  color: var(--ink);
}

html[data-theme="dark"] :is(tbody tr, .table-row, .register-row, .data-row) {
  background-color: #0e202d;
  color: var(--ink);
}

html[data-theme="dark"] :is(tbody tr:nth-child(even), .table-row:nth-child(even), .register-row:nth-child(even)) {
  background-color: #112634;
}

html[data-theme="dark"] :is(
  .view-tab,
  .nav-subsections button,
  .notification-filter,
  .bridge-mate-tabs button,
  .bridge-mate-mode button,
  .segmented-control button,
  [role="tab"]
) {
  border-color: var(--line);
  background: #122a39;
  color: var(--steel);
}

html[data-theme="dark"] :is(
  .bridge-mate-tabs,
  .worklist-view-switch,
  .ism-subtabs,
  .inventory-subtabs,
  .medkits-subtabs,
  [role="tablist"]
) {
  border-color: var(--line);
  background: #0b1d29;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .view-tab.is-active,
  .notification-filter.is-active,
  .bridge-mate-tabs button.is-active,
  .bridge-mate-mode button[aria-pressed="true"],
  .segmented-control button.is-active,
  [role="tab"][aria-selected="true"]
) {
  background: var(--navy);
  color: #fff;
}

html[data-theme="dark"] :is(
  .stale-session-banner,
  .empty-state,
  .empty-message,
  .summary-strip,
  .summary-stat,
  .metric-card,
  .detail-summary,
  .inspector-summary,
  .info-box,
  .note-box
) {
  border-color: var(--line);
  background: #132837;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .files-row,
  .files-list-row,
  .file-row,
  .folder-row,
  .files-entry,
  .file-entry,
  .folder-entry
) {
  border-color: var(--line);
  background: #0f2230;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .files-commandbar,
  .file-browser,
  .file-column-strip,
  .file-column,
  .file-column__heading,
  .file-column__list,
  .file-inspector,
  .file-inspector__stat
) {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .files-board :is(
  .file-browser,
  .file-column-strip,
  .file-column,
  .file-column__heading,
  .file-column__list,
  .file-inspector,
  .file-inspector__stats div
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .file-column + .file-column,
html[data-theme="dark"] .file-inspector {
  border-left-color: var(--line);
}

html[data-theme="dark"] .files-board .file-list-row__main {
  border-color: transparent;
  background: #132b3a !important;
  color: var(--ink);
}

html[data-theme="dark"] .files-board .file-list-row__main:hover,
html[data-theme="dark"] .files-board .file-list-row__main:focus-visible {
  border-color: var(--line-strong);
  background: #1a3a4d !important;
}

html[data-theme="dark"] .files-board .file-list-row__main[aria-pressed="true"],
html[data-theme="dark"] .files-board .file-list-row.is-active .file-list-row__main,
html[data-theme="dark"] .files-board .file-list-row.is-selected .file-list-row__main {
  border-color: #4f9ad1;
  background: #19598f !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(
  .file-inspector__meta,
  .file-inspector__details,
  .file-inspector__actions,
  .file-inspector__document-control
) {
  border-color: var(--line);
}

html[data-theme="dark"] :is(.files-action--secondary, .files-board .file-inspector__actions .ghost-button) {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .files-action--secondary.is-active {
  border-color: #4f9ad1 !important;
  background: #19598f !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(
  .file-search-results,
  .file-search-results__list,
  .file-search-result,
  .bridge-mate-file-context
) {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .file-search-result:hover,
html[data-theme="dark"] .file-search-result:focus-visible {
  background: #1a3a4d;
}

html[data-theme="dark"] .file-search-results__group-heading span {
  background: #182f40;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .bridge-mate-file-context__open,
  .bridge-mate-file-context__remove
) {
  border-color: var(--line-strong);
  background: #182f40;
  color: var(--ink);
}

html[data-theme="dark"] .file-navigationbar {
  border-color: var(--line);
  background: #0d202d;
}

html[data-theme="dark"] :is(
  .file-navigation-button:hover,
  .file-navigation-button:focus-visible,
  .file-navigation-button.is-active,
  .file-breadcrumb__item:hover,
  .file-breadcrumb__item:focus-visible
) {
  background: #1a3a4d;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .files-row.is-selected,
  .files-list-row.is-selected,
  .file-row.is-selected,
  .folder-row.is-selected,
  .files-entry.is-selected,
  .file-entry.is-selected,
  .folder-entry.is-selected
) {
  background: #19598f;
  color: #fff;
}

html[data-theme="dark"] :is(
  .planner-day,
  .planner-day-cell,
  .calendar-day,
  .calendar-day-cell,
  .month-cell,
  .week-day
) {
  border-color: var(--line);
  background: #0d202c;
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .planner-item-card,
  .planner-calendar-item,
  .planner-calendar-item--job,
  .planner-calendar-item--task,
  .planner-calendar-item--watch,
  .planner-calendar-item--navWatch,
  .planner-calendar-item--safety
) {
  border-color: var(--line);
  background: #132b3a !important;
  color: var(--ink);
}

html[data-theme="dark"] :is(.planner-item-card, .planner-calendar-item):hover,
html[data-theme="dark"] :is(.planner-item-card, .planner-calendar-item):focus-visible {
  background: #193749 !important;
}

html[data-theme="dark"] .planner-card :is(
  .ghost-button,
  .segmented-button,
  .planner-icon-menu-button,
  .planner-filter-summary
) {
  border-color: var(--line-strong);
  background: #182f40;
  color: var(--ink);
}

html[data-theme="dark"] .planner-card :is(
  .ghost-button,
  .segmented-button,
  .planner-icon-menu-button
):hover,
html[data-theme="dark"] .planner-card :is(
  .ghost-button,
  .segmented-button,
  .planner-icon-menu-button
):focus-visible {
  background: #203d50;
}

html[data-theme="dark"] .planner-card :is(
  .segmented-button.is-active,
  .segmented-button[aria-pressed="true"]
) {
  background: var(--navy);
  color: #fff;
}

html[data-theme="dark"] .planner-card :is(
  .planner-menu-panel,
  .planner-menu-panel--filters,
  .planner-menu-panel--actions
) {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .planner-day.is-today,
  .planner-day-cell.is-today,
  .calendar-day.is-today,
  .calendar-day-cell.is-today,
  .month-cell.is-today
) {
  background: rgba(209, 170, 71, 0.12);
  box-shadow: inset 0 0 0 1px rgba(209, 170, 71, 0.55);
}

html[data-theme="dark"] .worklist-command-bar {
  border-color: var(--line) !important;
  background: #102331 !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .worklist-command-bar :is(
  .worklist-title-line h2,
  .row-count
) {
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .systems-register-table,
  .systems-register-summary,
  .systems-register-expanded,
  .systems-register-nested-row
) {
  border-color: var(--line) !important;
  background: #102331 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .systems-register-summary {
  background: #152c3b !important;
}

html[data-theme="dark"] .systems-register-expanded {
  background: #0c1f2b !important;
}

html[data-theme="dark"] .systems-register-nested-row:hover,
html[data-theme="dark"] .systems-register-nested-row:focus-visible {
  background: #1a3a4d !important;
}

html[data-theme="dark"] :is(#add-system-record, #add-equipment-record, #add-component-record) {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .ism-register-workspace,
  .ism-register-heading,
  .ism-register-layout,
  .ism-register-table-wrap,
  .ism-register-table,
  .ism-register-timeline
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .ism-register-row {
  border-color: var(--line) !important;
  background: #0e202d !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .ism-register-row:not(.ism-register-row--head):hover,
html[data-theme="dark"] .ism-register-row:not(.ism-register-row--head):focus-visible {
  background: #183446 !important;
}

html[data-theme="dark"] .ism-register-row--head {
  background: #172c3b !important;
}

html[data-theme="dark"] .ism-register-shortcuts button {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .ism-register-shortcuts button:hover,
html[data-theme="dark"] .ism-register-shortcuts button:focus-visible {
  background: #203d50 !important;
}

html[data-theme="dark"] .ism-register-shortcuts strong {
  background: #294556 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .accounting-cockpit,
  .accounting-cockpit__heading,
  .accounting-cockpit__metrics,
  .accounting-budget-strip,
  .accounting-budget-strip__departments,
  .accounting-funding-summary,
  .accounting-funding-summary__grid,
  .accounting-quote-summary__details,
  .accounting-quote-summary__body,
  .accounting-quote-summary__header,
  .accounting-quote-summary__empty,
  .accounting-quote-summary__cards article,
  .accounting-quote-summary__table-wrap
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .accounting-cockpit-metric,
  .accounting-budget-strip__departments > span,
  .accounting-funding-summary__grid article
) {
  border-color: var(--line) !important;
  background: #102838 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-cockpit-metric:hover,
html[data-theme="dark"] .accounting-cockpit-metric:focus-visible,
html[data-theme="dark"] .accounting-cockpit-metric.is-active {
  background: #193749 !important;
}

html[data-theme="dark"] .accounting-workflow-tab {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-workflow-tab:hover,
html[data-theme="dark"] .accounting-workflow-tab:focus-visible {
  background: #203d50 !important;
}

html[data-theme="dark"] .accounting-workflow-tab.is-active {
  border-color: var(--gold) !important;
  background: var(--navy) !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(.status-pill, .quote-pill, .locked-pill) {
  border-color: var(--line);
}

html[data-theme="dark"] :is(.eyebrow, .mini-label, label, small, .muted, .subtle) {
  color: var(--steel);
}

html[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6, strong) {
  color: var(--ink);
}

html[data-theme="dark"] :is(a, .text-link) {
  color: #f0c75f;
}

html[data-theme="dark"] .topbar :is(a, strong, button),
html[data-theme="dark"] .bridge-mate-panel__heading :is(h1, h2, h3, strong, button),
html[data-theme="dark"] .login-aside :is(h1, h2, h3, p, li, strong) {
  color: #fff;
}

html[data-theme="dark"] :is(.danger-button, .error-state, .form-message) {
  color: #f0938d;
}

html[data-theme="dark"] :is(.success-state, .is-success) {
  color: #88c9aa;
}

html[data-theme="dark"] ::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #081620;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  border: 3px solid #081620;
  border-radius: 999px;
  background: #415766;
}

@media (max-width: 720px) {
  .appearance-menu {
    position: fixed;
    top: 66px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .login-appearance {
    top: 14px;
    right: 14px;
  }
}

/*
 * Dark-theme contrast pass.
 * These selectors cover compact workspaces that still declare literal light
 * backgrounds in styles.css. Keeping the corrections here preserves the light
 * theme and prevents appearance changes from touching operational behaviour.
 */

html[data-theme="dark"] :is(
  .bridge-home-composer__send,
  .files-action--primary,
  .upload-button,
  .technical-system-add-button,
  .job-complete-button
),
html[data-theme="dark"] :is(
  .bridge-home-composer__send,
  .files-action--primary,
  .upload-button,
  .technical-system-add-button,
  .job-complete-button
) :is(span, strong, small) {
  color: #071f35 !important;
}

html[data-theme="dark"] :is(
  .completed-toggle-control,
  .planner-completed-control
) {
  border-color: var(--line-strong) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .completed-toggle-control,
  .planner-completed-control
) :is(span, strong, small) {
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .worklist-type-pill--unplanned,
  .crew-status--off-duty
) {
  border-color: rgba(209, 170, 71, 0.44) !important;
  background: rgba(209, 170, 71, 0.18) !important;
  color: #f1ce70 !important;
}

/* Files */
html[data-theme="dark"] .file-breadcrumb__item {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .file-breadcrumb__item::after {
  color: var(--muted) !important;
}

html[data-theme="dark"] .file-breadcrumb__item:hover,
html[data-theme="dark"] .file-breadcrumb__item:focus-visible {
  border-color: rgba(209, 170, 71, 0.58) !important;
  background: #203d50 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .file-breadcrumb__item.is-current {
  border-color: #4f9ad1 !important;
  background: #19598f !important;
  color: #fff !important;
}

html[data-theme="dark"] .files-board .file-list-row__icon--file {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: #f29a94 !important;
}

html[data-theme="dark"] .files-board :is(
  .file-inspector__icon,
  .file-inspector__preview
) {
  border-color: var(--line-strong) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

/* Systems register and Yacht Atlas switches */
html[data-theme="dark"] .systems-register-tabs {
  border-color: var(--line) !important;
  background: #0b1d29 !important;
}

html[data-theme="dark"] .systems-register-tab {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .systems-register-tab :is(span, strong, small) {
  color: inherit !important;
}

html[data-theme="dark"] .systems-register-tab.is-active {
  border-color: var(--gold) !important;
  background: var(--gold) !important;
  color: #071f35 !important;
}

html[data-theme="dark"] .atlas-mode-switch {
  border-color: var(--line-strong) !important;
  background: #0b1d29 !important;
}

html[data-theme="dark"] .atlas-mode-switch button {
  background: #182f40 !important;
  color: var(--steel) !important;
}

html[data-theme="dark"] .atlas-mode-switch button :is(span, small) {
  color: inherit !important;
}

html[data-theme="dark"] .atlas-mode-switch button.is-active {
  border-color: var(--line-strong) !important;
  background: #19598f !important;
  color: #fff !important;
}

html[data-theme="dark"] .atlas-mode-switch button[data-yacht-atlas-mode="xray"].is-active {
  border-color: var(--gold) !important;
  background: var(--gold) !important;
  color: #071f35 !important;
}

html[data-theme="dark"] :is(
  .atlas-plan-card,
  .atlas-detail-panel,
  .atlas-detail-grid article,
  .atlas-plan-toolbar,
  .atlas-detail-heading
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .atlas-detail-grid article {
  background: #132837 !important;
}

html[data-theme="dark"] .atlas-status-strip span {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

/* Vessel particulars and summary cards */
html[data-theme="dark"] :is(
  .vessel-passport-strip,
  .vessel-passport-card,
  .vessel-passport-grid--compact .vessel-passport-card,
  .vessel-particulars-status,
  .vessel-particulars-status__heading,
  .vessel-particulars-status section
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .vessel-passport-card h3,
  .vessel-passport-strip .vessel-detail-field,
  .vessel-passport-card .vessel-detail-field,
  .vessel-particulars-status__heading,
  .vessel-particulars-status section
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .vessel-passport-summary span {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .crew-summary-card,
  .galley-summary-card
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .galley-summary-card--warning,
html[data-theme="dark"] .crew-summary-card--attention {
  border-color: rgba(209, 170, 71, 0.45) !important;
  background: rgba(209, 170, 71, 0.14) !important;
}

html[data-theme="dark"] :is(
  .crew-summary-card,
  .galley-summary-card
) :is(span, strong, small) {
  color: inherit !important;
}

/* Shipyard and Worklist job sheets */
html[data-theme="dark"] :is(
  .job-sheet-page,
  .job-detail-breadcrumb,
  .job-top-media-panel,
  .job-sheet-card,
  .job-rail-card,
  .job-linked-card,
  .job-subtask-card,
  .job-history-card
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .job-top-media-heading,
  .job-sheet-section-header,
  .job-sheet-page .job-rail-card-heading,
  .job-sheet-page .job-subtask-card .history-heading,
  .job-sheet-page .job-rail-kicker,
  .job-sheet-page .job-link-add-panel
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .job-sheet-field {
  border-color: var(--line) !important;
  background: #0d202d !important;
}

html[data-theme="dark"] .job-sheet-field > span {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--steel) !important;
}

html[data-theme="dark"] :is(
  .job-sheet-page .history-entry,
  .job-sheet-page .job-equipment-rail-item,
  .job-sheet-page .technical-equipment-result,
  .job-sheet-page .job-file-row,
  .job-sheet-page .job-subtask-row,
  .job-detail-rail .technical-linked-row
) {
  border-color: var(--line) !important;
  background: #0e202d !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .job-breadcrumb-back {
  color: #f0c75f !important;
}

html[data-theme="dark"] .job-sheet-page .due-date-clear {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .job-sheet-page .empty-history,
  .job-sheet-page .equipment-system-empty,
  .job-sheet-page .job-media-empty,
  .job-sheet-page .job-media-more
) {
  background: #0e202d !important;
  color: var(--steel) !important;
}

/* Systems, equipment, components and inventory details */
html[data-theme="dark"] :is(
  .technical-system-details-card,
  .technical-system-tile,
  .inventory-item-details-card
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .technical-system-card-heading,
  .technical-system-tile__header
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .technical-equipment-page,
  .technical-component-page
) .technical-system-details-card :is(
  .technical-edit-grid label,
  .worklist-detail-readonly-grid .property-card
) {
  border-color: var(--line) !important;
  background: #0e202d !important;
  color: var(--steel) !important;
}

html[data-theme="dark"] .technical-system-details-card .technical-edit-grid :is(
  input,
  select,
  textarea
) {
  border-color: var(--line-strong) !important;
  background: #0c1d29 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  color-scheme: dark;
}

html[data-theme="dark"] .technical-system-details-card .technical-edit-grid :is(
  input,
  select,
  textarea
)::placeholder {
  color: #748896 !important;
  -webkit-text-fill-color: #748896 !important;
  opacity: 1;
}

html[data-theme="dark"] .technical-system-details-card .technical-edit-grid :is(
  input,
  select,
  textarea
):focus {
  border-color: rgba(209, 170, 71, 0.64) !important;
  background: #102737 !important;
  box-shadow: 0 0 0 3px rgba(209, 170, 71, 0.12);
}

html[data-theme="dark"] .inventory-item-page__rail .technical-link-selector-group :is(
  input,
  select
) {
  border-color: var(--line-strong) !important;
  background: #0c1d29 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  color-scheme: dark;
}

html[data-theme="dark"] .inventory-item-page__rail .technical-link-selector-group input::placeholder {
  color: #748896 !important;
  -webkit-text-fill-color: #748896 !important;
  opacity: 1;
}

html[data-theme="dark"] .inventory-item-page__rail .technical-link-selector-group :is(
  input,
  select
):focus {
  border-color: rgba(209, 170, 71, 0.64) !important;
  background: #102737 !important;
  box-shadow: 0 0 0 3px rgba(209, 170, 71, 0.12);
}

html[data-theme="dark"] :is(
  .technical-system-row,
  .technical-system-history-row,
  .technical-linked-row,
  .inventory-item-linked-record
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .technical-system-row,
  .technical-system-history-row,
  .technical-linked-row,
  .inventory-item-linked-record
):hover,
html[data-theme="dark"] :is(
  .technical-system-row,
  .technical-system-history-row,
  .technical-linked-row,
  .inventory-item-linked-record
):focus-visible {
  border-color: rgba(209, 170, 71, 0.62) !important;
  background: #1a3a4d !important;
}

html[data-theme="dark"] .technical-system-jobs-tab {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--steel) !important;
}

html[data-theme="dark"] .technical-system-jobs-tab.is-active {
  border-color: #4f9ad1 !important;
  background: #19598f !important;
  color: #fff !important;
}

/* Crew profile details */
html[data-theme="dark"] .crew-profile-tabs {
  border-color: var(--line) !important;
  background: #0b1d29 !important;
}

html[data-theme="dark"] .crew-profile-tab {
  border-color: var(--line-strong) !important;
  background: #182f40 !important;
  color: var(--steel) !important;
}

html[data-theme="dark"] .crew-profile-tab.is-active {
  border-color: #4f9ad1 !important;
  background: #19598f !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(
  .crew-personal-card,
  .crew-document-status-card,
  .crew-compact-summary,
  .crew-profile-layout--compact .crew-files-card,
  .crew-profile-layout--compact .crew-personal-group
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .crew-profile-layout--compact .crm-section-heading,
  .crew-profile-layout--compact .crew-files-card > h3,
  .crew-profile-layout--compact .crew-personal-group > summary,
  .crew-profile-layout--compact .crew-personal-group[open] > summary,
  .crew-document-status-heading,
  .crew-compact-summary section
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .crew-compact-summary__row {
  border-color: var(--line) !important;
}

/* Accounting invoice workspace */
html[data-theme="dark"] :is(
  .accounting-compact-header,
  .accounting-page-card,
  .accounting-compact-details,
  .accounting-review-panel,
  .accounting-review-panel.is-ready,
  .accounting-review-panel.has-blockers
) {
  border-color: var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .accounting-page-card__header,
  .accounting-review-panel > header,
  .accounting-compact-details > summary,
  .accounting-line-row--total,
  .accounting-review-finding
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-balance {
  border-color: rgba(209, 170, 71, 0.55) !important;
  background: rgba(209, 170, 71, 0.14) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-facts {
  border-color: var(--line) !important;
  background: #0e202d !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-facts > span {
  border-color: var(--line) !important;
}

html[data-theme="dark"] .accounting-review-panel__findings {
  background: var(--line) !important;
}

html[data-theme="dark"] .accounting-compact-page .accounting-line-row {
  border-color: var(--line) !important;
  background: #102737 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-page :is(
  .accounting-line-row--head,
  .accounting-line-row--total
) {
  background: #132837 !important;
}

html[data-theme="dark"] .accounting-compact-page .accounting-line-row--head span {
  color: var(--steel) !important;
  -webkit-text-fill-color: var(--steel) !important;
}

html[data-theme="dark"] .accounting-compact-page .accounting-line-row :is(
  input,
  select
),
html[data-theme="dark"] .accounting-compact-page .accounting-payment-form :is(
  input,
  select
) {
  border-color: var(--line-strong) !important;
  background: #0c1d29 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  color-scheme: dark;
}

html[data-theme="dark"] .accounting-compact-page .accounting-payment-form :is(
  input,
  select
)::placeholder {
  color: #748896 !important;
  -webkit-text-fill-color: #748896 !important;
  opacity: 1;
}

html[data-theme="dark"] .accounting-compact-page :is(
  .accounting-payment-row,
  .accounting-ledger-list article
) {
  border-color: var(--line) !important;
  background: #102737 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-page .accounting-payment-row > :is(
  strong,
  span:not(.status-pill)
),
html[data-theme="dark"] .accounting-compact-page .accounting-ledger-list article > strong {
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
}

html[data-theme="dark"] .accounting-compact-page .accounting-payment-row > small,
html[data-theme="dark"] .accounting-compact-page .accounting-ledger-list article > :is(
  span,
  small
) {
  color: var(--steel) !important;
  -webkit-text-fill-color: var(--steel) !important;
}

/* Remaining overview states */
html[data-theme="dark"] .vessel-particulars-status .status-pill--warning {
  border-color: rgba(240, 199, 95, 0.52) !important;
  background: rgba(209, 170, 71, 0.18) !important;
  color: #f0c75f !important;
}

html[data-theme="dark"] .systems-register-tab:not(.is-active) strong {
  color: #10293a !important;
}

html[data-theme="dark"] .danger-button {
  border-color: rgba(240, 147, 141, 0.52) !important;
  background: #32191a !important;
  color: #ffb4ae !important;
}

html[data-theme="dark"] .files-board .file-inspector__actions .danger-button {
  border-color: rgba(255, 180, 174, 0.48) !important;
  background: #32191a !important;
  color: #ffb4ae !important;
}

/* Detail workspace contrast exceptions */
html[data-theme="dark"] .status-pill--warning {
  border-color: rgba(240, 199, 95, 0.52) !important;
  background: rgba(209, 170, 71, 0.18) !important;
  color: #f0c75f !important;
}

html[data-theme="dark"] .job-media-remove {
  border-color: rgba(255, 180, 174, 0.48) !important;
  background: #32191a !important;
  color: #ffb4ae !important;
}

html[data-theme="dark"] :is(
  .equipment-system-link-editor--tile,
  .equipment-system-chip
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .equipment-system-chip small {
  background: rgba(209, 170, 71, 0.18) !important;
  color: #f0c75f !important;
}

html[data-theme="dark"] .crew-profile-layout--compact .crew-personal-grid .crew-info-row,
html[data-theme="dark"] .crew-profile-layout--compact .crew-personal-grid .crew-info-row :is(
  input,
  select,
  textarea
) {
  border-color: var(--line) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .crew-profile-layout--compact .crew-personal-grid .crew-info-row > span {
  color: #afbfcb !important;
}

html[data-theme="dark"] .crew-profile-header-status .crew-status-choice.is-selected {
  border-color: rgba(240, 199, 95, 0.62) !important;
  background: #d1aa47 !important;
  color: #071f35 !important;
}

html[data-theme="dark"] :is(
  .crew-status--off-vessel,
  .crew-status--leaving,
  .crew-rest--exception,
  .crew-document-status-tone--danger
) {
  border-color: rgba(255, 180, 174, 0.46) !important;
  background: rgba(255, 180, 174, 0.12) !important;
  color: #ffb4ae !important;
}

/* Quote outcome and pricing controls must remain dark when embedded in job sheets. */
html[data-theme="dark"] :is(
  .quote-outcome-grid--editable,
  .quote-card.is-locked,
  .quote-part-summary-row
) {
  border-color: var(--line) !important;
  background: #0e202d !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .quote-payment-check {
  border-color: var(--line-strong) !important;
  background: #132837 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .quote-payment-check :is(span, strong, small) {
  color: var(--ink) !important;
}

html[data-theme="dark"] .quote-payment-check:focus-within {
  border-color: rgba(209, 170, 71, 0.64) !important;
  background: #173447 !important;
}

html[data-theme="dark"] .quote-payment-check input[type="checkbox"] {
  accent-color: var(--gold);
  color-scheme: dark;
}

/* The file viewer keeps a pale document header in both themes. */
html[data-theme="dark"] .quote-file-toolbar {
  border-color: #cbd7df;
  background: #f8fafb;
  color: #071f35;
}

html[data-theme="dark"] .quote-file-heading h2 {
  color: #071f35;
}

html[data-theme="dark"] .quote-file-heading .eyebrow,
html[data-theme="dark"] .quote-file-heading p:not(.eyebrow) {
  color: #587087;
}

html[data-theme="dark"] :is(
  .quote-download-button,
  .quote-download-button:hover,
  .quote-download-button:focus-visible,
  .quote-download-button:visited
) {
  color: #071f35;
}

/* Files: inspector editors stay dark and readable against the dark panel. */
html[data-theme="dark"] .files-board .file-inspector__inline-control {
  border-color: rgba(220, 233, 241, 0.24);
  background: #132837;
  color: #edf3f7;
  -webkit-text-fill-color: #edf3f7;
  color-scheme: dark;
  opacity: 1;
}

html[data-theme="dark"] .files-board .file-inspector__inline-control:focus {
  border-color: #d1aa47;
  background: #173447;
}

html[data-theme="dark"] .files-board select.file-inspector__inline-control :is(option, optgroup) {
  background: #132837;
  color: #edf3f7;
}

html[data-theme="dark"] .files-board input.file-inspector__inline-control[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.82);
}
