/* ═══ NATIVE CHROME CLEANUP ═══════════════════════════════════════════
   Custom select (replaces the OS-rendered open option list — the one thing
   the base select's appearance:none couldn't reach), plus small resets for
   the number-spinner and date-icon native controls. */

/* ── Custom select ─────────────────────────────────────────────────────── */
.csel { position: relative; display: inline-block; width: 100%; }
.csel-native {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; opacity: 0; pointer-events: none;
}
.csel-trigger {
  appearance: none; -webkit-appearance: none;
  font: inherit; color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  /* Button group (5px), not field group: a dropdown reads as a clickable
     pill with a chevron, and in toolbar rows (.tdl-sort, .trk-picker) it
     sits beside real buttons. Trades a slight mismatch with text inputs in
     form bodies for matching the buttons it visually belongs with. */
  border-radius: var(--radius-md);
  padding: 0 24px 0 8px;
  height: var(--control-h);
  width: 100%;
  display: block;
  text-align: left;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 9px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' fill='none' stroke='%235c5953' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.dark .csel-trigger {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' fill='none' stroke='%239c9c9c' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.csel-trigger:hover { border-color: var(--fg); background-color: var(--hover-bg); }
.csel-trigger:disabled { cursor: default; opacity: .5; }
.csel.open .csel-trigger { border-color: var(--fg); }
/* Match the two contexts that sized the native <select> smaller/wider.
   .tdl-sort sits in a flex row with no width of its own to inherit, so
   without a floor the trigger (and the portalled list, which mirrors its
   width) shrinks to content and clips "Due date"/"Start date" to "Due d…" —
   112px is the shortest width that fits "Start date" at --text-sm with room
   to spare. */
.trk-picker .csel { min-width: 200px; }
.tdl-sort .csel { min-width: 112px; }
.trk-picker .csel-trigger, .tdl-sort .csel-trigger { height: var(--control-h-sm); }

/* Portalled onto <body> and positioned via JS (custom-select.js) — fixed,
   not absolute, and z-indexed above modals (.scrim is 50) since a select
   inside a modal must still float its list above that modal's own content. */
.csel-list {
  position: fixed; z-index: 70;
  margin: 0; padding: 4px; list-style: none;
  background: var(--popover-bg); border: 1px solid var(--hairline);
  -webkit-backdrop-filter: var(--popover-blur);
  backdrop-filter: var(--popover-blur);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  animation: menu-pop-in var(--dur-fast) ease-out;
}
.csel-list::-webkit-scrollbar { width: 8px; }
.csel-list::-webkit-scrollbar-track { background: transparent; }
.csel-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--radius-bar); }
.csel-opt {
  padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: var(--text-base); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.csel-opt.hl, .csel-opt:hover { background: var(--hover-bg); }
.csel-opt.active { font-weight: 500; }
.csel-opt.disabled { color: var(--ink-faint); cursor: default; pointer-events: none; }

/* ── Number input: drop the native up/down spinner ──────────────────────
   -moz-appearance:textfield is the Firefox equivalent; Chromium/Safari need
   the pseudo-elements targeted directly. Replaced by the +/- pair below
   (number-stepper.js) rather than left with no way to nudge the value. */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; appearance: none; margin: 0;
}

/* ── Number stepper: a seamless 3-piece control — dec button / input / inc
   button — built from the same border+radius tokens as a plain input, just
   split into thirds with the shared edges removed so it reads as one field. */
.nstep { display: flex; width: 100%; }
.nstep input[type="number"] {
  flex: 1; min-width: 0; text-align: center;
  border-left: none; border-right: none; border-radius: 0;
}
.nstep-btn {
  flex: none; width: 26px; height: var(--control-h);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline);
  background: transparent; color: var(--ink-soft);
  font-size: var(--text-base); line-height: 1; cursor: pointer;
  transition: transform var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.nstep-dec { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; }
.nstep-inc { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.nstep-btn:hover:not(:disabled) { background: var(--hover-bg); color: var(--fg); }
.nstep-btn:active:not(:disabled) { transform: scale(0.94); }
.nstep-btn:disabled { color: var(--line-strong); cursor: default; }

/* ── Date input: recolor the native calendar icon to match ink tokens ───
   The calendar POPUP itself is OS-drawn with no CSS hook at all — this only
   themes the trigger icon so it doesn't look like a foreign black glyph. */
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .5; cursor: pointer;
  filter: invert(0);
}
body.dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: .85; }
