/* Punchcard — mobile-first. The clock screen is designed for cold hands:
   one huge button, big type, high contrast, nothing decorative. */

:root {
  --green: #14532d;
  --green-bright: #16a34a;
  --red: #b91c1c;
  --ink: #17211a;
  --paper: #f7f6f2;
  --muted: #6b7268;
  --line: #e3e1da;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 30rem;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 0.25rem; }
.sub { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.95rem; }
.card { padding: 2rem 0.25rem; }
.centre { display: block; margin: 1rem auto 0; }

/* ── Top bar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 0.25rem 0;
}
.who { font-weight: 650; font-size: 1.05rem; }
.net { font-size: 0.8rem; margin-top: 0.1rem; }
.net.on { color: var(--green); }
.net.off { color: var(--red); font-weight: 600; }

/* ── Clock screen ── */
.clock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 1rem 0 2rem;
}
.state { font-size: 1.15rem; font-weight: 600; margin: 0; }
.estimate { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; min-height: 1.4em; }

.bigbtn {
  width: min(72vw, 17rem);
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.06s ease;
}
.bigbtn:active { transform: scale(0.96); }
.bigbtn:disabled { opacity: 0.6; }
.bigbtn.go { background: var(--green-bright); }
.bigbtn.stop { background: var(--red); }
.bigbtn.wide {
  width: 100%;
  aspect-ratio: auto;
  border-radius: 14px;
  padding: 1rem;
  font-size: 1.1rem;
}

.secondary { min-height: 3.2rem; display: flex; align-items: center; }
.smallbtn {
  border: 2px solid var(--green);
  background: #fff;
  color: var(--green);
  border-radius: 999px;
  padding: 0.65rem 1.6rem;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
.smallbtn:active { background: #eef5ee; }

.notice { min-height: 1.4em; font-weight: 600; margin: 0.5rem 0 0; }
.notice.err { color: var(--red); font-weight: 500; }
.pending { color: var(--muted); font-size: 0.85rem; min-height: 1.2em; margin: 0; }

.why {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 24rem;
  text-align: left;
}
.why summary { cursor: pointer; text-align: center; }
.why p { margin: 0.5rem 0 0; }

/* ── Auth / PIN ── */
.auth form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.5rem; }
.auth label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; }
.auth input {
  font-size: 1.1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.auth input:focus { outline: 2px solid var(--green); outline-offset: 1px; }

.pinpad-wrap { text-align: center; }
.dots { display: flex; gap: 1rem; justify-content: center; margin: 1.25rem 0 0.5rem; }
.dots span {
  width: 1.05rem; height: 1.05rem;
  border-radius: 50%;
  border: 2px solid var(--green);
}
.dots span.filled { background: var(--green); }

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  max-width: 17rem;
  margin: 1rem auto 0;
}
.pinpad button {
  aspect-ratio: 1.25;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.pinpad button:active { background: #eceae3; }

.linklike {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.25rem;
}

/* ── Tab bar ── */
.view { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(4.4rem, 1fr);
  gap: 0.4rem;
  padding: 0.6rem 0.25rem calc(0.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  bottom: 0;
  overflow-x: auto;
}
.tabs button {
  padding: 0.75rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.tabs button.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ── Sheets (My week / My leave) ── */
.sheet { padding: 1rem 0.25rem 1.5rem; }
.sheet h2 { font-size: 1.2rem; margin: 0; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }

.weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.navbtn {
  width: 2.8rem; height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 1.4rem;
  color: var(--green);
  cursor: pointer;
  touch-action: manipulation;
}

.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.75rem; }
.badge {
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.badge.ok { background: #dcfce7; color: var(--green); }
.badge.warn { background: #fef3c7; color: #92400e; }

.daycard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.daycard.sunday { border-left: 4px solid #d97706; }
.daycard header { font-weight: 650; font-size: 0.95rem; margin-bottom: 0.3rem; }
.suntag {
  font-size: 0.72rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}
.shift {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
  padding: 0.15rem 0;
  font-size: 0.95rem;
  flex-wrap: wrap;
}
.flag {
  font-size: 0.72rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.totals {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.totals td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.totals tr:last-child td { border-bottom: none; }
.totals td:last-child { text-align: right; font-weight: 650; }
.totals tr.tot td { background: #eef5ee; font-weight: 700; }

.bignum {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.75rem 0 1rem;
  text-align: center;
}
.bignum > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.3rem;
}
.bignum strong { display: block; font-size: 1.5rem; color: var(--green); }
.bignum span { font-size: 0.75rem; color: var(--muted); }

/* ── Owner hub ── */
.tabs button { padding: 0.7rem 0.2rem; font-size: 0.82rem; }

.sheetscroll { overflow-x: auto; }
.payroll { min-width: 34rem; }
.payroll th {
  text-align: left;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.5rem 0.9rem;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.payroll td { white-space: nowrap; }
.payroll .marks { white-space: normal; min-width: 8rem; }
.payroll .badge { margin: 0.1rem 0.15rem 0.1rem 0; display: inline-block; }
.commentrow td {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  padding-top: 0;
}

/* Desktop: give the hub more room */
@media (min-width: 48rem) {
  .app { max-width: 46rem; }
}

/* ── Owner week actions ── */
.namelink { font-weight: 650; color: var(--ink); text-decoration: none; padding: 0.4rem 0; }
.namerow:hover { background: #faf9f5; }
.actioncell { background: #f2f1ec; }
.actions { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.4rem 0; }
.actionrowline { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; }
.actionrowline label { display: flex; flex-direction: column; font-size: 0.78rem; font-weight: 600; color: var(--muted); gap: 0.2rem; }
.actionrowline input, .actionrowline select {
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.addentry summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--green); }
.addentry[open] summary { margin-bottom: 0.5rem; }

/* declined badge (leave requests) */
.badge.no { background: #fee2e2; color: var(--red); }
