/* ── Global form controls ───────────────────────────────────────────
   One consistent look for scrollbars, <select> dropdowns and checkboxes
   across the whole app. These are element-level (low-specificity) rules:
   any component that wants a bespoke control can still override them.
   Loaded after the component styles so unstyled/native controls pick up
   the on-brand appearance, and before themes-light.css so light mode can
   re-tint them. */

:root {
  /* Shared down-chevron used by every styled <select> (muted-text stroke). */
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a6b1ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}

/* ═══ Scrollbars ═════════════════════════════════════════════════════ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb, rgba(255, 255, 255, 0.22)) transparent;
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb, rgba(255, 255, 255, 0.18));
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
  transition: background-color 0.15s ease;
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(var(--accent-rgb), 0.55);
}
::-webkit-scrollbar-corner { background: transparent; }

/* ═══ Native <select> ════════════════════════════════════════════════ */
select {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: var(--text, #f0f3f1);
  background-color: var(--input-bg, rgba(255, 255, 255, 0.05));
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: var(--radius-control, 10px);
  padding: 9px 34px 9px 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
select:hover { border-color: rgba(var(--accent-rgb), 0.4); }
select:focus,
select:focus-visible {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}
select:disabled { opacity: 0.5; cursor: default; }
/* The option popup is OS-rendered but still receives the semantic palette. */
select option {
  background-color: var(--control-bg, #15191a);
  color: var(--text, #f0f3f1);
}

/* ═══ Checkboxes ═════════════════════════════════════════════════════ */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.28));
  border-radius: 6px;
  background: var(--input-bg, rgba(255, 255, 255, 0.05));
  cursor: pointer;
  position: relative;
  display: inline-grid;
  place-content: center;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
input[type="checkbox"]:hover { border-color: rgba(var(--accent-rgb), 0.5); }
input[type="checkbox"]::after {
  content: '';
  width: 5px;
  height: 9px;
  margin-top: -1px;
  border: solid var(--on-accent, #06080a);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.16s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}
input[type="checkbox"]:checked {
  background: rgb(var(--accent-rgb));
  border-color: rgb(var(--accent-rgb));
}
input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}
input[type="checkbox"]:disabled { opacity: 0.45; cursor: default; }

/* Custom switch toggles drive a visually-hidden input — never paint a box for
   those (they render their own track/thumb). Higher specificity than above. */
.ui-toggle input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; border: 0; border-radius: 0; background: none;
  opacity: 0; display: block; place-content: initial;
}
.ui-toggle input[type="checkbox"]::after { content: none; }

/* ── "Enable sensors" affordance (js/sensor-access.js) ─────────────────────────
   Shown by the Fans/Energy widgets and Settings → System when LibreHardwareMonitor
   is present but unelevated, so its kernel driver never loads. Scoped to .sa-* so
   it renders the same wherever the user meets the problem. */
.sa-hint { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.sa-hint-text { font-size: 11.5px; opacity: 0.7; line-height: 1.4; max-width: 320px; }
/* The hardware-sensors section builds itself (js/sensor-access.js) and stays
   empty unless there is something to repair — which is every macOS and Linux
   install, and every healthy Windows one. An empty div is still a GRID ITEM of
   .settings-content, so it holds a row and the 12px row-gap above the next
   section: no box, but a gap at the top of the page for nothing. `hidden` is not
   an option here, because settingsSetCategory() rewrites it on every element
   with data-settings-cat each time a category is opened. */
#settings-sensors-hub:empty { display: none; }
.sa-btn {
  flex: 0 0 auto; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text, #f0f3f1); padding: 5px 13px; border-radius: 999px;
  background: rgba(var(--accent-rgb, 30, 215, 96), 0.16);
  border: 1px solid rgba(var(--accent-rgb, 30, 215, 96), 0.42);
  transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}
.sa-btn:hover:not(:disabled) { background: rgba(var(--accent-rgb, 30, 215, 96), 0.28); border-color: rgba(var(--accent-rgb, 30, 215, 96), 0.7); }
.sa-btn:active:not(:disabled) { transform: scale(0.98); }
.sa-btn:disabled { opacity: 0.5; cursor: default; }
.sa-status { font-size: 11px; line-height: 1.35; max-width: 320px; opacity: 0.75; }
.sa-status:empty { display: none; }
.sa-status.is-ok { color: #4ade80; opacity: 1; }
.sa-status.is-warn { color: #fbbf24; opacity: 1; }
