:root {
  color-scheme: light;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --canvas: #f5f3f8;
  --surface: #fff;
  --ink: #231b31;
  --subtle: #62586f;
  --border: #e5deed;
  --accent: #65458a;
  --accent-deep: #543575;
  --accent-pale: #eee7f6;
  --good: #236454;
  --good-pale: #e6f3ed;
  --warn: #8a4c12;
  --warn-pale: #faeee1;
  --bad: #a13042;
  --bad-pale: #fae8ed;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 1rem; line-height: 1.5; min-width: 290px; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(calc(100% - 4rem), 1280px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.site-header { background: var(--surface); border-top: 4px solid var(--accent); }
.masthead, .brand, .header-readings, .weather, .header-values { display: flex; align-items: center; }
.masthead { justify-content: space-between; min-height: 82px; gap: 16px; }
.brand { gap: 13px; }
.brand-mark { display: flex; justify-content: center; align-items: end; gap: 3px; padding-bottom: 11px; width: 43px; height: 43px; border-radius: 12px; background: var(--accent-deep); }
.brand-mark i { width: 4px; background: #fff; border-radius: 3px; height: 11px; }
.brand-mark i:nth-child(2) { height: 20px; }
.brand-mark i:nth-child(3) { height: 15px; }
.brand-title { font-size: 1.14rem; font-weight: 800; letter-spacing: -.045em; }
.brand-subtitle, .header-caption, .footer { color: var(--subtle); font-size: .82rem; }
.header-readings { gap: 27px; white-space: nowrap; }
.weather { gap: 10px; }
.weather-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent-deep); background: var(--accent-pale); font-family: system-ui, sans-serif; font-size: 1.28rem; line-height: 1; }
.header-values { gap: 9px; font-size: .87rem; font-weight: 700; }
.header-divider { width: 1px; height: 13px; background: var(--border); }
.clock { padding-left: 23px; border-left: 1px solid var(--border); }
.clock time { display: block; font-size: 1.13rem; font-weight: 750; line-height: 1.35; font-variant-numeric: tabular-nums; }
.nav-band { border-block: 1px solid var(--border); }
.nav { display: flex; gap: 29px; }
.nav a { position: relative; padding: 13px 14px 14px; text-decoration: none; color: var(--subtle); white-space: nowrap; font-size: .92rem; font-weight: 650; }
.nav a:hover, .nav a[aria-current] { color: var(--accent-deep); }
.nav a:hover { background: #f8f4fc; }
.nav a[aria-current] { font-weight: 800; }
.nav a[aria-current]::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
main.wrap { padding-block: 37px 24px; min-height: calc(100vh - 214px); }
.notice { margin-bottom: 18px; color: var(--warn); background: var(--warn-pale); border-radius: 9px; padding: 10px 14px; font-size: .9rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 23px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.05rem); line-height: 1.24; letter-spacing: -.06em; }
.page-heading p, .panel-heading p { color: var(--subtle); margin-top: 4px; }
.page-heading p { font-size: .94rem; }
.live-meta { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; font-size: .83rem; color: var(--subtle); gap: 8px 11px; text-align: right; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: fit-content; min-height: 26px; border-radius: 20px; padding: 3px 9px; font-size: .8rem; line-height: 1.3; font-weight: 700; white-space: nowrap; background: var(--accent-pale); color: var(--accent-deep); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-pale); color: var(--good); }
.pill.warn { background: var(--warn-pale); color: var(--warn); }
.pill.bad { background: var(--bad-pale); color: var(--bad); }

.measurements { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-bottom: 19px; }
.metric-tile { position: relative; display: block; width: 100%; padding: 16px 17px 15px 21px; text-align: left; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.metric-tile::before { content: ""; position: absolute; inset: 16px auto 16px 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--metric); }
.metric-tile:hover, .metric-tile[aria-pressed="true"] { border-color: #a689c3; }
.metric-tile[aria-pressed="true"] { background: #fcfaff; }
.metric-name { display: block; color: var(--subtle); font-size: .89rem; font-weight: 700; }
.metric-value { display: flex; align-items: baseline; flex-wrap: wrap; min-height: 43px; gap: 5px; line-height: 1.1; margin-top: 9px; }
.metric-value strong { font-size: clamp(1.43rem, 3vw, 2.04rem); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-unit { font-size: .84rem; font-weight: 650; color: var(--subtle); }
.dashboard-details, .ai-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 18px 20px 13px; }
.panel-heading h2, .panel-heading h3 { line-height: 1.3; letter-spacing: -.035em; font-size: 1.15rem; }
.panel-heading p { font-size: .85rem; }
.filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 7px; font-size: .86rem; font-weight: 650; color: var(--subtle); }
select { appearance: none; color: var(--ink); background-color: var(--surface); background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; border: 1px solid var(--border); border-radius: 8px; padding: 7px 28px 7px 11px; }
.chart-box { position: relative; margin: 0 13px 13px; min-height: 259px; }
.chart-box canvas { display: block; width: 100%; height: 259px; }
.chart-tooltip { position: absolute; z-index: 1; pointer-events: none; white-space: nowrap; padding: 6px 9px; border-radius: 8px; color: #fff; background: #342546; font-size: .8rem; font-variant-numeric: tabular-nums; }
.empty { display: grid; place-items: center; min-height: 150px; padding: 16px; color: var(--subtle); text-align: center; font-size: .91rem; }
.empty.compact { min-height: 95px; }
.status-list { display: grid; margin: 0 20px 11px; }
.status-list div { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; min-height: 37px; padding: 4px 0; border-top: 1px solid var(--border); }
.status-list dt { font-size: .87rem; }
.status-list dd { margin: 0; }
.status-list .pill { min-height: 22px; padding-block: 2px; }
.bit-details { margin: 0 20px 18px; border-top: 1px solid var(--border); padding-top: 9px; }
.bit-details summary { width: fit-content; cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--accent-deep); }
.bit-details ul, .factor-list { margin: 8px 0 0; padding: 0; list-style: none; }
.bit-details li { overflow-wrap: anywhere; padding-block: 3px; color: var(--subtle); font-size: .84rem; }
.bit-details code { color: var(--ink); }
.alarm-details { padding: 0 20px 10px; color: var(--bad); font-size: .84rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .89rem; }
th, td { padding: 10px 16px; text-align: right; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; padding-left: 20px; }
th { font-weight: 700; color: var(--accent-deep); background: #f7f3fb; }
tr:last-child td { border-bottom: 0; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 13px; padding: 15px; border-top: 1px solid var(--border); color: var(--subtle); font-size: .87rem; }
.secondary-button { border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; color: var(--accent-deep); font-weight: 700; background: #faf7fc; }
.secondary-button:disabled { opacity: .42; }
.statistics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.summary-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 18px 12px; padding: 11px; background: #f7f3fb; border-radius: 9px; }
.summary-values div { min-width: 0; text-align: center; }
.summary-values dt { color: var(--subtle); font-size: .83rem; }
.summary-values dd { margin: 3px 0 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.ai-score-body, .ai-factor-body { padding: 3px 20px 20px; }
.ai-number { display: flex; align-items: baseline; gap: 7px; margin: 8px 0; }
.ai-number strong { font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.ai-number span { color: var(--subtle); font-size: .95rem; }
progress { display: block; width: 100%; height: 10px; border: 0; border-radius: 10px; background: var(--accent-pale); accent-color: var(--accent); margin: 15px 0; }
progress::-webkit-progress-bar { background: var(--accent-pale); border-radius: 10px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }
.ai-summary, .factor-list li { font-size: .94rem; overflow-wrap: anywhere; }
.factor-list li { padding: 9px 0; border-top: 1px solid var(--border); }
.factor-list li span { display: block; color: var(--subtle); margin-top: 3px; }
.footer { padding: 12px 0 19px; }

@media (max-width: 880px) {
  .wrap { width: min(calc(100% - 2.25rem), 1280px); }
  .dashboard-details { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .measurements { gap: 8px; }
  .metric-tile { padding-inline: 13px 10px; }
}
@media (max-width: 690px) {
  .dashboard-details, .statistics-grid, .ai-grid { grid-template-columns: minmax(0, 1fr); }
  .masthead { flex-wrap: wrap; padding-block: 13px; gap: 10px; }
  .header-readings { justify-content: space-between; width: 100%; gap: 11px; padding-top: 8px; border-top: 1px solid var(--border); }
  .brand-mark { width: 37px; height: 37px; padding-bottom: 8px; }
  .clock { border: 0; padding: 0; text-align: right; }
  .nav { justify-content: space-between; gap: 0; }
  .nav a { padding: 10px 7px; font-size: .87rem; }
  main.wrap { padding-block: 25px 17px; }
  .page-heading { align-items: start; }
  .measurements { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-tile { padding-block: 11px; }
  .metric-value { min-height: 0; margin-top: 6px; }
  .filter { justify-items: end; }
}
@media (max-width: 380px) {
  .wrap { width: calc(100% - 1.5rem); }
  .nav a { padding-inline: 4px; font-size: .81rem; }
  .live-meta { max-width: 7rem; }
  .panel-heading { padding-inline: 15px; }
  .summary-values, .status-list, .bit-details { margin-inline: 15px; }
}
