/* QB-Produktion: globale Hell-/Dunkel-Darstellung. */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #ffffff20;
  border-radius: 10px;
  background: #ffffff0c;
  color: #eef5f1;
  cursor: pointer;
  text-align: left;
}

.theme-toggle:hover, .theme-toggle:focus-visible {
  border-color: #d7813a;
  background: #ffffff16;
  outline: none;
}

.theme-toggle > span:first-child {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #d7813a;
  color: #1a1511;
  font-size: 18px;
}

.theme-toggle strong, .theme-toggle small { display: block; }
.theme-toggle strong { font-size: 13px; }
.theme-toggle small { margin-top: 2px; color: #aebdb6; font-size: 10px; }
.sidebar .theme-toggle { margin: 0 12px 10px; padding: 7px 10px; }
.topbar-theme-toggle { margin-left: auto; padding: 6px 10px; }
.pwa-install-button[hidden] { display: none !important; }
.topbar .pwa-install-button { margin-left: 0; }

html[data-theme="dark"] {
  color-scheme: dark;
  --navy: #171512;
  --blue: #d4772b;
  --cyan: #eba34f;
  --paper: #151515;
  --ink: #f1ede7;
  --muted: #aaa39a;
  --line: #3c3935;
  --danger: #ff8178;
  --ok: #69cf91;
  --warn: #e7ad55;
  background: #151515;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-content { background: #151515; color: var(--ink); }
html[data-theme="dark"] a { color: #ef9b50; }
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] strong { color: #f4f0e9; }
html[data-theme="dark"] .muted,
html[data-theme="dark"] .hint,
html[data-theme="dark"] small { color: var(--muted); }

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar { background: #11100f; box-shadow: 0 2px 18px #0008; }
html[data-theme="dark"] .nav-group-toggle { color: #b9afa5; }
html[data-theme="dark"] .sidebar nav a { color: #d8d1c8; }
html[data-theme="dark"] .sidebar nav a:hover { background: #d4772b20; color: #fff; }
html[data-theme="dark"] .sidebar nav a.nav-current {
  background: linear-gradient(135deg, #a94f17, #d4772b);
  color: #fff;
  box-shadow: 0 6px 18px #0008;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .scanner-card,
html[data-theme="dark"] .kpis article,
html[data-theme="dark"] .flow-panel,
html[data-theme="dark"] .flow-metrics article,
html[data-theme="dark"] .flow-job,
html[data-theme="dark"] .flow-warning-panel,
html[data-theme="dark"] .inventory-panel,
html[data-theme="dark"] .inventory-metrics article,
html[data-theme="dark"] .data-panel,
html[data-theme="dark"] .diagnostic-card,
html[data-theme="dark"] .help-topic,
html[data-theme="dark"] .integration-card,
html[data-theme="dark"] .storage-group,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .recipe-card,
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .print-card {
  background: #232220;
  border-color: var(--line);
  box-shadow: 0 7px 22px #0005;
  color: var(--ink);
}

html[data-theme="dark"] .flow-hero,
html[data-theme="dark"] .data-hero,
html[data-theme="dark"] .export-hero,
html[data-theme="dark"] .inventory-head,
html[data-theme="dark"] .integration-head,
html[data-theme="dark"] .diagnostic-summary,
html[data-theme="dark"] .storage-head {
  background: linear-gradient(135deg, #211c18, #342318);
  border-color: #5a3b26;
  color: var(--ink);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #191817;
  border-color: #504b44;
  color: #f4f0e9;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #817b74; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #e18a3e;
  box-shadow: 0 0 0 3px #d4772b2c;
  outline: none;
}
html[data-theme="dark"] option { background: #191817; color: #f4f0e9; }

html[data-theme="dark"] .primary { background: #d4772b; color: #17110c; }
html[data-theme="dark"] .primary:hover { background: #e18a3e; }
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .inventory-action,
html[data-theme="dark"] .data-link {
  background: #35322e;
  border-color: #514c45;
  color: #eee7de;
}
html[data-theme="dark"] .secondary:hover,
html[data-theme="dark"] .inventory-action:hover,
html[data-theme="dark"] .data-link:hover { background: #433b34; border-color: #d4772b; }

html[data-theme="dark"] table,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .inventory-table { color: var(--ink); }
html[data-theme="dark"] th,
html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .inventory-table thead th {
  background: #1c1b19;
  border-color: var(--line);
  color: #c4bcb2;
}
html[data-theme="dark"] td,
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .inventory-table td { border-color: var(--line); }
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .data-table tbody tr:hover,
html[data-theme="dark"] .inventory-table tbody tr:hover { background: #d4772b12; }

html[data-theme="dark"] .article-tabs,
html[data-theme="dark"] .data-tabs,
html[data-theme="dark"] .storage-toolbar,
html[data-theme="dark"] .flow-panel-head,
html[data-theme="dark"] .data-panel-head,
html[data-theme="dark"] .storage-group summary,
html[data-theme="dark"] .scanner-card-head,
html[data-theme="dark"] .pallet-dialog header { background: #1d1c1a; border-color: var(--line); }

html[data-theme="dark"] .pallet-dialog,
html[data-theme="dark"] dialog {
  background: #242321;
  border-color: #514a42;
  color: var(--ink);
  box-shadow: 0 24px 70px #000c;
}
html[data-theme="dark"] dialog::backdrop { background: #050505c7; }

html[data-theme="dark"] .alert,
html[data-theme="dark"] .flow-notice,
html[data-theme="dark"] .help-notice,
html[data-theme="dark"] .export-note { background: #342b20; border-color: #78542e; color: #f3d2a8; }
html[data-theme="dark"] .alert.success,
html[data-theme="dark"] .live,
html[data-theme="dark"] .audit-ok { background: #173426; color: #79dda0; }
html[data-theme="dark"] .alert.error,
html[data-theme="dark"] .audit-bad { background: #3b201e; color: #ff938a; }

html[data-theme="dark"] .data-code,
html[data-theme="dark"] .code,
html[data-theme="dark"] .barcode,
html[data-theme="dark"] .location-code,
html[data-theme="dark"] .error-code-help { background: #181715; border-color: #49443e; color: #efb173; }
html[data-theme="dark"] .auto-target { background: #332719; border-color: #76502d; color: #f0bd86; }
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .data-empty,
html[data-theme="dark"] .flow-empty { background: #1d1c1a; border-color: #46413b; color: var(--muted); }

html[data-theme="dark"] .status,
html[data-theme="dark"] .data-status,
html[data-theme="dark"] .flow-pill { border-color: #514b44; }

html[data-theme="dark"] .scanner-field,
html[data-theme="dark"] .scanner-step,
html[data-theme="dark"] .scanner-help,
html[data-theme="dark"] .scanner-history { background: #232220; border-color: var(--line); }
html[data-theme="dark"] .scanner-select-wrap > span { background: #392a1e; }

@media (max-width: 960px) {
  .topbar-theme-toggle strong { display: none; }
  .topbar-theme-toggle { padding: 5px; }
}

@media print {
  .theme-toggle { display: none !important; }
  html[data-theme="dark"],
  html[data-theme="dark"] body,
  html[data-theme="dark"] .app-content,
  html[data-theme="dark"] .panel,
  html[data-theme="dark"] .form-card,
  html[data-theme="dark"] table,
  html[data-theme="dark"] th,
  html[data-theme="dark"] td {
    color-scheme: light;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
  }
}
