/* Clock-in screen — built for a wall-mounted or counter iPad.

   Design rules this file follows:
   - Thumb-first. Nothing interactive is under 60px; cards are ~200px.
   - Readable at arm's length. A shop iPad is not held 30cm from your face,
     so type is a size up from a normal web app.
   - No hover-only affordances. Touch has no hover.
   - Fits landscape AND portrait without scrolling for a normal-sized team.
   Self-contained: nothing here is shared with the manager pages. */

:root {
  --ink:      #1f1b16;
  --ink-soft: #6b6257;
  --paper:    #f6f2ea;
  --card:     #ffffff;
  --line:     #e5ddd0;
  --amber:    #c8860d;
  --green:    #2e7d32;
  --green-bg: #eaf4ea;
  --red:      #b3261e;
  --shadow:   0 2px 4px rgba(31,27,22,.06), 0 8px 24px rgba(31,27,22,.07);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  /* Nothing on this screen is meant to be selected or dragged. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}

.muted { color: var(--ink-soft); }

/* ---------------- header ---------------- */
.top {
  display: flex; align-items: center; gap: 1.2rem;
  padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1.6rem 1rem;
  background: var(--ink); color: #fff;
}
.brand { font-weight: 600; font-size: 1.15rem; letter-spacing: .01em; }

.clock { margin-left: auto; text-align: right; line-height: 1.1; }
.clock span {
  font-size: 2rem; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.clock small { display: block; font-size: .85rem; color: rgba(255,255,255,.7); margin-top: .1rem; }

/* Deliberately quiet: staff should reach for their own card, not this. */
.ghost {
  appearance: none; font: inherit; cursor: pointer;
  background: transparent; color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; padding: .6rem 1.15rem;
  min-height: 48px; font-size: .95rem; white-space: nowrap;
}
.ghost:active { background: rgba(255,255,255,.16); color: #fff; }

/* ---------------- staff grid ---------------- */
.grid {
  display: grid; gap: 1.1rem;
  padding: 1.6rem 1.6rem calc(env(safe-area-inset-bottom, 0px) + 1.6rem);
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-content: start;
}
.grid > p { grid-column: 1 / -1; text-align: center; padding: 4rem 1rem; font-size: 1.1rem; }

.person {
  appearance: none; font: inherit; cursor: pointer; text-align: center;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 1.5rem 1rem;
  min-height: 216px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem;
  box-shadow: var(--shadow);
  transition: transform .08s ease;
}
.person:active { transform: scale(.97); }

/* On shift reads at a glance from across the room. */
.person.on { border-color: var(--green); background: var(--green-bg); }
.person.on::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); margin-bottom: .1rem;
}

.avatar {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--amber); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 600; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.name { font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.state { font-size: .95rem; color: var(--ink-soft); }
.person.on .state { color: var(--green); font-weight: 600; }
.elapsed {
  font-size: 1.05rem; font-weight: 600; color: var(--green);
  font-variant-numeric: tabular-nums;
}

/* ---------------- sheets ---------------- */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(31,27,22,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet[hidden] { display: none; }

.card {
  background: var(--card); border-radius: 24px; padding: 2rem;
  width: min(440px, 100%); max-height: 94vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(31,27,22,.3);
  text-align: center;
}
.card h2 { margin: 0 0 .25rem; font-size: 1.5rem; }
.card > p { margin: 0 0 1rem; font-size: 1rem; }

/* PIN */
.dots { display: flex; gap: 1rem; justify-content: center; margin: 1.4rem 0 1rem; }
.dots i {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #c9c1b4; display: block;
  transition: background .1s ease, transform .1s ease;
}
.dots i.filled { background: var(--ink); border-color: var(--ink); transform: scale(1.1); }

.err { color: var(--red); min-height: 1.4em; font-size: 1rem; margin: 0 0 .8rem; font-weight: 500; }

.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.keys button {
  appearance: none; font: inherit; cursor: pointer;
  font-size: 1.75rem; font-weight: 500;
  min-height: 78px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: transform .06s ease;
}
.keys button:active { background: #efe6d4; transform: scale(.96); }
.keys button.dim { font-size: 1.05rem; color: var(--ink-soft); }

/* Result */
.card.done { padding: 2.4rem 2rem; }
.tick {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 1.3rem;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  animation: pop .28s cubic-bezier(.2,.9,.3,1.3);
}
.tick.info { background: var(--ink-soft); font-style: italic; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tick { animation: none; } }

.card.done h2 { font-size: 1.7rem; margin-bottom: .3rem; }
.card.done > p { font-size: 1.15rem; }

.primary {
  appearance: none; font: inherit; cursor: pointer;
  width: 100%; min-height: 64px; margin-top: 1.4rem;
  font-size: 1.15rem; font-weight: 600;
  background: var(--amber); color: #fff;
  border: none; border-radius: 16px;
}
.primary:active { background: #ad740b; }

button:focus-visible, a:focus-visible {
  outline: none; box-shadow: 0 0 0 4px rgba(200,134,13,.5);
}

/* ---------------- iPad sizes ---------------- */

/* Landscape iPad — the usual counter setup. Four across, bigger everything. */
@media (min-width: 1024px) {
  body { font-size: 18px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 1.4rem; padding: 2rem; }
  .person { min-height: 244px; }
  .avatar { width: 104px; height: 104px; font-size: 2.3rem; }
  .name { font-size: 1.45rem; }
  .clock span { font-size: 2.3rem; }
  .card { width: min(480px, 100%); }
  .keys button { min-height: 86px; font-size: 1.9rem; }
}

/* Portrait iPad — three across still gives a comfortable target. */
@media (min-width: 700px) and (max-width: 1023px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 1.2rem; padding: 1.8rem; }
  .person { min-height: 230px; }
}

/* Phone */
@media (max-width: 560px) {
  .top { padding-left: 1rem; padding-right: 1rem; gap: .8rem; }
  .brand { font-size: 1rem; }
  .clock span { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: .8rem; padding: 1rem; }
  .person { min-height: 175px; padding: 1.1rem .6rem; }
  .avatar { width: 68px; height: 68px; font-size: 1.5rem; }
  .name { font-size: 1.1rem; }
  .card { padding: 1.5rem; }
  .keys button { min-height: 66px; font-size: 1.5rem; }
}

/* ---------------- sign-in ---------------- */
.loginpage {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.5rem;
}
.logincard {
  background: var(--card); border-radius: 24px; padding: 2.4rem;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}
.logincard h1 { margin: 0 0 .2rem; font-size: 1.5rem; }
.logincard > p.muted { margin: 0 0 1.8rem; }
.logincard label { display: block; margin-bottom: 1.1rem; font-size: .95rem; color: var(--ink-soft); }
.logincard input {
  display: block; width: 100%; margin-top: .4rem;
  font: inherit; font-size: 1.1rem;
  padding: .95rem 1rem; min-height: 58px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--ink);
  -webkit-user-select: text; user-select: text;
}
.logincard input:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(200,134,13,.28);
}
.logincard .primary { margin-top: .5rem; }
.small { font-size: .88rem; text-align: center; margin-top: 1.2rem; }
