/* Se încarcă după app.css. Luminosul păstrează designul inițial. */
:root {
  color-scheme: light;
  --theme-button-bg: #fff;
  --theme-button-hover: #edf4f7;
  --theme-button-border: #708796;
  --theme-button-text: #172b3c;
  --theme-focus: #087d74;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid var(--theme-button-border);
  border-radius: 11px;
  background: var(--theme-button-bg);
  color: var(--theme-button-text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  touch-action: manipulation;
}
.theme-toggle:hover { background: var(--theme-button-hover); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
.theme-toggle > span { display: block; line-height: 1; pointer-events: none; }
.login-panel { position: relative; padding-top: 88px; }
.auth-theme-control { position: absolute; top: 20px; right: 24px; display: flex; z-index: 1; }

/* Aceeași paletă luminoasă, cu detalii și contururi mai ușor de citit. */
:root[data-theme="light"] :is(.page-footer, .profile-source, .breadcrumb) { color: var(--muted); }
:root[data-theme="light"] :is(.field input, .field select, .field textarea, .project-picker select, .btn-secondary, .demo-button) { border-color: #708796; }
:root[data-theme="light"] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
:root[data-theme="light"] :is(button, a, input, select, textarea, summary):focus-visible { outline-color: var(--theme-focus); }
:root[data-theme="light"] .btn:disabled { opacity: 1; color: #576b79; background: #e5ebef; border-color: #708796; }
:root[data-theme="light"] .step-button:disabled { opacity: 1; color: #576b79; }
:root[data-theme="light"] :is(.field input, .field select, .field textarea, .project-picker select):disabled { opacity: 1; color: #576b79; background-color: #edf2f5; -webkit-text-fill-color: #576b79; }
:root[data-theme="light"] .field [aria-invalid="true"] { border-color: var(--danger); }
:root[data-theme="light"] .tab.active { box-shadow: inset 0 0 0 1px #708796; }

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #edf3f8;
  background: #101820;
  --surface: #192733;
  --surface-raised: #203341;
  --control: #12212d;
  --text: #edf3f8;
  --navy: #edf3f8;
  --navy-soft: #c2d2de;
  --teal: #70dfce;
  --teal-hover: #99ebde;
  --teal-pale: #16392f;
  --muted: #acbdca;
  --line: #3d5567;
  --white: #192733;
  --danger: #ffb8c7;
  --danger-pale: #43232c;
  --shadow: 0 6px 30px #00000020;
  --control-border: #748c9c;
  --theme-button-bg: #192733;
  --theme-button-hover: #203341;
  --theme-button-border: #748c9c;
  --theme-button-text: #edf3f8;
  --theme-focus: #70dfce;
}
:root[data-theme="dark"] body { background: #101820; color: var(--text); }
:root[data-theme="dark"] ::selection { background: #70dfce; color: #102a30; }
:root[data-theme="dark"] :is(button, a, input, select, textarea, summary):focus-visible {
  outline-color: var(--theme-focus);
}
:root[data-theme="dark"] .skip-link { background: var(--surface); color: var(--teal); }
:root[data-theme="dark"] .brand-mark { background: var(--teal); color: #102a30; }
:root[data-theme="dark"] .brand small { opacity: 1; color: var(--muted); }
:root[data-theme="dark"] .btn-primary { background: var(--teal); color: #102a30; }
:root[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: var(--teal-hover); }
:root[data-theme="dark"] .btn-secondary {
  background: var(--surface-raised);
  border-color: var(--control-border);
  color: var(--text);
}
:root[data-theme="dark"] .btn-secondary:hover:not(:disabled) { background: #294352; border-color: #9bb5c6; }
:root[data-theme="dark"] .btn-quiet:hover:not(:disabled),
:root[data-theme="dark"] .icon-button:hover { background: var(--surface-raised); color: var(--text); }
:root[data-theme="dark"] .btn-danger { color: var(--danger); background: var(--danger-pale); border-color: #b85c75; }
:root[data-theme="dark"] .btn:disabled,
:root[data-theme="dark"] .icon-button:disabled,
:root[data-theme="dark"] .theme-toggle:disabled {
  opacity: 1;
  background: #283744;
  color: #b5c3cd;
  border-color: #667e8e;
}
:root[data-theme="dark"] .badge-demo { background: #233b4b; color: #c9e1ef; border-color: #5b7b8f; }
:root[data-theme="dark"] .badge-new,
:root[data-theme="dark"] .badge-muted { background: #283b4b; color: #c7d8e5; }
:root[data-theme="dark"] .badge-progress { background: #3e321b; color: #f7d783; }
:root[data-theme="dark"] .badge-complete { background: #16392f; color: #9ee3bf; }
:root[data-theme="dark"] .notice { background: #1c3443; border-color: #537c90; color: #c1deed; }
:root[data-theme="dark"] .error { background: var(--danger-pale); border-color: #b85c75; color: var(--danger); }
:root[data-theme="dark"] .success { background: #16392f; border-color: #477f64; color: #9ee3bf; }
:root[data-theme="dark"] :is(.notice, .error, .success) a { color: #a3ecdf; }
:root[data-theme="dark"] .empty { border-color: #647f90; }
:root[data-theme="dark"] .empty .icon { color: var(--muted); }
:root[data-theme="dark"] .loading:before { border-color: #567282; border-top-color: var(--teal); }
:root[data-theme="dark"] th { background: var(--surface-raised); color: var(--muted); }
:root[data-theme="dark"] td { border-color: var(--line); }
:root[data-theme="dark"] :is(.field input, .field select, .field textarea, .project-picker select) {
  background-color: var(--control);
  border-color: var(--control-border);
  color: var(--text);
  accent-color: var(--teal);
}
:root[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
:root[data-theme="dark"] .field input:read-only,
:root[data-theme="dark"] .field textarea:read-only,
:root[data-theme="dark"] :is(.field input, .field select, .field textarea, .project-picker select):disabled {
  background-color: #283744;
  border-color: #667e8e;
  color: #b5c3cd;
  opacity: 1;
  -webkit-text-fill-color: #b5c3cd;
}
:root[data-theme="dark"] :is(.field select, .project-picker select) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23acbdca' stroke-width='1.6'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] option { background: var(--control); color: var(--text); }
:root[data-theme="dark"] option:disabled { color: var(--muted); }
:root[data-theme="dark"] .field [aria-invalid="true"] { border-color: var(--danger); }
:root[data-theme="dark"] .check-row input { accent-color: var(--teal); }
:root[data-theme="dark"] input:-webkit-autofill,
:root[data-theme="dark"] input:-webkit-autofill:hover,
:root[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--control) inset;
  box-shadow: 0 0 0 1000px var(--control) inset;
}
:root[data-theme="dark"] .login-story { background: #101f2b; color: var(--text); }
:root[data-theme="dark"] .login-story .brand-mark { background: #203341; color: var(--teal); border-color: #537c90; }
:root[data-theme="dark"] .login-intro h1 span,
:root[data-theme="dark"] .login-feature .icon { color: var(--teal); }
:root[data-theme="dark"] .login-intro > p,
:root[data-theme="dark"] .login-feature { color: #c7d8e5; }
:root[data-theme="dark"] .login-story footer { color: var(--muted); }
:root[data-theme="dark"] .login-panel { background: #101820; }
:root[data-theme="dark"] .demo-button { background: var(--surface); color: var(--text); border-color: var(--control-border); }
:root[data-theme="dark"] .demo-button:hover { color: var(--teal); background: var(--surface-raised); border-color: var(--teal); }
:root[data-theme="dark"] .sidebar { background: #0c1b28; color: #d5e0e9; }
:root[data-theme="dark"] .sidebar .brand { color: var(--text); }
:root[data-theme="dark"] .sidebar .brand-mark { background: #203341; color: var(--teal); }
:root[data-theme="dark"] .nav-label,
:root[data-theme="dark"] .sidebar-company p { color: var(--muted); }
:root[data-theme="dark"] .nav-link { color: #c7d8e5; }
:root[data-theme="dark"] .nav-link:hover { background: #203341; color: var(--text); }
:root[data-theme="dark"] .nav-link.active { background: #193a3d; color: #9aeee0; box-shadow: inset 3px 0 var(--teal); }
:root[data-theme="dark"] .sidebar-company { border-color: var(--line); }
:root[data-theme="dark"] .sidebar-company strong { color: var(--text); }
:root[data-theme="dark"] .topbar { background: var(--surface); }
:root[data-theme="dark"] .topbar-context strong { color: #d6e4ee; }
:root[data-theme="dark"] .avatar { background: #284455; color: #d4ecf9; }
:root[data-theme="dark"] .breadcrumb { color: var(--muted); }
:root[data-theme="dark"] .breadcrumb span[aria-hidden] { color: #839eaf; }
:root[data-theme="dark"] .project-hero { background: linear-gradient(115deg, #17313f, #164547); color: var(--text); }
:root[data-theme="dark"] .project-hero .eyebrow { color: #abdcd8; }
:root[data-theme="dark"] .project-hero p { color: #cce5e7; }
:root[data-theme="dark"] .project-emblem { border-color: #65988e; background: #193b40; }
:root[data-theme="dark"] .project-emblem .icon { color: #9aeee0; }
:root[data-theme="dark"] .stat-card .stat-top { color: #a4c6d8; }
:root[data-theme="dark"] .tile-icon { background: #263e4d; color: #b0dcea; }
:root[data-theme="dark"] .progress-line,
:root[data-theme="dark"] .progress-line::-webkit-progress-bar { background: #415b6b; }
:root[data-theme="dark"] .progress-line::-webkit-progress-value { background: var(--teal); }
:root[data-theme="dark"] .progress-line::-moz-progress-bar { background: var(--teal); }
:root[data-theme="dark"] :is(.integration-item, .case-row, .document-row, .profile-photo-category) { border-color: var(--line); }
:root[data-theme="dark"] .search-wrap > .icon { color: var(--muted); }
:root[data-theme="dark"] .tabs { background: #233746; }
:root[data-theme="dark"] .tab { color: #c4d6e2; }
:root[data-theme="dark"] .tab.active { background: #335364; color: #f0f7fb; box-shadow: inset 0 0 0 1px #83a3b5; }
:root[data-theme="dark"] .tab:hover:not(.active) { background: #2c4657; }
:root[data-theme="dark"] .step-button:hover:not(:disabled) { background: var(--surface-raised); }
:root[data-theme="dark"] .step-button.active { color: #9aeee0; background: #163b35; border-color: #629a87; }
:root[data-theme="dark"] .step-button:disabled { color: #a7bac8; opacity: 1; }
:root[data-theme="dark"] .step-number { background: var(--control); border-color: var(--control-border); color: var(--text); }
:root[data-theme="dark"] .step-button.active .step-number { background: var(--teal); border-color: var(--teal); color: #102a30; }
:root[data-theme="dark"] .step-button.done .step-number { background: #204635; border-color: #6caa8d; color: #b6efd0; }
:root[data-theme="dark"] :is(.location-box, .upload-box, .reconcile-comparison > section) { background: var(--control); }
:root[data-theme="dark"] .upload-box { border-color: var(--control-border); }
:root[data-theme="dark"] .location-box .tile-icon { background: #20433c; color: var(--teal); }
:root[data-theme="dark"] .gps-pending { background: #3e321b; border-color: #94763d; color: #f7d783; }
:root[data-theme="dark"] .gps-pending p { color: #f7d783; }
:root[data-theme="dark"] .photo-card { background: var(--surface); }
:root[data-theme="dark"] .photo-card.complete { background: #18312b; border-color: #4e8069; }
:root[data-theme="dark"] .template-help code { background: #2b4252; color: #dceaf4; }
:root[data-theme="dark"] .success-panel .success-icon { background: #204635; color: #b6efd0; }
:root[data-theme="dark"] .scope-tags span { background: #2b4252; color: #d4e5ef; }
:root[data-theme="dark"] .dialog { background: var(--surface); color: var(--text); border-color: #69899c; box-shadow: 0 28px 100px #00000080; }
:root[data-theme="dark"] .dialog::backdrop { background: #030b12bb; }
:root[data-theme="dark"] .toast { background: #23483f; color: #d7f8e8; border: 1px solid #6eab94; }
:root[data-theme="dark"] .toast.error-toast { background: #582c3a; color: #ffe1e9; border-color: #cc8296; }
:root[data-theme="dark"] .page-footer,
:root[data-theme="dark"] .page-footer a,
:root[data-theme="dark"] .profile-source { color: var(--muted); }
:root[data-theme="dark"] .pending-label { color: #f7d783; }
:root[data-theme="dark"] .profile-edit-bar { background: #16392f; border-color: #477f64; }

@media(max-width:580px) {
  .auth-theme-control { top: 18px; right: 22px; }
  .topbar .theme-toggle { margin-right: 2px; }
}
@media(forced-colors:active) {
  .theme-toggle { background: ButtonFace; color: ButtonText; border-color: ButtonText; }
  .theme-toggle:focus-visible { outline-color: Highlight; }
}
