/* ==== Preview and slide to approve (sheets.slide, static/js/slide.js). Everything for it lives in this file. ====
   Phone-size: the slide. A computer (a wide screen with a mouse, the site's 900 px layout): plain buttons, no slide.
   Without JavaScript the slide is not drawn and the real Approve button stays: nothing depends on the script. */

/* who sees what: .on-phone is hidden on a computer, .on-desk only on a computer */
.on-desk { display: none; }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .on-phone { display: none !important; }
  .on-desk { display: block; }
}

/* ---- the slide ---- */
.slide-form { display: flex; flex-direction: column; gap: var(--s2); }
.slide { display: none; position: relative; height: 56px; border-radius: var(--rb); background: var(--inv); color: var(--on-inv); overflow: hidden; user-select: none; -webkit-user-select: none; }
.slide-ready .slide { display: block; }
.slide-text { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 56px; font: 700 var(--t-m)/1 var(--font); pointer-events: none; }
.slide-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--primary); }
.slide-knob { position: absolute; left: 4px; top: 4px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--on-inv); color: var(--inv); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); touch-action: none; cursor: grab; }
.slide-knob svg { width: 22px; height: 22px; }
.slide.drag .slide-knob { cursor: grabbing; }
.slide.back .slide-knob, .slide.back .slide-fill { transition: transform .2s ease, width .2s ease; }
.slide.done { background: var(--primary); }
.slide-note { display: none; margin: 0; text-align: center; color: var(--ink2); font-size: var(--t-s); }
.slide-ready .slide-note { display: block; }
/* the real button stays for the keyboard: hidden until it has focus, then it sits where the slide is */
.slide-ready .slide-btn { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; border: 0; white-space: nowrap; }
.slide-ready .slide-btn:focus { position: static; width: 100%; height: auto; overflow: visible; clip-path: none; padding: 0 var(--s5); border: 1.5px solid var(--primary); }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .slide, .slide-note { display: none !important; }
  .slide-ready .slide-btn { position: static; width: auto; height: auto; overflow: visible; clip-path: none; padding: 0 var(--s5); border: 1.5px solid var(--primary); }
}
@media (prefers-reduced-motion: reduce) { .slide.back .slide-knob, .slide.back .slide-fill { transition: none; } }

/* ---- the small card above the slide: total, when it goes, who gets it ---- */
.pv-card { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s3) var(--s4); border: 1px solid var(--edge); border-radius: var(--r1); background: var(--glass-list); box-shadow: var(--hi); }
.pv-card h2 { margin: 0 0 var(--s1); font-size: var(--t-m); }
.pv-card dl { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s4); margin: 0; }
.pv-card dt { color: var(--ink2); }
.pv-card dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* ---- the Preview screen: the real PDF, then (in the dock) the card and the slide ---- */
.pv { display: flex; flex-direction: column; gap: var(--s2); }
.pv-frame { width: 100%; height: calc(100dvh - 64px - 330px); min-height: 300px; border: 1px solid var(--doc-line); border-radius: var(--rp); background: var(--doc); }
.pv-box { position: relative; }
.pv-box .frame-shapes { position: absolute; inset: 0; padding: var(--s3); overflow: hidden; border-radius: var(--rp); background: var(--doc); }
.pv-box .sk-paper { border: 0; background: transparent; }
.slide-form[aria-busy="true"] .slide-note, .slide-form.wait-off .slide, .slide-form.wait-off .slide-note { display: none; }
.slide.busy { background: var(--primary); color: var(--on-primary); }
.slide.busy .slide-knob, .slide.busy .slide-fill { display: none; }
.slide.busy .slide-text { padding-left: 0; gap: var(--s2); grid-auto-flow: column; justify-content: center; align-items: center; }
.pv-note { margin: 0; color: var(--ink2); font-size: var(--t-s); }
.pv-dock .pv-card { padding: var(--s2) var(--s4); }
@media (min-width: 900px) { .pv-frame { height: 72vh; } }

/* ---- the Week to approve list ---- */
.wk-row { color: inherit; text-decoration: none; display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s3); padding: var(--s3) var(--s4); }
.wk-row + .wk-row { border-top: 1px solid var(--hair); }
.wk-row b { font-weight: 700; }
.wk-row small { grid-column: 1; color: var(--ink2); }
.wk-row .wk-amt { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; }
.wk-total { display: flex; justify-content: space-between; margin: var(--s3) var(--s2); font-weight: 700; }

/* ---- Settings: the Preview before approving switch ---- */
.sw-row { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); margin-top: var(--s4); border: 1px solid var(--edge); border-radius: var(--r2); background: var(--glass-list); box-shadow: var(--hi); }
.sw-row .sw-t { flex: 1; display: flex; flex-direction: column; }
.sw-row small { color: var(--ink2); }
.sw { position: relative; flex: none; width: 56px; height: 32px; border-radius: var(--rb); border: 1.5px solid var(--ctl); background: var(--glass-chip); cursor: pointer; padding: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ctl); transition: transform .15s ease; }
.sw[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.sw[aria-checked="true"]::after { transform: translateX(24px); background: var(--on-primary); }
@media (prefers-reduced-motion: reduce) { .sw::after { transition: none; } }
