/* 画面の色: ダーク — v1.30.0 (master 2026-11-24「ダークモード搭載して」)
   画面全体の明暗を反転し、色相は hue-rotate で戻す (青は青、緑は緑のまま)。
   0.88 (v1.31.0、元 0.92) = 真っ黒・真っ白にしない (濃いグレーの背景・明るいグレーの文字で目が疲れにくい)。
   印は html[data-color-mode="dark"] (src/features/colorMode/colorMode.js と index.html の <head>)。
   旧ダークモード (html[data-theme="dark"]、darkMode.css) とは別の印なので、二重に暗くならない。
   このファイルは他の CSS より後に読む (同じ詳細度の上書きを確実にするため)。 */

html[data-color-mode="dark"] {
  filter: invert(0.88) hue-rotate(180deg); /* v1.31.0: 0.92 → 0.88 (少し明るい濃いグレー) */
  background: #fff; /* 反転して濃いグレーになる下地 */
}

/* 写真・画面写真・動画・図は元の色に戻す。
   ヘッダーのロゴ (マスコット・TORIAI の文字) は黒一色なので反転のまま (= 暗い背景で白く見える)。
   ログイン前に左上のロゴの右に出る鳥 (.sh-login-bird-img、背景が透明な白黒の GIF) も同じく反転のまま (= 黒い輪郭が暗い背景に溶けない)。 */
html[data-color-mode="dark"] img:not(.logo-mascot):not(.logo-image):not(.sh-login-bird-img),
html[data-color-mode="dark"] video,
html[data-color-mode="dark"] canvas {
  filter: invert(1) hue-rotate(180deg);
}

/* 作業指示書のプレビューは紙。印刷と同じ色 (白い紙・色付きのラベル) で見せる。
   紙の下地が白でないと戻したときに暗くなるので白を敷く。 */
html[data-color-mode="dark"] .cu-sheet,
html[data-color-mode="dark"] #histPreviewBody .work-page,
html[data-color-mode="dark"] #livePreviewLeft .work-page {
  filter: invert(1) hue-rotate(180deg);
  background: #fff;
}

/* 暗幕 (モーダルの後ろの半透明の黒)。そのままだと反転で白っぽい幕になるので、
   元を白にして反転後に暗い幕にする。 */
html[data-color-mode="dark"] .cart-unified-modal,
html[data-color-mode="dark"] #cartModal.cart-unified-modal,
html[data-color-mode="dark"] .changelog-modal,
html[data-color-mode="dark"] .onboarding-modal,
html[data-color-mode="dark"] .job-template-modal,
html[data-color-mode="dark"] .live-preview-modal,
html[data-color-mode="dark"] .calc-loading-overlay,
html[data-color-mode="dark"] .calc-notice-overlay,
html[data-color-mode="dark"] body.mobile-shell.csp-mobile-open #mobSheetBackdrop,
html[data-color-mode="dark"] body.mobile-app .ma-dim,
html[data-color-mode="dark"] .sa-modal,
html[data-color-mode="dark"] .shm-backdrop,
html[data-color-mode="dark"] .share-login-overlay,
html[data-color-mode="dark"] .srn-modal,
html[data-color-mode="dark"] .inv-add-modal-overlay,
html[data-color-mode="dark"] .ug-modal,
html[data-color-mode="dark"] #onelinePromoModal,
html[data-color-mode="dark"] #pwaFbModalRoot .pwa-fb-modal-overlay,
html[data-color-mode="dark"] #toriaiEmailReturnOverlay,
html[data-color-mode="dark"] .tor-backdrop {
  background: rgba(255, 255, 255, .55) !important;
}

/* 大きくぼかした影は反転で周りが白くもやっとするので、ダークでは薄い縁取りにする。
   (影で描いている選択中の枠などを消さないよう、全部ではなく大きな影の部品だけ) */
html[data-color-mode="dark"] .cart-unified-inner,
html[data-color-mode="dark"] .cart-unified-more-menu,
html[data-color-mode="dark"] .cu-help-pop,
html[data-color-mode="dark"] .cu-sheet,
html[data-color-mode="dark"] .calc-result-toolbar,
html[data-color-mode="dark"] .cc,
html[data-color-mode="dark"] body:not(.print-mode) #rp .cc,
html[data-color-mode="dark"] .calc-loading-card,
html[data-color-mode="dark"] .calc-notice-box,
html[data-color-mode="dark"] .data-backup-dialog,
html[data-color-mode="dark"] .ctab-ghost,
html[data-color-mode="dark"] .changelog-card,
html[data-color-mode="dark"] .data-info-card,
html[data-color-mode="dark"] .dt-sb-dropdown,
html[data-color-mode="dark"] .dt-sb-tooltip,
html[data-color-mode="dark"] .cart-modal-inner,
html[data-color-mode="dark"] .job-template-inner,
html[data-color-mode="dark"] .live-preview-inner,
html[data-color-mode="dark"] body.mobile-shell .calc-settings-panel,
html[data-color-mode="dark"] body.mobile-shell #cp #rp,
html[data-color-mode="dark"] body.mobile-app .ma-sheet,
html[data-color-mode="dark"] #hip .hi-detail-panel,
html[data-color-mode="dark"] .hi-detail-panel,
html[data-color-mode="dark"] #hip #hiPanelH .hist-job-group,
html[data-color-mode="dark"] #hip #hiPanelH .hist-row,
html[data-color-mode="dark"] #hip .inv-table-card,
html[data-color-mode="dark"] .ham-menu,
html[data-color-mode="dark"] .sa-modal-card,
html[data-color-mode="dark"] .shm-card,
html[data-color-mode="dark"] .share-login-card,
html[data-color-mode="dark"] .srn-modal-card,
html[data-color-mode="dark"] #cmdDropdown,
html[data-color-mode="dark"] #wCmdDropdown,
html[data-color-mode="dark"] .inv-add-modal-box,
html[data-color-mode="dark"] .ug-card,
html[data-color-mode="dark"] #onelinePromoModal .opm-card,
html[data-color-mode="dark"] #pwaFbModalRoot .pwa-fb-modal {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08) !important;
}

/* 画面をそのまま印刷 (Ctrl+P) したときは反転しない (紙に暗い背景を刷らない)。
   作業指示書の印刷は別ウィンドウ (印なし) なので、もともと影響しない。 */
@media print {
  html[data-color-mode="dark"],
  html[data-color-mode="dark"] img:not(.logo-mascot):not(.logo-image):not(.sh-login-bird-img),
  html[data-color-mode="dark"] video,
  html[data-color-mode="dark"] canvas,
  html[data-color-mode="dark"] .cu-sheet,
  html[data-color-mode="dark"] #histPreviewBody .work-page,
  html[data-color-mode="dark"] #livePreviewLeft .work-page {
    filter: none !important;
  }
}

/* メニューの「画面の色」の札 */
.hm-row#themeToggleBtn .hm-theme-pill {
  margin-left: auto;
}
