:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-tint: #eef7ff;
  --border: #dfe6ef;
  --border-strong: #c8d3df;
  --text: #071a3b;
  --muted: #647087;
  --accent: #1677e8;
  --aqua: #24bfd0;
  --ok: #2d8b4f;
  --ok-bg: #e9f8ee;
  --warn: #f47b16;
  --warn-bg: #fff4e8;
  --danger: #c24b25;
  --shadow: 0 14px 40px rgba(20, 39, 68, 0.09);
  --radius: 18px;
  --radius-small: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-max-width: 430px;
  --shell-pad-x: 14px;
  --bottom-tabs-height: 78px;
  --bottom-nav-offset: calc(var(--safe-bottom) + var(--bottom-tabs-height));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-size: 16px;
  line-height: 1.35;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.phone-shell {
  position: relative;
  width: min(100%, var(--app-max-width));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) var(--shell-pad-x) calc(var(--bottom-nav-offset) + 18px);
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 38%, #f6f8fb 100%);
}

.pull-refresh {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  z-index: 25;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(204, 228, 255, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% + var(--pull-y, 0px)));
  transition: opacity 120ms ease, transform 120ms ease, border-color 120ms ease;
  box-shadow: 0 14px 30px rgba(20, 39, 68, 0.12);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.pull-refresh.visible {
  opacity: 1;
}

.pull-refresh.ready {
  border-color: #bfe6cf;
  color: var(--ok);
}

.pull-refresh svg {
  width: 17px;
  height: 17px;
}

.pull-refresh.visible svg {
  animation: pull-spin 900ms linear infinite;
}

@keyframes pull-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-header {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 16;
  margin: calc(-1 * (var(--safe-top) + 20px)) calc(-1 * var(--shell-pad-x)) 18px;
  padding: calc(var(--safe-top) + 12px) var(--shell-pad-x) 12px;
  border-bottom: 1px solid rgba(223, 230, 239, 0.78);
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.98) 0%, rgba(247, 249, 252, 0.96) 100%);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 26px rgba(20, 39, 68, 0.06);
}

.title-row,
.section-title-row,
.row-heading,
.tab-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.title-row h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
  color: #071a3b;
  line-height: 1;
}

.brand-logo-icon {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(20, 39, 68, 0.12);
}

.brand-logo-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.brand-logo-copy strong {
  display: block;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-logo-copy small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: lowercase;
  white-space: nowrap;
}

.app-logo {
  justify-content: flex-start;
  min-width: 0;
}

.app-logo .brand-logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
}

.app-logo .brand-logo-copy strong {
  font-size: 28px;
}

.app-logo .brand-logo-copy small {
  font-size: 10px;
}

.icon-button,
.avatar-button,
.link-button,
.inline-shop-link,
.bottom-tabs button,
.secondary-mini {
  border: 0;
  background: transparent;
  color: inherit;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(22, 119, 232, 0.5);
  border-radius: 50%;
  color: var(--accent);
}

.avatar-button {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  padding: 3px;
  border: 2px solid rgba(22, 119, 232, 0.45);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.85), transparent 32%),
    linear-gradient(135deg, #e8f3ff 0%, #dffaf7 100%);
  color: var(--accent);
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(20, 39, 68, 0.08);
}

.avatar-button img,
.avatar-button span {
  grid-area: 1 / 1;
}

.avatar-button img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #ccfbf1 100%);
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.avatar-button span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #ccfbf1 100%);
  font-size: 15px;
  line-height: 1;
}

.pool-switcher,
.grouped-section,
.signin-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.pool-switcher {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.pool-icon,
.brand-mark,
.empty-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #e8f3ff;
  border: 1px solid #cfe5ff;
  border-radius: 50%;
}

.splash-screen {
  min-height: 100vh;
  min-height: 100dvh;
  align-content: center;
  background:
    radial-gradient(circle at 50% 32%, rgba(36, 191, 208, 0.13), transparent 34%),
    linear-gradient(180deg, #fbfdff 0%, #f1f7fb 100%);
}

.splash-logo {
  filter: drop-shadow(0 18px 34px rgba(20, 39, 68, 0.12));
}

.splash-logo .brand-logo-icon {
  width: 86px;
  height: 86px;
  border-radius: 24px;
}

.splash-logo .brand-logo-copy strong {
  font-size: 40px;
}

.splash-logo .brand-logo-copy small {
  font-size: 13px;
}

.pool-icon {
  width: 48px;
  height: 48px;
}

.pool-select {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.pool-select strong {
  display: block;
  font-size: 19px;
}

.pool-select span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.segmented button {
  min-width: 64px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented.compact button {
  min-width: 58px;
  padding: 0 10px;
}

.segmented button.selected {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 119, 232, 0.25);
}

.screen-region {
  display: grid;
  gap: 20px;
  padding-bottom: 2px;
}

.setup-shell {
  padding-bottom: calc(var(--safe-bottom) + 28px);
}

.setup-hero {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px 10px 22px;
  text-align: center;
}

.setup-logo,
.signin-logo {
  width: min(100%, 320px);
}

.setup-hero p {
  max-width: 310px;
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.status-banner {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid;
}

.status-banner svg {
  width: 44px;
  height: 44px;
}

.status-banner h2 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.12;
  font-weight: 800;
}

.status-banner p,
.tab-title p,
.action-copy p,
.action-copy small,
.section-note,
.quiet-row,
.setup-note p,
.timeline-row p,
.timeline-row small,
.trend-card small,
.safe-callout p,
.empty-state p,
.signin-panel p {
  margin: 0;
  color: var(--muted);
}

.status-warn {
  background: var(--warn-bg);
  border-color: #ffd8b0;
  color: var(--warn);
}

.status-warn h2 {
  color: #111827;
}

.status-ok {
  background: var(--ok-bg);
  border-color: #ccecd7;
  color: var(--ok);
}

.grouped-section {
  overflow: hidden;
}

.section-title-row {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.section-title-row.compact-title {
  margin: -16px -16px 4px;
}

.section-title-row h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.section-title-row h3 span {
  text-transform: none;
  font-weight: 500;
}

.section-title-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.link-button {
  color: var(--accent);
  font-weight: 700;
}

.section-title-row .link-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef7ff;
  font-size: 13px;
  font-weight: 800;
}

.action-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: start;
  padding: 18px 16px;
  transition: background 160ms ease, opacity 160ms ease;
}

.action-row + .action-row {
  border-top: 1px solid var(--border);
}

.action-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--warn);
  color: white;
  font-weight: 800;
}

.action-copy h4 {
  margin: 0;
  font-size: 18px;
}

.dose {
  margin-top: 8px !important;
  color: var(--accent) !important;
  font-size: 21px;
  font-weight: 800;
}

.action-copy small {
  display: block;
  margin-top: 2px;
}

.action-instructions {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d8ebff;
  border-radius: 12px;
  background: #f5faff;
}

.action-instructions strong {
  color: #244766;
  font-size: 12px;
  text-transform: uppercase;
}

.action-instructions span {
  color: #526071;
  font-size: 13px;
  line-height: 1.35;
}

.inline-shop-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 10px;
  border: 1px solid #cce4ff;
  border-radius: 10px;
  background: #f5faff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.inline-shop-link svg {
  width: 16px;
  height: 16px;
}

.action-check {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #cfe0f3;
  border-radius: 14px;
  background: #f8fbff;
  color: transparent;
  font-weight: 900;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.action-check span {
  transform: scale(0.7);
  transition: transform 140ms ease;
}

.action-check.checked {
  border-color: #bfe6cf;
  background: #e9f8ee;
  color: var(--ok);
}

.action-check.checked span {
  transform: scale(1);
}

.action-done {
  background: #fbfdfb;
}

.action-done .action-copy {
  opacity: 0.72;
}

.affiliate-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-chip.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.status-chip.low,
.status-chip.high {
  color: var(--danger);
  background: #fff0eb;
}

.status-chip.missing {
  color: var(--muted);
  background: var(--surface-soft);
}

.retest-row {
  display: grid;
  width: calc(100% - 28px);
  grid-template-columns: 40px 1fr 20px;
  gap: 12px;
  align-items: center;
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid #cce4ff;
  border-radius: var(--radius-small);
  background: var(--surface-tint);
  color: var(--text);
  text-align: left;
}

.retest-row span span,
.retest-row span {
  color: var(--muted);
}

.retest-row strong {
  display: block;
  color: var(--text);
}

.readings-section {
  margin-bottom: 6px;
}

.reading-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 58px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.reading-label {
  display: block;
  min-width: 0;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-copy small,
.reading-value small {
  display: block;
  color: var(--muted);
}

.reading-value {
  min-width: 58px;
  text-align: right;
}

.reading-value strong {
  font-size: 20px;
}

.strip-color {
  display: block;
  width: 8px;
  height: 28px;
  border-radius: 999px;
  background: var(--strip, var(--aqua));
}

.section-note {
  padding: 12px 16px 16px;
}

.marketplace-label {
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f3f6fa;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.shopping-table-head,
.shopping-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(0, 1.5fr) minmax(86px, 0.85fr);
  gap: 12px;
  align-items: center;
}

.shopping-table-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.shopping-row {
  padding: 16px;
  transition: background 160ms ease, opacity 160ms ease;
}

.shopping-row + .shopping-row {
  border-top: 1px solid var(--border);
}

.shopping-qty,
.shopping-what,
.shopping-link-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shopping-qty span,
.shopping-what span,
.shopping-link-cell span {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.shopping-qty strong,
.shopping-what strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.2;
}

.shopping-qty strong {
  color: var(--accent);
}

.shopping-what small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(22, 119, 232, 0.15);
}

.shopping-link-cell em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
}

.bottom-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, var(--app-max-width));
  min-height: calc(var(--bottom-tabs-height) + var(--safe-bottom));
  margin: 0 auto;
  padding: 8px 8px calc(var(--safe-bottom) + 10px);
  border-top: 1px solid var(--border);
  background: rgba(250, 252, 255, 0.94);
  backdrop-filter: blur(16px);
}

.bottom-tabs button {
  position: relative;
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 58px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.bottom-tabs svg {
  width: 22px;
  height: 22px;
}

.bottom-tabs button.selected {
  color: var(--accent);
}

.bottom-tabs button.selected::before {
  position: absolute;
  top: -8px;
  width: 52px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.tab-title {
  align-items: flex-end;
}

.tab-title h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.safe-callout,
.insight-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #cce4ff;
  border-radius: var(--radius-small);
  background: var(--surface-tint);
}

.setup-note {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #cce4ff;
  border-radius: var(--radius-small);
  background: var(--surface-tint);
}

.setup-note strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.setup-note p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.test-form,
.pool-form {
  display: grid;
  gap: 12px;
}

.slider-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.slider-main {
  display: grid;
  gap: 10px;
}

.slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.value-entry {
  display: inline-grid;
  grid-template-columns: minmax(64px, 84px) auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.value-entry input {
  min-height: 36px;
  padding: 6px 8px;
  border-color: #cfe0f3;
  background: #f8fbff;
  color: var(--accent);
  font-weight: 800;
  text-align: right;
}

.notes-field,
.pool-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  scroll-margin-top: calc(var(--safe-top) + 18px);
  scroll-margin-bottom: calc(var(--bottom-nav-offset) + 24px);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-small);
  border: 0;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(22, 119, 232, 0.22);
}

.secondary-button {
  background: var(--surface-soft);
  color: var(--text);
}

.submit-button {
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pool-form {
  padding: 16px;
}

.settings-section {
  margin-top: 16px;
}

.settings-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row svg {
  color: var(--accent);
}

.settings-row strong,
.settings-row small {
  display: block;
}

.settings-row small {
  margin-top: 2px;
  color: var(--muted);
}

.admin-row {
  background: #f4fbf6;
}

.admin-row svg,
.admin-row strong {
  color: var(--ok);
}

.app-version-row .secondary-mini {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: #eef7ff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.trend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.trend-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--accent);
}

.trend-card span {
  color: var(--muted);
  font-weight: 700;
}

.trend-card strong {
  color: var(--text);
  font-size: 22px;
}

.trend-card svg {
  width: 100%;
  height: 42px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--aqua);
}

.quiet-row {
  padding: 16px;
}

.empty-state,
.loading-screen {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 50px 22px;
  text-align: center;
}

.empty-state h2,
.signin-panel h1 {
  margin: 0;
  font-size: 28px;
}

.empty-icon,
.brand-mark {
  width: 68px;
  height: 68px;
}

.signin-body {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px);
}

.signin-shell {
  width: min(100%, 410px);
}

.signin-panel {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 32px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.signin-logo {
  margin-bottom: 4px;
}

@media (max-width: 380px) {
  .brand-logo {
    gap: 10px;
  }

  .brand-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .brand-logo-copy strong {
    font-size: 27px;
  }

  .brand-logo-copy small {
    font-size: 10px;
  }

  .splash-logo .brand-logo-icon {
    width: 76px;
    height: 76px;
    border-radius: 22px;
  }

  .splash-logo .brand-logo-copy strong {
    font-size: 34px;
  }

  .app-logo .brand-logo-copy small {
    display: none;
  }
}

.auth-divider {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--border);
  content: "";
}

.password-auth-form,
.password-settings {
  display: grid;
  width: 100%;
  gap: 12px;
  text-align: left;
}

.password-auth-form label,
.password-settings label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-actions .primary-button,
.auth-actions .secondary-button {
  padding-right: 10px;
  padding-left: 10px;
}

.dev-login-button[hidden] {
  display: none;
}

.password-settings {
  padding: 14px 16px 16px 56px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}

.recovery-link {
  font-weight: 700;
  text-decoration: none;
}

.fine-print {
  font-size: 13px;
}

.secondary-mini {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  font-weight: 800;
}

.explain-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 18px 14px calc(var(--safe-bottom) + 18px);
  background: rgba(7, 26, 59, 0.28);
  backdrop-filter: blur(10px);
}

.explain-panel {
  width: min(100%, var(--app-max-width));
  overflow: hidden;
  border: 1px solid rgba(200, 211, 223, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(20, 39, 68, 0.22);
}

.explain-header {
  display: grid;
  grid-template-columns: 44px 1fr 40px;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.explain-header p,
.explain-header h2 {
  margin: 0;
}

.explain-header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.explain-header h2 {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.15;
}

.explain-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--accent);
}

.explain-close {
  width: 40px;
  height: 40px;
  border-color: transparent;
  background: var(--surface-soft);
}

.explain-body {
  display: grid;
  gap: 0;
}

.explain-body article {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.explain-body article + article {
  border-top: 1px solid var(--border);
}

.explain-body strong {
  color: var(--text);
  font-size: 15px;
}

.explain-body span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.toast-region {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottom-nav-offset) + 16px);
  left: 16px;
  z-index: 20;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  padding: 12px 14px 12px 16px;
  border: 1px solid rgba(200, 211, 223, 0.9);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 14px 34px rgba(20, 39, 68, 0.14);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.toast span {
  min-width: 0;
}

.toast-action {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 850;
}

.signin-body .toast-region {
  bottom: calc(var(--safe-bottom) + 18px);
}

@media (pointer: coarse) {
  .app-shell,
  .signin-body {
    overscroll-behavior-y: contain;
  }
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-warn {
  border-left-color: var(--warn);
  background: #fffaf5;
  color: #7a3518;
}

.toast-success {
  border-left-color: var(--ok);
  background: #f4fbf6;
  color: #145b36;
}

@media (max-width: 380px) {
  :root {
    --shell-pad-x: 10px;
  }

  .pool-switcher {
    grid-template-columns: 40px 1fr;
  }

  .pool-icon {
    width: 40px;
    height: 40px;
  }

  .pool-switcher .segmented {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .reading-row {
    grid-template-columns: 10px minmax(0, 1fr) auto 48px;
    gap: 7px;
    padding-right: 10px;
    padding-left: 10px;
    font-size: 13px;
  }

  .reading-value strong {
    font-size: 17px;
  }

  .form-grid,
  .trend-grid {
    grid-template-columns: 1fr;
  }
}
