* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { overflow-x: hidden;
  margin: 0; padding: 0; background: #071E2B;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #ffffff; min-height: 100vh;
}
.page { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }

.header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; background: #0D4A6B; padding: 2px 16px; border-radius: 12px;
}
.logo-img { height: 26px; display: block; }
.app-name-group { display: flex; align-items: center; gap: 6px; }
.logo-divider { display: inline-block; width: 1px; height: 22px; background: #38A8DB; }
.app-name {
  font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 15px;
  letter-spacing: 0.3px; white-space: nowrap;
}
.app-name .name-a { color: #96BF0D; }
.app-name .name-b { color: #F29400; }
.settings-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.25); border-radius: 8px;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  color: #ffffff; cursor: pointer; flex: 0 0 auto;
}
.settings-btn:active { background: rgba(255,255,255,0.1); }

.card {
  background: #EAF3F9; border-radius: 12px; padding: 0.9rem 1rem; margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-title { font-size: 12px; font-weight: 700; color: #0D4A6B; letter-spacing: 0.5px; text-transform: uppercase; margin: 0; }
.card-sub { font-size: 12px; color: #888; margin: 0; }

.station-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.station-box { background: #EAF3F9; border-radius: 12px; padding: 0.9rem 0.8rem; border-top: 5px solid #38A8DB; min-width: 0; }
.station-box.stale { opacity: 0.6; }
#boxBottom { border-top-color: #F29400; }
.station-name { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px; font-weight: 700; text-align: center; }
#boxTop .metric-value { color: #38A8DB; }
#boxBottom .metric-value { color: #F29400; }
.metric-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.metric-col { text-align: center; min-width: 0; }
.metric-value { font-size: 38px; font-weight: 700; color: #0D4A6B; line-height: 1; white-space: nowrap; }
.metric-value .unit { font-size: 14px; color: #5f7080; font-weight: 700; margin-left: 2px; }

.chart-wrap { position: relative; width: 100%; height: 220px; }
canvas { touch-action: pan-y; }

.limits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 10px; }
.limit-field label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.limit-field input {
  width: 100%; height: 38px; background: #ffffff; color: #0D4A6B; border: 1px solid #DCE7EE;
  border-radius: 6px; padding: 0 10px; font-size: 16px; font-weight: 600; -webkit-appearance: none;
}
.limit-field input:focus { outline: none; border-color: #38A8DB; }
.save-btn {
  width: 100%; height: 42px; background: #38A8DB; color: #F5F8FA; border: none; border-radius: 8px;
  font-weight: 600; font-size: 14px; -webkit-appearance: none; cursor: pointer;
}
.save-btn:active { background: #2c8bb8; }
.save-btn.danger { background: #E8382D; }
.save-btn.danger:active { background: #c22f26; }
.save-btn.secondary { background: #DCE7EE; color: #0D4A6B; }

.alarm-scroll { max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.alarm-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; border-left: 3px solid;
}
.alarm-item.bad { background: rgba(232,56,45,0.08); border-color: #E8382D; }
.alarm-item.ok { background: rgba(150,191,13,0.08); border-color: #96BF0D; }
.alarm-text { font-size: 13px; color: #0D4A6B; margin: 0; line-height: 1.3; font-weight: 600; }
.alarm-time { font-size: 11px; color: #888; margin: 0; flex: 0 0 auto; white-space: nowrap; }
.alarm-empty { font-size: 13px; color: #888; text-align: center; padding: 20px 0; }


.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7,30,43,0.75); display: none;
  align-items: flex-start; justify-content: center; z-index: 50; padding-top: 68px; box-sizing: border-box;
}
.modal-backdrop.open { display: flex; }
.modal-sheet {
  background: #EAF3F9; width: calc(100% - 32px); max-width: 448px; margin: 0 auto; border-radius: 16px;
  padding: 18px 16px 24px; max-height: calc(100vh - 88px); overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 15px; font-weight: 700; color: #0D4A6B; margin: 0; }
.modal-subtitle { font-size: 12px; font-weight: 700; color: #0D4A6B; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 10px; }
.modal-close { background: transparent; border: none; font-size: 20px; color: #888; cursor: pointer; line-height: 1; }
.setting-field { margin-bottom: 12px; }
.setting-field label { display: block; font-size: 12px; color: #0D4A6B; font-weight: 600; margin-bottom: 4px; }
.setting-field .setting-hint { font-size: 11px; color: #888; margin: 3px 0 0; }
.setting-field input, .setting-field select {
  width: 100%; height: 38px; background: #ffffff; color: #0D4A6B; border: 1px solid #DCE7EE;
  border-radius: 6px; padding: 0 10px; font-size: 16px; font-weight: 600; -webkit-appearance: none;
}
.setting-divider { height: 1px; background: rgba(13,74,107,0.12); margin: 16px 0; }

.status-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status-pill.ok { background: rgba(150,191,13,0.16); color: #6c8a08; }
.status-pill.bad { background: rgba(232,56,45,0.14); color: #E8382D; }
