/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --orange: #FF8308;
  --navy: #101A31;
  --warm: #F8FAF9;
  --white: #FFFFFF;
  --charcoal: #2D3748;
  --gray: #A0AEC0;
  --muted: #EDF2F7;
  --shadow: 0 4px 20px rgba(16, 26, 49, 0.08);
  --shadow-lg: 0 8px 32px rgba(16, 26, 49, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Classification palette */
  --cl-yellow:   #FEFCBF;
  --cl-orange:   #FBD38D;
  --cl-green:    #C6F6D5;
   --cl-palered: #FBB6B6;
  --cl-red:      #FC8181;
  --cl-purple:   #D6BCFA;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--warm);
  color: var(--navy);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray);
  border-radius: 4px;
}

/* ===== SPLASH ===== */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.app-logo {
  width: 168px;
  height: 168px;
  object-fit: contain;
  margin-bottom: 16px;
  animation: pulseLogo 1.5s ease-in-out infinite;
}
@keyframes pulseLogo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.brand-name {
  font-size: clamp(29px, 8vw, 42px);
  font-weight: 800;
  color: #111;
  white-space: nowrap;
  letter-spacing: -0.5px;
}
.brand-name .health-word { color: var(--orange); }
.splash-loader {
  margin-top: 24px;
  width: 32px;
  height: 32px;
  border: 3px solid var(--muted);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.splash-dev {
  font-size: 10px;
  color: var(--gray);
  margin-top: 20px;
  letter-spacing: 0.5px;
}
.splash-brand {
  font-size: 14px;
  color: var(--charcoal);
  font-weight: 500;
  margin-top: 2px;
}

/* ===== APP ===== */
#app {
  display: none;
  height: 100vh;
  flex-direction: column;
  background: var(--warm);
}
#app.active {
  display: flex;
}

/* ===== TOP BAR ===== */
.top-bar {
  background: var(--white);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--muted);
  flex-shrink: 0;
  min-height: 56px;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--navy);
}
.mini-logo {
  height: 160px;
  width: 160px;
  object-fit: contain;
}
.brand .orange {
  color: var(--orange);
}
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-time {
  font-size: 13px;
  color: var(--gray);
  font-weight: 500;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(255, 131, 8, 0.3);
}
.avatar:active {
  transform: scale(0.95);
}
.avatar .avatar-emoji {
  font-size: 18px;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== SCREEN CONTAINER ===== */
.screen-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 80px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ===== SCREENS ===== */
.screen-view {
  display: none;
  animation: fadeSlide 0.3s ease;
}
.screen-view.active {
  display: block;
}
@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: var(--transition);
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--orange);
  color: var(--navy);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
}
.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.9;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--muted);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  font-family: 'Inter', sans-serif;
}
.btn-outline:active {
  background: var(--muted);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--muted);
  color: var(--navy);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-secondary:active {
  transform: scale(0.96);
}

.danger-btn {
  border-color: #FC8181;
  color: #9B2C2C;
}
.danger-btn:active {
  background: #FED7D7;
}

/* ===== INPUTS ===== */
.input-group {
  margin-bottom: 14px;
}
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 4px;
}
.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--muted);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  background: var(--white);
  color: var(--navy);
  -webkit-appearance: none;
  appearance: none;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 131, 8, 0.1);
}
.input-group input.error,
.input-group select.error {
  border-color: #FC8181;
}
.input-group textarea {
  min-height: 56px;
  resize: vertical;
}
.input-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A0AEC0' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select[multiple] {
  min-height: 100px;
  padding: 8px;
  background-image: none;
}
select[multiple] option {
  padding: 6px 10px;
  border-radius: 4px;
}
select[multiple] option:checked {
  background: var(--orange);
  color: var(--navy);
}

/* ===== PASSWORD WRAP ===== */
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 44px;
}
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
  padding: 4px;
}
.toggle-pw:hover {
  opacity: 1;
}

/* ===== ERROR MESSAGES ===== */
.error-msg {
  color: #9B2C2C;
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

/* ===== LOGIN ===== */
.login-card {
  text-align: center;
  padding: 32px 20px;
}
.login-title {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--gray);
  margin-bottom: 20px;
}
.divider {
  color: var(--gray);
  font-size: 13px;
  margin: 16px 0;
}
.register-link {
  margin-top: 16px;
  font-size: 14px;
}
.register-link a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: none;
}
.register-link a:active {
  opacity: 0.7;
}
.forgot-password {
  text-align: right;
  margin: 4px 0 12px;
}
.forgot-password a {
  color: var(--orange);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.forgot-password a:active {
  opacity: 0.7;
}

/* ===== PIN LOGIN ===== */
.pin-login-section {
  background: var(--muted);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.pin-header {
  font-weight: 600;
  margin-bottom: 8px;
}
.pin-input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px !important;
  padding: 12px !important;
}
.pin-login-section .input-group {
  margin-bottom: 10px;
}

/* ===== REGISTER ===== */
.section-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.section-sub {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 16px;
}
.form-section {
  margin-bottom: 20px;
}
.form-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--muted);
}
.required-star {
  color: #FC8181;
  font-weight: 700;
  margin-left: 2px;
}
.age-display {
  display: block;
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== HOME ===== */
.home-header {
  margin-bottom: 12px;
}
.greeting {
  font-size: 13px;
  font-weight: 500;
}
.home-username{font-size:24px;font-weight:750;color:var(--navy);margin-top:2px}
.home-date {
  font-size: 13px;
  color: var(--gray);
  margin-top: 2px;
}

/* ===== READING CARD ===== */
.reading-display {
  text-align: center;
  padding: 4px 0;
}
.reading-label {
  font-size: 14px;
  color: var(--gray);
  font-weight: 500;
}
.reading-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -1px;
}
.reading-unit {
  font-size: 16px;
  color: var(--gray);
  font-weight: 400;
}
.reading-status {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}
.reading-pulse {
  font-size: 16px;
  color: var(--charcoal);
  margin-top: 4px;
}
.reading-time {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
}
.record-btn {
  margin-top: 12px;
}

/* ===== STATUS COLORS ===== */
/* BP status */

.status-hypotension { background: var(--cl-yellow);  color: #975A16; }
.status-normal      { background: var(--cl-green);   color: #276749; }
.status-elevated    { background: var(--cl-orange);  color: #975A16; }
.status-stage1      { background: var(--cl-palered); color: #9B2C2C; }
.status-stage2      { background: var(--cl-red);     color: #742A2A; }
.status-crisis      { background: var(--cl-purple);  color: #553C9A; }

/* Pulse status */
.pulse-brady-severe { background: var(--cl-yellow);  color: #975A16; }
.pulse-brady        { background: var(--cl-orange);  color: #975A16; }
.pulse-normal       { background: var(--cl-green);   color: #276749; }
.pulse-tachy-mild   { background: var(--cl-palered); color: #9B2C2C; }
.pulse-tachy-severe { background: var(--cl-red);     color: #742A2A; }

/* ===== SNAPSHOT ===== */
.snapshot-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--charcoal);
}
.snapshot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.snapshot-item {
  background: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.snapshot-label {
  display: block;
  font-size: 10px;
  color: var(--gray);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.snapshot-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2px;
}
.today-consistency {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.consistency-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
}
.consistency-value {
  font-size: 20px;
  font-weight: 700;
  margin-left: auto;
}
.consistency-grade {
  font-size: 14px;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 12px;
  background: var(--white);
}

/* ===== CONSISTENCY GRADE COLORS ===== */
.consistency-grade-awful     { background: var(--cl-purple);  color: #553C9A; }
.consistency-grade-poor      { background: var(--cl-red);     color: #742A2A; }
.consistency-grade-below     { background: var(--cl-palered); color: #9B2C2C; }
.consistency-grade-average   { background: var(--cl-yellow);  color: #975A16; }
.consistency-grade-good      { background: var(--cl-orange);  color: #975A16; }
.consistency-grade-excellent { background: var(--cl-green);   color: #276749; }

/* ===== DAILY WINDOWS ===== */
.daily-windows {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.window-item {
  flex: 1;
  background: var(--muted);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.window-item .window-icon {
  display: block;
  font-size: 18px;
}
.window-item .window-name {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--charcoal);
}
.window-item .window-status {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.window-status.completed {
  color: #276749;
}
.window-status.pending {
  color: var(--gray);
}
.window-icon i {
  font-size: 24px !important;
  color: var(--orange) !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* ===== TODAY READINGS LIST ===== */
.today-readings-list {
  margin-top: 8px;
}
.today-reading-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--muted);
  font-size: 14px;
}
.today-reading-item:last-child {
  border-bottom: none;
}
.today-reading-item .reading-bp {
  font-weight: 600;
}
.today-reading-item .reading-time-sm {
  color: var(--gray);
  font-size: 12px;
}

/* ===== HISTORY ===== */
.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}
.filter-btn-small {
  padding: 4px 10px;
  border-radius: 16px;
  border: 2px solid var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  color: var(--charcoal);
}
.filter-btn-small.active {
  border-color: var(--orange);
  background: rgba(255, 131, 8, 0.08);
  color: var(--orange);
}
.filter-btn-small:active {
  transform: scale(0.95);
}

.history-date-display {
  font-size: 12px;
  color: var(--gray);
  margin: 8px 0 12px;
  padding: 6px 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
}

.history-list {
  max-height: 500px;
  overflow-y: auto;
}
.history-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}
.history-item:active {
  background: var(--muted);
  transform: scale(0.99);
}
.history-item:last-child {
  border-bottom: none;
}
.history-item .left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-item .bp {
  font-weight: 600;
  font-size: 18px;
}
.history-item .meta {
  font-size: 12px;
  color: var(--gray);
}
.history-item .right {
  text-align: right;
}
.history-item .tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
  display: inline-block;
}

/* ===== TRENDS ===== */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  color: var(--charcoal);
}
.filter-btn.active {
  border-color: var(--orange);
  background: rgba(255, 131, 8, 0.08);
  color: var(--orange);
}
.filter-btn:active {
  transform: scale(0.95);
}

.trend-date-display {
  font-size: 12px;
  color: var(--gray);
  margin: 4px 0 12px;
  padding: 6px 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
}

#customDateRange,
#historyCustomRange {
  display: none;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
}
#customDateRange .inline-group,
#historyCustomRange .inline-group {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 0;
}
#customDateRange .inline-group label,
#historyCustomRange .inline-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray);
}
#customDateRange .inline-group input,
#historyCustomRange .inline-group input {
  padding: 6px 10px;
  font-size: 13px;
}

/* ===== CHART OPTIONS ===== */
.chart-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.chart-option {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  color: var(--charcoal);
}
.chart-option.active {
  border-color: var(--orange);
  background: rgba(255, 131, 8, 0.08);
  color: var(--orange);
}
.chart-option:active {
  transform: scale(0.95);
}

.trend-stats {
  margin-bottom: 16px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.stat-item {
  background: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat-label {
  display: block;
  font-size: 10px;
  color: var(--gray);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2px;
}

.trend-consistency {
  background: var(--muted);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.trend-consistency h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 4px;
}
.consistency-display {
  display: flex;
  align-items: center;
  gap: 12px;
}
.consistency-percent {
  font-size: 24px;
  font-weight: 700;
}
.consistency-detail {
  font-size: 13px;
  color: var(--gray);
}

/* ===== CHARTS ===== */
.chart-container {
  margin-top: 16px;
}
.chart-container h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 8px;
}
.chart-area {
  background: var(--white);
  border-radius: var(--radius-sm);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 14px;
  padding: 12px;
  position: relative;
  border: 1px solid var(--muted);
}
.chart-area canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 200px;
}

/* ===== PROFILE ===== */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.avatar-actions .btn-secondary {
  padding: 6px 14px;
  font-size: 12px;
  width: auto;
}

.profile-field {
  padding: 8px 0;
  border-bottom: 1px solid var(--muted);
}
.profile-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.profile-field span {
  font-size: 16px;
  font-weight: 500;
  color: var(--navy);
}

/* ===== USER ID STYLES ===== */
.user-id-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #F0F4F8;
  border-radius: 6px;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.copy-btn:hover {
  background-color: #E0E8F0;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 49, 0.4);
  z-index: 999;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
}
.modal-sheet {
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 16px 20px 32px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--muted);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-sheet .btn-primary,
.modal-sheet .btn-outline {
  margin-bottom: 10px;
}

/* ===== AVATAR OPTIONS ===== */
.avatar-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.avatar-option {
  font-size: 48px;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 3px solid transparent;
}
.avatar-option:active {
  transform: scale(0.92);
}
.avatar-option.selected {
  border-color: var(--orange);
  background: rgba(255, 131, 8, 0.08);
}

/* ===== SETTINGS ===== */
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--muted);
}
.settings-item label {
  font-weight: 500;
  font-size: 14px;
}
.settings-item select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.settings-version {
  color: var(--gray);
  font-size: 14px;
}
.settings-item .btn-secondary {
  width: auto;
  padding: 4px 12px;
  font-size: 12px;
}

/* ===== TOGGLE SWITCH ===== */
.switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray);
  border-radius: 26px;
  transition: var(--transition);
}
.slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.switch input:checked + .slider {
  background: var(--orange);
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
}

/* ===== RESULT CARD ===== */
.result-card {
  text-align: center;
  padding: 32px 20px;
}
.result-icon {
  font-size: 48px;
}
.result-title {
  font-size: 22px;
  font-weight: 600;
  margin: 8px 0;
}
.result-bp {
  font-size: 36px;
  font-weight: 700;
}
.result-status {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0;
}
.result-pulse {
  font-size: 16px;
  color: var(--charcoal);
}
.result-time,
.result-count {
  font-size: 13px;
  color: var(--gray);
}
.result-avg {
  font-size: 15px;
  font-weight: 500;
  margin: 8px 0;
}

/* ===== READY CARD ===== */
.ready-card {
  text-align: center;
  padding: 40px 20px;
}
.ready-icon {
  font-size: 56px;
}
.ready-title {
  font-size: 24px;
  font-weight: 600;
  margin: 8px 0;
}
.ready-sub {
  color: var(--gray);
  margin-bottom: 20px;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  z-index: 100;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.04);
}
.nav-item {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  position: relative;
  min-width: 56px;
}
.nav-icon {
  font-size: 22px;
  line-height: 1;
}
.nav-label {
  font-size: 10px;
  font-weight: 500;
}
.nav-item.active {
  color: var(--orange);
}
.nav-item.active .nav-label {
  color: var(--orange);
}
.nav-item:active {
  transform: scale(0.92);
}
.fab-btn {
  background: var(--orange);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  font-size: 30px;
  font-weight: 300;
  box-shadow: 0 4px 16px rgba(255, 131, 8, 0.35);
  cursor: pointer;
  transition: var(--transition);
  margin-top: -16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
}
.fab-btn:active {
  transform: scale(0.9);
}

/* ===== UTILITY ===== */
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.inline-group {
  display: inline-block;
}
.import-preview {
  margin: 12px 0;
  font-size: 14px;
  color: var(--gray);
  min-height: 40px;
}
.gdrive-info {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 16px;
}
.import-info {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 12px;
}
#otpEmailDisplay {
  color: var(--orange);
  font-weight: 600;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  max-width: 90%;
  text-align: center;
  animation: fadeSlide 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 500px) {
  .screen-container {
    padding: 16px 24px 80px;
  }
  .modal-sheet {
    border-radius: 24px;
    margin-bottom: 20px;
    max-height: 70vh;
  }
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .snapshot-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 400px) {
  .snapshot-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .reading-value {
    font-size: 34px;
  }
  .top-time {
    font-size: 11px;
  }
  .filter-btn-small {
    font-size: 10px;
    padding: 3px 8px;
  }
  .chart-option {
    font-size: 11px;
    padding: 4px 10px;
  }
  .profile-avatar-section {
    flex-direction: column;
    align-items: center;
  }
  .avatar-actions {
    justify-content: center;
  }
}

/* ===== MY HEALTH JOURNAL v1.0 ===== */
[hidden] { display: none !important; }
.brand-tagline {
  font-weight: 600;
  font-size: 16px;
  color: var(--charcoal);
}

.brand-tagline .orange-text {
  color: var(--orange);
}
.splash-content { min-height: 100vh; position: relative; padding-bottom: 96px; }
.splash-credit { position: absolute; bottom: 28px; left: 18px; right: 18px; text-align: center; }
.splash-credit .splash-dev { color: #a7adb6; font-size: 11px; margin: 0 0 4px; }
.splash-credit .splash-brand { color: var(--orange); font-size: clamp(10px,3vw,13px); font-weight: 600; margin: 0; white-space: nowrap; }
.preauth-card { padding-top: 28px; }.preauth-logo { display:block; width:min(220px,70%); max-height:92px; object-fit:contain; margin:0 auto 28px; }
.quick-auth-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }.quick-auth { min-height:92px; border:1px solid #e2e8f0; border-radius:18px; background:#fff; color:var(--navy); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; box-shadow:0 8px 22px rgba(16,26,49,.08); }.quick-auth .ui-icon{color:var(--orange);font-size:24px}.quick-auth small{letter-spacing:4px;color:var(--gray)}
.biometric-btn{width:100%;margin:14px 0 10px;padding:13px;border:1px solid #e2e8f0;border-radius:14px;background:#f8fafc;color:var(--navy);font-weight:600}.credentials-link{display:block;text-align:center;margin:10px 0 20px;color:var(--orange)}
.preauth-options{display:grid;grid-template-columns:1fr 1fr;gap:9px}.preauth-options button{display:flex;align-items:center;justify-content:center;width:100%;padding:11px 8px;border:1px solid #edf1f5;border-radius:12px;background:#fff;color:var(--navy);text-align:center;font-size:12px;font-weight:600}
.login-sheet,.pin-sheet{position:fixed;z-index:1200;left:0;right:0;bottom:0;max-height:58vh;overflow:auto;background:#fff;border-radius:24px 24px 0 0;padding:16px 20px 24px;box-shadow:0 -12px 35px rgba(16,26,49,.18)}
.login-sheet,.pin-sheet,.modal-sheet,.card{position:relative}.modal-close{position:absolute;top:10px;right:12px;z-index:5;width:30px;height:30px;border:0;border-radius:50%;background:#f1f3f5;color:#27313d;font-size:17px;line-height:30px;padding:0;cursor:pointer}.modal-close:hover{background:#e5e7eb}.credentials-link{font-size:12px;text-decoration:underline;margin:8px 0 14px}.mini-logo{width:62px!important;height:42px!important;object-fit:contain}.top-time{display:none!important}
.quick-auth small{letter-spacing:0!important;font-size:10px}.custom-multi-input{margin-top:8px}.expand-btn{margin-bottom:20px!important}#saveReadingBtn{margin-top:20px}.avatar-actions{display:none}.profile-avatar-section.actions-open .avatar-actions{display:flex}.about-sheet{max-height:90vh;overflow-y:auto}.about-sheet h4{margin:18px 0 6px}.about-sheet p,.about-sheet li{font-size:12px;line-height:1.6}.about-maintainer{text-align:center}.about-maintainer span{color:var(--orange)}
.chart-legend{display:flex;justify-content:center;gap:18px;flex-wrap:wrap;margin:10px 0 4px;font-size:12px}.chart-legend span::before{content:'';display:inline-block;width:10px;height:3px;margin-right:5px;vertical-align:middle}.legend-sys::before{background:#f97316}.legend-dia::before{background:#2563eb}.legend-pulse::before{background:#16a34a}
.avatar-menu{position:fixed;z-index:1300;right:12px;top:58px;width:190px;padding:7px;border-radius:14px;background:#fff;box-shadow:0 12px 35px rgba(16,26,49,.2)}.avatar-menu button{width:100%;padding:10px 12px;border:0;border-radius:9px;background:transparent;text-align:left;color:var(--navy)}.avatar-menu button:hover{background:#f6f8fa}.danger-text{color:#b42318!important}
.history-bulk{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:12px 0}.history-bulk label{margin-right:auto;font-size:13px}.history-item{position:relative;gap:10px}.history-select{width:18px;height:18px;flex:0 0 auto}
.reference-guide{margin:12px 0;padding:12px;border:1px solid #e4e9ef;border-radius:12px}.reference-guide summary{cursor:pointer;font-weight:700}.reference-guide table{width:100%;margin:10px 0;border-collapse:collapse;font-size:11px}.reference-guide th,.reference-guide td{padding:7px 5px;border:1px solid #e3e7eb}.ref-low{background:#e5f1ff}.ref-normal{background:#e8f7ee}.ref-elevated{background:#fff8d8}.ref-stage1{background:#fff0df}.ref-stage2{background:#efe8ff}.ref-crisis{background:#ffe7e5}.about-copy{font-size:12px;line-height:1.6;color:var(--gray);margin:8px 0}.form-section{margin-bottom:22px}.form-section .input-group{margin-bottom:16px}

/* ===== ABOUT MODAL STYLES ===== */
.about-sheet {
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: 40px;
}

.about-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  text-align: center;
}

.orange-text {
  color: var(--orange);
}

.about-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--charcoal);
  margin-bottom: 20px;
}

.about-section-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--orange);
}

.about-sub-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
  margin: 16px 0 8px;
}

.about-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.about-feature-list li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--charcoal);
  padding: 4px 0 4px 20px;
  position: relative;
}

.about-feature-list li::before {
  content: "◆";
  color: var(--orange);
  position: absolute;
  left: 0;
  font-size: 10px;
  top: 6px;
}

.about-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0 16px;
}

.about-table thead th {
  background: var(--navy);
  color: white;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}

.about-table tbody td {
  padding: 7px 10px;
  border: 1px solid #e3e7eb;
  color: #101A31;
}

.about-ordered-list {
  padding-left: 20px;
  margin: 8px 0 16px;
}

.about-ordered-list li {
  font-size: 13px;
  line-height: 1.7;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.about-ordered-list ul {
  padding-left: 20px;
  margin-top: 4px;
}

.about-ordered-list ul li {
  font-size: 12px;
  list-style: disc;
  margin-bottom: 2px;
}

.about-ordered-list code {
  background: var(--muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Inter', monospace;
  color: var(--orange);
}

.about-disclaimer {
  background: #fff0df;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--orange);
  font-size: 13px;
  line-height: 1.6;
  color: var(--charcoal);
  margin: 8px 0 16px;
}

.about-terms {
  font-size: 13px;
  line-height: 1.6;
  color: var(--charcoal);
  margin: 4px 0 10px;
}

.about-terms-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.about-terms-list li {
  font-size: 12px;
  line-height: 1.6;
  color: var(--charcoal);
  padding: 4px 0 4px 18px;
  position: relative;
}

.about-terms-list li::before {
  content: "•";
  color: var(--orange);
  position: absolute;
  left: 0;
  font-size: 14px;
  font-weight: 700;
}

.about-contact {
  font-size: 13px;
  line-height: 1.8;
  color: var(--charcoal);
  margin: 8px 0 16px;
}

.about-contact a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 500;
}

.about-contact a:hover {
  text-decoration: underline;
}

.about-version {
  font-size: 14px;
  color: var(--charcoal);
  text-align: center;
  margin: 20px 0 12px;
  padding: 10px;
  background: var(--muted);
  border-radius: var(--radius-sm);
}

.about-maintainer {
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
  color: var(--charcoal);
  margin: 12px 0 16px;
}

.about-maintainer .orange-text {
  font-weight: 600;
  font-size: 14px;
}

.about-copyright {
  text-align: center;
  font-size: 12px;
  color: var(--gray);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--muted);
}

.about-copyright strong {
  color: var(--navy);
}
.about-download-list {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 16px;
}

.about-download-list li {
  position: relative;
  padding-left: 0;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.9;
}

.about-download-list li::before {
  content: "◆";
  color: var(--orange);
  position: absolute;
  left: 0;
  top: 0.55em;
  font-size: 10px;
  line-height: 3;      /* same as li line-height */
  width: 20px;
  text-align: left;
}

.about-download-list li a,
.about-download-list li span {
  display: inline-block;
  margin-left: 20px;
  word-break: break-all;
}

/* ===== RESPONSIVE ABOUT ===== */
@media (max-width: 400px) {
  .about-table {
    font-size: 10px;
  }
  .about-table thead th,
  .about-table tbody td {
    padding: 4px 6px;
  }
  .about-title {
    font-size: 20px;
  }
  .about-feature-list li {
    font-size: 12px;
  }
}

/* ===== LOGIN SCREEN FIXES ===== */
.login-sheet .input-group,
.pin-sheet .input-group {
  margin-bottom: 18px;
}

.login-sheet .btn-primary,
.pin-sheet .btn-primary {
  margin-top: 10px;
}

.login-sheet .modal-close,
.pin-sheet .modal-close {
  top: 12px;
  right: 14px;
}

.quick-auth {
  min-height: 80px;
  padding: 10px;
}

.quick-auth-row {
  margin-bottom: 10px;
}

.preauth-options {
  margin-top: 6px;
  gap: 8px;
}

.preauth-options button {
  padding: 8px 6px;
  font-size: 11px;
}

#view-login .card {
  margin-bottom: 10px;
}

#loginSheet h3,
#pinSheet h3 {
  margin-top: 4px;
  margin-bottom: 16px;
}

#loginSheet .input-group:last-child,
#pinSheet .input-group:last-child {
  margin-bottom: 6px;
}

#loginSheet #loginBtn,
#pinSheet #submitPinLogin {
  margin-top: 6px;
}

.login-sheet,
.pin-sheet {
  max-height: 70vh;
  padding: 20px 24px 30px;
}

/* ===== FONT AWESOME ICON STYLES ===== */
.nav-icon i {
  font-size: 22px;
  color: var(--gray);
  transition: var(--transition);
}

.nav-item.active .nav-icon i {
  color: var(--orange);
}

.nav-item .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fab-btn {
  background: var(--orange);
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 16px rgba(255, 131, 8, 0.35);
  cursor: pointer;
  transition: var(--transition);
  margin-top: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  font-size: 0;
}

.fab-btn:active {
  transform: scale(0.9);
}

.fab-btn i {
  color: white;
  font-size: 24px;
  display: none;
}

.fab-btn .material-icons {
  font-size: 30px !important;
  color: white !important;
  line-height: 1 !important;
}

.window-icon.material-icons {
  font-size: 28px !important;
  color: var(--orange) !important;
  display: inline-block !important;
  line-height: 1 !important;
}

.nav-icon .material-icons {
  font-size: 24px;
  color: var(--gray);
  transition: var(--transition);
}

.nav-item.active .nav-icon .material-icons {
  color: var(--orange);
}

.avatar .avatar-emoji {
  font-size: 18px;
}

@media (max-width: 400px) {
  .nav-icon i {
    font-size: 18px;
  }
  .nav-icon .material-icons {
    font-size: 20px;
  }
  .fab-btn .material-icons {
    font-size: 24px !important;
  }
  .window-icon.material-icons {
    font-size: 24px !important;
  }
}

#wMorning .window-icon.material-icons { font-size: 28px; }
#wAfternoon .window-icon.material-icons { font-size: 30px; }
#wEvening .window-icon.material-icons { font-size: 26px; }

/* ===== BACKUP CODES STYLES ===== */
#backupCodesDisplay {
  background: var(--muted) !important;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

#backupCodesList div {
  padding: 4px 8px;
  background: var(--white);
  border-radius: 4px;
  margin-bottom: 4px;
  border-left: 3px solid var(--orange);
  font-size: 12px;
}

/* ===== EMAIL VERIFICATION BADGE ===== */
.verification-badge {
  display: inline-flex;
  align-items: center;
  background: transparent;
  padding: 0;
  margin-left: 6px;
  line-height: 1;
}

.verification-badge.verified,
.verification-badge.unverified {
  background: transparent;
  padding: 0;
}

.verification-badge.unverified {
  cursor: pointer;
}

.verification-badge.unverified:hover {
  opacity: 0.75;
}

/* Verified starburst — solid orange with white tick */
.verify-icon.verified {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  display: inline-grid;
  place-items: center;
  cursor: default;
}

.verify-icon.verified svg {
  width: 22px;
  height: 22px;
  display: block;
}

.verify-icon.verified svg path:first-of-type {
  fill: #FF8308;
  fill-opacity: 1;
}

.verify-icon.verified svg path:last-of-type {
  stroke: #FFFFFF;
  stroke-opacity: 1;
}

/* Unverified starburst — clearer orange outline with visible tick */
.verify-icon:not(.verified) {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.verify-icon:not(.verified) svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* More visible orange tint so it doesn't look ghostly */
.verify-icon:not(.verified) svg path:first-of-type {
  fill: #FF8308;
  fill-opacity: 0.25;
  stroke: #FF8308;
  stroke-width: 1;
  stroke-dasharray: 1.2 1.2;
}

.verify-icon:not(.verified) svg path:last-of-type {
  stroke: #FF8308;
  stroke-opacity: 0.9;
  stroke-width: 2;
}

/* ===== BACKUP CODES POPUP ===== */
#backupCodesPopup {
  background: var(--muted) !important;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  animation: fadeSlide 0.3s ease;
}

#backupCodesList {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 600;
  padding: 12px;
  background: #FFFFFF;
  border-radius: 6px;
  text-align: center;
  word-break: break-all;
  border: 2px solid var(--muted);
  color: var(--navy);
}

#backupCodesList.backup-code-usable {
  color: #10B981;
  border-color: #10B981;
}

#backupCodesList.backup-code-used {
  color: #EF4444;
  border-color: #EF4444;
}

#backupCodesList.backup-code-empty {
  color: var(--gray);
  border-color: var(--muted);
}

/* ===== LOGS POPUP ===== */
#logsPopupContainer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(16, 26, 49, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#logsPopupContainer > div {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

#logsPopupContainer h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

#logsPopupContainer .logs-field {
  accent-color: var(--orange);
}

/* ===== SETTINGS ITEMS ===== */
.settings-item .btn-secondary {
  width: auto;
  padding: 6px 16px;
  font-size: 12px;
}

/* ===== EDIT PROFILE ===== */
#profileEdit {
  display: none;
  background: white;
  border: 3px solid #FF8308;
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  position: relative;
}

#profileEdit.active {
  display: block !important;
}

#profileEdit .input-group {
  display: block !important;
  margin-bottom: 16px !important;
  width: 100% !important;
}

#profileEdit .input-group label {
  display: block !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #2D3748 !important;
  margin-bottom: 6px !important;
}

#profileEdit .input-group input,
#profileEdit .input-group select,
#profileEdit .input-group textarea {
  display: block !important;
  width: 100% !important;
  height: 45px !important;
  min-height: 45px !important;
  padding: 8px 12px !important;
  border: 2px solid #E2E8F0 !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  font-family: 'Inter', sans-serif !important;
  background: white !important;
  color: #1A202C !important;
  box-sizing: border-box !important;
}

#profileEdit .input-group textarea {
  height: 80px !important;
  min-height: 80px !important;
  resize: vertical !important;
}

#profileEdit .input-group input:focus,
#profileEdit .input-group select:focus,
#profileEdit .input-group textarea:focus {
  border-color: #FF8308 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(255, 131, 8, 0.2) !important;
}

#profileEdit .btn-primary {
  display: block !important;
  width: 100% !important;
  margin-top: 16px !important;
  padding: 12px !important;
  background: #FF8308 !important;
  color: #101A31 !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

#profileEdit .modal-close {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  width: 30px !important;
  height: 30px !important;
  border: none !important;
  border-radius: 50% !important;
  background: #EDF2F7 !important;
  color: #2D3748 !important;
  font-size: 18px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#profileEdit .modal-close:hover {
  background: #E2E8F0 !important;
}

#profileView.hidden {
  display: none !important;
}
/* Targeted profile, settings and dialog repairs. */
#pUserId { color: var(--navy, #101A31); font: inherit; overflow-wrap: anywhere; }
.user-id-container { min-width: 0; flex-wrap: wrap; }
#profileEdit { margin-top: 0; padding-top: 52px; }
.verification-badge { display:inline-flex; align-items:center; background:transparent; padding:0; }
.verify-icon { width:25px; height:25px; border:2px dotted #FF8308; border-radius:50%; background:transparent; color:#101A31; cursor:pointer; display:inline-grid; place-items:center; font-size:16px; }
.verify-icon.verified { background:#FF8308; border-style:solid; }
.settings-help { font-size:13px; line-height:1.5; color:#4A5568; margin:8px 0; }
.settings-item { gap:12px; flex-wrap:wrap; }
.mhj-dialog { position:fixed; inset:0; z-index:10000; background:#101a3188; display:grid; place-items:center; padding:16px; }
.mhj-dialog-panel { width:min(100%,540px); max-height:85dvh; overflow:auto; background:white; padding:24px; border-radius:16px; }
.mhj-dialog-panel .dialog-top { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:18px; }
.mhj-dialog-panel select,.mhj-dialog-panel input[type=date] { width:100%; padding:10px; margin:6px 0 12px; }
.mhj-dialog-panel .log-row { overflow-wrap:anywhere; padding:12px 0; border-bottom:1px solid #e2e8f0; }
.mhj-dialog-panel button { margin-top:8px; }

/* Independent metric summaries, glucose statuses, and aligned trend panels. */
.glucose-low          { background: var(--cl-yellow);  color: #975A16; }  /* Hypoglycemia */
.glucose-below-target { background: var(--cl-orange);  color: #975A16; }  /* Below Target */
.glucose-normal       { background: var(--cl-green);   color: #276749; }  /* Normoglycemia / Target */
.glucose-elevated     { background: var(--cl-palered); color: #9B2C2C; }  /* Prediabetes / Above Target */
.glucose-high         { background: var(--cl-red);     color: #742A2A; }  /* Diabetes Range */
.glucose-hyper        { background: var(--cl-purple);  color: #553C9A; }  /* Hyperglycemia (High) */
.glucose-none         { background: #E5E7EB; color: #6B7280; }
.glucose-badge { display:inline-block; padding:4px 8px; border-radius:8px; font-size:12px; line-height:1.5; }
.glucose-badge small { font-size:0.9em; opacity:0.9; }
.metric-panel { border-top:1px solid #E2E8F0; padding:14px 0; min-width:0; }
.metric-panel h4 { margin:0 0 10px; }
.metric-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:0; }
.metric-grid dt,.metric-empty,#glucoseConversionHint { color:#64748B; font-size:12px; }
.metric-grid dd { margin:3px 0; font-weight:600; font-size:13px; overflow-wrap:anywhere; }
.glucose-summary { display:grid; gap:4px; padding:10px 0; border-bottom:1px solid #E2E8F0; }
.glucose-summary small { color:#64748B; }
.measurement-scores { font-size:12px; line-height:1.7; margin-bottom:12px; overflow-wrap:anywhere; }
.glucose-reference { max-width:100%; overflow-x:auto; }
.glucose-reference table { min-width:620px; }
#bpChart { height:auto; display:block; min-width:0; }
.chart-metric { width:100%; min-width:0; }
.chart-metric canvas { display:block; max-width:100%; touch-action:pan-y; }
.chart-metric h5 { margin:10px 0; }
.chart-tooltip { min-height:2em; font-size:12px; overflow-wrap:anywhere; }
.today-reading-item { flex-wrap:wrap; gap:6px; }
.chart-options { flex-wrap:wrap; }
#glucoseCategorySelector[hidden] { display:none; }

#bpChart canvas { height:210px !important; max-height:none; }

.glucose-secondary { color:#64748B; font-size:0.85em; font-weight:400; }
/* ================================================================
   APPEND-ONLY PATCH — My Health Journal v1.0 fixes
   Do not delete anything above this line.
   ================================================================ */

/* ===== CURRENT READING CARD — three equal siblings ===== */
.current-reading-panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.current-panel {
  background: var(--muted);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.current-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.current-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
  line-height: 1.1;
  word-break: break-word;
}
.current-unit {
  font-size: 11px;
  color: var(--gray);
  font-weight: 500;
  line-height: 1.2;
}
.current-unit small {
  font-size: 0.9em;
  color: #94A3B8;
}
.current-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  text-align: center;
  word-break: break-word;
}
.current-category {
  font-size: 10px;
  color: var(--gray);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

/* Override legacy reading-display so any leftover markup collapses gracefully */
.reading-display { text-align: center; padding: 4px 0; }
.reading-time {
  font-size: 12px;
  color: var(--gray);
  text-align: center;
  margin-bottom: 12px;
  margin-top: 4px;
}

/* ===== RESULT SCREEN — clean per-line scores ===== */
.result-count {
  font-size: 12px;
  color: var(--charcoal);
  margin: 4px 0 12px;
  line-height: 1.7;
  white-space: pre-line;
  text-align: center;
}
.result-icon { color: var(--orange); }

/* ===== SNAPSHOT PANELS — three stacked sections ===== */
#homeMetricPanels { display: block; }
.metric-panel {
  border-top: 0px solid #E2E8F0;
  padding: 14px 0;
  min-width: 0;
}
.metric-panel:first-child { border-top: none; padding-top: 6px; }
.metric-panel h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
  margin: 0 0 10px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.metric-grid div { min-width: 0; }
.metric-grid dt {
  color: #64748B;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  font-weight: 500;
}
.metric-grid dd {
  margin: 3px 0;
  font-weight: 600;
  font-size: 13px;
  overflow-wrap: anywhere;
  color: var(--navy);
}
.metric-empty { color: #64748B; font-size: 12px; margin: 4px 0; }

/* Glucose subcategory rows inside Glucose panel */
.glucose-summary {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid #E2E8F0;
}
.glucose-summary:last-child { border-bottom: none; }
.glucose-summary strong { font-size: 13px; font-weight: 600; color: var(--navy); }
.glucose-summary span { font-size: 13px; font-weight: 600; color: var(--navy); }
.glucose-summary small { color: #64748B; font-size: 11px; line-height: 1.5; }

/* ===== GLUCOSE BADGES (idempotent — safe if already present) ===== */
.glucose-low       { background: #EF4444; color: #fff; }
.glucose-normal    { background: #10B981; color: #fff; }
.glucose-elevated  { background: #F59E0B; color: #fff; }
.glucose-high      { background: #B91C1C; color: #fff; }
.glucose-none      { background: #E5E7EB; color: #6B7280; }
.glucose-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}
.glucose-badge small { font-size: 0.9em; opacity: 0.92; }
.glucose-secondary { color: #64748B; font-size: 0.85em; font-weight: 400; }

/* ===== TODAY READINGS LIST — no heart emoji, consistent styling ===== */
.today-reading-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--muted);
  font-size: 13px;
  gap: 6px;
}
.today-reading-item span { font-weight: 500; color: var(--navy); }
.today-reading-item .reading-time-sm { color: var(--gray); font-size: 12px; }

/* ===== HISTORY — equal-weight metrics ===== */
.history-item .bp { font-weight: 600; font-size: 16px; color: var(--navy); }
.history-item .meta { font-size: 11px; color: var(--gray); }
.measurement-scores {
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  color: var(--charcoal);
  padding: 8px 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
}

/* ===== CHART PANELS ===== */
.chart-metric { width: 100%; min-width: 0; }
.chart-metric canvas { display: block; max-width: 100%; touch-action: pan-y; }
.chart-metric h5 {
  margin: 10px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
}
.chart-tooltip {
  min-height: 2em;
  font-size: 12px;
  overflow-wrap: anywhere;
  color: var(--charcoal);
}
#glucoseCategorySelector[hidden] { display: none; }
.glucose-reference { max-width: 100%; overflow-x: auto; }
.glucose-reference table { min-width: 620px; }

/* ===== DESTRUCTIVE BUTTONS — neutral grey + red text ===== */
.danger-btn {
  background: transparent !important;
  border: 2px solid #E2E8F0 !important;
  color: #B91C1C !important;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.danger-btn:hover { background: #FEF2F2 !important; }
.danger-btn:active { transform: scale(0.96); }

/* ===== AUTO BACKUP — two visible fields ===== */
.backup-schedule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.backup-schedule-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--navy);
}
.backup-schedule-row input[type="number"] {
  width: 100px;
  padding: 6px 10px;
  border: 2px solid var(--muted);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}
.backup-schedule-row input[type="number"]:disabled {
  background: #F1F5F9;
  color: #94A3B8;
}

/* ===== MEDICAL RECORDS ===== */
.medical-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--muted);
  flex-wrap: wrap;
}
.medical-record-item:last-child { border-bottom: none; }
.medical-record-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.medical-record-info strong { font-size: 14px; color: var(--navy); word-break: break-word; }
.medical-record-info small { font-size: 11px; color: var(--gray); }
.medical-record-actions { display: flex; gap: 6px; }
.medical-record-actions .btn-secondary { width: auto; padding: 6px 14px; font-size: 12px; }
#medicalRecordsList { margin-top: 12px; }

/* ===== JEWELLER LINKS ===== */
.jeweller-link {
  color: var(--orange);
  text-decoration: none;
  border-bottom: 1px dotted var(--orange);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.jeweller-link:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.contact-link {
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dotted var(--gray);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.contact-link:hover {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* Splash-specific: keep flex layout */
.splash-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* ===== COLOUR-CODED REFERENCE TABLES ===== */
.about-table .ref-blue { background: #e5f1ff; }
.about-table .ref-green { background: #e8f7ee; }
.about-table .ref-yellow { background: #fff8d8; }
.about-table .ref-orange { background: #fff0df; }
.about-table .ref-purple { background: #efe8ff; }
.about-table .ref-red { background: #ffe7e5; }
.about-table .ref-darkred { background: #f8d7d7; }

/* ===== Small-screen adjustments for new components ===== */
@media (max-width: 400px) {
  .current-panel { padding: 10px 6px; }
  .current-value { font-size: 20px; }
  .metric-grid { grid-template-columns: 1fr; }
}
.email-trigger-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--muted);
}
.email-trigger-row:last-child { border-bottom: none; }
.email-trigger-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.email-trigger-head strong { font-size: 14px; color: var(--navy); }
.email-trigger-type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.email-trigger-type.is-routine { background: #C6F6D5; color: #276749; }
.email-trigger-type.is-critical { background: #FED7D7; color: #9B2C2C; }
.email-trigger-subject { font-size: 12px; color: var(--navy); margin-bottom: 4px; }
.email-trigger-body { font-size: 12px; color: var(--charcoal); line-height: 1.5; margin-bottom: 6px; }
.email-trigger-vars {
  font-size: 11px;
  color: var(--gray);
  font-family: monospace;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.email-trigger-test { width: auto; padding: 6px 14px; font-size: 12px; }

/* Shared readings presentation and accessible verification artwork. */
.readings-table-wrap { background:#fff; border-radius:12px; padding:12px; margin:16px 0; overflow-x:auto; }
.readings-table-title { color:#101A31; margin:0 0 12px; }
.readings-table { width:100%; border-collapse:collapse; font-size:13px; text-align:left; }
.readings-table th { color:#101A31; background:#EDF2F7; font-weight:700; padding:10px 8px; white-space:nowrap; }
.readings-table td { padding:12px 8px; border-bottom:1px solid #EDF2F7; vertical-align:top; }
.readings-table tbody tr:nth-child(even) { background:#F8FAF9; }
.metric-value-cell { font-weight:700; color:#101A31; white-space:nowrap; }
.metric-pill { display:inline-block; padding:3px 7px; margin-top:5px; border-radius:8px; font-size:10px; font-weight:600; line-height:1.4; }
.range-classification { min-width:180px; }
.range-classification .metric-pill { margin-right:4px; }
#historyTable tr[data-reading-id] { cursor:pointer; }
#historyTable tr:focus-visible { outline:2px solid #FF8308; outline-offset:-2px; }
#historyTable .selection-cell { display:none; }
#historyTable.selection-mode .selection-cell { display:table-cell; }
.metric-panel h4, .about-section-heading { color: #101A31; }
.glucose-category-panel { border:1px solid #EDF2F7; border-radius:10px; padding:12px; margin-top:10px; position:relative; }
.glucose-category-panel h5 { margin:0; color:#000; padding-right:25px; }
.category-heading { background:none; border:0; padding:0; color:#000; font:inherit; font-weight:700; text-align:left; cursor:pointer; width:100%; }
.category-close { position:absolute; top:7px; right:8px; background:none; border:0; font-size:22px; color:#2D3748; cursor:pointer; }
.glucose-category-panel.collapsed .category-stats, .glucose-category-panel.collapsed .category-close { display:none; }
.glucose-category-panel.collapsed .category-heading::after { content:'+'; float:right; }
.metric-grid { display:block; }
.metric-grid > div { display:flex; justify-content:space-between; gap:12px; padding:6px 0; }
.metric-grid dd { text-align:right; margin:0; color:#101A31; }
#topVerificationBadge { display:inline-flex; align-items:center; margin-right:6px; flex-shrink:0; }
#topVerificationBadge[hidden] { display:none; }
.verification-badge { display:inline-flex; padding:0; background:none; border:none; }
.verify-icon, .verify-icon.verified { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; padding:4px; border:0; border-radius:0; background:none; clip-path:none; }
.verify-icon svg { display:block; flex-shrink:0; }
.result-icon { background:none; display:flex; justify-content:center; align-items:center; }
.settings-subgroup { padding:14px; border:1px solid #EDF2F7; border-radius:12px; margin-top:14px; }
.settings-subgroup label { display:block; margin:8px 0; }
.settings-subgroup-heading { color:#000; margin:0 0 10px; }
.drive-settings { flex-direction:column; align-items:stretch; }
.backup-schedule-row { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.backup-schedule-row select { max-width:180px; padding:8px; }
#autoBackupDays { max-width:90px; }
#autoBackupDaysLabel[hidden] { display:none; }
#backupCodesPopup { padding:20px 8px 8px; }
#backupCodesList { border:1px solid #A0AEC0; padding:14px; border-radius:8px; font-family:monospace; overflow-wrap:anywhere; margin:12px 0; }
.backup-code-actions, .about-legal-buttons { display:flex; gap:10px; flex-wrap:wrap; }
.about-legal-buttons > button {
  flex: 1 1 140px;
  background: var(--orange);
  color: var(--navy);
  border: none;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

.about-legal-buttons > button:hover {
  box-shadow: 0 0 14px rgba(255, 131, 8, 0.6);
  transform: translateY(-1px);
}

.about-legal-buttons > button:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(255, 131, 8, 0.4);
}
.legal-doc { position:relative; padding:24px; }
.legal-title { color:#101A31; padding-right:28px; }
.legal-updated { color:#667085; margin:10px 0 20px; }
.legal-doc h2 { margin:22px 0 10px; font-size:18px; color:#101A31; }
.legal-doc p, .legal-doc li { line-height:1.65; margin-bottom:10px; overflow-wrap:anywhere; }
.legal-doc ul { padding-left:20px; }
.jeweller-link, .jeweller-link.orange-text { color:#FF8308; }
.jeweller-link:hover, .jeweller-link.orange-text:hover { color:#000; }
.about-download-list { list-style:none; padding:0; margin:8px 0 16px; }
.about-download-list li { font-size:13px; padding:6px 0; word-break:break-all; }
.splash-contact-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 14px;
  margin-top: 10px;
}

.splash-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #A0AEC0;
  text-decoration: none;
  font-size: 11px;


.splash-contact-item:hover {
  color: #FF8308;
}

.splash-contact-item:hover::before {
  color: #FF8308;
}
.splash-contact-row img, .splash-contact-row span { animation:none !important; opacity:1; }
@media(max-width:480px) { .readings-table { min-width:530px; } #trendsTable { min-width:730px; } .email-trigger-head { align-items:flex-start; flex-direction:column; } .legal-doc { padding:18px; } }

.metric-pill.status-stage1, .metric-pill.pulse-tachy-mild { background:#fff0df; color:#9a4b00; }
#bpChart { display:block; }
#bpChart canvas { height:210px !important; }
.splash-contact-row { font-size:10px; }
/* ===== About table row colours — classification palette ===== */
.about-table tbody tr.ref-yellow  { background: var(--cl-yellow); }
.about-table tbody tr.ref-orange  { background: var(--cl-orange); }
.about-table tbody tr.ref-green   { background: var(--cl-green); }
.about-table tbody tr.ref-palered { background: var(--cl-palered); }
.about-table tbody tr.ref-red     { background: var(--cl-red); }
.about-table tbody tr.ref-purple  { background: var(--cl-purple); }

/* If any glucose tables still use their own class names, map them too */
.about-table tbody tr.glucose-low          { background: var(--cl-yellow); }   /* Hypoglycemia */
.about-table tbody tr.glucose-below-target { background: var(--cl-orange); }   /* Below Target */
.about-table tbody tr.glucose-normal       { background: var(--cl-green); }    /* Normoglycemia / Target */
.about-table tbody tr.glucose-elevated     { background: var(--cl-palered); }  /* Prediabetes / Above Target */
.about-table tbody tr.glucose-high         { background: var(--cl-red); }      /* Diabetes Range */
.about-table tbody tr.glucose-hyper        { background: var(--cl-purple); }   /* Hyperglycemia (High) */
/* Google Drive status display */
#googleDriveStatus.connected {
  color: #10B981;
  font-weight: 600;
}
#googleDriveStatus.disconnected {
  color: #A0AEC0;
}
.drive-settings {
  gap: 10px;
}
.drive-settings .btn-secondary {
  width: auto;
}
/* ===== SETTINGS SECTION GROUPING ===== */
.settings-subgroup {
  padding: 14px;
  border: 1px solid #EDF2F7;
  border-radius: 12px;
  margin-top: 14px;
  background: #FFFFFF;
}
.settings-subgroup-heading {
  color: #101A31;
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid #EDF2F7;
}
.settings-subgroup .settings-item {
  border-bottom: none;
  padding: 8px 0;
}
.settings-subgroup .settings-item + .settings-item {
  border-top: 1px solid #F7FAFC;
}