/* WRC coach hours. The approved concept (v9): the club's own tokens (What's On page + our forms: Rubik, ink, one
   blue), ONE screen, two cards. The pay period with every day and its hours; the chosen day with +/- per type, saved
   as you go. No pop-ups, no native pickers (iOS re-opens them on focus). */
:root {
  --ink: #15222e; --ink-2: #2c3a47; --body: #4a5763; --muted: #7a8895; --faint: #aab4bf; --ghost: #d5dbe2;
  --line: #e6eaf0; --line-2: #eef1f5; --bg: #f3f5f8; --tint: #f6f8fb;
  --blue: #0a6cc4; --blue-d: #075aa3; --blue-soft: #e8f1fb; --blue-mid: #cfe2f6;
  --green: #149a6a; --amber: #b7791f;
  --r: 20px; --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow: 0 1px 2px rgba(21, 34, 46, .05), 0 10px 30px -14px rgba(21, 34, 46, .16);
}
* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font-family: 'Rubik', 'Helvetica Neue', Arial, sans-serif; font-weight: 400; font-size: 16px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.page {
  max-width: 480px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
  display: grid; gap: 12px;
}
.page > * { opacity: 0; animation: in .5s var(--ease) forwards; }
.page > *:nth-child(2) { animation-delay: .05s; }
.page > *:nth-child(3) { animation-delay: .1s; }
.page > *:nth-child(4) { animation-delay: .15s; }
@keyframes in { to { opacity: 1; } }

/* header */
.bar { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 2px; }
.bar img { width: 38px; height: 38px; border-radius: 50%; display: block; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.bar__who { flex: 1; min-width: 0; }
.bar__who h1 { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; line-height: 1.15; }
.bar__who span { display: block; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.bar__nav { display: flex; gap: 6px; }
.nav { width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(21, 34, 46, .05); display: grid; place-items: center; color: var(--ink); transition: opacity .2s; }
.nav svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.9; fill: none; }
.nav:disabled { opacity: .35; cursor: default; }

.card { background: #fff; border-radius: var(--r); box-shadow: 0 0 0 1px var(--line), var(--shadow); }

/* pay period card */
.period { padding: 16px 16px 14px; }
.period__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eye { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.period__top strong { display: block; margin-top: 5px; font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
.period__sum { text-align: right; white-space: nowrap; }
.period__sum b { font-size: 30px; font-weight: 600; color: var(--ink); line-height: .95; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.period__sum span { font-size: 14px; color: var(--muted); margin-left: 3px; }
.period__sum small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.period__note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.cal .wd { text-align: center; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; color: var(--faint); padding-bottom: 2px; }
.tile {
  height: 54px; border-radius: 13px; background: var(--tint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink); transition: background .22s var(--ease), color .22s var(--ease), box-shadow .22s var(--ease);
}
.tile .n { font-size: 16px; font-weight: 600; line-height: 1; }
.tile .h { font-size: 12px; font-weight: 600; line-height: 1; color: var(--blue); min-height: 12px; font-variant-numeric: tabular-nums; transition: color .3s; }
.tile.has { background: var(--blue-soft); }
.tile.today { box-shadow: inset 0 0 0 2px var(--blue); }
.tile.sel { background: var(--ink); color: #fff; box-shadow: 0 6px 16px -8px rgba(21, 34, 46, .6); }
.tile.sel .h { color: #9fcaf2; }
.tile.future { background: transparent; color: var(--ghost); cursor: default; box-shadow: inset 0 0 0 1px var(--line-2); }
.tile.future .n { font-weight: 500; }
.tile.flash .h { color: var(--green); }

/* the chosen day */
.day { padding: 16px 16px 6px; }
.day__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 6px; }
.day__top h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
.day__tot { text-align: right; white-space: nowrap; }
.day__tot b { font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.day__tot span { font-size: 13px; color: var(--muted); margin-left: 2px; }
.status { display: flex; align-items: center; gap: 5px; height: 16px; margin-top: 3px; font-size: 12.5px; color: var(--muted); transition: opacity .3s; }
.status svg { width: 13px; height: 13px; stroke: var(--green); stroke-width: 2.4; fill: none; }
.status.saved { color: var(--green); }
.status.saving i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: pulse .8s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.types { list-style: none; margin: 0; padding: 0; transition: opacity .14s; }
.types.swap { opacity: 0; }
.type { border-top: 1px solid var(--line-2); }
.type__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.type__name { font-size: 16px; font-weight: 500; color: var(--ink); }
.type__name small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.step { display: flex; align-items: center; gap: 4px; }
.step__btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); transition: background .15s, transform .12s, opacity .2s; }
.step__btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.step__btn.plus { background: var(--blue); color: #fff; }
.step__btn:active { transform: scale(.92); }
.step__btn:disabled { opacity: .3; cursor: default; transform: none; }
.step__val {
  min-width: 58px; height: 38px; padding: 0 6px; border-radius: 10px; font-size: 19px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; transition: background .2s, color .3s;
}
.step__val.zero { color: var(--ghost); }
.step__val[aria-expanded="true"] { background: var(--tint); box-shadow: inset 0 0 0 1px var(--line); }
.step__val.bump { color: var(--blue); }
.ro { font-size: 19px; font-weight: 600; color: var(--ink); min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.ro.zero { color: var(--ghost); }

/* exact values, inline under the row (tap the number) */
.tray { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s var(--ease); }
.tray.open { grid-template-rows: 1fr; }
.tray > div { overflow: hidden; }
.tray__strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tray__strip::-webkit-scrollbar { display: none; }
.pill { flex: none; min-width: 48px; height: 36px; padding: 0 12px; border-radius: 18px; background: var(--tint); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; font-weight: 500; color: var(--ink); scroll-snap-align: center; font-variant-numeric: tabular-nums; }
.pill.on { background: var(--ink); color: #fff; box-shadow: none; }

.lock { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--tint); font-size: 13px; color: var(--body); }
.lock svg { flex: none; width: 15px; height: 15px; margin-top: 1px; stroke: var(--muted); stroke-width: 1.8; fill: none; }

.foot { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* states the real app needs: not saved yet, can't reach the sheet, loading, a link that is not a coach */
.period__note.warn { color: var(--amber); font-weight: 500; }
.status { height: auto; min-height: 16px; }
.status.warn { color: var(--amber); font-weight: 500; }
.tile { position: relative; }
.tile.unsaved::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.step__val:disabled { cursor: default; }
.stop { padding: 22px 4px 30px; text-align: center; }
.stop h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--ink); }
.stop p { margin: 0; font-size: 14px; color: var(--muted); }
body.loading .period, body.stopped .period, body.stopped .bar__nav { display: none; }

/* computer: the two cards side by side */
@media (min-width: 760px) {
  .page { max-width: 940px; padding-top: 44px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px 20px; align-items: start; }
  .bar { grid-column: 1 / -1; margin-bottom: 4px; }
  .period { padding: 22px 22px 20px; }
  .day { padding: 22px 22px 10px; }
  .tile { height: 64px; }
  .cal { gap: 8px; margin-top: 18px; }
  .foot { grid-column: 1 / -1; }
  body.loading .day, body.stopped .day { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; } .page > * { opacity: 1; } }
.day__tot .status { justify-content: flex-end; }
