:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: #0c0d16;
  color: #f7f8ff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% -10%, rgba(255, 91, 151, 0.2), transparent 38%),
    radial-gradient(circle at 100% 45%, rgba(88, 216, 255, 0.08), transparent 34%),
    #0c0d16;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 91, 151, 0.2), transparent 38%),
    linear-gradient(145deg, rgba(28, 25, 42, 0.98), rgba(12, 13, 22, 0.97));
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.08);
}

.app-header, .brand-row, .header-actions, .outlook-header, .app-footer, .chart-toolbar {
  display: flex;
  align-items: center;
}

.app-header { justify-content: space-between; margin-bottom: 16px; }
.brand-row, .header-actions { gap: 9px; }
.brand-logo { display: block; width: 124px; height: auto; }
.live-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #43e19a;
  box-shadow: 0 0 0 5px rgba(67, 225, 154, 0.11), 0 0 16px rgba(67, 225, 154, 0.65);
}
.live-label {
  color: rgba(235, 238, 249, 0.55);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tiny-button, .tiny-select {
  min-width: 28px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(235, 238, 249, 0.72);
  background: rgba(255, 255, 255, 0.055);
  font-size: 10px;
  font-weight: 750;
}
.tiny-button { padding: 0 7px; cursor: pointer; }
.tiny-select { width: 76px; padding: 0 5px; cursor: pointer; }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.metric-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}
.ratio-card, .peaks-card { grid-column: 1 / -1; }
.ratio-card { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.metric-label {
  margin-bottom: 6px;
  color: rgba(235, 238, 249, 0.58);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.metric-value { font-size: clamp(23px, 7vw, 29px); font-weight: 740; letter-spacing: -0.035em; line-height: 1; }
.ratio-value { color: #ff8fba; font-size: clamp(30px, 9vw, 36px); }
.trend { margin-left: 5px; color: #43e19a; font-size: 15px; vertical-align: 3px; }
.trend.down { color: #ff7188; }
.trend.steady { color: #ffd166; }
.supporting { margin-top: 7px; color: rgba(235, 238, 249, 0.48); font-size: 10px; line-height: 1.35; }
.range-values { min-width: 125px; text-align: right; color: rgba(235, 238, 249, 0.55); font-size: 10px; line-height: 1.55; }
.mini-chart { display: block; width: 120px; height: 42px; margin: 0 0 5px auto; overflow: visible; }

.peak-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.peak-value { margin-top: 2px; font-size: 20px; font-weight: 720; letter-spacing: -0.025em; }
.peak-time { margin-top: 4px; color: #ff8fba; font-size: 10px; font-weight: 680; }
.chart-section { margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.chart-toolbar { justify-content: flex-end; height: 26px; }
.day-chart { display: block; width: 100%; height: 84px; overflow: visible; }
.time-axis, .chart-legend { display: flex; justify-content: space-between; color: rgba(235, 238, 249, 0.4); font-size: 9px; }
.chart-legend { justify-content: flex-end; gap: 10px; margin-top: 6px; }
.legend-swatch { display: inline-block; width: 12px; margin-right: 4px; border-top: 2px solid; vertical-align: 3px; }
.legend-swatch.today { border-color: #ff8fba; }
.legend-swatch.comparison { border-color: rgba(88, 216, 255, 0.46); }
.coverage { margin-top: 9px; color: rgba(235, 238, 249, 0.44); font-size: 9px; line-height: 1.45; letter-spacing: 0.035em; text-transform: uppercase; }

.outlook { margin: 14px 2px 0; }
.outlook-header { justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.outlook-label { color: rgba(235, 238, 249, 0.55); font-size: 9px; font-weight: 680; letter-spacing: 0.08em; text-transform: uppercase; }
.advice { flex: 0 0 auto; color: #ffd166; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.advice.go { color: #43e19a; }
.advice.wait { color: #ff7188; }
.outlook-copy { margin: 0; color: rgba(244, 246, 255, 0.78); font-size: 13px; line-height: 1.5; }

.loading-card, .error-card { padding: 34px 12px 28px; text-align: center; color: rgba(235, 238, 249, 0.62); font-size: 13px; }
.spinner { width: 24px; height: 24px; margin: 0 auto 12px; border: 2px solid rgba(255,255,255,.12); border-top-color: #ff8fba; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.retry-button, .login-form button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  color: #171321;
  background: linear-gradient(135deg, #ff8fba, #ffb0cf);
  font-weight: 750;
}
.retry-button { padding: 0 22px; }

.app-footer {
  justify-content: space-between;
  gap: 9px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(235, 238, 249, 0.4);
  font-size: 9px;
}
.app-footer form { margin: 0; }
.logout-button { padding: 3px 0; border: 0; color: rgba(235, 238, 249, 0.48); background: none; font-size: 9px; cursor: pointer; }

.login-body { display: grid; place-items: center; }
.login-card {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  background: radial-gradient(circle at 100% 0%, rgba(255, 91, 151, 0.22), transparent 42%), linear-gradient(145deg, rgba(28, 25, 42, 0.98), rgba(12, 13, 22, 0.97));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-kicker { margin: 0 0 8px; color: #ff8fba; font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-size: 29px; letter-spacing: -.035em; }
.login-intro { margin: 9px 0 22px; color: rgba(235,238,249,.58); font-size: 13px; line-height: 1.5; }
.login-error { padding: 10px; border: 1px solid rgba(255,113,136,.25); border-radius: 9px; color: #ff8fa1; background: rgba(255,113,136,.08); font-size: 12px; }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 6px; color: rgba(235,238,249,.62); font-size: 11px; font-weight: 650; }
.login-form input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; outline: none; color: #fff; background: rgba(255,255,255,.055); font-size: 16px; }
.login-form input:focus { border-color: rgba(255,143,186,.58); box-shadow: 0 0 0 3px rgba(255,143,186,.1); }
.login-form button { margin-top: 12px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@media (max-width: 370px) {
  body { padding-inline: 8px; }
  .app-shell { padding: 14px; border-radius: 20px; }
  .metric-card { padding: 12px; }
  .brand-logo { width: 112px; }
  .supporting { font-size: 9px; }
  .range-values { min-width: 112px; }
  .mini-chart { width: 108px; }
}

@media (display-mode: standalone) {
  body { padding-top: max(12px, env(safe-area-inset-top)); }
}
