.theme-control {
  position: relative;
  width: fit-content;
  margin: 8px 12px 8px auto;
  background: var(--card, #fff);
  color: var(--ink, #142d35);
  border: 1px solid var(--line, #abb);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px #0002;
}
.theme-control select {
  width: auto;
  margin: 0;
  padding: 4px;
}
.photo-gallery {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.photo-gallery figure {
  margin: 5px;
  max-width: 250px;
  overflow-wrap: anywhere;
}
fieldset {
  border: 1px solid var(--line, #bcd);
  border-radius: 12px;
  margin: 14px 0;
  padding: 14px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101923;
  --paper: #182531;
  --card: #182531;
  --ink: #e8eff5;
  --text: #e8eff5;
  --muted: #aebdcc;
  --line: #384d5d;
  --teal: #62d4c5;
  --navy: #102330;
  --gold: #f1c96a;
}
[data-theme="dark"] body,
[data-theme="dark"] main {
  background: #101923;
  color: #e8eff5;
}
[data-theme="dark"] .card,
[data-theme="dark"] .stat,
[data-theme="dark"] .stats,
[data-theme="dark"] dialog,
[data-theme="dark"] aside,
[data-theme="dark"] nav,
[data-theme="dark"] .checks,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .auth,
[data-theme="dark"] .theme-control {
  background: #182531 !important;
  color: #e8eff5 !important;
  border-color: #384d5d !important;
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #101d28 !important;
  color: #f3f7fa !important;
  border-color: #567083 !important;
}
[data-theme="dark"] input[type="checkbox"] {
  accent-color: #32b6aa;
}
[data-theme="dark"] th,
[data-theme="dark"] tr:nth-child(even),
[data-theme="dark"] .hint,
[data-theme="dark"] .checks label,
[data-theme="dark"] .canvas-leader,
[data-theme="dark"] .secret {
  background: #223442 !important;
  color: #dce9f2 !important;
}
[data-theme="dark"] td,
[data-theme="dark"] th {
  border-color: #384d5d !important;
}
[data-theme="dark"] a,
[data-theme="dark"] small {
  color: #8bdbd1;
}
[data-theme="dark"] button.secondary,
[data-theme="dark"] aside button {
  background: #253b49;
  color: #edf5fa;
}
[data-theme="dark"] .badge {
  background: #324955;
  color: #fff;
}
[data-theme="dark"] .rating.red {
  background: #632b36;
  color: #ffe9ed;
}
[data-theme="dark"] .rating.yellow {
  background: #574716;
  color: #fff1b6;
}
[data-theme="dark"] .rating.green {
  background: #1d503e;
  color: #d0ffe7;
}
@media print {
  .theme-control {
    display: none !important;
  }
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: white;
    --card: white;
    --paper: white;
    --ink: black;
    --text: black;
    --muted: #444;
    --line: #ccc;
  }
  [data-theme="dark"] body,
  [data-theme="dark"] main,
  [data-theme="dark"] dialog,
  [data-theme="dark"] .card,
  [data-theme="dark"] td,
  [data-theme="dark"] th,
  [data-theme="dark"] .hint {
    background: white !important;
    color: black !important;
  }
  img {
    max-width: 100%;
    break-inside: avoid;
  }
}

#knowledge-launch[hidden],
.theme-control[hidden] {
  display: none !important;
}
body:has(#app .auth) #knowledge-launch,
body:has(#app .auth) .theme-control {
  display: none !important;
}
[data-performer-list] label[hidden] {
  display: none !important;
}

/* Alert foregrounds stay readable against fixed severity backgrounds in every theme. */
#priority-alerts .priority-alert.warning,
#priority-alerts .priority-alert.warning b,
#priority-alerts .priority-alert.warning p,
#priority-alerts .priority-alert.warning small {
  color: #493300 !important;
}
#priority-alerts .priority-alert.info {
  color: #183047 !important;
}
#priority-alerts .priority-alert.urgent {
  color: #681d17 !important;
}
