/* Gate Expectations — shared styles (UI_V2)
   Loaded by index.html, wind.html, settings.html. */

@view-transition { navigation: auto; }

:root {
  --bg: #F5F4F0;
  --card: #FFFFFF;
  --card-border: #E3E1DA;
  --divider: #EFEDE7;
  --text: #15171A;
  --muted: #5E6266;
  --muted-2: #C9CBC6;
  --accent: #1E6B52;
  --accent-tint: #E4F0EB;
  --red: #B4372F;
  --red-text: #9A2C25;
  --red-tint: #F7E3E1;
  --amber: #D99A1E;
  --amber-tint: #FBEFD6;
  --online: #2E9B6B;
  --status-red-on-dark: #E0685E;
  --chart-5min: #C07A12;
  --chart-30min: #2F6FA8;
  --input-border: #D6D3CA;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Manrope, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
a { color: var(--text); }
button { font-family: inherit; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Page shell — fits a 390 × 844 iPhone with safe-area padding.
   The top minimum (54px) clears the iOS status bar / Dynamic Island when
   the browser doesn't expose safe-area-inset-top (e.g. in Safari with
   viewport-fit=cover, where the viewport extends under the status bar). */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: max(env(safe-area-inset-top), 35px);
  padding-bottom: max(env(safe-area-inset-bottom), 16px);
}

/* Header */
.header {
  padding: 12px 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}
.header-title { display: flex; flex-direction: column; gap: 3px; }
.brand { font-size: 16px; font-weight: 800; letter-spacing: 2.6px; }
.brand-sub { font-size: 10px; font-weight: 600; letter-spacing: 2px; color: var(--muted); }
.temp { display: flex; align-items: center; gap: 5px; font-size: 18px; font-weight: 700; }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 0;
  min-height: 0;
}

/* Page title (Wind, Settings) */
.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Section labels (small caps) */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow.accent { color: var(--accent); letter-spacing: 1.4px; }
.eyebrow.danger { color: var(--red-text); letter-spacing: 1.4px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

/* Nav buttons above the footer */
.pagenav {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 12px;
}
.navbtn {
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}
.navbtn svg { flex-shrink: 0; }

/* Footer */
.footer {
  border-top: 1px solid var(--card-border);
  padding: 12px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.footer-left, .footer-right { display: flex; align-items: center; gap: 16px; }
.footer-item { display: flex; align-items: center; gap: 6px; }
.footer-item .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.footer-item .dot.ok { background: var(--online); }
.footer-item .dot.err { background: var(--red); }
.footer-link { color: var(--muted); font-weight: 600; text-decoration: underline; }

/* Status pill (Wind + Settings footer) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-pill.closed { background: var(--red-tint); color: var(--red-text); }
.status-pill.closed .dot { background: var(--red); }
.status-pill.open { background: var(--accent-tint); color: var(--accent); }
.status-pill.open .dot { background: var(--accent); }
.status-pill.amber { background: var(--amber-tint); color: #7A5A12; }
.status-pill.amber .dot { background: var(--amber); }

/* Generic buttons */
.btn {
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.loading { opacity: 0.5; }
.btn-primary { background: var(--accent); color: #FFFFFF; height: 56px; font-size: 16px; }
.btn-outline { background: var(--card); color: var(--text); border: 1.5px solid var(--text); height: 56px; font-size: 16px; }
.btn-full-green { background: var(--accent); color: #FFFFFF; height: 50px; font-size: 15px; border-radius: 14px; width: 100%; }
.btn-full-green:disabled { background: #C9CBC6; color: #FFFFFF; opacity: 1; }

/* Toggle switches */
.toggle {
  width: 50px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 3px;
  background: #D6D3CA;
  display: flex;
  justify-content: flex-start;
  cursor: pointer;
  transition: background 0.2s, justify-content 0.2s;
}
.toggle[aria-pressed="true"] { background: var(--accent); justify-content: flex-end; }
.toggle-thumb {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* Number input */
.num-input {
  width: 56px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}
.num-unit { width: 30px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* Status card (Gate page) */
.status-card {
  background: var(--text);
  color: #FFFFFF;
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.status-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--muted-2);
}
.status-card-head .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot-open { background: var(--online); }
.status-dot-closed { background: var(--status-red-on-dark); }
.status-dot-amber { background: var(--amber); }
.status-word { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.status-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-sub-cancel {
  text-decoration: underline;
  cursor: pointer;
  color: var(--muted-2);
}

/* Open & Hold button (Gate page) */
.hold-btn {
  height: 64px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
  padding: 0 16px;
  font-family: inherit;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
.hold-btn-tile {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hold-btn-label {
  flex: 1;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Activity list (Gate page) */
.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.activity-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.activity-list { padding: 0 14px; }
.activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--divider);
}
.activity-row:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.activity-dot.open { background: var(--accent); }
.activity-dot.close { background: var(--red); }
.activity-dot.cancel { background: #9A9C98; }
.activity-text {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.activity-text .by { font-weight: 500; color: var(--muted); }
.activity-time { font-size: 12px; font-weight: 500; color: var(--muted); }

/* Wind summary (Gate page) */
.wind-summary-card { overflow: hidden; }
.wind-summary-inner {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 14px;
}
.wind-summary-icon { color: var(--muted); flex-shrink: 0; }
.wind-summary-stats {
  flex: 1;
  display: flex;
  align-items: center;
}
.wind-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wind-stat-row { display: flex; align-items: baseline; gap: 3px; }
.wind-stat-num { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.wind-stat-unit { font-size: 11px; font-weight: 600; color: var(--muted); }
.wind-stat-lbl { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.wind-stat-sep { width: 1px; height: 36px; background: var(--card-border); flex-shrink: 0; margin: 0 8px; }

/* Modal (Open & Hold) — restyled */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-backdrop.show { display: flex; }
.modal-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 10px 20px 28px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--card-border);
  border-radius: 2px;
  margin: 0 auto 10px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 14px;
}
.modal-tab {
  flex: 1;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-buttons {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 14px;
}
.modal-btn {
  height: 48px;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.modal-cancel { background: var(--divider); color: var(--text); }
.modal-confirm { background: var(--accent); color: #FFFFFF; }
.modal-confirm:disabled { background: #C9CBC6; opacity: 1; cursor: not-allowed; }

/* Hold-modal picker (iOS-style scroll pickers) */
.picker-row { display: flex; flex-direction: column; gap: 6px; }
.picker-row > .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.picker-wrap {
  position: relative;
  height: 140px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg);
}
.picker-highlight {
  position: absolute;
  left: 8px; right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  background: rgba(30, 107, 82, 0.08);
  border-radius: 10px;
  pointer-events: none;
}
.picker-cols {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.picker-col {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 52px 0;
  min-width: 48px;
  text-align: center;
}
.picker-col::-webkit-scrollbar { display: none; }
.picker-col > div {
  height: 36px;
  line-height: 36px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  scroll-snap-align: center;
}
.picker-sep { font-size: 20px; font-weight: 700; padding: 0 4px; }
.picker-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
}
.picker-fade-top, .picker-fade-bottom {
  position: absolute; left: 0; right: 0; height: 48px;
  pointer-events: none;
  z-index: 1;
}
.picker-fade-top { top: 0; background: linear-gradient(var(--bg), transparent); }
.picker-fade-bottom { bottom: 0; background: linear-gradient(transparent, var(--bg)); }
.later-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.or-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0 6px;
}
.until-close-btn {
  width: 100%;
  height: 44px;
  border: 1px solid var(--card-border);
  background: var(--card);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

/* "See all" events sheet */
.sheet-events {
  max-height: 70dvh;
  overflow-y: auto;
  padding: 10px 20px 28px;
}
.sheet-events-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 10px;
}
