/* PACPlay picker and date picker (picker.ts, datepicker.ts). The same file in every app; each app styles .pick-trigger
   with its own select and input rules, so triggers and fields share height, radius, border, hover and focus. */
:root {
  --pk-line: var(--line-2, var(--line, rgba(196, 226, 255, 0.13)));
  --pk-text: var(--text, #f0f6fc);
  --pk-soft: var(--text-2, var(--soft, #c2ccd8));
  --pk-muted: var(--muted, var(--text-3, #8b98a8));
  --pk-accent: var(--accent, #2f8cff);
  --pk-ice: var(--accent-2, #9cebff);
  --pk-glow: var(--glow, rgba(47, 140, 255, 0.38));
  --pk-ease: var(--ease, cubic-bezier(0.2, 0.7, 0.1, 1));
  --pk-mono: var(--mono, ui-monospace, 'SF Mono', Consolas, monospace);
}

/* the native control stays in the form, out of sight */
.pick-native {
  position: absolute !important; width: 1px !important; min-width: 0 !important; height: 1px !important; min-height: 0 !important;
  margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none;
}

:where(.pick-trigger) { display: inline-grid; grid-template-columns: minmax(0, 1fr); align-items: center; min-width: 0; text-align: left; color: var(--pk-text); cursor: pointer; }
.pick-trigger[hidden] { display: none !important; }
.pick-value, .pick-sizer { grid-area: 1 / 1; min-width: 0; }
.pick-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sizer { display: grid; height: 0; overflow: hidden; visibility: hidden; }
.pick-sizer > span { white-space: nowrap; }
.pick-trigger.is-empty .pick-value { color: var(--pk-muted); }
.pick-trigger:disabled { cursor: default; }
.pick-trigger.is-invalid { border-color: rgba(244, 122, 114, 0.7); }
/* open: the chevron turns up in the accent colour; dates show a calendar */
.pick-trigger.is-open:not(.pick-date) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239cebff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 14 5-5 5 5'/%3E%3C/svg%3E"); }
.pick-trigger.pick-date { font-variant-numeric: tabular-nums; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa7b6' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5.5' width='16' height='14.5' rx='3'/%3E%3Cpath d='M4 10h16M8.5 3.5v4M15.5 3.5v4'/%3E%3C/svg%3E"); }
.pick-trigger.pick-date.is-open { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239cebff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5.5' width='16' height='14.5' rx='3'/%3E%3Cpath d='M4 10h16M8.5 3.5v4M15.5 3.5v4'/%3E%3C/svg%3E"); }

/* ---------- the floating panel (top layer) ---------- */
.pick-panel {
  position: fixed; inset: auto; z-index: 1000; display: flex; flex-direction: column; width: 260px; height: auto; max-height: 380px; margin: 0; padding: 0;
  overflow: hidden; border: 1px solid rgba(156, 235, 255, 0.16); border-radius: 16px; color: var(--pk-text); font: inherit;
  background: linear-gradient(180deg, rgba(27, 35, 46, 0.96), rgba(12, 16, 22, 0.97));
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 28px 60px -22px rgba(0, 0, 0, 0.9), 0 0 50px -28px var(--pk-glow), inset 0 1px 0 rgba(196, 226, 255, 0.08);
  opacity: 0; transform: translateY(-6px) scale(0.985); transform-origin: top center;
  transition: opacity 0.16s var(--pk-ease), transform 0.2s var(--pk-ease);
}
.pick-panel[hidden] { display: none; }
.pick-panel.is-up { transform: translateY(6px) scale(0.985); transform-origin: bottom center; }
.pick-panel.is-open { opacity: 1; transform: none; }
.pick-panel::backdrop { background: transparent; }
.pick-head { display: none; }

/* phones: a bottom sheet with large rows */
.pick-panel.is-sheet {
  top: auto; right: 0; bottom: 0; left: 0; width: auto; max-width: none; max-height: 78dvh; border-bottom: 0; border-radius: 22px 22px 0 0;
  padding-bottom: env(safe-area-inset-bottom); transform: translateY(32px);
}
.pick-panel.is-sheet.is-open { transform: none; }
.pick-panel.is-sheet::backdrop { background: rgba(2, 4, 6, 0.64); }
.pick-panel.is-sheet .pick-head { display: grid; flex: none; justify-items: center; gap: 10px; padding: 10px 16px 4px; }
.pick-grip { width: 38px; height: 4px; border-radius: 4px; background: rgba(240, 246, 252, 0.2); }
.pick-title { justify-self: start; margin: 0; color: var(--pk-ice); font: 500 10.5px/1.2 var(--pk-mono); letter-spacing: 0.14em; text-transform: uppercase; }
.pick-panel.is-sheet .pick-row { min-height: 52px; }
.pick-panel.is-sheet .pick-search input { height: 46px; font-size: 16px; }
.pick-panel.is-sheet .pick-list { padding: 6px 10px 14px; }

/* ---------- select list ---------- */
.pick-search { position: relative; display: block; flex: none; padding: 8px 8px 6px; border-bottom: 1px solid var(--pk-line); color: var(--pk-muted); }
.pick-search[hidden] { display: none; }
.pick-search svg { position: absolute; left: 21px; top: 50%; width: 16px; height: 16px; margin-top: 1px; translate: 0 -50%; pointer-events: none; }
.pick-panel .pick-search input {
  width: 100%; height: 42px; min-height: 0; margin: 0; padding: 0 12px 0 38px; border: 1px solid var(--pk-line); border-radius: 11px; outline: 0;
  background: rgba(6, 8, 11, 0.5); color: var(--pk-text); font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1; box-shadow: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.pick-panel .pick-search input::placeholder { color: var(--pk-muted); }
.pick-panel .pick-search input:focus { border-color: rgba(88, 174, 255, 0.65); box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.13); }
.pick-search input::-webkit-search-cancel-button { filter: invert(0.6); }
.pick-list { flex: 1; min-height: 0; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; list-style: none; outline: 0; }
.pick-row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; margin: 0; padding: 6px 10px 6px 10px; border-radius: 10px;
  color: var(--pk-soft); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.pick-row + .pick-row { margin-top: 2px; }
.pick-row[hidden], .pick-group[hidden] { display: none; }
.pick-row.is-active { background: rgba(196, 226, 255, 0.07); color: var(--pk-text); }
.pick-list:focus-visible .pick-row.is-active, .pick-search:focus-within + .pick-list .pick-row.is-active { box-shadow: inset 0 0 0 1px rgba(88, 174, 255, 0.5); }
.pick-row:active:not([aria-disabled]) { background: rgba(47, 140, 255, 0.16); }
.pick-row[aria-selected='true'] { background: linear-gradient(90deg, rgba(47, 140, 255, 0.2), rgba(47, 140, 255, 0.06)); color: var(--pk-text); }
.pick-row[aria-selected='true']::before { content: ''; position: absolute; left: -6px; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #9cebff, #2f8cff); box-shadow: 0 0 10px var(--pk-glow); }
.pick-row[aria-disabled] { cursor: default; opacity: 0.45; }
.pick-row[aria-disabled].is-active { background: none; }
.pick-group { margin: 8px 10px 4px; color: var(--pk-muted); font: 500 10px/1.2 var(--pk-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.pick-media { display: grid; flex: none; place-items: center; width: 34px; height: 34px; }
.pick-media img { width: 34px; height: 34px; border: 1px solid var(--pk-line); border-radius: 10px; object-fit: cover; background: #07090c; }
.pick-badge {
  display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--pk-line); border-radius: 10px;
  background: linear-gradient(180deg, rgba(196, 226, 255, 0.08), rgba(196, 226, 255, 0.02)); color: var(--pk-ice); font: 600 12px/1 var(--pk-mono); letter-spacing: 0.02em;
}
.pick-text { flex: 1; min-width: 0; line-height: 1.3; }
.pick-text b { display: block; overflow: hidden; font-size: 14px; font-weight: 550; letter-spacing: -0.005em; text-overflow: ellipsis; white-space: nowrap; }
.pick-text small { display: block; overflow: hidden; color: var(--pk-muted); font: 400 11.5px/1.4 var(--pk-mono); text-overflow: ellipsis; white-space: nowrap; }
.pick-note { flex: none; padding: 3px 7px; border: 1px solid var(--pk-line); border-radius: 6px; color: var(--pk-muted); font: 500 10px/1 var(--pk-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.pick-check { flex: none; width: 16px; height: 16px; color: var(--pk-ice); opacity: 0; transform: scale(0.6); transition: opacity 0.2s, transform 0.25s var(--pk-ease); }
.pick-row[aria-selected='true'] .pick-check { opacity: 1; transform: none; }
.pick-empty { margin: 0; padding: 16px 12px 20px; color: var(--pk-muted); font-size: 13px; text-align: center; }
.pick-empty[hidden] { display: none; }

/* ---------- calendar ---------- */
.dp { padding: 0 10px 10px; }
.dp.is-sheet { padding: 0 max(12px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)); overflow-y: auto; }
.dp button { margin: 0; font: inherit; letter-spacing: normal; text-transform: none; box-shadow: none; }
.dp-top { display: flex; align-items: center; gap: 4px; padding: 10px 0 6px; }
.dp .dp-step, .dp .dp-title {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--pk-soft); cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.dp-step { width: 36px; flex: none; }
.dp-step svg { width: 18px; height: 18px; }
.dp .dp-title { flex: 1; gap: 6px; color: var(--pk-text); font-weight: 600; font-size: 14px; }
.dp-title svg { width: 14px; height: 14px; color: var(--pk-muted); transition: transform 0.2s var(--pk-ease); }
.dp:not([data-mode='days']) .dp-title svg { transform: rotate(180deg); }
.dp-step:hover:not(:disabled), .dp-title:hover { background: rgba(196, 226, 255, 0.07); color: var(--pk-text); }
.dp-step:disabled { opacity: 0.3; cursor: default; }
.dp button:focus-visible { outline: 0; border-color: rgba(88, 174, 255, 0.75); box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.18); }
.dp-hint { margin: 0 2px 6px; color: var(--pk-ice); font: 500 10.5px/1.4 var(--pk-mono); letter-spacing: 0.06em; }
.dp-hint[hidden] { display: none; }
.dp-grid { width: 100%; margin: 0; border: 0; border-collapse: separate; border-spacing: 0 2px; table-layout: fixed; background: none; }
/* the apps style their own tables; none of that here */
.dp .dp-grid th, .dp .dp-grid td, .dp .dp-grid tr:hover td { position: static; border: 0; background: none; box-shadow: none; white-space: nowrap; }
.dp-grid th { height: 28px; padding: 0 0 4px; color: var(--pk-muted); font: 500 10.5px/1 var(--pk-mono); letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.dp-grid td { padding: 0; text-align: center; }
.dp-cell {
  position: relative; display: inline-grid; place-items: center; width: 100%; height: 36px; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--pk-text); font-variant-numeric: tabular-nums; font-size: 13.5px; cursor: pointer; transition: background-color 0.12s, color 0.12s;
}
.dp-cell:hover:not([aria-disabled]) { background: rgba(196, 226, 255, 0.08); }
.dp-cell.is-out { color: var(--pk-muted); }
.dp-cell.is-today::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--pk-ice); }
.dp-cell.in-range { border-radius: 0; background: rgba(47, 140, 255, 0.13); }
.dp-cell.is-start { border-radius: 10px 0 0 10px; }
.dp-cell.is-end { border-radius: 0 10px 10px 0; }
.dp-cell.is-start.is-end { border-radius: 10px; }
.dp-cell.is-sel { background: linear-gradient(180deg, #58aeff, #2f8cff); color: #fff; font-weight: 650; box-shadow: 0 6px 18px -8px var(--pk-glow); }
.dp-cell.is-sel.is-today::after { background: #fff; }
.dp-cell[aria-disabled] { color: var(--pk-muted); opacity: 0.35; cursor: default; text-decoration: line-through; text-decoration-color: rgba(196, 226, 255, 0.25); }
.dp-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 0; }
.dp-list .dp-cell { height: 46px; font-size: 13.5px; }
.dp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--pk-line); }
.dp .dp-link {
  min-height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--pk-ice);
  font: 500 12px/1 var(--pk-mono); letter-spacing: 0.06em; cursor: pointer; transition: background-color 0.15s;
}
.dp-link:hover:not(:disabled) { background: rgba(156, 235, 255, 0.08); }
.dp-link:disabled { opacity: 0.35; cursor: default; }
.dp-link[hidden] { display: none; }
.dp.is-sheet .dp-cell { height: 44px; font-size: 15px; }
.dp.is-sheet .dp-list .dp-cell { height: 52px; }
.dp.is-sheet .dp-step, .dp.is-sheet .dp-title { height: 44px; }
.dp.is-sheet .dp-step { width: 44px; }
.dp.is-sheet .dp-link { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .pick-panel, .pick-check, .dp-title svg { transition: none; }
}
