/* ==========================================================================
   controls.css: the look of our own dropdowns, date and time pickers (controls.js),
   checkboxes and radio buttons. No browser-default controls anywhere (owner, 2026-11-03).

   Uses the site's colour tokens, with fallbacks so a demo website with its own
   colours can load it too.
   ========================================================================== */

.ctl-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; }

/* the button that stands in for the field: looks exactly like a text box */
.cselect, .cdate { position: relative; display: block; min-width: 0; }
.select.cselect::after { display: none; }
.cselect__btn, .cdate__btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 10px 14px; text-align: left;
  border-radius: var(--r-sm, 12px); background: var(--bg-elev, #fff); border: 1px solid var(--line-strong, #d6d3d1); color: var(--ink, #111);
  font: inherit; font-size: 16px; line-height: 1.3; cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.cselect__btn:hover, .cdate__btn:hover { border-color: var(--muted, #888); }
.cselect__btn:focus-visible, .cdate__btn:focus-visible, .cselect.is-open .cselect__btn, .cdate__btn[aria-expanded="true"] { outline: none; border-color: var(--accent, #d6246e); box-shadow: var(--ring, 0 0 0 3px rgba(214, 36, 110, .18)); }
.cselect__btn:disabled, .cdate__btn:disabled { opacity: .55; cursor: not-allowed; }
.cselect__value, .cdate__value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cselect__btn.is-placeholder .cselect__value, .cdate__btn.is-placeholder .cdate__value { color: var(--muted, #888); }
.cselect__btn > .i { flex: none; width: 18px; height: 18px; color: var(--muted, #888); transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.cselect.is-open .cselect__btn > .i { transform: rotate(180deg); color: var(--accent, #d6246e); }
.cdate__btn > .i { flex: none; width: 18px; height: 18px; color: var(--accent, #d6246e); }
.cdate__clear { position: absolute; right: 8px; top: 50%; translate: 0 -50%; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--muted, #888); background: none; border: 0; cursor: pointer; }
.cdate__clear:hover { background: var(--bg-soft, #f4f4f5); color: var(--ink, #111); }
.cdate__clear .i { width: 16px; height: 16px; }
.cdate:has(.cdate__clear:not([hidden])) .cdate__btn { padding-right: 44px; }
.cdate.is-invalid .cdate__btn { border-color: var(--bad, #dc2626); }

/* small ones: the status dropdown in a table row, filters */
.cselect--sm .cselect__btn { min-height: 34px; padding: 4px 10px 4px 12px; gap: 6px; font-size: calc(13px * var(--fz, 1)); border-radius: var(--r-pill, 999px); font-weight: 600; }
.cselect--sm .cselect__btn > .i { width: 15px; height: 15px; }

/* the pop-up (list or calendar), placed on <body> by controls.js */
.ctl-pop {
  position: fixed; z-index: 3000; min-width: 180px; max-width: min(360px, calc(100vw - 16px)); overflow: auto; overscroll-behavior: contain;
  padding: 6px; border-radius: 14px; background: var(--bg-elev, #fff); color: var(--ink, #111);
  border: 1px solid var(--line, #e7e5e4); box-shadow: 0 18px 40px -12px rgba(12, 15, 29, .28), 0 4px 12px -4px rgba(12, 15, 29, .12);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center;
  transition: opacity .14s ease-out, transform .16s cubic-bezier(.2, .7, .2, 1);
}
.ctl-pop[data-side="above"] { transform-origin: bottom center; transform: translateY(4px) scale(.98); }
.ctl-pop.is-open { opacity: 1; transform: none; }
.ctl-pop.is-closing { opacity: 0; transition-duration: .1s; }
[data-theme="dark"] .ctl-pop { box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04); }

.cselect__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 8px 12px;
  border-radius: 9px; cursor: pointer; font-size: calc(15px * var(--fz, 1)); line-height: 1.3; user-select: none;
}
.cselect__opt .i { flex: none; width: 16px; height: 16px; color: var(--accent, #d6246e); }
.cselect__opt.is-active { background: var(--bg-soft, #f4f4f5); }
.cselect__opt[aria-selected="true"] { color: var(--accent, #d6246e); font-weight: 600; }
.cselect__opt.is-disabled { opacity: .45; cursor: not-allowed; }
.cselect__group { margin: 8px 12px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #888); }
@media (pointer: coarse) { .cselect__opt { min-height: 46px; } }

/* the calendar */
.cdate__pop { width: 296px; max-width: calc(100vw - 16px); padding: 10px; }
.cdate__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.cdate__nav, .cdate__title { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; border-radius: 10px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.cdate__nav { width: 36px; color: var(--muted, #888); }
.cdate__nav:hover, .cdate__title:hover { background: var(--bg-soft, #f4f4f5); color: var(--ink, #111); }
.cdate__nav .i { width: 18px; height: 18px; }
.cdate__title { padding: 0 10px; font-weight: 700; font-size: 15px; }
.cdate__title .i { width: 14px; height: 14px; color: var(--muted, #888); }
.cdate__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cdate__dow { display: grid; place-items: center; height: 28px; font-size: 11.5px; font-weight: 700; color: var(--muted, #888); text-transform: uppercase; letter-spacing: .04em; }
.cdate__day {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; border: 0; background: none; color: inherit;
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color .12s, color .12s;
}
.cdate__day:hover { background: var(--bg-soft, #f4f4f5); }
.cdate__day.is-other { color: var(--muted, #888); opacity: .55; }
.cdate__day.is-today { box-shadow: inset 0 0 0 1.5px var(--accent, #d6246e); font-weight: 700; }
.cdate__day.is-selected { background: var(--accent, #d6246e); color: var(--accent-ink, #fff); font-weight: 700; opacity: 1; }
.cdate__day:focus-visible { outline: 2px solid var(--accent, #d6246e); outline-offset: 1px; }
.cdate__day:disabled { opacity: .25; cursor: not-allowed; background: none; }
.cdate__months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.cdate__month { height: 44px; border-radius: 10px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.cdate__month:hover { background: var(--bg-soft, #f4f4f5); }
.cdate__month.is-selected { background: var(--accent, #d6246e); color: var(--accent-ink, #fff); }
.cdate__foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line, #e7e5e4); }
.cdate__link { border: 0; background: none; padding: 6px 10px; border-radius: 8px; color: var(--accent, #d6246e); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.cdate__link:hover { background: var(--bg-soft, #f4f4f5); }
.cdate__link:disabled { opacity: .4; cursor: not-allowed; }

/* checkboxes and radio buttons, drawn by us */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 20px; height: 20px; margin: 0; vertical-align: -4px; cursor: pointer;
  border: 1.5px solid var(--line-strong, #c7c4c1); background: var(--bg-elev, #fff);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input[type="checkbox"] { border-radius: 6px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ""; width: 11px; height: 11px; transform: scale(0); transition: transform .15s cubic-bezier(.3, 1.6, .5, 1);
  background: var(--accent-ink, #fff); clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
}
input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; transform: scale(0); transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); background: var(--accent-ink, #fff); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent, #d6246e); border-color: var(--accent, #d6246e); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--accent, #d6246e); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: var(--ring, 0 0 0 3px rgba(214, 36, 110, .18)); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) { .ctl-pop, .cselect__btn > .i { transition: none; } }
@media print { .cdate__clear { display: none; } .cselect__btn > .i, .cdate__btn > .i { display: none; } }
