/* Shared staff/account form controls. Inputs retain native semantics and values. */
body input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  display: inline-block; width: 18px; height: 18px; min-width: 18px; min-height: 18px;
  flex: 0 0 18px; margin: 1px 0 0; padding: 0;
  border: 1.5px solid var(--line); border-radius: 5px;
  background-color: var(--surface); background-position: center; background-repeat: no-repeat; background-size: 14px 14px;
  vertical-align: middle; cursor: pointer; box-shadow: none;
  transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
body input[type="checkbox"]:hover:not(:disabled) { border-color: var(--blue); }
body input[type="checkbox"]:checked {
  background-color: #124bce; border-color: #124bce;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m4 10 4 4 8-8' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body input[type="checkbox"]:indeterminate {
  background-color: #124bce; border-color: #124bce;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10h10' stroke='white' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
}
body input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
body input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
body input[type="checkbox"][aria-invalid="true"] { border-color: var(--danger); }
.checkbox-row:has(input[type="checkbox"]) { cursor: pointer; gap: 10px; }
.checkbox-row:has(input[type="checkbox"]:disabled) { cursor: not-allowed; }
.people-member-option input[type="checkbox"] { width: 18px; height: 18px; flex-basis: 18px; margin: 0; }

.dh-select { position: relative; display: inline-flex; flex-direction: column; min-width: 0; width: 100%; vertical-align: middle; }
/* Leave the native source measurable for existing integrations, but not interactive. */
select[data-custom-select] {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  opacity: 0 !important; pointer-events: none !important; margin: 0 !important;
}
.dh-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-width: 0; min-height: 40px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface);
  font: inherit; font-size: var(--text-sm); font-weight: 400; text-align: left; cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.dh-select-trigger:hover:not(:disabled) { border-color: color-mix(in srgb,var(--muted) 65%,var(--line)); }
/* Open: a slightly firmer border, no glow ring; the list itself shows it's open. */
.dh-select-trigger[aria-expanded="true"] { border-color: color-mix(in srgb,var(--ink) 22%,var(--line)); box-shadow: none; }
.dh-select-trigger:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.dh-select-trigger>svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform .14s ease; }
.dh-select-trigger[aria-expanded="true"]>svg { transform: rotate(180deg); }
.dh-select-value { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-select.is-disabled .dh-select-trigger { background: var(--soft); opacity: .55; cursor: not-allowed; }
.dh-select.is-invalid .dh-select-trigger { border-color: var(--danger); }
.dh-select-error { margin-top: 7px; color: var(--danger); font-size: var(--text-sm); }
.dh-select-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
  display: flex; flex-direction: column; gap: 6px; width: 100%; max-height: 320px;
  margin: 0; padding: 6px; overflow: hidden; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px #00000022;
}
.dh-select-panel[popover] { position: fixed; inset: auto; }
.dh-select-panel.opens-up { top: auto; bottom: calc(100% + 6px); }
.dh-select-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dh-select-panel .dh-select-search { width: 100%; min-height: 38px; flex-shrink: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: var(--text-sm); }
.dh-select-list [role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 36px; padding: 9px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer;
  transition: background-color .12s ease;
}
.dh-select-list [role="option"]>span:first-child { min-width: 0; overflow-wrap: anywhere; }
/* Only the row under the pointer (or keyboard) tints, softly; the chosen one has its check, no box. */
.dh-select-list [role="option"]:is(:hover,.is-active):not(:disabled) { background: color-mix(in srgb,var(--ink) 6%,transparent); }
.dh-select-list [role="option"][aria-selected="true"] { font-weight: 500; }
.dh-select-list [role="option"]:disabled { opacity: .4; cursor: not-allowed; }
.dh-select-list [role="option"] + [role="option"] { margin-top: 2px; }
.dh-select-mark { display: flex; align-items: center; width: 14px; flex-shrink: 0; color: var(--blue); opacity: 0; }
.dh-select-mark svg { width: 14px; height: 14px; }
[aria-selected="true"]>.dh-select-mark { opacity: 1; }
.dh-select-value.is-placeholder { color: var(--muted); }
/* Options can carry a colour dot (data-dot on the <option>), e.g. an inbox's colour. */
.dh-select-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
.dh-select-value.has-dot { display: flex; align-items: center; gap: 10px; }
.dh-select-value.has-dot .dh-select-dot { margin-left: 1px; }
.dh-select-list [role="option"]:has(>.dh-select-dot) { justify-content: flex-start; gap: 10px; }
.dh-select-list [role="option"]:has(>.dh-select-dot)>span:not(.dh-select-mark) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* Multi-select: checkbox marks show every chosen item; rows only tint on hover/keyboard focus. */
.is-multiple .dh-select-list [role="option"] { justify-content: flex-start; gap: 10px; }
.is-multiple .dh-select-list [role="option"]>span:first-child { order: 2; flex: 1; }
.is-multiple .dh-select-mark { order: 1; justify-content: center; width: 16px; height: 16px; border: 1px solid color-mix(in srgb,var(--muted) 55%,var(--line)); border-radius: 4px; color: #fff; opacity: 1; }
.is-multiple .dh-select-mark svg { width: 11px; height: 11px; opacity: 0; }
.is-multiple [aria-selected="true"]>.dh-select-mark { border-color: #124bce; background: #124bce; }
.is-multiple [aria-selected="true"]>.dh-select-mark svg { opacity: 1; }

.dh-select-group { padding: 10px 10px 5px; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.dh-select-empty { margin: 0; padding: 16px 10px; color: var(--muted); font-size: var(--text-sm); text-align: center; }
/* Keep compact filters compact and ordinary form fields full width. */
.row>.dh-select { width: auto; flex: 1 1 auto; }
.surface-header>.dh-select { width: auto; min-width: 135px; }
.overview-report-controls>.dh-select { width: auto; }
.overview-report-controls .dh-select-trigger { font-size: var(--text-sm); min-height: 31px; padding: 6px 9px; gap: 10px; }
.dh-select:has(select.filter-chip) { width: auto; }
.dh-select:has(select.filter-chip) .dh-select-trigger { border-color: transparent; background: transparent; padding: 5px 8px; min-height: 30px; font-size: var(--text-sm); color: var(--muted); }
.setup-team-controls>.dh-select,.setup-guide-controls>.dh-select { flex: 1; }
.project-setup-dialog .dh-select-trigger { font-size: var(--text-md); }
@media(pointer:coarse) { .dh-select-list [role="option"] { min-height: 44px; } }
@media(max-width:540px) { .dh-select-panel .dh-select-search { font-size: var(--text-md); } }
@media(prefers-reduced-motion:reduce) { body input[type="checkbox"],.dh-select-trigger,.dh-select-trigger>svg { transition: none; } }
@media(forced-colors:active) {
  body input[type="checkbox"] { appearance: auto; background-image: none; }
  .dh-select-trigger,.dh-select-panel { border-color: ButtonText; }
  .dh-select-mark { color: Highlight; }
}
@media(prefers-reduced-motion:no-preference) {
  .dh-select-panel:popover-open { animation: dh-select-in .12s ease-out; }
}
@keyframes dh-select-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.people-filter>.dh-select { width: auto; min-width: 128px; }
.dh-select:has(select.people-role-select) { width: 130px; }
:is(.people-filter, .member-table) .dh-select-trigger { font-size: var(--text-sm); min-height: 32px; padding: 6px 10px; gap: 10px; }

/* Dropdown scrollbars: no track, a slim thumb flush with the panel's right edge that stays
   visible. Each list bleeds into its panel's right padding (--dropdown-pad) and gives back
   the rest after the scrollbar, so rows sit with equal space on both sides. */
html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options) {
  --dropdown-bar: 6px;
  scrollbar-gutter: stable;
  margin-right: calc(-1 * var(--dropdown-pad, 0px));
  padding-right: max(0px, calc(var(--dropdown-pad, 0px) - var(--dropdown-bar)));
}
html .dh-select-list { --dropdown-pad: 6px; }
html .timezone-picker-list, html #timezone-options { --dropdown-pad: 8px; }
html #project-options { --dropdown-pad: 7px; }
@supports selector(::-webkit-scrollbar) {
  /* Chromium ignores ::-webkit-scrollbar while scrollbar-width/color apply (theme.css inherits one). */
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options) {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options)::-webkit-scrollbar {
    width: var(--dropdown-bar);
    background: transparent;
  }
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options)::-webkit-scrollbar-track {
    background: transparent;
  }
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options)::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: color-mix(in srgb, var(--ink, #172033) 24%, transparent);
  }
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options)::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--ink, #172033) 40%, transparent);
  }
}
@supports not selector(::-webkit-scrollbar) {
  html :is(.dh-select-list, .timezone-picker-list, #project-options, #notification-items, #timezone-options) {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink, #172033) 24%, transparent) transparent;
  }
}
/* Custom switches, segments and chips keep a hidden native checkbox for semantics; it must stay
   hidden when disabled (e.g. while saving), otherwise it flashes beside the label. */
body :is(.home-setting, .routing-switch, .look-switch, .people-mode-switch, .studio-seg, .routing-chip, .platform-card, .theme-options, .look-choice) input[type="checkbox"],
body :is(.home-setting, .routing-switch, .look-switch, .people-mode-switch, .studio-seg, .routing-chip, .platform-card, .theme-options, .look-choice) input[type="checkbox"]:disabled {
  opacity: 0;
  transition: none;
}
/* Controls you click shouldn't select their label text on quick or double clicks. */
:is(button, .button, .home-setting, .routing-switch, .look-switch, .people-mode-switch, .studio-seg label, .routing-chip, .routing-day-toggle, .checkbox-row, .account-switch, .account-theme, .account-rail-link, .account-rail-sublink, .nav-link, .nav-sublink, .view-toggle, .dh-select-trigger, .dh-select-list [role="option"], label:has(> input[type="checkbox"]), label:has(> input[type="radio"])) {
  -webkit-user-select: none;
  user-select: none;
}
