/* Three colours only: deep blue (main), green (accent), neutral (background).
   White, lines and muted text are tints of the neutral or the blue. No gradients. */
:root {
  --blue: #0F2D6B;
  --green: #1E8E4E;
  --bg: #F3F2EE;

  --surface: #FFFFFF;
  --line: #E2E0D9;
  --muted: rgba(15, 45, 107, 0.62);
  --blue-soft: rgba(15, 45, 107, 0.07);
  --green-soft: rgba(30, 142, 78, 0.10);

  --radius: 12px;
  --pad: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--blue);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

button { font: inherit; color: inherit; cursor: pointer; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Sticky header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--blue);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px var(--pad) 10px;
}
.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.week-range { font-size: 14px; opacity: 0.85; white-space: nowrap; }

.search input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--blue);
  font-size: 16px; /* keeps iOS from zooming in */
  outline: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { box-shadow: 0 0 0 3px var(--green); }

/* Day buttons */
.days {
  display: flex;
  gap: 3px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day-btn {
  flex: 1 1 0;
  min-width: 38px;
  min-height: 52px;
  padding: 4px 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: transparent;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  position: relative;
}
.day-btn .d { font-size: 12px; opacity: 0.9; }
.day-btn .n { font-size: 16px; font-weight: 600; }
.day-btn.week { flex-grow: 1.25; }
.day-btn.week .n { font-size: 13px; }
.day-btn[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--surface);
  color: var(--blue);
}
.day-btn[aria-pressed="true"] .d { opacity: 1; }
.day-btn.today::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
}
.day-btn:focus-visible { outline: 3px solid var(--green); outline-offset: 1px; }

/* ---------- Banner ---------- */
.banner {
  max-width: 960px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--blue);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.banner[hidden] { display: none; }
.banner p { margin: 0; }
@media (max-width: 992px) { .banner { margin-left: var(--pad); margin-right: var(--pad); } }

.link-btn {
  border: 0; background: none; padding: 4px 0;
  color: var(--green); font-weight: 600; text-decoration: underline;
}

/* ---------- Main ---------- */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px var(--pad) 24px;
}
.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 2px 12px;
}
.view-head h2 { font-size: 18px; margin: 0; }
.view-head .count { font-size: 14px; color: var(--muted); white-space: nowrap; }

.empty {
  margin: 24px 0;
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Week view: one card per person */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
}
.card.me { border-color: var(--green); box-shadow: inset 4px 0 0 var(--green); }
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.card-head h3 { flex: 1; margin: 0; font-size: 17px; }
.total {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  white-space: nowrap;
}
.star {
  width: 36px; height: 36px;
  margin: -6px -8px -6px 0;
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
}
.star[aria-pressed="true"] { color: var(--green); }

.shifts { list-style: none; margin: 0; padding: 0; }
.shifts li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.shifts li:first-child { border-top: 0; }
.shifts .day { font-weight: 600; }
.shifts .day.repeat { visibility: hidden; }
.shifts li.today .day { color: var(--green); }
.len { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Day view: grouped rows */
.group { margin-bottom: 16px; }
.group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 0 2px 6px;
}
.rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row .name { font-weight: 600; }
.row .time { text-align: right; white-space: nowrap; }
.row .meta { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.row.me { box-shadow: inset 4px 0 0 var(--green); background: var(--green-soft); }

.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
}
.tag.outline { background: transparent; color: var(--green); border: 1px solid var(--green); }

@media (min-width: 720px) {
  .row { grid-template-columns: 1fr auto auto; align-items: baseline; }
  .row .meta { grid-column: auto; justify-content: flex-end; min-width: 110px; }
}

/* ---------- Footer ---------- */
.foot {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px var(--pad) calc(32px + env(safe-area-inset-bottom));
  text-align: center;
}
.outline-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--blue);
  border-radius: 10px;
  background: transparent;
  color: var(--blue);
  font-weight: 600;
}
.outline-btn:active { background: var(--blue-soft); }
.foot-note { font-size: 13px; color: var(--muted); max-width: 460px; margin: 10px auto 0; }
.foot-note code { font-size: 12px; }
