:root { color-scheme: light; }

.theme-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}
.theme-control > .material-icons { font-size: 20px; color: var(--brand); }
.theme-control select {
  width: auto;
  min-width: 88px;
  min-height: 32px;
  padding: 4px;
  border: 0;
  border-radius: 3px;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.theme-control select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.login-card > .theme-control { display: flex; width: fit-content; margin: 0 auto 20px; }

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --brand: #79bff5;
    --brand-strong: #a5d7fc;
    --ink: #e5edf5;
    --muted: #a5b4c5;
    --line: #35475b;
    --surface: #182536;
    --surface-2: #111c2a;
    --surface-3: #23364a;
    --accent-soft: #293b1d;
    --brand-soft: #203d56;
    --danger: #ff91aa;
    --warning: #f6c774;
    --success: #abd979;
    --shop: #ff88b5;
    --shadow: 0 16px 36px rgb(0 0 0 / 28%);
  }
  :root[data-theme="dark"] body { background: var(--surface-2); }
  :root[data-theme="dark"] .sidebar,
  :root[data-theme="dark"] .topbar { background: rgb(24 37 54 / 97%); }
  :root[data-theme="dark"] .btn.primary { background: #005ca9; color: #fff; }
  :root[data-theme="dark"] .btn.primary:hover { background: #004a89; }
  :root[data-theme="dark"] .btn.success { background: #3f7412; color: #fff; }
  :root[data-theme="dark"] .btn.success:hover { background: #32600d; }
  :root[data-theme="dark"] .btn.danger { background: #a92445; color: #fff; }
  :root[data-theme="dark"] .btn.accent,
  :root[data-theme="dark"] .btn.accent:hover { color: #143000; }
  :root[data-theme="dark"] input::placeholder,
  :root[data-theme="dark"] textarea::placeholder { color: var(--muted); opacity: 1; }
  :root[data-theme="dark"] input[type="checkbox"],
  :root[data-theme="dark"] input[type="radio"] { accent-color: #94c11f; }
  /* Images, photographs, maps and exported documents keep their own colors. */
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; min-width: 0; margin-left: auto; }
}

@media print {
  .theme-control { display: none !important; }
  :root { color-scheme: light; }
}
