:root {
  color-scheme: light;
  --paper: #f4f7f4;
  --surface: #ffffff;
  --ink: #182b29;
  --muted: #667772;
  --line: #dce5e0;
  --teal: #08796f;
  --teal-soft: #e4f2ee;
  --coral: #d76549;
  --shadow: 0 12px 36px rgb(25 54 47 / 5%);
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: linear-gradient(rgb(34 76 67 / 2%) 1px, transparent 1px), linear-gradient(90deg, rgb(34 76 67 / 2%) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
}

button { font: inherit; }

.topbar {
  min-height: 64px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
}

.brand-divider { color: var(--coral); }
.topbar-right, .region-label { display: flex; align-items: center; }
.topbar-right { gap: 22px; }

.region-label {
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.refresh-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.refresh-button:hover:not(:disabled) { background: var(--teal); border-color: var(--teal); }
.refresh-button:disabled { opacity: 0.65; cursor: wait; }
.signout-button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.signout-button:hover { border-color: var(--coral); color: var(--coral); }
.avatar-control { position: relative; }
.avatar-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--teal); color: #fff; box-shadow: 0 0 0 1px var(--line); font-size: 13px; font-weight: 750; cursor: pointer; }
.avatar-button:hover, .avatar-button[aria-expanded="true"] { background: var(--ink); box-shadow: 0 0 0 2px var(--teal-soft); }
.profile-popover { position: absolute; z-index: 5; top: calc(100% + 10px); right: 0; width: min(280px, calc(100vw - 28px)); padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.profile-popover .eyebrow { margin-bottom: 4px; }
.profile-popover h2 { margin-bottom: 14px; font-size: 16px; }
.profile-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
.profile-popover input { width: 100%; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font: inherit; font-size: 12px; }
.profile-save { width: 100%; min-height: 34px; margin-top: 10px; border: 1px solid var(--teal); border-radius: 4px; background: var(--teal); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.profile-save:disabled { opacity: .6; cursor: wait; }
.profile-status { min-height: 16px; margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.profile-status.error-text { color: var(--coral); }

.dashboard {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 28px;
}

.login-section {
  width: min(440px, 100%);
  margin: clamp(24px, 8vh, 76px) auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-section h1 { font-size: 23px; }
.login-copy { margin: 12px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 5px; color: var(--ink); font-size: 12px; font-weight: 650; }
.login-form input, .login-form select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; }
.login-form input:focus, .login-form select:focus { border-color: var(--teal); outline: 2px solid var(--teal-soft); }
.login-form .remember-login { display: flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; }
.login-form .remember-login input { width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; flex: 0 0 18px; accent-color: var(--teal); }
.login-form .login-archive-consent { margin: 4px 0; }
.login-form .login-archive-consent input { width: 18px; height: 18px; min-height: 18px; margin: 1px 0 0; padding: 0; flex: 0 0 18px; accent-color: var(--teal); }
.optional-label { color: var(--muted); font-weight: 400; }
.login-button { min-height: 42px; margin-top: 9px; border: 1px solid var(--ink); border-radius: 5px; background: var(--ink); color: white; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.login-button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal); }
.login-button:disabled { opacity: .65; cursor: wait; }
.login-status { min-height: 18px; margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.login-status.error-text { color: var(--coral); }
.login-footnote { margin: 19px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.6; }
.archive-control { margin-top: 26px; padding: 18px 0; display: grid; grid-template-columns: minmax(210px, .75fr) minmax(300px, 1.25fr); align-items: center; gap: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.archive-control h2 { font-size: 17px; }
.archive-status { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.archive-status.error-text { color: var(--coral); }
.archive-consent { display: flex; align-items: start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; cursor: pointer; }
.archive-consent input { width: 18px; height: 18px; flex: 0 0 18px; margin: 1px 0 0; accent-color: var(--teal); }
.archive-consent input:disabled { cursor: not-allowed; }
.archive-toggle { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.archive-toggle:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.archive-toggle:disabled { opacity: .55; cursor: not-allowed; }
.community-section { margin-top: 30px; padding: 21px 22px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.community-heading { margin-bottom: 15px; }
.community-heading h2 { font-size: 19px; }
.community-status { margin: 0; color: var(--muted); font-size: 11px; }
.community-status.error-text { color: var(--coral); }
.community-intro { margin: 0 0 15px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.community-consent-update { margin-top: 15px; padding: 15px 0 0; border-top: 1px solid var(--line); }
.community-consent-update[hidden] { display: none; }
.community-consent-row { width: min(360px, 100%); margin-top: 10px; }
.community-consent-row label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 11px; font-weight: 700; }
.community-consent-row input[type="text"] { width: 100%; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
.share-consent { margin-top: 14px; display: flex; align-items: start; gap: 9px; color: var(--muted); font-size: 11px; line-height: 1.55; cursor: pointer; }
.share-consent input { width: 16px; height: 16px; flex: 0 0 16px; margin: 1px 0 0; accent-color: var(--teal); }
.community-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 9px; }
.community-primary { min-height: 35px; padding: 0 12px; border: 1px solid var(--teal); border-radius: 5px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.community-primary { background: var(--teal); color: #fff; }
.community-primary:hover { background: #06675e; }
.community-primary:disabled { opacity: .55; cursor: wait; }
.community-room-header { padding-bottom: 15px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.community-room-header .eyebrow { margin-bottom: 4px; }
.community-room-copy { margin: 0; color: var(--muted); font-size: 12px; }
.community-member-list { margin-top: 14px; display: flex; align-items: start; flex-wrap: wrap; gap: 15px; }
.community-member { width: 112px; min-height: 142px; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.community-member-avatar { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; flex: 0 0 56px; border: 0; border-radius: 50%; background: var(--member-color, #4285f4); color: #fff; cursor: pointer; }
.community-member-avatar:hover, .community-member-avatar[aria-expanded="true"] { filter: brightness(.94); box-shadow: 0 0 0 3px rgb(66 133 244 / 18%); }
.community-member-avatar:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.community-member-initials { color: #fff; font-size: 19px; font-weight: 650; line-height: 1; }
.community-member-name { width: 100%; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.community-member-value { max-width: 100%; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 700; text-align: center; white-space: nowrap; }
.community-member-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10px; text-align: center; }
.community-member.is-expanded { width: min(420px, 100%); }
.community-member-details { width: min(420px, calc(100vw - 48px)); margin-top: 7px; padding-top: 9px; border-top: 1px solid var(--line); }
.history-view-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.graph-day-nav { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
.graph-day-nav[hidden] { display: none; }
.graph-day-nav time { min-width: 94px; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.graph-day-nav button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font-size: 21px; line-height: 1; cursor: pointer; }
.graph-day-nav button:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.graph-day-nav button:disabled { opacity: .45; cursor: not-allowed; }
.community-member-details-title { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.community-shared-note { padding: 7px 0; border-top: 1px solid var(--line); color: var(--ink); font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.community-shared-note-photo-button { display: block; max-width: 100%; margin-top: 6px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); cursor: zoom-in; }
.community-shared-note-photo { display: block; width: min(220px, 100%); max-height: 180px; object-fit: cover; }
.community-shared-note time, .community-shared-note span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.community-shared-reading { padding: 5px 0; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.community-shared-reading span { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; }
.community-footer { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; }
.leave-community { min-height: 30px; padding: 0 9px; border: 1px solid #ead2ca; border-radius: 4px; background: #fff; color: var(--coral); font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
.leave-community:hover { background: #fbefeb; }

.page-heading, .section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading { margin-bottom: 24px; }
.eyebrow, .section-label { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { margin-bottom: 0; color: var(--ink); font-weight: 650; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
.updated-label, .table-note { margin: 0; color: var(--muted); font-size: 12px; }

.current-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 194px;
  padding: 24px 30px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.current-section[data-glucose-level="low"] { border-color: #f0b9b3; border-left-color: #b3261e; background: #fcebea; }
.current-section[data-glucose-level="in-range"] { border-color: #b8d9c4; border-left-color: #188038; background: #eaf4ed; }
.current-section[data-glucose-level="high"] { border-color: #efd08b; border-left-color: #b06000; background: #fff3d6; }
.current-section[data-glucose-level="unknown"] { background: var(--surface); }

.reading-line { display: flex; align-items: baseline; gap: 12px; }
.reading-value { color: var(--ink); font-size: 58px; font-variant-numeric: tabular-nums; font-weight: 620; line-height: 1.05; }
.reading-unit { color: var(--muted); font-size: 15px; font-weight: 600; }
.trend-line { min-height: 22px; margin-top: 10px; display: flex; align-items: center; gap: 9px; color: var(--teal); font-size: 14px; font-weight: 650; }
.trend-indicator { color: var(--teal); font-size: 10px; }

.history-section, .readings-section { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.history-workspace { min-width: 0; }
.notes-section.notes-panel { margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); }
.notes-panel .section-heading { margin-bottom: 12px; }
.notes-status { margin: 0; color: var(--muted); font-size: 11px; }
.note-form { max-width: 760px; display: grid; grid-template-columns: 110px minmax(0, 1fr) 70px minmax(150px, .7fr); align-items: center; gap: 10px 12px; }
.notes-panel .note-form { grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
.note-form label { color: var(--muted); font-size: 11px; font-weight: 650; }
.note-form input, .note-form select, .note-form textarea { width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
.note-form input[type="file"] { padding: 6px; }
.note-form textarea { grid-column: 2 / -1; resize: vertical; }
.note-photo-field { grid-column: 2 / -1; display: grid; justify-items: start; gap: 8px; }
.note-photo-remove { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.note-photo-remove input { width: 16px; min-height: 16px; }
.note-photo-preview img, .note-photo-thumb { display: block; width: min(220px, 100%); max-height: 180px; border: 1px solid var(--line); border-radius: 5px; object-fit: cover; }
.note-photo-disclosure { color: var(--muted); font-size: 10px; line-height: 1.45; }
.note-item-text .note-photo-thumb { margin-top: 8px; }
.note-form-actions { grid-column: 2 / -1; display: flex; gap: 8px; }
.note-save, .note-cancel, .note-edit, .note-delete { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
.note-save { border-color: var(--teal); background: var(--teal); color: #fff; }
.note-save:hover { background: #06675e; }
.note-cancel:hover, .note-edit:hover { border-color: var(--teal); color: var(--teal); }
.note-delete:hover { border-color: var(--coral); color: var(--coral); }
.note-form button:disabled { opacity: .55; cursor: wait; }
.note-list { max-width: 760px; max-height: 320px; margin-top: 18px; display: grid; gap: 8px; overflow-y: auto; }
.note-item { padding: 11px 0; display: grid; grid-template-columns: minmax(130px, .3fr) minmax(0, 1fr) auto; align-items: start; gap: 12px; border-top: 1px solid var(--line); }
.note-item-meta { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.note-item-category { display: inline-flex; align-items: center; gap: 4px; color: var(--coral); font-weight: 700; }
.note-item-category svg { width: 13px; height: 13px; }
.note-item-text { min-width: 0; color: var(--ink); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-item-actions { display: flex; gap: 5px; }
.note-empty { margin: 0; color: var(--muted); font-size: 11px; }
.analysis-section { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.analysis-status { margin: 0; color: var(--muted); font-size: 11px; }
.analysis-status.error-text { color: var(--coral); }
.analysis-consent { max-width: 780px; display: flex; align-items: start; gap: 10px; color: var(--muted); font-size: 11px; line-height: 1.55; cursor: pointer; }
.analysis-consent input { width: 18px; height: 18px; flex: 0 0 18px; margin: 1px 0 0; accent-color: var(--teal); }
.analysis-actions { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.analysis-run { min-height: 36px; padding: 0 12px; border: 1px solid var(--teal); border-radius: 5px; background: var(--teal); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.analysis-run:disabled { opacity: .45; cursor: not-allowed; }
.analysis-run:not(:disabled):hover { background: #06675e; }
.analysis-reports { max-width: 780px; margin-top: 14px; display: grid; gap: 12px; }
.analysis-pagination { max-width: 780px; margin-top: 10px; display: flex; align-items: center; justify-content: end; gap: 12px; color: var(--muted); font-size: 11px; }
.analysis-pagination button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 11px; cursor: pointer; }
.analysis-pagination button:disabled { opacity: .45; cursor: default; }
.analysis-report { padding: 20px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.analysis-report-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.analysis-report h3 { margin: 0; color: var(--ink); font-size: 1.375rem; line-height: 1.5; }
.analysis-report p, .analysis-report li { color: var(--ink); font-size: 1.125rem; line-height: 1.85; }
.analysis-report h4 { margin: 24px 0 8px; color: var(--ink); font-size: 1.25rem; line-height: 1.6; }
.analysis-report ul { margin: 8px 0; padding-left: 24px; }
.analysis-report li + li { margin-top: 12px; }
.analysis-delete { min-height: 44px; padding: 8px 14px; border: 1px solid var(--coral); border-radius: 10px; background: var(--surface); color: var(--coral); font: inherit; cursor: pointer; }
.analysis-delete:disabled { opacity: .5; cursor: not-allowed; }
.section-heading { margin-bottom: 20px; align-items: center; }
.control-groups { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; gap: 10px; }
.chart-tools { display: flex; gap: 4px; }
.chart-tools button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; }
.chart-tools button:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.chart-tools button:disabled { opacity: .4; cursor: default; }
.chart-tools svg { width: 18px; height: 18px; }
.chart-tools button:focus-visible, #glucose-chart:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.segmented-control {
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9efeb;
}

.segmented-control button { min-height: 29px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.segmented-control button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(25 54 47 / 12%); }
.chart-wrap { position: relative; padding: 5px 4px 0 0; }
.chart-plot { position: relative; height: 300px; }
.chart-plot canvas { display: block; max-width: 100%; cursor: grab; touch-action: none; }
.chart-plot canvas:active { cursor: grabbing; }
.chart-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.chart-state.is-hidden { display: none; }
.chart-annotation-lane { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.notes-help { color: var(--muted); font-size: 13px; line-height: 1.6; }
.note-photo-open { display: block; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.note-photo-open:focus-visible, .photo-viewer-close:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.chart-annotation-status { margin: 6px 0 0; color: var(--coral); font-size: 11px; }
.chart-annotation-status:empty { display: none; }
.photo-viewer { max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.photo-viewer::backdrop { background: rgb(18 31 27 / 72%); }
.photo-viewer-content { position: relative; padding: 18px; }
.photo-viewer-content img { display: block; max-width: min(82vw, 980px); max-height: 78vh; object-fit: contain; }
.photo-viewer-content p { margin: 10px 36px 0 0; color: var(--muted); font-size: 12px; }
.photo-viewer-close { position: absolute; z-index: 1; top: 7px; right: 7px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 23px; cursor: pointer; }

.validation-strip { min-height: 45px; margin-top: 8px; padding: 10px 0; display: flex; flex-wrap: wrap; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.validation-strip strong { margin-left: 5px; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.table-heading { margin-bottom: 14px; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { height: 39px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
th { height: 34px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.04em; }
td { color: var(--ink); font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { padding-left: 4px; }
.numeric { text-align: right; }
td.numeric { color: var(--teal); font-weight: 700; }
.trend-cell { color: var(--muted); }
.empty-cell { height: 72px; color: var(--muted); text-align: center; }
.page-footer { margin-top: 23px; padding-top: 13px; display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.error-text { color: var(--coral); }

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .topbar-right { gap: 12px; }
  .region-label { font-size: 0; }
  .status-dot { width: 8px; height: 8px; }
  .dashboard { width: min(100% - 32px, 600px); padding-top: 26px; }
  .current-section { grid-template-columns: 1fr; gap: 23px; padding: 22px; }
  .community-section { padding: 17px; }
  .archive-control { grid-template-columns: 1fr; gap: 12px; }
  .community-consent-row { width: 100%; }
  .community-room-header { align-items: start; flex-direction: column; }
  .community-member-list { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .control-groups { width: 100%; justify-content: start; }
  .segmented-control { max-width: 100%; overflow-x: auto; }
  .chart-plot { height: 250px; }
  .note-form { width: 100%; grid-template-columns: 1fr; gap: 7px; }
  .note-form textarea, .note-photo-field, .note-form-actions { grid-column: 1; }
  .notes-panel .note-form { grid-template-columns: 1fr; }
  .notes-panel .note-form textarea, .notes-panel .note-photo-field, .notes-panel .note-form-actions { grid-column: 1; }
  .history-view-controls { width: 100%; }
  .note-item { grid-template-columns: minmax(0, 1fr) auto; }
  .note-item-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
  .analysis-actions { align-items: start; flex-direction: column; }
}

@media (max-width: 420px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 6px; flex: 0 0 auto; }
  .region-label { display: none; }
  .signout-button { padding: 0 7px; }
  .brand { min-width: 0; gap: 7px; font-size: 10px; }
  .brand > span:last-child { white-space: nowrap; }
  .page-heading { align-items: start; flex-direction: column; gap: 8px; }
  .refresh-button { width: 36px; min-height: 34px; padding: 0; overflow: hidden; font-size: 0; }
  .refresh-button::before { content: "↻"; font-size: 20px; }
  .dashboard { width: calc(100% - 24px); }
  .login-section { margin: 26px auto; padding: 21px; }
  .reading-value { font-size: 52px; }
  .control-groups { align-items: start; flex-direction: column; }
  .control-groups .segmented-control { flex-wrap: wrap; overflow: visible; }
  .page-footer { flex-direction: column; }
}
.analysis-meal-controls { margin-top: 14px; max-width: 780px; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.analysis-meal-controls[hidden] { display: none; }
.analysis-meal-controls .analysis-meal-field { display: grid; gap: 6px; min-width: 0; color: var(--ink); font-size: 12px; }
.analysis-meal-controls .analysis-meal-field:nth-child(2) { flex: 1 1 240px; }
.analysis-meal-controls input, .analysis-meal-controls select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font: inherit; }
.analysis-meal-controls p { flex-basis: 100%; }
