/* PWA design refresh foundation (staging only).
 * Keeps the approved warm opaque palette, persistent attendance navigation,
 * and the photo-backed site grid. Progressive reveal is defined by v160. */

:root {
  --v159-paper: #fbf8f3;
  --v159-surface: #fffdf9;
  --v159-surface-muted: #f4efe7;
  --v159-navy: #0d315c;
  --v159-muted: #52677d;
  --v159-border: #d7d3cb;
  --v159-coral: #b9492f;
  --v159-coral-strong: #a33d28;
  --v159-coral-soft: #fff0ea;
  --v159-green: #285f49;
  --v159-green-soft: #edf7f1;
  --v159-nav-height: 66px;
}

/* Home: the selected-site control is an operation, never a hidden label. */
.app-view #pwa-home-v153 .hp153-site-panel {
  border-color: var(--v159-border);
  background: var(--v159-surface);
}

.app-view #pwa-home-v153 .hp153-site-change {
  min-width: 112px;
  min-height: 44px;
  padding: 7px 11px;
  border-color: #c4d0da;
  background: #f7fafc;
  color: var(--v159-navy);
  -webkit-text-fill-color: var(--v159-navy);
  font-size: 12px;
  font-weight: 800;
  touch-action: manipulation;
}

.app-view #pwa-home-v153 .hp153-site-change::after {
  margin-left: 5px;
  content: "›";
  font-size: 17px;
  line-height: 1;
}

.app-view #pwa-home-v153 .hp153-site-change:active {
  background: #edf3f7;
  transform: scale(.98);
}

/* iPhone safe area and a stable first-screen hierarchy. */
.app-view #tab-punch .v153-site-head {
  min-height: calc(56px + env(safe-area-inset-top));
  padding-top: max(10px, env(safe-area-inset-top));
}

.app-view #tab-punch .v153-site-search {
  position: relative;
  z-index: 2;
  min-height: 52px;
  margin: 5px 0 12px;
  background: var(--v159-surface);
}

.app-view #tab-punch .punch-actions .btn-in {
  background: linear-gradient(135deg, var(--v159-coral), var(--v159-coral-strong));
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.app-view #tab-punch .punch-actions .btn-out {
  background: linear-gradient(135deg, #9d4332, #7f3428);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.app-view #tab-punch .punch-correction-entry button {
  border-color: #c4d0da;
  background: #f7fafc;
  color: var(--v159-navy);
  -webkit-text-fill-color: var(--v159-navy);
}

/* Four photo-backed choices are visible in the initial site batch. */
.app-view #tab-punch .pwa-site-choice-list.pwa-site-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  width: 100%;
  margin: 0;
  overflow: visible;
  touch-action: pan-y pinch-zoom;
}

.app-view #tab-punch .pwa-site-choice-grid > .empty-state,
.app-view #tab-punch .pwa-site-reveal-controls,
.app-view #tab-punch .pwa-site-selection-note {
  grid-column: 1 / -1;
}

.app-view #tab-punch .pwa-site-choice-row {
  position: relative;
  min-width: 0;
  min-height: 174px;
}

.app-view #tab-punch .pwa-site-choice-row[hidden] {
  display: none !important;
}

.app-view #tab-punch .pwa-site-choice {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 82px minmax(62px, auto);
  align-content: start;
  gap: 8px;
  width: 100%;
  min-height: 174px;
  height: 100%;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--v159-border);
  border-radius: 16px;
  background: var(--v159-surface);
  color: var(--v159-navy);
  -webkit-text-fill-color: var(--v159-navy);
  text-align: left;
  box-shadow: 0 4px 12px rgb(35 50 61 / 6%);
  touch-action: manipulation;
}

.app-view #tab-punch .pwa-site-choice:active {
  background: #f8f4ed;
  transform: scale(.985);
}

.app-view #tab-punch .pwa-site-choice[aria-pressed="true"] {
  border: 2px solid var(--v159-coral);
  background: #fffaf6;
  box-shadow: 0 0 0 3px rgb(185 73 47 / 9%);
}

.app-view #tab-punch .pwa-site-choice-image {
  display: block;
  width: 100%;
  height: 82px;
  overflow: hidden;
  border: 0;
  border-radius: 11px;
  background-color: #e8e2d8;
  background-position: center;
  background-size: cover;
}

.app-view #tab-punch .pwa-site-choice > span:nth-child(2) {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 0 2px 2px;
}

.app-view #tab-punch .pwa-site-choice b {
  display: -webkit-box;
  min-height: 41px;
  overflow: hidden;
  color: var(--v159-navy);
  -webkit-text-fill-color: var(--v159-navy);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-view #tab-punch .pwa-site-choice small {
  display: -webkit-box;
  min-height: 34px;
  margin: 0;
  overflow: hidden;
  color: var(--v159-muted);
  -webkit-text-fill-color: var(--v159-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-view #tab-punch .pwa-site-selected-badge {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--v159-coral);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 11px;
  font-weight: 850;
  box-shadow: 0 2px 7px rgb(13 49 92 / 18%);
}

.app-view #tab-punch .pwa-site-selected-badge::before {
  margin-right: 4px;
  content: "✓";
}

.app-view #tab-punch .pwa-site-photo-edit {
  top: 27px;
  left: 14px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 2px solid #fff;
  background: var(--v159-navy);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.app-view #tab-punch .pwa-site-photo-message {
  position: absolute;
  right: 8px;
  bottom: 4px;
  left: 8px;
  margin: 0;
  padding: 3px 5px;
  border-radius: 6px;
  background: var(--v159-surface);
  color: var(--v159-muted);
  -webkit-text-fill-color: var(--v159-muted);
  font-size: 11px;
}

.app-view #tab-punch .pwa-site-selection-note {
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  border-left: 3px solid #b9c7d2;
  background: #f5f8fa;
  color: #415a72;
  -webkit-text-fill-color: #415a72;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
}

/* Menu and its secondary pages keep an opaque, stable five-item nav. */
.pwa-secondary-content {
  padding-bottom: calc(28px + var(--v159-nav-height) + env(safe-area-inset-bottom));
}

.pwa-secondary-bottom-nav {
  position: fixed;
  z-index: 95;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(var(--v159-nav-height) + env(safe-area-inset-bottom));
  padding: 5px max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-right));
  border-top: 1px solid var(--v159-border);
  background: #fffdf9;
  box-shadow: 0 -6px 18px rgb(35 50 61 / 7%);
}

.pwa-secondary-bottom-nav button {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 56px;
  padding: 4px 2px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #647386;
  -webkit-text-fill-color: #647386;
  font-size: 12px;
  font-weight: 800;
  touch-action: manipulation;
}

.pwa-secondary-bottom-nav button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pwa-secondary-bottom-nav button[aria-current="page"] {
  color: var(--v159-coral-strong);
  -webkit-text-fill-color: var(--v159-coral-strong);
}

.pwa-secondary-bottom-nav button[aria-current="page"]::after {
  position: absolute;
  right: 26%;
  bottom: 1px;
  left: 26%;
  height: 3px;
  border-radius: 999px;
  background: var(--v159-coral);
  content: "";
}

.pwa-secondary-bottom-nav button:active {
  background: var(--v159-coral-soft);
  transform: scale(.97);
}

@media (max-width: 360px) {
  .app-view #tab-punch .pwa-site-choice-list.pwa-site-choice-grid { gap: 8px; }
  .app-view #tab-punch .pwa-site-choice-row,
  .app-view #tab-punch .pwa-site-choice { min-height: 158px; }
  .app-view #tab-punch .pwa-site-choice { grid-template-rows: 70px minmax(60px, auto); padding: 7px; }
  .app-view #tab-punch .pwa-site-choice-image { height: 70px; }
  .app-view #tab-punch .pwa-site-photo-edit { top: 20px; }
  .app-view #tab-punch .pwa-site-choice b { font-size: 14px; }
  .app-view #tab-punch .pwa-site-choice small { font-size: 11px; }
}

@media (prefers-color-scheme: dark) and (prefers-color-scheme: light) {
  .app-view #tab-punch,
  .pwa-secondary-layer { color-scheme: light; }
}

@media (prefers-reduced-motion: reduce) {
  .app-view #pwa-home-v153 .hp153-site-change,
  .app-view #tab-punch .pwa-site-choice,
  .pwa-secondary-bottom-nav button {
    transition: none !important;
  }
}
