/* CAS Time Clock: the look of CAS Inventory (cas-puller), cut down to one page.
   Dark by default with a light mode that follows the device (_theme.html sets
   data-theme). The colours are the Inventory app's; keep the two in step. */

:root {
  color-scheme: dark;
  --bg: #08090b;
  --field: #0c0d10;
  --rule: #2a2e35;
  --text: #ecebe6;        /* warm off-white, like "Autostore" in the logo */
  --muted: #8e939a;
  --strong: #fff;
  /* The accent: main buttons are yellow with dark text, secondary ones a yellow outline. */
  --yellow: #f4d03a;
  --yellow-press: #d4b22c;
  --yellow-tint: #3a3212;
  --on-yellow: #16181c;
  --dir-bg: #1b4498;      /* the blue in the logo */
  --dir-text: #fff;
  --bad: #ff9a9a;
  --bad-edge: #a83c3c;
  --bad-bg: #2a1213;
  --ok: #7dd9a3;
  --warn: #f1d27a;
  --warn-edge: #6b5715;
  --warn-bg: #241d06;
  /* Raised boxes, lit from above: a warm dark grey a little lighter than the page */
  --lift-bg: linear-gradient(180deg, #2c2a26 0%, #1e1c1a 100%);
  --lift-shadow: 0 12px 26px rgba(0, 0, 0, 0.85), 0 3px 7px rgba(0, 0, 0, 0.7),
                 inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -3px 0 rgba(0, 0, 0, 0.4);
  --lift-pressed: 0 2px 5px rgba(0, 0, 0, 0.7), inset 0 2px 4px rgba(0, 0, 0, 0.5);
  --btn-shadow: var(--lift-shadow);
  --sheet-bg: linear-gradient(180deg, #161514 0%, #0b0a09 100%);   /* almost black, raised */
  --tri-hi: #ffe680;
  --tri-lift: drop-shadow(0 2px 0 #8a7316) drop-shadow(0 4px 5px rgba(0, 0, 0, 0.8));
  --overlay: rgba(8, 9, 11, 0.88);
}

/* Yellow can't be read on white, so the logo's blue takes its place. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff;
  --field: #fff;
  --rule: #dcdfe5;
  --text: #16181c;
  --muted: #646b76;
  --strong: #16181c;
  --yellow: #1b4498;
  --yellow-press: #153677;
  --yellow-tint: #e3e9f6;
  --on-yellow: #fff;
  --bad: #a32020;
  --bad-edge: #e0a0a0;
  --bad-bg: #fdeeee;
  --ok: #146c3c;
  --warn: #6b5210;
  --warn-edge: #d9c16a;
  --warn-bg: #fdf6dc;
  --lift-bg: linear-gradient(180deg, #ffffff 0%, #eef0f4 100%);
  --lift-shadow: 0 10px 22px rgba(20, 30, 60, 0.2), 0 2px 6px rgba(20, 30, 60, 0.14),
                 inset 0 1px 0 #fff, inset 0 -3px 0 rgba(20, 30, 60, 0.08);
  --lift-pressed: 0 1px 3px rgba(20, 30, 60, 0.18), inset 0 2px 4px rgba(20, 30, 60, 0.12);
  --btn-shadow: 0 10px 22px rgba(20, 30, 60, 0.2), 0 2px 6px rgba(20, 30, 60, 0.14),
                inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.32);
  --sheet-bg: var(--lift-bg);
  --tri-hi: #4a78dc;
  --tri-lift: drop-shadow(0 2px 0 #0d2459) drop-shadow(0 3px 4px rgba(20, 30, 60, 0.35));
  --overlay: rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Iowan Old Style, like the Inventory app (built into iPhones, iPads and Macs). */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Iowan Old Style", Georgia, "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}
button, input { font-family: inherit; }
::placeholder { color: var(--muted); opacity: 1; }

main {
  display: flex;
  flex-direction: column;
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---- logo, as on Notes and Bins ---------------------------------- */

.brand { display: flex; justify-content: center; padding: 20px 12px 4px; }
.brand img {
  max-height: 138px;
  max-width: 80%;
  width: auto;
  height: auto;
  display: block;
  mix-blend-mode: screen;   /* the dark logo is on black; this drops the black into the page */
}
:root[data-theme="light"] .brand img { mix-blend-mode: normal; }

/* ---- the time ----------------------------------------------------- */

.now { text-align: center; margin: 6px 0 18px; }
.clock {
  font-size: 58px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--strong);
  letter-spacing: 0.5px;
}
.date { color: var(--muted); font-size: 17px; margin-top: 2px; }

/* ---- the sheet: names and a note, raised off the page ------------ */

.sheet {
  padding: 16px 16px 18px;
  background: var(--sheet-bg);
  border-radius: 12px;
  box-shadow: var(--lift-shadow);
}
.sheet h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-align: center;
}

/* Each name is a raised tile; the one tapped turns the accent, like a bin box. */
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.name {
  min-height: 60px;
  padding: 10px 12px;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  background: var(--lift-bg);
  border: 0;
  border-radius: 12px;
  box-shadow: var(--lift-shadow);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.name:active { box-shadow: var(--lift-pressed); transform: translateY(1px); }
.name.on { color: var(--on-yellow); background: var(--yellow); }
.none { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--muted); }

.note {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 16px;   /* 16px or more, or iPhones zoom in */
  color: var(--text);
  background: var(--lift-bg);
  border: 0;
  border-radius: 12px;
  box-shadow: var(--lift-shadow);
}
.note:focus { outline: none; box-shadow: var(--lift-shadow), 0 0 0 2px var(--yellow); }

/* ---- Clock in (solid accent) and Clock out (accent outline) ------ */

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.act {
  min-height: 108px;
  padding: 16px 12px;
  font-size: 26px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.act.in {
  color: var(--on-yellow);
  background: var(--yellow);
  border: 1px solid var(--yellow);
  box-shadow: var(--btn-shadow);
}
.act.in:active:not(:disabled) { background: var(--yellow-press); box-shadow: var(--lift-pressed); transform: translateY(1px); }
.act.out {
  color: var(--yellow);
  background: transparent;
  border: 2px solid var(--yellow);
}
.act.out:active:not(:disabled) { background: var(--yellow-tint); }
.act:disabled { opacity: 0.35; cursor: not-allowed; }

.helper { min-height: 22px; margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 15px; }

.alert {
  margin: 0 0 14px;
  padding: 12px;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid var(--bad-edge);
  border-radius: 10px;
  font-size: 14px;
}

/* ---- done: a raised sheet over the page -------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
}
.overlay[hidden] { display: none; }
.done-sheet {
  width: 100%;
  max-width: 360px;
  padding: 28px 24px 24px;
  text-align: center;
  background: var(--sheet-bg);
  border-radius: 12px;
  box-shadow: var(--lift-shadow);
  animation: pop 0.22s ease;
}
.done-sheet h2 { margin: 18px 0 6px; font-size: 30px; font-weight: 700; color: var(--strong); }
.done-sheet p { margin: 0; color: var(--muted); font-size: 17px; }

/* A big check mark drawn like Orders' Found button: the accent with a lit top
   and a raised edge; a cross when it failed. */
.mark { width: 84px; height: 68px; margin: 0 auto; filter: var(--tri-lift); }
.mark::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--tri-hi) 0%, var(--yellow) 55%, var(--yellow-press) 100%);
  clip-path: path("M12.6 26.8L29.6 43.8L71.2 2.2L81.6 12.6L29.6 64.6L2.2 37.2Z");
}
.mark.bad { width: 68px; filter: none; }
.mark.bad::before {
  background: var(--bad);
  clip-path: path("M10.4 0L34 23.6L57.6 0L68 10.4L44.4 34L68 57.6L57.6 68L34 44.4L10.4 68L0 57.6L23.6 34L0 10.4Z");
}

.dismiss {
  margin-top: 22px;
  min-width: 120px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--yellow);
  background: transparent;
  border: 2px solid var(--yellow);
  border-radius: 12px;
  cursor: pointer;
}
.dismiss:active { background: var(--yellow-tint); }

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Tablets and up: the sheet and the buttons a little roomier. */
@media (min-width: 601px) {
  main { max-width: 560px; }
  .clock { font-size: 68px; }
  .name { min-height: 66px; font-size: 21px; }
  .act { min-height: 120px; font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Hours: who's on the clock, a week's shifts ------------------- */

.hours-page .brand img { max-height: 96px; }
.brand a { display: flex; justify-content: center; }
.sheet + .sheet, .sheet + .weeknav { margin-top: 18px; }
/* A shift is two lines: day, name and hours, then the times under them. */
.onclock .row, .shifts .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
  font-size: 16px;
}
.onclock .row:first-of-type, .shifts .row:first-of-type { border-top: 0; }
.row .who { font-weight: 600; }
.row .since, .row .times { color: var(--muted); }
.row .day { flex: 0 0 84px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .times { flex: 0 0 100%; padding-left: 94px; font-size: 15px; }
.row .times b { font-weight: 600; color: var(--bad); }
.row .hm { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.open .hm, .row.open .times { color: var(--yellow); }
.row.odd .hm { color: var(--bad); }
.row.total { border-top: 2px solid var(--rule); font-weight: 700; }
.row.total .who { color: var(--muted); font-weight: 400; }
.sheet .none { margin: 0; text-align: center; color: var(--muted); }

/* One person's week: pay and the Processed for Payroll switch. */
.payweek { margin-bottom: 14px; }
.payline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.payline .who { font-size: 20px; font-weight: 700; color: var(--strong); }
.payline .hm { font-size: 20px; font-variant-numeric: tabular-nums; }
.payline.pay { margin-top: 4px; color: var(--muted); }
.payline .amount { font-size: 24px; font-weight: 700; color: var(--yellow); font-variant-numeric: tabular-nums; }
.processed { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.markbtn {
  padding: 11px 22px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--on-yellow);
  background: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
}
.markbtn:active { background: var(--yellow-press); box-shadow: var(--lift-pressed); transform: translateY(1px); }
.donetag { font-size: 17px; font-weight: 700; color: var(--ok); }
.saved { margin: 12px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.chip.done { border-color: var(--ok); }
.chip.done:not(.on) { color: var(--ok); }
.shifts .row.done .day::before { content: "\2713 "; color: var(--ok); }

.weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 12px;
}
.weeknav a {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  line-height: 1;
  color: var(--yellow);
  text-decoration: none;
  background: var(--lift-bg);
  border-radius: 12px;
  box-shadow: var(--lift-shadow);
}
.weeknav a:active { box-shadow: var(--lift-pressed); transform: translateY(1px); }
.weeklabel { text-align: center; font-size: 22px; font-weight: 700; color: var(--strong); line-height: 1.1; }
.weeklabel small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 3px; }

/* Each person's week as a chip, like Orders' filters: a grey outline, the one showing solid. */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 14px; }
.chip {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--muted);
  border-radius: 999px;
  white-space: nowrap;
}
.chip b { font-weight: 400; font-variant-numeric: tabular-nums; }
.chip.on { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }

.foot {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 26px 0 0;
  font-size: 14px;
}
.foot a, .linkbtn { color: var(--muted); text-decoration: underline; }
.linkbtn { padding: 0; font: inherit; background: none; border: 0; cursor: pointer; }
.foot form { display: inline; }
.review {
  display: block;
  margin: 22px auto 0;
  max-width: 220px;
  padding: 12px 22px;
  font-size: 17px;
  font-weight: 700;
  color: var(--on-yellow);
  background: var(--yellow);
  border-radius: 12px;
  box-shadow: var(--btn-shadow);
  text-decoration: none;
}
.review[hidden] { display: none; }
.review + .dismiss { margin-top: 14px; }

/* ---- sign in, as in CAS Inventory --------------------------------- */

.login-page main { max-width: 380px; padding-top: 8vh; }
.login { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.login input {
  padding: 14px 12px;
  font-size: 17px;
  color: var(--text);
  border: 2px solid var(--yellow);
  background: var(--field);
  border-radius: 12px;
}
.login input:focus { outline: none; }
.login button {
  align-self: center;
  min-width: 120px;
  padding: 10px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-yellow);
  background: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  cursor: pointer;
}
.login button:active { background: var(--yellow-press); }
.login .alert { margin: 0; }
.loginnote { margin: 2px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
