/* Cihantas OS Dark Mode v2
   Acceptance Feedback #2: full-surface theming + service card depth.
   Loaded last on purpose so legacy light-mode literals are normalized
   without disturbing the light theme. */

html[data-theme="dark"]{
  color-scheme:dark;
  --dm-bg-app:#0d1117;
  --dm-surface-section:#121821;
  --dm-surface-card:#171e28;
  --dm-surface-elevated:#1d2632;
  --dm-surface-hover:#24303e;
  --dm-surface-input:#101720;
  --dm-border:#2b3645;
  --dm-border-strong:#3a485b;
  --dm-text-primary:#eef3f8;
  --dm-text-secondary:#c3ccd8;
  --dm-text-muted:#8f9aac;
  --dm-blue:#8eaeff;
  --dm-green:#76d6a7;
  --dm-amber:#f0c36f;
  --dm-red:#ff8b98;
  --bg:var(--dm-bg-app);
  --panel:var(--dm-surface-card);
  --soft:var(--dm-surface-elevated);
  --ink:var(--dm-text-primary);
  --muted:var(--dm-text-muted);
  --line:var(--dm-border);
  --blue:var(--dm-blue);
  --green:var(--dm-green);
  --amber:var(--dm-amber);
  --red:var(--dm-red);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .main-area,
html[data-theme="dark"] .content{background:var(--dm-bg-app);color:var(--dm-text-primary)}

/* Application chrome */
html[data-theme="dark"] .sidebar{
  background:#0f141c!important;
  color:var(--dm-text-primary)!important;
  border-right:1px solid #202a36;
}
html[data-theme="dark"] .sidebar .brand strong,
html[data-theme="dark"] .sidebar .brand-copy strong{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .sidebar .brand span,
html[data-theme="dark"] .smart-section-head,
html[data-theme="dark"] .nav-group-toggle,
html[data-theme="dark"] .sidebar-footer span{color:#7f8b9e!important}
html[data-theme="dark"] .sidebar .nav{color:#aeb8c7!important}
html[data-theme="dark"] .sidebar .nav:hover{background:#18212c!important;color:#f5f8fb!important}
html[data-theme="dark"] .sidebar .nav.active{background:#202b3a!important;color:#f6f8fb!important}
html[data-theme="dark"] .sidebar-toggle,
html[data-theme="dark"] .mobile-nav-toggle{background:#151c26!important;border-color:var(--dm-border)!important;color:#b9c3d0!important}
html[data-theme="dark"] .sidebar-toggle:hover,
html[data-theme="dark"] .mobile-nav-toggle:hover{background:#202b38!important;color:#fff!important}
html[data-theme="dark"] .sidebar-footer{border-color:#273240!important;background:#10161e!important}

html[data-theme="dark"] .topbar{background:rgba(13,17,23,.94)!important;border-color:#25303d!important}
html[data-theme="dark"] .command-search input,
html[data-theme="dark"] .searchwrap input{background:var(--dm-surface-input)!important;border-color:var(--dm-border)!important;color:var(--dm-text-primary)!important}
html[data-theme="dark"] .command-search input:focus{background:#131b25!important;border-color:#51647f!important;box-shadow:0 0 0 3px rgba(116,146,190,.12)!important}
html[data-theme="dark"] .command-search kbd{background:var(--dm-surface-elevated)!important;border-color:var(--dm-border)!important;color:#aeb8c7!important;box-shadow:none!important}
html[data-theme="dark"] .icon-action,
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .theme-toggle{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .user-chip b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .user-chip span{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .user-avatar{background:#253141!important;color:#d6dee8!important}

/* Shared surfaces and controls */
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .auth-card{
  background:var(--dm-surface-card)!important;
  border-color:var(--dm-border)!important;
  color:var(--dm-text-primary)!important;
}
html[data-theme="dark"] .panel{box-shadow:0 1px 0 rgba(255,255,255,.015),0 10px 28px rgba(0,0,0,.08)}
html[data-theme="dark"] .card .label,
html[data-theme="dark"] .card .hint,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .muted{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .card .value,
html[data-theme="dark"] .panel h3,
html[data-theme="dark"] .title-row h1{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .mini-btn,
html[data-theme="dark"] .export-btn,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .picker-input,
html[data-theme="dark"] .compact-month{
  background:var(--dm-surface-elevated)!important;
  border-color:var(--dm-border)!important;
  color:var(--dm-text-primary)!important;
}
html[data-theme="dark"] .secondary:hover,
html[data-theme="dark"] .mini-btn:hover,
html[data-theme="dark"] .export-btn:hover{background:var(--dm-surface-hover)!important;border-color:var(--dm-border-strong)!important}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#687587!important}

html[data-theme="dark"] .create-menu,
html[data-theme="dark"] .notification-menu,
html[data-theme="dark"] .global-search-results,
html[data-theme="dark"] .picker-results{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important;color:var(--dm-text-primary)!important;box-shadow:0 20px 48px rgba(0,0,0,.34)!important}
html[data-theme="dark"] .create-option,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .global-result,
html[data-theme="dark"] .picker-option{background:transparent!important;color:var(--dm-text-secondary)!important;border-color:#26313e!important}
html[data-theme="dark"] .create-option:hover,
html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .global-result:hover,
html[data-theme="dark"] .global-result.active,
html[data-theme="dark"] .picker-option:hover,
html[data-theme="dark"] .picker-option.active{background:var(--dm-surface-hover)!important;color:#fff!important}

/* Tables and inventory/supply surfaces */
html[data-theme="dark"] .table th{background:#141b24!important;color:#8f9aac!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .table td{color:var(--dm-text-secondary)!important;border-color:#283341!important}
html[data-theme="dark"] .table td b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .table tr.clickable:hover,
html[data-theme="dark"] .service-ops-list tbody tr:hover{background:#1c2632!important}
html[data-theme="dark"] .low-stock-row{background:#241e16!important}
html[data-theme="dark"] .low-stock-row:hover{background:#2d2419!important}
html[data-theme="dark"] .warehouse-metrics span{background:var(--dm-surface-elevated)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .healthy{background:#173126!important;color:#7be0ad!important}
html[data-theme="dark"] .risk{background:#302719!important;color:#efc575!important}
html[data-theme="dark"] .critical{background:#361f26!important;color:#ff98a3!important}
html[data-theme="dark"] .open{background:#182944!important;color:#9ab7ff!important}
html[data-theme="dark"] .mutedpill{background:#232b36!important;color:#a7b1bf!important}

/* Daily Flow, remove remaining light islands */
html[data-theme="dark"] .flow-summary>div,
html[data-theme="dark"] .flow-toolbar,
html[data-theme="dark"] .work-zone-group{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .flow-search{background:var(--dm-surface-input)!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .flow-search input{background:transparent!important;color:var(--dm-text-primary)!important}
html[data-theme="dark"] .flow-scope{color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .flow-scope:hover{background:var(--dm-surface-elevated)!important}
html[data-theme="dark"] .flow-scope span{background:#26313e!important;color:#aeb8c7!important}
html[data-theme="dark"] .flow-scope.active{background:#22304a!important;color:#a9bdff!important}
html[data-theme="dark"] .flow-scope.active span{background:#2b3a55!important;color:#dce5ff!important}
html[data-theme="dark"] .work-zone-toggle{background:var(--dm-surface-card)!important;color:var(--dm-text-primary)!important}
html[data-theme="dark"] .work-zone-body{border-color:var(--dm-border)!important}
html[data-theme="dark"] .work-table thead th{background:#141b24!important;color:#8f9aac!important}
html[data-theme="dark"] .work-row:hover{background:#1c2632!important}
html[data-theme="dark"] .assignee-dot{background:#26313e!important;color:#d3dbe6!important}

/* Service Operations list */
html[data-theme="dark"] .service-ops-summary button{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important;color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-ops-summary button:hover{background:var(--dm-surface-hover)!important;border-color:var(--dm-border-strong)!important}
html[data-theme="dark"] .service-ops-summary b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-ops-controls{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-main-scopes{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-main-scopes button{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-main-scopes button:hover{background:var(--dm-surface-elevated)!important;color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-main-scopes button.active{background:#253142!important;color:#f3f6fa!important}
html[data-theme="dark"] .service-quick-filters button,
html[data-theme="dark"] .service-team-toggle,
html[data-theme="dark"] .service-tech-filter select{background:var(--dm-surface-elevated)!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .service-quick-filters button:hover,
html[data-theme="dark"] .service-team-toggle:hover{background:var(--dm-surface-hover)!important;color:#fff!important;border-color:var(--dm-border-strong)!important}
html[data-theme="dark"] .service-quick-filters button.active,
html[data-theme="dark"] .service-team-toggle.active{background:#293648!important;color:#fff!important;border-color:#45566c!important}
html[data-theme="dark"] .service-tech-filter>span{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-view-toggle{background:#121923!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-view-toggle button{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-view-toggle button.active{background:var(--dm-surface-elevated)!important;color:#fff!important;box-shadow:none!important}
html[data-theme="dark"] .service-identity b,
html[data-theme="dark"] .service-work b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-identity span,
html[data-theme="dark"] .service-technician,
html[data-theme="dark"] .service-plan{color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .service-identity small{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-status-quiet{background:#25303d!important;color:#c9d2dd!important}
html[data-theme="dark"] .service-status-quiet.warning{background:#33291a!important;color:#efc372!important}
html[data-theme="dark"] .service-status-quiet.positive{background:#173126!important;color:#76d6a7!important}
html[data-theme="dark"] .service-status-quiet.muted{background:#232b36!important;color:#9aa5b5!important}
html[data-theme="dark"] .service-ops-card,
html[data-theme="dark"] .service-team-panel{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important;color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-ops-card:hover{background:#1a2330!important;border-color:var(--dm-border-strong)!important;box-shadow:0 12px 30px rgba(0,0,0,.2)!important}
html[data-theme="dark"] .service-ops-card-problem,
html[data-theme="dark"] .service-team-item{background:var(--dm-surface-elevated)!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}

/* Service Job v2: restore product-card hierarchy */
html[data-theme="dark"] .service-v2-identity h1{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-v2-identity h2{color:#cbd4df!important}
html[data-theme="dark"] .service-v2-identity p,
html[data-theme="dark"] .service-v2-kicker{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-v2-command{
  background:linear-gradient(145deg,#171f2a,#1b2431)!important;
  border:1px solid #2d3949;
  box-shadow:0 16px 38px rgba(0,0,0,.2)!important;
}
html[data-theme="dark"] .service-v2-command-actions .secondary,
html[data-theme="dark"] .service-v2-command-actions .mini-btn{background:#202a37!important;border-color:#384659!important;color:#f1f4f8!important}
html[data-theme="dark"] .service-v2-workspace,
html[data-theme="dark"] .service-v2-machine{
  background:var(--dm-surface-card)!important;
  border:1px solid var(--dm-border-strong)!important;
  box-shadow:0 16px 36px rgba(0,0,0,.14)!important;
}
html[data-theme="dark"] .service-v2-lifecycle-nav{
  background:#1b2430!important;
  border-bottom-color:var(--dm-border-strong)!important;
}
html[data-theme="dark"] .service-v2-lifecycle-nav button{color:#8f9aac!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button:not(:last-child):after{background:#313e4e!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button>span{background:#26313e!important;color:#aeb8c7!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button>b{color:#aab4c2!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.done>span{background:#1d3a2e!important;color:#8be0b2!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.done>b{color:#aac9b9!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.current{background:#263344!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.current>span{background:#dce5f0!important;color:#18212d!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.current>b{color:#f2f5f8!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.current:before{background:#b9c7d8!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button:hover{background:#222e3c!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.upcoming>span{background:#18202a!important;border-color:#394657!important;color:#778397!important}
html[data-theme="dark"] .service-v2-lifecycle-nav button.upcoming>b{color:#778397!important}
html[data-theme="dark"] .service-v2-stage-body{background:var(--dm-surface-card)!important}
html[data-theme="dark"] .service-v2-stage-copy span,
html[data-theme="dark"] .service-v2-stage-copy p{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-v2-stage-copy h3{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-v2-facts{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-v2-fact{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-v2-fact small{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-v2-fact b{color:#e6ebf1!important}
html[data-theme="dark"] .service-v2-fact span{color:#9ca7b6!important}
html[data-theme="dark"] .service-v2-narrative,
html[data-theme="dark"] .service-v2-result-placeholder,
html[data-theme="dark"] .service-parts-empty,
html[data-theme="dark"] .service-complete-advanced,
html[data-theme="dark"] .service-part-card{background:var(--dm-surface-elevated)!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .service-v2-list,
html[data-theme="dark"] .service-v2-list>div,
html[data-theme="dark"] .service-v2-machine-head,
html[data-theme="dark"] .service-v2-machine-rows>div{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-v2-list b,
html[data-theme="dark"] .service-v2-machine-head h3,
html[data-theme="dark"] .service-v2-machine-rows b,
html[data-theme="dark"] .service-v2-machine-history b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-v2-list small,
html[data-theme="dark"] .service-v2-list strong,
html[data-theme="dark"] .service-v2-machine-head span,
html[data-theme="dark"] .service-v2-machine-rows span,
html[data-theme="dark"] .service-v2-machine-history small,
html[data-theme="dark"] .service-v2-machine-history span{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-v2-machine-alert,
html[data-theme="dark"] .service-v2-attention{background:#33291a!important;color:#efc575!important;border:1px solid #554321!important}
html[data-theme="dark"] .service-v2-history,
html[data-theme="dark"] .service-v2-legacy{background:#141b24!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .service-v2-history summary,
html[data-theme="dark"] .service-v2-legacy summary{color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .service-v2-history-body,
html[data-theme="dark"] .service-v2-revision,
html[data-theme="dark"] .service-v2-legacy>[data-service-v2-legacy-slot]{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-v2-revision p{color:#abb5c2!important}
html[data-theme="dark"] .service-v2-original-grid .info-grid>div{background:var(--dm-surface-elevated)!important}

/* Completion modal remains in the same dark family */
html[data-theme="dark"] .service-complete-head{background:#151c25!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-complete-head h2,
html[data-theme="dark"] .service-complete-section-head b{color:var(--dm-text-primary)!important}
html[data-theme="dark"] .service-complete-head p,
html[data-theme="dark"] .service-complete-section-head small{color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-complete-section{border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-complete-section-head>div>span{background:#26313e!important;color:#aeb8c7!important}
html[data-theme="dark"] .service-meter-input-wrap{background:var(--dm-surface-input)!important;border-color:var(--dm-border)!important}
html[data-theme="dark"] .service-meter-input-wrap span{border-color:var(--dm-border)!important;color:var(--dm-text-muted)!important}
html[data-theme="dark"] .service-part-remove{background:#18212b!important;border-color:var(--dm-border)!important;color:#aeb8c7!important}
html[data-theme="dark"] .service-complete-actions{background:rgba(18,24,33,.96)!important;border-color:var(--dm-border)!important}

/* Work drawer / notification surfaces */
html[data-theme="dark"] .work-drawer-panel,
html[data-theme="dark"] .work-drawer-tabs,
html[data-theme="dark"] .work-composer,
html[data-theme="dark"] .work-composer textarea,
html[data-theme="dark"] .work-file-card,
html[data-theme="dark"] .update-body{background:var(--dm-surface-card)!important;border-color:var(--dm-border)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .work-description{background:var(--dm-surface-elevated)!important;color:var(--dm-text-secondary)!important}
html[data-theme="dark"] .work-detail-head,
html[data-theme="dark"] .work-drawer-tabs,
html[data-theme="dark"] .work-composer-foot{border-color:var(--dm-border)!important}
html[data-theme="dark"] .work-detail-head h2,
html[data-theme="dark"] .work-detail-head h3,
html[data-theme="dark"] .update-body p{color:var(--dm-text-primary)!important}
