/* ============================================================
   The "when" pop-up (Shared/Controls/WhenPicker, WhenPicker.dc.html):
   a card over the page on desktop, a bottom sheet on a phone.
   Month on one side, a clock face on the other. Roles only, so it
   follows the theme; the picked day/hour is the yellow highlighter.
   ============================================================ */

.wp-wrap { position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; }
.wp-wrap.phone { place-items: end stretch; }
.wp-dim { position: absolute; inset: 0; padding: 0; border: none; background: color-mix(in srgb, var(--night-900) 30%, transparent); cursor: pointer; }

.wp { position: relative; display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; max-height: 100%; overflow-y: auto; background: var(--paper); color: var(--ink); border: 2.5px solid var(--line); font-family: var(--font-hand); }
.wp button { font-family: inherit; color: inherit; }
.wp.desk { width: min(620px, calc(100vw - 24px)); padding: 12px 16px 14px; border-radius: 14px 10px 16px 12px; box-shadow: 5px 6px 0 var(--line); }
.wp.phone { width: 100%; max-height: 96%; gap: 8px; padding: 0 14px calc(14px + env(safe-area-inset-bottom)); border-bottom: none; border-radius: 18px 22px 0 0; box-shadow: 0 -4px 0 color-mix(in srgb, var(--gray-900) 18%, transparent), 0 -18px 40px color-mix(in srgb, var(--night-900) 20%, transparent); }

.wp-grab { display: grid; place-items: center; width: 100%; height: 26px; flex-shrink: 0; margin-top: 4px; padding: 0; border: none; background: none; cursor: pointer; }
.wp-grab span { width: 56px; height: 6px; border-radius: 4px; background: var(--ink); opacity: .35; }
.wp-head { display: flex; align-items: center; gap: 8px; }
.wp-ttl { margin-right: 6px; font-family: var(--font-marker); font-weight: 700; font-size: 30px; line-height: 1; white-space: nowrap; }
.wp-x { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; margin-left: auto; padding: 0; border: none; border-radius: 50%; background: none; cursor: pointer; }
.wp-x:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

.wp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-q { min-height: 34px; padding: 0 11px; border: 2px solid var(--line); border-radius: 14px 10px 14px 9px; background: var(--surface); font-size: 14.5px; white-space: nowrap; cursor: pointer; }
.wp-q:hover { background: color-mix(in srgb, var(--yellow-500) 15%, var(--surface)); }
.wp-q.on { background: var(--yellow-500); color: var(--gray-900); box-shadow: 2px 2px 0 var(--line); }

/* phone: two tabs that also show what's picked */
.wp-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wp-tab { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 56px; padding: 6px 12px; box-sizing: border-box; border: 2.5px solid var(--line); border-radius: 14px 11px 15px 10px; background: var(--surface); text-align: left; cursor: pointer; }
.wp-tab small { font-size: 13px; color: var(--ink-soft); line-height: 1.1; }
.wp-tab b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-marker); font-weight: 700; font-size: 25px; line-height: 1.05; }
.wp-tab.on { background: var(--yellow-500); color: var(--gray-900); box-shadow: 2px 2px 0 var(--line); }
.wp-tab.on small { color: var(--gray-700); }

.wp-body { display: flex; align-items: flex-start; gap: 22px; }

/* the month */
.wp-cal { display: flex; flex-direction: column; gap: 4px; width: 268px; flex-shrink: 0; }
.wp.phone .wp-cal { width: 100%; }
.wp.phone .wp-cal > .wp-chips { margin-bottom: 4px; }
.wp-mh { display: flex; align-items: center; gap: 6px; }
.wp-mh b { flex: 1; text-align: center; font-family: var(--font-marker); font-weight: 700; font-size: 26px; line-height: 1; }
.wp-ib { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 2px solid var(--line); border-radius: 50% 45% 52% 48%; background: var(--paper); box-shadow: 2px 2px 0 var(--line); cursor: pointer; }
.wp-ib:disabled { opacity: .3; box-shadow: none; cursor: default; }
.wp-dow, .wp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.wp-dow span { font-size: 13px; color: var(--ink-soft); text-align: center; }
.wp-d { position: relative; display: grid; place-items: center; height: 36px; padding: 0; border: none; border-radius: 50% 46% 52% 48%; background: none; font-family: var(--font-marker) !important; font-weight: 700; font-size: 21px; line-height: 1; cursor: pointer; }
.wp.phone .wp-d { height: 42px; font-size: 23px; }
.wp-d:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.wp-d.out { color: var(--ink-faint); }
.wp-d.wkend { color: var(--ink-orange); }
.wp-d.out.wkend { color: color-mix(in srgb, var(--ink-orange) 45%, var(--paper)); }
.wp-d:disabled { color: var(--ink-faint); opacity: .55; background: none; text-decoration: line-through; text-decoration-thickness: 1px; cursor: default; }
.wp-d.today { color: var(--ink-red); box-shadow: inset 0 0 0 2px var(--ink-red); }
.wp-d.on { background: var(--yellow-500); color: var(--gray-900); box-shadow: inset 0 0 0 2.5px var(--gray-900); }
.wp-d i { position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ink-blue); }
.wp-d.on i { background: var(--gray-900); }

/* the clock */
.wp-time { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.wp-clkh { display: flex; align-items: center; justify-content: center; gap: 4px; }
.wp-seg { min-width: 58px; height: 50px; padding: 0 6px; border: 2.5px solid var(--line); border-radius: 12px 9px 13px 10px; background: var(--surface); font-family: var(--font-marker) !important; font-weight: 700; font-size: 38px; line-height: 1; cursor: pointer; }
.wp-seg.on { background: var(--yellow-500); color: var(--gray-900); box-shadow: 2px 2px 0 var(--line); }
.wp-colon { font-family: var(--font-marker); font-weight: 700; font-size: 38px; line-height: 1; }
.wp-ampm { display: flex; flex-direction: column; gap: 3px; margin-left: 8px; }
.wp-ampm button { width: 44px; height: 24px; padding: 0; border: 2px solid var(--line); border-radius: 8px 6px 9px 6px; background: var(--surface); font-size: 14px; line-height: 1; cursor: pointer; }
.wp-ampm button.on { background: var(--ink); color: var(--paper); }
.wp-dial { position: relative; align-self: center; flex-shrink: 0; box-sizing: border-box; border: 2.5px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--yellow-200) 45%, var(--paper)); box-shadow: inset 0 0 0 6px var(--paper); }
.wp-hand { position: absolute; left: 50%; bottom: 50%; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); transform-origin: 50% 100%; pointer-events: none; }
.wp-pin { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--ink); pointer-events: none; }
.wp-n { position: absolute; translate: -50% -50%; display: grid; place-items: center; padding: 0; border: none; border-radius: 50%; background: none; font-family: var(--font-marker) !important; font-weight: 700; line-height: 1; cursor: pointer; }
.wp-n:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.wp-n.inner { color: var(--ink-soft); }
.wp-n.on { background: var(--yellow-500); color: var(--gray-900); box-shadow: inset 0 0 0 2.5px var(--gray-900); }
.wp-hint { font-size: 13.5px; color: var(--ink-soft); text-align: center; }

.wp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.wp-lbl { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-marker); font-weight: 700; font-size: 21px; line-height: 1; color: var(--ink-soft); }
.wp-lbl small { font-family: var(--font-hand); font-weight: 400; font-size: 13px; }
.wp-clash { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--blue-500) 12%, var(--paper)); font-size: 14px; line-height: 1.2; }
.wp-clash i { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--ink-blue); }
.wp-foot { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 2px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.wp-sum { flex: 1; min-width: 0; line-height: 1.1; }
.wp-sumb { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-marker); font-weight: 700; font-size: 26px; }
.wp-sums { font-size: 14px; color: var(--ink-soft); }
.wp-done { display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 44px; padding: 0 20px; border: 2.5px solid var(--line); border-radius: 20px 16px 20px 14px; background: var(--yellow-500); color: var(--gray-900); font-size: 17px; box-shadow: 2px 2px 0 var(--line); cursor: pointer; }
.wp-done:hover { rotate: -1deg; }
.calm .wp-done:hover { rotate: none; }

@media (max-width: 640px) {
    .wp.desk .wp-body { flex-direction: column; align-items: stretch; }
    .wp.desk .wp-cal { width: 100%; }
}
