/* Time picker (ui/time-picker.js), after Material 3's vertical dial time picker:
   24px padding, 28px corners, 96×80 time boxes, 52×80 AM/PM, 256px dial, 48px handle, 2px track, 8px centre.
   Colours come from Zeu's tokens, so dark mode (ui/theme.css) follows automatically. */
.tp-field { position: relative; }
.tp-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.tp-btn svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.tp-btn:hover svg { color: var(--navy); }

dialog.tp {
  --tp-primary: var(--fill, var(--navy));         /* handle and track */
  --tp-on-primary: #fff;
  --tp-pc: var(--navy-100);                        /* primary container: the selected time box */
  --tp-on-pc: var(--navy-800);
  --tp-tc: var(--amber-bg);                        /* tertiary container: the selected AM/PM */
  --tp-on-tc: var(--amber);
  --tp-highest: var(--line-2);                     /* surface container highest: unselected boxes and the dial */
  border: 0; padding: 24px; width: 328px; max-width: calc(100% - 24px); max-height: calc(100dvh - 24px); overflow: auto; border-radius: 28px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 4px 8px 3px rgba(15,18,34,.15), 0 1px 3px rgba(15,18,34,.3); /* elevation 3 */
}
dialog.tp::backdrop { background: rgba(5,9,64,.42); }
dialog.tp[open] { animation: tp-in .22s cubic-bezier(.2,0,0,1); }
@keyframes tp-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

.tp-head { margin: 0 0 20px; font-size: 12px; font-weight: 600; letter-spacing: .5px; color: var(--muted); }
.tp-top { display: flex; align-items: flex-start; gap: 0; }
.tp-sel-wrap { position: relative; display: flex; flex-direction: column; }
.tp-sel, .tp-in {
  width: 96px; height: 80px; border: 0; border-radius: 8px; padding: 0;
  background: var(--tp-highest); color: var(--ink);
  font-family: var(--font); font-size: 57px; line-height: 64px; font-weight: 500; letter-spacing: -.25px; text-align: center;
  font-variant-numeric: tabular-nums; cursor: pointer; transition: background .15s, color .15s;
}
.tp-sel.on { background: var(--tp-pc); color: var(--tp-on-pc); }
.tp-sel:hover:not(.on) { background: color-mix(in srgb, var(--tp-highest) 88%, var(--ink)); }
.tp-sel:focus-visible, .tp-in:focus-visible, .tp-period button:focus-visible, .tp-text:focus-visible, .tp-mode:focus-visible { outline: 2px solid var(--tp-primary); outline-offset: 2px; }
.tp-colon { width: 24px; height: 80px; display: grid; place-items: center; font-size: 57px; line-height: 1; color: var(--ink); }

.tp-period { margin-left: 12px; width: 52px; height: 80px; display: flex; flex-direction: column; border: 1px solid var(--muted-2); border-radius: 8px; overflow: hidden; }
.tp-period button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 600 14px/1 var(--font); letter-spacing: .1px; cursor: pointer; transition: background .15s, color .15s; }
.tp-period button + button { border-top: 1px solid var(--muted-2); }
.tp-period button[aria-checked="true"] { background: var(--tp-tc); color: var(--tp-on-tc); }
.tp-period button:hover:not([aria-checked="true"]) { background: color-mix(in srgb, transparent 92%, var(--ink)); }

/* Clock dial */
.tp-dial { position: relative; width: 256px; height: 256px; margin: 36px auto 0; border-radius: 50%; background: var(--tp-highest); --tp-r: 104px; touch-action: none; user-select: none; cursor: pointer; }
.tp-center { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--tp-primary); }
.tp-hand { position: absolute; left: calc(50% - 1px); top: calc(50% - var(--tp-r)); width: 2px; height: var(--tp-r); background: var(--tp-primary); transform-origin: 50% 100%; transition: transform .25s cubic-bezier(.2,0,0,1); }
.tp-hand.instant { transition: none; }
.tp-knob { position: absolute; left: 50%; top: 0; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: var(--tp-primary); }
.tp-knob.dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--tp-on-primary); }
.tp-nums { position: absolute; inset: 0; pointer-events: none; }
.tp-num { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; display: grid; place-items: center; font: 400 16px/24px var(--font); color: var(--ink); font-variant-numeric: tabular-nums; transition: color .15s; }
.tp-num.on { color: var(--tp-on-primary); }

/* Keyboard mode: the time boxes become text fields with "Hour" / "Minute" under them; the dial hides. */
.tp-in, .tp-sup { display: none; }
.tp.typing .tp-sel { display: none; }
.tp.typing .tp-in { display: block; cursor: text; height: 72px; line-height: 72px; outline: none; }
.tp.typing .tp-in:focus { background: var(--tp-pc); color: var(--tp-on-pc); box-shadow: inset 0 0 0 2px var(--tp-primary); }
.tp.typing .tp-in.bad { box-shadow: inset 0 0 0 2px var(--red); }
.tp.typing .tp-sup { display: block; margin-top: 7px; font-size: 12px; color: var(--muted); }
.tp.typing .tp-colon, .tp.typing .tp-period { height: 72px; }
.tp.typing .tp-dial { display: none; }

.tp-actions { display: flex; align-items: center; gap: 8px; margin-top: 24px; }
.tp-grow { flex: 1; }
.tp-mode { width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.tp-mode svg { width: 24px; height: 24px; }
.tp-mode:hover { background: color-mix(in srgb, transparent 92%, var(--ink)); }
.tp-text { height: 40px; padding: 0 12px; border: 0; border-radius: 20px; background: transparent; color: var(--navy); font: 600 14px/1 var(--font); letter-spacing: .1px; cursor: pointer; }
.tp-text:hover { background: color-mix(in srgb, transparent 92%, var(--navy)); }

@media (max-width: 360px) {
  dialog.tp { padding: 20px; }
  .tp-sel, .tp-in { width: 80px; font-size: 48px; }
  .tp-dial { width: 232px; height: 232px; --tp-r: 94px; }
}
@media (prefers-reduced-motion: reduce) { .tp-hand, dialog.tp[open] { transition: none; animation: none; } }
