/* Roster — bone paper, viridian ink, mono ledger.
   Phone-first. No backdrop-filter anywhere (iOS WebKit compositing bug).
   dvh units for viewport height (installed-PWA correctness). */

:root {
  --bg: #F4F3ED;
  --surface: #FFFFFF;
  --ink: #23281F;
  --muted: #6E7265;
  --faint: #A2A498;
  --line: #E4E2D6;
  --line-strong: #D4D2C4;
  --brand: #30503F;
  --brand-deep: #24402F;
  --brand-soft: #E6ECE4;
  --warn: #A66A1F;
  --warn-soft: #F5EBDA;
  --danger: #9C3B2E;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  --font-ui: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Young Serif", Georgia, serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ─── Top nav ─────────────────────────────────────────────────────────── */

.topnav {
  padding: calc(var(--safe-top) + 10px) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark-dot { color: var(--brand); }

.topnav-right { display: flex; align-items: center; gap: 12px; }

.user-chip {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #F4F3ED;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── Page shell ──────────────────────────────────────────────────────── */

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 6px 18px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}

/* ─── Date hero (the signature) ───────────────────────────────────────── */

.page-head { margin-bottom: 18px; }

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 2px;
}

.crumb { color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--brand); }

.date-hero-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.date-big {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.02em;
}

.date-big-sm { font-size: 32px; }

.date-rest {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--muted);
}

/* ─── Controls ────────────────────────────────────────────────────────── */

.head-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.seg-item {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.seg-item.is-active {
  background: var(--brand);
  color: #F4F3ED;
}

.pager { display: inline-flex; align-items: center; gap: 4px; }

.pager-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.pager-today {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.pager-today.is-muted { color: var(--faint); pointer-events: none; }

.pills {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.pill {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pill.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #F4F3ED;
}

/* ─── Sections + ledger ───────────────────────────────────────────────── */

.section { margin-top: 26px; }

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

.ledger {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.ledger.is-dim { opacity: 0.65; }

.shift {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
}

.shift + .shift,
.person-row + .person-row,
.holiday-row + .holiday-row,
.mini-row + .mini-row {
  border-top: 1px solid var(--line);
}

.shift-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 64px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.t-end { color: var(--muted); }

.t-sep {
  width: 1px;
  height: 8px;
  background: var(--line-strong);
  margin: 2px 0;
}

.shift-body { flex: 1; min-width: 0; }

.shift-name-row { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shift-name { font-weight: 600; }

.shift-meta {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-sep { color: var(--faint); }

.money { font-family: var(--font-mono); font-weight: 500; }

.shift-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* ─── Chips / marks ───────────────────────────────────────────────────── */

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.chip-warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.chip-special { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }

.special-mark {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.today-mark {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.you-mark {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
}

.dim { color: var(--faint); }

/* ─── Week view ───────────────────────────────────────────────────────── */

.week { display: flex; flex-direction: column; gap: 18px; }

.week-day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 8px;
}

.week-dow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.week-num {
  font-family: var(--font-display);
  font-size: 22px;
}

.week-day.is-today .week-num,
.week-day.is-today .week-dow { color: var(--brand); }

.week-empty {
  color: var(--faint);
  margin: 0;
  padding: 4px 2px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Pay page ────────────────────────────────────────────────────────── */

.total-card {
  background: var(--brand);
  color: #F4F3ED;
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.total-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.75;
}

.total-hours {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  opacity: 0.85;
  font-family: var(--font-mono);
}

.total-money {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.total-money .chip-warn { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); color: #F4F3ED; }

.person-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}

.person-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
}

.person-head::-webkit-details-marker { display: none; }

.person-name { font-weight: 600; flex: 1; min-width: 0; }

.person-hours {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.person-money {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.band-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 10px;
}

.band-chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.band-chip strong { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

.mini-ledger { border-top: 1px solid var(--line); }

.mini-row {
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  font-size: 13px;
}

.mini-row.is-future { color: var(--muted); }

.mini-date { font-weight: 600; }
.mini-loc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { font-family: var(--font-mono); color: var(--muted); }
.mini-money { text-align: right; }

.admin-links { display: flex; gap: 10px; margin-top: 22px; }

/* ─── Rates page ──────────────────────────────────────────────────────── */

.note {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 56ch;
}

.rate-card.is-locked { opacity: 0.75; }

.rate-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.rate-role { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.rate-current {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ─── People page ─────────────────────────────────────────────────────── */

.person-row, .holiday-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
}

.person-row-body, .holiday-row > div:first-child { flex: 1; min-width: 0; }

.person-row.is-dim, .holiday-row.is-dim { opacity: 0.6; }

.invite-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.invite-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}

/* ─── Cards, forms, buttons ───────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  margin: 0 0 4px;
}

.form-card { margin-top: 14px; }

.stack { display: flex; flex-direction: column; gap: 13px; }

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }

.field-narrow { max-width: 240px; }

.field-pair { display: flex; gap: 12px; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--faint); font-size: 12px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], select {
  font-family: var(--font-ui);
  font-size: 16px; /* prevents iOS zoom-on-focus */
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

input:disabled { background: var(--bg); color: var(--faint); }

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236E7265' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary { background: var(--brand); color: #F4F3ED; }
.btn-primary:active { background: var(--brand-deep); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-block { width: 100%; }

.link-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

.link-danger { color: var(--danger); }

.inline-form { display: inline; margin: 0; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-error {
  background: #F7E7E2;
  border: 1px solid #E0BCB2;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 12px;
}

.form-ok {
  background: var(--brand-soft);
  border: 1px solid #C6D4C4;
  color: var(--brand-deep);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 12px;
}

/* ─── Empty states ────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 42px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  margin-top: 14px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0;
  color: var(--muted);
}

.empty-sub { margin: 6px 0 0; font-size: 13px; color: var(--faint); }

/* ─── Tab bar (fixed, no blur, dvh-safe) ──────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  z-index: 9999;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(var(--safe-bottom) + 6px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--faint);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  min-width: 74px;
  padding: 3px 0;
}

.tab svg { width: 22px; height: 22px; }

.tab.is-active { color: var(--brand); }

/* ─── Auth pages ──────────────────────────────────────────────────────── */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  margin: 0 0 4px;
}

.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

/* ─── Wider screens ───────────────────────────────────────────────────── */

@media (min-width: 700px) {
  .date-big { font-size: 64px; }
  .week {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* ─── User menu popover ───────────────────────────────────────────────── */

.user-menu { position: relative; }

.user-menu > summary {
  list-style: none;
  cursor: pointer;
}

.user-menu > summary::-webkit-details-marker { display: none; }

.user-menu[open] > summary { outline: 2px solid var(--brand); outline-offset: 2px; }

.user-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(35, 40, 31, 0.10);
  padding: 12px;
  z-index: 10000;
}

.user-pop-name { font-weight: 600; font-size: 14px; }

.user-pop-email {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  word-break: break-all;
}

.user-pop-logout {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
  padding: 7px 6px;
  border-radius: 8px;
}

.user-pop-logout:hover { background: var(--bg); }

/* ─── Announcements, notes, account ───────────────────────────────────── */

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.ann-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.ann-card {
  background: var(--brand-soft);
  border: 1px solid #C9D6C7;
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 13px 16px;
}

.ann-body {
  margin: 0;
  font-size: 14px;
  color: var(--brand-deep);
  white-space: pre-line;
}

.ann-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ann-meta { font-size: 12px; color: var(--muted); }

.ann-actions { display: inline-flex; gap: 12px; }

.shift-note {
  margin-top: 4px;
  font-size: 13px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-radius: 8px;
  padding: 4px 9px;
  display: inline-block;
}

.user-pop-link {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 7px 6px;
  border-radius: 8px;
}

.user-pop-link:hover { background: var(--bg); }

textarea {
  font-family: var(--font-ui);
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  resize: vertical;
  appearance: none;
  -webkit-appearance: none;
}
