:root { color-scheme: light; font-family: system-ui, sans-serif; color: #172033; background: #f1f5f9; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1200px; margin: 32px auto; padding: 24px; }
main.narrow { max-width: 440px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid #cbd5e1; }
.brand-lockup { min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0; color: #142d3e; font-size: 2rem; font-weight: 800; letter-spacing: -.05em; line-height: 1.2; }
.brand::before { content: ""; flex: 0 0 28px; height: 28px; border: 4px solid #075985; border-top-color: #0f766e; border-right-color: transparent; border-radius: 50%; transform: rotate(-25deg); }
.brand-tagline { margin: 6px 0 0; font-size: .8rem; color: #475569; letter-spacing: .04em; }
header > button { flex-shrink: 0; margin-top: 0; }
.login-shell { background: white; border: 1px solid #dbe5ed; border-radius: 16px; box-shadow: 0 8px 32px #1720330a; }
.login-shell button[type="submit"] { width: 100%; }
a { color: #075985; text-underline-offset: .2em; }
a:hover { color: #142d3e; }
.back-link { display: inline-block; margin-top: 24px; padding: 4px 0; }
h1 { font-size: 1.8rem; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; margin-top: 0; }
small { font-size: .85rem; font-weight: normal; }
.cards, .forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 24px 0; }
.card { background: white; border: 1px solid #dbe5ed; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px #17203308; }
.metric-card { border-top: 3px solid #075985; }
.metric-pm25 .value { color: #075985; }
.metric-pm10 { border-top-color: #166534; }
.metric-pm10 .value { color: #166534; }
.value { font-size: 3.5rem; font-weight: 700; margin: 0; }
label { display: block; font-weight: 600; margin-top: 16px; }
input, textarea { display: block; width: 100%; padding: 10px; margin: 6px 0 12px; border: 1px solid #64748b; border-radius: 5px; font: inherit; }
textarea { resize: vertical; }
input[readonly] { background: #f1f5f9; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: auto; margin: 0; }
button { padding: 10px 16px; background: #075985; color: white; border: 1px solid #075985; border-radius: 5px; font: inherit; cursor: pointer; margin-top: 8px; }
button.secondary { background: white; color: #075985; }
button.danger { background: #991b1b; border-color: #991b1b; }
button:disabled { opacity: .6; cursor: wait; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #0284c7; outline-offset: 3px; }
.notice, .warning { color: #854d0e; }
.notice { background: #fef9c3; border-radius: 6px; padding: 16px; }
.error { color: #991b1b; }
.success { color: #166534; }
#status { min-height: 1.5em; overflow-wrap: anywhere; }
#sensor-address { white-space: pre-wrap; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; margin: 20px 0; }
table { width: 100%; border-collapse: collapse; background: white; text-align: left; }
caption { text-align: left; font-weight: 600; padding: 8px 0; }
th, td { padding: 12px; border-bottom: 1px solid #cbd5e1; overflow-wrap: anywhere; }
td:nth-child(3) { min-width: 180px; white-space: pre-wrap; }
th { background: #e2e8f0; }
td button { margin: 0 4px 4px 0; }
[hidden] { display: none !important; }
.history { margin-top: 24px; min-width: 0; border-top: 3px solid #0f766e; }
.history-legend { display: flex; flex-wrap: wrap; gap: 12px 24px; list-style: none; padding: 0; font-weight: 600; }
.history-pm25 { color: #075985; stroke: #075985; }
.history-pm10 { color: #166534; stroke: #166534; }
.history-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.history-plot text { fill: #334155; font: 14px system-ui, sans-serif; }
.history-grid { stroke: #cbd5e1; stroke-width: 1; }
.history-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-line.history-pm10 { stroke-dasharray: 6 4; }
.history-dot.history-pm25 { fill: #075985; }
.history-dot.history-pm10 { fill: #166534; }
.history-target { fill: transparent; stroke: transparent; cursor: pointer; }
.history-target:hover, .history-target:focus { stroke: #172033; stroke-width: 2; outline: none; }
.history-readout, #history-status { min-height: 3em; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .history { padding: 16px 10px; }
  .history-plot text { font-size: 16px; }
  header { gap: 12px; flex-wrap: wrap; }
  .brand { font-size: 1.75rem; }
}
@media (max-width: 600px) { main { padding: 16px; margin: 12px auto; } header { align-items: flex-start; } h1 { font-size: 1.4rem; } }
