* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #F9FAFB;
  color: #111827;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; }
button:focus-visible { outline: 2px solid #0369A1; outline-offset: 2px; }
h1, h2 { font: inherit; }

.page {
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.brand h1 span { color: #0EA5E9; }
.logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, #0EA5E9, #0369A1);
  display: flex; align-items: center; justify-content: center;
}
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #6B7280; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #D1D5DB; }
.dot.live { background: #10B981; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  text-align: left; background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 14px; cursor: pointer; color: #111827; min-width: 0;
}
#tile-temperature { --color: #F59E0B; --tint: #FEF3C7; }
#tile-humidity { --color: #0EA5E9; --tint: #E0F2FE; }
.tile[aria-pressed="true"] { border-color: var(--color); box-shadow: 0 0 0 3px var(--tint); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow { font-size: 11px; font-weight: 500; color: #6B7280; text-transform: uppercase; letter-spacing: 0.04em; }
.tile-icon {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--tint); color: var(--color);
}
.tile-now {
  font-size: 34px; font-weight: 600; line-height: 1; margin-top: 10px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.unit { font-size: 14px; font-weight: 400; color: #9CA3AF; margin-left: 2px; }
.tile-today { font-size: 12px; color: #6B7280; margin-top: 8px; font-variant-numeric: tabular-nums; }

.card { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; }
.chart-card { padding: 14px 16px 16px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.chart-head h2 { font-size: 14px; font-weight: 600; }
.chart-span { font-size: 11px; color: #6B7280; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 120px; display: block; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: #9CA3AF; margin: 6px 0 12px; }
.ranges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: #F3F4F6; border-radius: 8px; padding: 2px; }
.ranges button {
  height: 40px; border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: transparent; color: #6B7280;
}
.ranges button[aria-pressed="true"] { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08); }

.periods-head { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 2px 0; gap: 12px; }
.periods-head h2 { font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 12px; font-size: 11px; font-weight: 500; }
.ink-temperature { color: #B45309; }
.ink-humidity { color: #0369A1; }
.periods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.period {
  text-align: left; background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 12px 14px; cursor: pointer; color: #111827;
  display: flex; flex-direction: column; gap: 8px;
}
.period:hover { border-color: #7DD3FC; }
.period-name { font-size: 12px; font-weight: 600; color: #374151; }
.period-row { display: flex; align-items: baseline; justify-content: space-between; font-variant-numeric: tabular-nums; }
.period-row b { font-size: 16px; font-weight: 600; }
.period-row span { font-size: 13px; color: #6B7280; }
.hint { font-size: 11px; color: #6B7280; text-align: center; padding: 4px 0; }

.scrim {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 10;
}
[hidden] { display: none !important; }
.sheet { width: 100%; max-width: 640px; background: #fff; border-radius: 16px 16px 0 0; padding: 8px 0 28px; max-height: 90vh; overflow-y: auto; }
.grip { width: 36px; height: 4px; border-radius: 2px; background: #E5E7EB; margin: 0 auto 8px; }
.sheet-head { padding: 8px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 15px; font-weight: 600; }
#sheet-close { width: 44px; height: 44px; border: none; background: transparent; border-radius: 8px; cursor: pointer; color: #6B7280; font-size: 20px; }
#sheet-close:hover { background: #F3F4F6; }
.sheet-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid #F3F4F6; }
.sheet-when { font-size: 14px; color: #111827; margin-top: 3px; }
.sheet-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
