/* DeviERP dark theme. Activated by <html data-theme="dark"> (top-bar toggle, saved in localStorage).
   Screen only: printed documents always use the light theme. */
@media screen {
html[data-theme="dark"] {
  color-scheme: dark;
  --green-800: #8fdba3;
  --green-700: #6fcf87;
  --green-600: #4cb565;
  --green-500: #45ad5e;
  --green-50: #17301f;
  --ink: #e8efea;
  --ink-2: #c9d4cd;
  --muted: #98a69f;
  --muted-2: #74827b;
  --line: #2a372f;
  --line-2: #223028;
  --bg: #0e1411;
  --card: #151e19;
  --surface-2: #1b2620;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background-color: #101813; color: var(--ink); border-color: #304037; }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #6f7d76; }
html[data-theme="dark"] input[type="date"], html[data-theme="dark"] input[type="time"], html[data-theme="dark"] input[type="month"] { color-scheme: dark; }

/* top bar & navigation */
html[data-theme="dark"] .topbar, html[data-theme="dark"] .mainnav { background: #111914; border-color: var(--line); box-shadow: none; }
html[data-theme="dark"] .brand__tag, html[data-theme="dark"] .search__icon, html[data-theme="dark"] .user__chev { color: var(--muted); }
html[data-theme="dark"] .search input { background: #0f1612; border-color: #2c3a31; color: var(--ink); }
html[data-theme="dark"] .search input::placeholder { color: #75837c; }
html[data-theme="dark"] .icon-btn { color: var(--ink-2); }
html[data-theme="dark"] .icon-btn:hover, html[data-theme="dark"] .user__btn:hover { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .icon-btn--sm { color: var(--muted); }
html[data-theme="dark"] .badge-count { border-color: #111914; }
html[data-theme="dark"] .avatar { background: #223028; color: var(--ink-2); }
html[data-theme="dark"] .avatar .ic { color: var(--muted); }
html[data-theme="dark"] .mainnav__item, html[data-theme="dark"] .mainnav__item .ic { color: var(--ink-2); }
html[data-theme="dark"] .mainnav__item:hover, html[data-theme="dark"] .navgroup.is-open > .mainnav__item:not(.is-active) { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .mainnav__item.is-active { background: linear-gradient(180deg, #1b3523, #17301f); color: var(--green-700); }
html[data-theme="dark"] .mainnav__item.is-active .ic { color: var(--green-700); }
html[data-theme="dark"] .dropdown__menu, html[data-theme="dark"] .submenu { background: #18221c; border-color: var(--line); box-shadow: 0 18px 44px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .menu-item, html[data-theme="dark"] .submenu__item { color: var(--ink-2); }
html[data-theme="dark"] .menu-item:hover, html[data-theme="dark"] .note:hover, html[data-theme="dark"] .bell__all:hover { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .submenu__item:hover, html[data-theme="dark"] .submenu__item:focus-visible { background: #1d3524; color: var(--green-700); }
html[data-theme="dark"] .submenu__item .ic { color: var(--muted); }
html[data-theme="dark"] .note.is-unread { background: #172a1d; }
html[data-theme="dark"] .menu-item--danger:hover { background: #3a1818; }

/* cards, kpis, stats */
html[data-theme="dark"] .card, html[data-theme="dark"] .kpi, html[data-theme="dark"] .stat, html[data-theme="dark"] .screen { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .kpi h3, html[data-theme="dark"] .welcome__hello, html[data-theme="dark"] .welcome__sub { color: var(--ink-2); }
html[data-theme="dark"] .kpi__ghost { color: #8fdba3; opacity: .05; }
html[data-theme="dark"] .welcome { background: linear-gradient(90deg, #142019 0%, #15241b 60%, #173021 100%); border-color: var(--line); }
html[data-theme="dark"] .welcome__bg { opacity: .32; }
html[data-theme="dark"] .welcome__script { color: #a7e2b5; text-shadow: none; }
html[data-theme="dark"] .clock { background: rgba(20, 30, 24, .92); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .clock strong, html[data-theme="dark"] .clock small { color: var(--ink-2); }
html[data-theme="dark"] .tone-good, html[data-theme="dark"] .stat--good strong { color: #5fd07c; }
html[data-theme="dark"] .tone-bad, html[data-theme="dark"] .stat--bad strong, html[data-theme="dark"] .form-error { color: #ff7b72; }
html[data-theme="dark"] .tone-text-green { color: #5fd07c; }
html[data-theme="dark"] .bar, html[data-theme="dark"] .progress, html[data-theme="dark"] .occupancy { background: #223028; }

/* charts */
html[data-theme="dark"] .chart-grid { stroke: #223028; }
html[data-theme="dark"] .chart-axis { stroke: #2e3d34; }
html[data-theme="dark"] .chart-ylabel, html[data-theme="dark"] .chart-xlabel { fill: #8d9b94; }
html[data-theme="dark"] .chart-value { fill: #c9d4cd; }
html[data-theme="dark"] .chart-tip { background: #e8efea; color: #0e1411; }

/* tables */
html[data-theme="dark"] .table thead th, html[data-theme="dark"] .lines th, html[data-theme="dark"] .pl-head { background: #19241e; color: var(--muted); }
html[data-theme="dark"] .table td, html[data-theme="dark"] .table th { border-color: var(--line-2); }
html[data-theme="dark"] .table tbody tr:hover td { background: #18221c; }
html[data-theme="dark"] .table tfoot td, html[data-theme="dark"] .pl-strong td { background: #18221c; }
html[data-theme="dark"] .table tr.is-muted td, html[data-theme="dark"] .table tr.is-muted td .row-link { color: #66746d; }
html[data-theme="dark"] .code { background: #1f2b24; color: var(--ink-2); }
html[data-theme="dark"] .tag { background: #3a2c10; color: #f5c565; }
html[data-theme="dark"] mark { background: #4a3b10; color: #ffe08a; }

/* pills & tones */
html[data-theme="dark"] .pill--success, html[data-theme="dark"] .tone-green { background: #17331f; color: #6fcf87; }
html[data-theme="dark"] .pill--warning, html[data-theme="dark"] .tone-amber { background: #3a2e10; color: #f5c565; }
html[data-theme="dark"] .pill--danger, html[data-theme="dark"] .tone-red { background: #3b1a1a; color: #ff8a80; }
html[data-theme="dark"] .pill--muted, html[data-theme="dark"] .tone-slate { background: #222c27; color: #a3b0a9; }
html[data-theme="dark"] .pill--info, html[data-theme="dark"] .tone-blue { background: #172a40; color: #7db7ff; }
html[data-theme="dark"] .tone-orange { background: #3a2412; color: #ffab6e; }
html[data-theme="dark"] .tone-purple { background: #2a2140; color: #b79cff; }

/* buttons & filters */
html[data-theme="dark"] .btn-secondary, html[data-theme="dark"] .btn-ghost, html[data-theme="dark"] .select select, html[data-theme="dark"] .subtab { background: #172019; border-color: #2c3a31; color: var(--ink-2); }
html[data-theme="dark"] .btn-secondary:hover, html[data-theme="dark"] .btn-ghost:hover, html[data-theme="dark"] .subtab:hover, html[data-theme="dark"] .btn.btn-ghost:hover { background: #1d2a22; border-color: #3a4c40; color: var(--ink); }
html[data-theme="dark"] .subtab.is-active, html[data-theme="dark"] .btn-ghost.is-active { background: #17301f; border-color: #2f5a3b; color: var(--green-700); }
html[data-theme="dark"] .btn-danger { background: #1f1414; border-color: #5a2a2a; color: #ff8a80; }
html[data-theme="dark"] .btn-danger:hover, html[data-theme="dark"] .icon-btn--danger:hover { background: #3a1818; color: #ff8a80; }
html[data-theme="dark"] .filters__search input, html[data-theme="dark"] .filters__date input,
html[data-theme="dark"] .lines input, html[data-theme="dark"] .lines select, html[data-theme="dark"] .totals input,
html[data-theme="dark"] .form-field input, html[data-theme="dark"] .form-field select, html[data-theme="dark"] .form-field textarea { background: #101813; border-color: #2e3d34; color: var(--ink); }
html[data-theme="dark"] .form-field input[readonly], html[data-theme="dark"] .lines input[readonly], html[data-theme="dark"] .static-value { background: #18221c; color: var(--muted); }
html[data-theme="dark"] .check__box { background: #101813; border-color: #3a4a40; }
html[data-theme="dark"] .multicheck { border-color: #2e3d34; }

/* messages & callouts */
html[data-theme="dark"] .toast--ok, html[data-theme="dark"] .alert--ok { background: #14301d; color: #8fe0a4; border-color: #22482d; }
html[data-theme="dark"] .toast--error, html[data-theme="dark"] .alert--error { background: #361818; color: #ffa39b; border-color: #5a2626; }
html[data-theme="dark"] .callout, html[data-theme="dark"] .info-box { background: #15261b; border-color: #23412c; color: #b8dcc2; }
html[data-theme="dark"] .callout--warn { background: #2f2610; border-color: #4d3e14; color: #f2d48a; }
html[data-theme="dark"] .result:hover, html[data-theme="dark"] .activity a:hover, html[data-theme="dark"] a.screen:hover { background: #18221c; }
html[data-theme="dark"] .grade, html[data-theme="dark"] .shed-card__grid div { background: #18221c; border-color: var(--line); }

/* ERP components */
html[data-theme="dark"] .board__card, html[data-theme="dark"] .followups li { background: #111a15; }
html[data-theme="dark"] .board__col.is-over { background: #17301f; }
html[data-theme="dark"] .stage-bar__step { background: #172019; }
html[data-theme="dark"] .toplist li:first-child .toplist__rank { background: #3a2412; color: #ffab6e; }
html[data-theme="dark"] .theme-toggle { color: #ffc861; }

/* login / forgot password */
html[data-theme="dark"] .auth-hero { background: radial-gradient(120% 60% at 0% 0%, #17241c 0%, rgba(23, 36, 28, 0) 60%), linear-gradient(180deg, #0f1712 0%, #111c15 45%, #13211a 100%); }
html[data-theme="dark"] .auth-hero__photo { opacity: .55; }
html[data-theme="dark"] .auth-hero__title, html[data-theme="dark"] .feature strong, html[data-theme="dark"] .preview__head { color: var(--ink); }
html[data-theme="dark"] .auth-hero__sub, html[data-theme="dark"] .feature small, html[data-theme="dark"] .brand__tag { color: var(--ink-2); }
html[data-theme="dark"] .preview__card, html[data-theme="dark"] .preview__chart { background: rgba(21, 30, 25, .9); border-color: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .pstat { background: #1b2620; }
html[data-theme="dark"] .pstat--warm { background: #2d2116; }
html[data-theme="dark"] .preview__pill, html[data-theme="dark"] .lang__btn, html[data-theme="dark"] .lang__menu { background: #172019; border-color: #2c3a31; color: var(--ink-2); }
html[data-theme="dark"] .auth-panel, html[data-theme="dark"] .auth-card, html[data-theme="dark"] .auth-card__badge { background: #121a16; }
html[data-theme="dark"] .auth-card { border-color: var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .field input { background: #0f1612; border-color: #2e3d34; color: var(--ink); }
html[data-theme="dark"] .field__icon, html[data-theme="dark"] .field__toggle { color: var(--muted); }
html[data-theme="dark"] .field__toggle:hover, html[data-theme="dark"] .lang__menu a:hover { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .lang__menu a.is-active { background: #17301f; color: var(--green-700); }
}
