:root {
  color-scheme: light;
  font: 16px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  color: #172e3a;
  background: #f3f6f6;
  --teal: #086b68;
  --border: #c7d6d7;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0 }
.mast { background: #113b41; color: white }
.mast-inner, main { width: min(1120px, 100%); margin: 0 auto; padding: 0 clamp(14px, 4vw, 44px) }
.mast-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px }
.brand { display: flex; align-items: center; gap: 5px; font-size: 1.15rem; letter-spacing: -.04em; white-space: nowrap }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-right: 5px; border: 1px solid #88cdbf; border-radius: 8px; color: #b6f1d7; font-weight: 800 }
.session { display: flex; align-items: center; gap: 12px; min-width: 0 }
#account { overflow-wrap: anywhere }
.session button { color: white; background: transparent; border-color: #759599; white-space: nowrap }
main { padding-top: clamp(20px, 4vw, 44px); padding-bottom: 32px }
.sections { display: flex; flex-wrap: wrap; gap: 3px; margin: -9px 0 22px; border-bottom: 1px solid var(--border) }
.sections a { padding: 10px 12px; text-decoration: none; color: #415b61; font-weight: 600; border-bottom: 3px solid transparent }
.sections a[aria-current="page"] { color: var(--teal); border-color: var(--teal) }
.sections a:hover { background: #e6efed }
.explore-hint { margin: 9px 3px; color: #4b656a; font-size: .84rem }
#explore-result td, #explore-result th { white-space: nowrap; max-width: 280px; overflow-wrap: anywhere }
#explore-result td { white-space: normal }
#explore-result { min-width: 0 }
h1, h2, p { margin: 0 }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; letter-spacing: -.045em }
h2 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.025em }
.heading, .records-heading, .chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px }
.heading { margin-bottom: 20px }
.heading p, .records-heading p, .login p { color: #4b656a; margin-top: 5px }
.card { border: 1px solid var(--border); border-radius: 13px; background: #fff }
.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 16px }
label { display: grid; gap: 5px; min-width: 0; font-size: .84rem; font-weight: 650; color: #384f58 }
input, select, button { font: inherit; min-height: 43px; padding: 8px 12px; border: 1px solid #aebfc3; border-radius: 7px; background: #fff; color: #173847; max-width: 100% }
input, select { width: 100%; min-width: 0; font-size: 1rem; font-weight: 400 }
button { cursor: pointer; font-size: .9rem; font-weight: 600 }
button:hover:enabled { border-color: #00867e; color: #005d58; background: #edf8f4 }
:focus-visible { outline: 3px solid #e39822; outline-offset: 2px }
button:disabled { opacity: .48; cursor: default }
.primary { background: var(--teal); color: white; border-color: var(--teal) }
.controls > label:first-child { flex: 1 1 170px }
.date-nav, .pager { display: flex; gap: 5px; align-items: center }
.date-nav button { padding-inline: 10px }
.notice, #status:not([hidden]) { margin: 15px 0; padding: 12px 16px; background: #e5eff0; border-radius: 8px; white-space: pre-line }
.login { max-width: 410px; margin: clamp(28px, 8vh, 95px) auto; padding: clamp(22px, 5vw, 36px) }
.login h1 { font-size: 2rem }
.login form { display: grid; gap: 16px; margin-top: 24px }
.login .error { color: #9b342f; margin: 0 }
.chart-card { padding: clamp(15px, 2.7vw, 25px); margin-top: 18px; color: #edf6f5; background: #16373e; border-radius: 13px }
.chart-heading { align-items: start }
.chart-heading p, #chart-help, #chart-empty { color: #b5cbce; font-size: .86rem; margin-top: 4px }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px 14px; color: #e1edef; font-size: .8rem }
.legend li { display: flex; align-items: center; gap: 6px }
.legend li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block }
.cgm::before { background: #64e5ba }
.dexcom::before { background: #72cbfe; border-radius: 1px !important }
.bg::before { background: #ffe083; transform: rotate(45deg); border-radius: 1px !important }
.bolus::before { background: #ffa88f; border-radius: 2px !important; height: 12px !important }
#chart { width: 100%; height: 240px; display: block; margin-top: 16px; touch-action: pan-y }
#chart-empty { margin-block: 25px }
#point { display: block; color: #e5f3ec; font-variant-numeric: tabular-nums; font-size: .93rem; margin-top: 5px }
.records { margin-top: 18px; overflow: hidden }
.records-heading { padding: 18px }
.records-heading p, .pager { font-size: .85rem }
.table-scroll { overflow-x: auto }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .92rem; font-variant-numeric: tabular-nums }
th, td { border-top: 1px solid #dce6e6; padding: 10px 14px; vertical-align: top }
th { background: #f1f6f5; font-size: .8rem; font-weight: 650; color: #3f5a61 }
td:first-child { white-space: nowrap }
td small { display: block; color: #50666b; overflow-wrap: anywhere }
.pager { justify-content: flex-end; padding: 12px 16px; gap: 12px; border-top: 1px solid #dce6e6 }
@media (max-width: 680px) {
  .chart-heading { display: grid }
  .controls { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px }
  .controls > label:first-child, .date-nav { grid-column: 1 / -1 }
  .date-nav { flex-wrap: wrap }
  th, td { padding: 8px 6px; font-size: .8rem }
  .legend { gap: 5px 10px }
  #account { display: none }
  .sections a { font-size: .87rem; padding-inline: 8px }
}
@media (max-width: 380px) {
  .records-heading { align-items: start; flex-direction: column }
  .controls { padding: 12px }
}
