/* ═══════════════════════════════════════════════
   FORGED RECOVERY — Design System
   Brand Colors from Logo
═══════════════════════════════════════════════ */

:root {
  /* ── Brand Colors ── */
  --navy:        #060c3e;
  --brown-dark:  #735e59;
  --brown-light: #cea87d;
  --taupe:       #928981;
  --white:       #ffffff;

  /* ── Derived Shades ── */
  --navy-light:  #0d1a6e;
  --navy-faded:  #060c3e18;
  --brown-bg:    #f7f2ed;
  --taupe-light: #e8e3e1;
  --taupe-faded: #92898120;

  /* ── Semantic Colors ── */
  --color-primary:    var(--navy);
  --color-accent:     var(--brown-light);
  --color-secondary:  var(--brown-dark);
  --color-neutral:    var(--taupe);
  --color-bg:         #faf8f6;
  --color-surface:    var(--white);
  --color-border:     var(--taupe-light);
  --color-text:       #1a1a2e;
  --color-text-light: var(--taupe);
  --color-text-on-primary: var(--white);

  /* ── Status Colors ── */
  --color-success: #2e7d5e;
  --color-success-bg: #eaf5f0;
  --color-error:   #c0392b;
  --color-error-bg: #fdecea;
  --color-warning: #c9793b;
  --color-warning-bg: #fdf3ea;
  --color-info:    #1a5276;
  --color-info-bg: #eaf2f8;

  /* ── Severity Scale Colors ── */
  --severity-1:  #2e7d5e;
  --severity-4:  #f0b429;
  --severity-7:  #e07b39;
  --severity-10: #c0392b;

  /* ── Spacing ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* ── Typography ── */
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, Helvetica, Arial, sans-serif;
  --text-xs:   12px;
  --text-sm:   14px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;

  /* ── Layout ── */
  --header-height:     56px;
  --bottom-nav-height: 64px;
  --menu-width:        280px;
  --border-radius:     12px;
  --border-radius-sm:  8px;
  --border-radius-lg:  20px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(6, 12, 62, 0.08);
  --shadow-md: 0 4px 12px rgba(6, 12, 62, 0.12);
  --shadow-lg: 0 8px 24px rgba(6, 12, 62, 0.16);
  --shadow-card: 0 2px 8px rgba(115, 94, 89, 0.10);

  /* ── Transitions ── */
  --transition: 0.2s ease;
}

/* ═══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: var(--text-md);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

ul { list-style: none; }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
═══════════════════════════════════════════════ */

.hidden { display: none !important; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--color-text-light); }
.text-accent  { color: var(--color-accent); }
.text-primary { color: var(--color-primary); }
.text-error   { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.font-bold    { font-weight: 700; }

.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-sm  { gap: var(--space-sm); }
.flex-gap-md  { gap: var(--space-md); }
.flex-col     { flex-direction: column; }

/* ═══════════════════════════════════════════════
   LOADING SCREEN
═══════════════════════════════════════════════ */

#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-logo {
  text-align: center;
  color: var(--white);
}

.loading-logo h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--brown-light);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-sm);
}

.loading-logo p {
  color: var(--taupe);
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════
   AUTH SCREENS
═══════════════════════════════════════════════ */

#auth-screen {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy) 0%, #0d1a6e 50%, #1a0a00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.auth-wrapper {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--white);
}

.auth-logo h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--brown-light);
  margin-bottom: var(--space-xs);
}

.auth-logo p {
  color: var(--taupe);
  font-size: var(--text-sm);
}

.auth-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-lg);
}

.auth-subtitle {
  color: var(--color-text-light);
  font-size: var(--text-sm);
  margin-top: calc(var(--space-sm) * -1);
  margin-bottom: var(--space-lg);
}

.auth-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-radius: var(--border-radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.auth-success-msg {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-radius: var(--border-radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.auth-links {
  text-align: center;
  margin-top: var(--space-md);
  font-size: var(--text-sm);
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: var(--space-lg) 0;
  color: var(--color-text-light);
  font-size: var(--text-sm);
}

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

.auth-divider span {
  padding: 0 var(--space-md);
}

.auth-terms {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  text-align: center;
  margin-top: var(--space-md);
  line-height: 1.5;
}

.auth-success {
  text-align: center;
}

.success-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

/* ═══════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════ */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* ── Header ── */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

#menu-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 22px;
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
}

#page-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--white);
}

.header-right {
  font-size: var(--text-sm);
  color: var(--brown-light);
  font-weight: 500;
}

/* ── Side Menu ── */
#side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--menu-width);
  height: 100vh;
  background: var(--navy);
  z-index: 200;
  transform: translateX(0);
  transition: transform var(--transition);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#side-menu.closed {
  transform: translateX(-100%);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-header span {
  color: var(--brown-light);
  font-size: var(--text-lg);
  font-weight: 700;
}

#close-menu-btn {
  background: none;
  border: none;
  color: var(--taupe);
  font-size: 20px;
  cursor: pointer;
  padding: var(--space-xs);
}

#side-menu ul {
  padding: var(--space-md) 0;
  flex: 1;
}

#side-menu li a {
  display: block;
  padding: 12px var(--space-lg);
  color: rgba(255,255,255,0.8);
  font-size: var(--text-sm);
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
}

#side-menu li a:hover,
#side-menu li a.active {
  background: rgba(206, 168, 125, 0.15);
  color: var(--brown-light);
  text-decoration: none;
}

.menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: var(--space-sm) var(--space-md);
}

#menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 62, 0.6);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ── Page Content ── */
#page-content {
  flex: 1;
  margin-top: var(--header-height);
  margin-bottom: var(--bottom-nav-height);
  padding: var(--space-md);
  max-width: 640px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ── Bottom Navigation ── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--white);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(6, 12, 62, 0.08);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--taupe);
  text-decoration: none;
  transition: color var(--transition);
  flex: 1;
}

.nav-item:hover,
.nav-item.active {
  color: var(--navy);
  text-decoration: none;
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--transition);
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════ */

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px var(--space-md);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--white);
  color: var(--color-text);
  font-size: var(--text-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brown-light);
  box-shadow: 0 0 0 3px rgba(206, 168, 125, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--taupe);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23928981' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  margin-top: var(--space-xs);
}

/* Slider */
.slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy);
  min-width: 32px;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid var(--brown-light);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* Toggle */
.toggle-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.toggle-option {
  flex: 1;
  min-width: 80px;
}

.toggle-option input[type="radio"] {
  display: none;
}

.toggle-option label {
  display: block;
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--taupe);
  transition: all var(--transition);
  margin: 0;
}

.toggle-option input:checked + label {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--navy);
}

.checkbox-group label {
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--color-text);
  margin: 0;
}

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 13px var(--space-lg);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-md);
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-full { width: 100%; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-light);
  border-color: var(--navy-light);
  text-decoration: none;
  color: var(--white);
}

.btn-accent {
  background: var(--brown-light);
  color: var(--navy);
  border-color: var(--brown-light);
}

.btn-accent:hover:not(:disabled) {
  background: #b8925f;
  text-decoration: none;
  color: var(--navy);
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-outline:hover:not(:disabled) {
  background: var(--navy-faded);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-light);
  border-color: var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--taupe-faded);
  text-decoration: none;
}

.btn-danger {
  background: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-error-bg);
  text-decoration: none;
}

.btn-sm {
  padding: 8px var(--space-md);
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════ */

.card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--navy);
}

.card-body { }

.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Entry card (symptom, appointment, etc.) */
.entry-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--brown-light);
  margin-bottom: var(--space-sm);
  transition: box-shadow var(--transition);
}

.entry-card:hover {
  box-shadow: var(--shadow-md);
}

.entry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xs);
}

.entry-card-title {
  font-weight: 600;
  color: var(--navy);
  font-size: var(--text-md);
}

.entry-card-date {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  white-space: nowrap;
  margin-left: var(--space-sm);
}

.entry-card-body {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: 1.5;
}

.entry-card-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* ═══════════════════════════════════════════════
   SEVERITY BADGE
═══════════════════════════════════════════════ */

.severity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--white);
  flex-shrink: 0;
}

.severity-low    { background: var(--severity-1); }
.severity-medium { background: var(--severity-4); }
.severity-high   { background: var(--severity-7); }
.severity-severe { background: var(--severity-10); }

/* ═══════════════════════════════════════════════
   MOOD SELECTOR
═══════════════════════════════════════════════ */

.mood-selector {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs);
}

.mood-option input[type="radio"] { display: none; }

.mood-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--taupe);
  transition: all var(--transition);
  min-width: 52px;
}

.mood-option label span:first-child { font-size: 24px; }

.mood-option input:checked + label {
  border-color: var(--navy);
  background: var(--navy-faded);
  color: var(--navy);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   SECTION HEADERS
═══════════════════════════════════════════════ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy);
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   PAGE STATES
═══════════════════════════════════════════════ */

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--color-text-light);
  font-size: var(--text-sm);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-light);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--navy);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
}

.error-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-error);
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════ */

#toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--border-radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: all var(--transition);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.toast-success { background: var(--color-success); }
#toast.toast-error   { background: var(--color-error); }
#toast.toast-warning { background: var(--color-warning); }

/* ═══════════════════════════════════════════════
   PLAN BADGE
═══════════════════════════════════════════════ */

.plan-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-free    { background: var(--taupe-faded); color: var(--taupe); }
.plan-insight { background: #e8f0fe; color: #1a5276; }
.plan-balanced { background: rgba(206,168,125,0.2); color: #8b5e2e; }
.plan-renewal { background: var(--navy-faded); color: var(--navy); }

/* ═══════════════════════════════════════════════
   PREMIUM GATE BANNER
═══════════════════════════════════════════════ */

.premium-gate {
  background: linear-gradient(135deg, var(--navy) 0%, #0d1a6e 100%);
  color: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  text-align: center;
  margin: var(--space-md) 0;
}

.premium-gate h3 {
  color: var(--brown-light);
  margin-bottom: var(--space-sm);
}

.premium-gate p {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.8);
  margin-bottom: var(--space-md);
}

/* ═══════════════════════════════════════════════
   STATS ROW (Dashboard)
═══════════════════════════════════════════════ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.stat-number {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  margin-top: var(--space-xs);
}

/* ═══════════════════════════════════════════════
   QUICK ACTION BUTTONS (Dashboard)
═══════════════════════════════════════════════ */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.quick-action-btn {
  background: var(--white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
}

.quick-action-btn:hover {
  border-color: var(--brown-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quick-action-btn span:first-child {
  font-size: 28px;
}

/* ═══════════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════════ */

.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-md) 0;
}

/* ═══════════════════════════════════════════════
   SCROLL TO TOP
═══════════════════════════════════════════════ */

#page-content {
  scroll-behavior: smooth;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet and up
═══════════════════════════════════════════════ */

@media (min-width: 640px) {
  #page-content {
    padding: var(--space-lg);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .auth-card {
    padding: var(--space-2xl);
  }
}

@media (min-width: 1024px) {
  #side-menu {
    transform: translateX(0);
  }

  #side-menu.closed {
    transform: translateX(0);
  }

  #menu-btn { display: none; }
  #menu-overlay { display: none !important; }

  #app-header {
    left: var(--menu-width);
  }

  #page-content {
    margin-left: var(--menu-width);
    max-width: none;
  }

  #bottom-nav {
    display: none;
  }

  #page-content {
    margin-bottom: 0;
  }
}

/* ═══════════════════════════════════════════════
   SAFE AREA (iPhone notch / home bar)
═══════════════════════════════════════════════ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  #page-content {
    margin-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════
   LOGO SIZES
═══════════════════════════════════════════════ */

.loading-logo-img {
  width: 200px;
  max-width: 80vw;
  margin: 0 auto var(--space-md);
  display: block;
}

.auth-logo-img {
  width: 180px;
  max-width: 70vw;
  margin: 0 auto var(--space-sm);
  display: block;
}

.menu-logo-img {
  width: 140px;
  max-width: 60%;
  display: block;
}

/* ═══════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════ */

.dashboard-greeting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.dashboard-greeting h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--navy);
}

.affirmation-card {
  background: linear-gradient(135deg, var(--navy) 0%, #0d1a6e 100%);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin: var(--space-md) 0;
  position: relative;
}

.affirmation-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brown-light);
  margin-bottom: var(--space-sm);
}

.affirmation-text {
  color: var(--white);
  font-size: var(--text-md);
  line-height: 1.6;
  font-style: italic;
  padding-right: var(--space-xl);
}

.affirmation-refresh {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.affirmation-refresh:hover {
  background: rgba(255,255,255,0.25);
}

.smd-banner {
  background: linear-gradient(135deg, var(--brown-light), #b8925f);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.smd-banner-evening {
  background: linear-gradient(135deg, var(--navy), var(--brown-dark));
}

.smd-banner-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.smd-banner-text span {
  font-size: 28px;
  flex-shrink: 0;
}

.smd-banner strong {
  display: block;
  color: var(--white);
  font-size: var(--text-sm);
}

.smd-banner p {
  color: rgba(255,255,255,0.8);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.empty-state-inline {
  padding: var(--space-md);
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--border-radius);
  border: 1px dashed var(--color-border);
}

.tag {
  display: inline-block;
  background: var(--taupe-faded);
  color: var(--brown-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.tag-sm {
  font-size: 11px;
  padding: 2px 6px;
}

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

/* ── Tracker Page ─────────────────────────── */
.tab-switcher {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
}
.tab-btn {
  flex: 1;
  padding: 0.6rem 0.25rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.form-card { padding: 1.25rem; margin-bottom: 1rem; }
.form-range {
  width: 100%;
  accent-color: var(--primary);
  margin: 0.5rem 0 0.25rem;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.optional-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

.mood-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}
.mood-btn span { font-size: 0.65rem; color: var(--text-secondary); }
.mood-btn.selected {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb, 6,12,62), 0.08);
}

.entry-filter {
  display: flex;
  gap: 0.35rem;
}
.filter-btn {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.entry-card { background: var(--surface); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; border: 1px solid var(--border); }
.entry-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; }
.entry-type-badge { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.4rem; border-radius: 4px; margin-right: 0.4rem; }
.badge-symptom { background: #e8f0fe; color: #1a56db; }
.badge-mood { background: #fef3c7; color: #92400e; }
.badge-pain { background: #fee2e2; color: #991b1b; }
.entry-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.entry-detail { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }
.entry-notes { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.4rem; font-style: italic; }
.entry-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ── Overflow / Viewport Fix ─────────────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

#app {
  overflow-x: hidden;
  max-width: 100vw;
}

#page-content {
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.page-container {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

/* ── Appointments Page ───────────────────────── */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.form-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.form-section-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}
.form-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}
.vitals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.appt-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
}
.status-upcoming { background: #dbeafe; color: #1e40af; }
.status-complete { background: #d1fae5; color: #065f46; }
.status-pending  { background: #fef3c7; color: #92400e; }
.mt-xs { margin-top: 0.25rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }


/* ── Medications Page ────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  transition: 0.2s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

.checkin-progress {
  margin-bottom: 1rem;
}
.checkin-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  margin-bottom: 0.4rem;
}
.checkin-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.checkin-bar-fill {
  height: 100%;
  background: var(--success, #10b981);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.med-checkin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  transition: all 0.2s;
}
.med-checkin-card.med-taken {
  background: #f0fdf4;
  border-color: #bbf7d0;
  opacity: 0.8;
}
.med-checkin-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.med-checkin-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.btn-checkin {
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-checkin-done {
  background: var(--primary);
  color: white;
}


/* ── Journal Page ────────────────────────────── */
.emd-toggles { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.emd-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.checklist-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  flex: 1;
  font-size: 0.9rem;
}
.checklist-checkbox { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.checklist-done { text-decoration: line-through; color: var(--text-muted); }
.btn-checklist-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
  transition: color 0.2s;
}
.btn-checklist-remove:hover { color: var(--danger, #ef4444); }
.checklist-add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.checklist-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}
.journal-entry-card { cursor: pointer; transition: box-shadow 0.2s; }
.journal-entry-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.entry-preview { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.journal-view-date { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }
.journal-view-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.journal-view-mood { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }
.journal-view-content {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.journal-view-section { margin-bottom: 1.25rem; }
.journal-view-section strong { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.35rem; }
.journal-view-section p, .journal-view-section ul { font-size: 0.9rem; line-height: 1.6; color: var(--text-primary); margin: 0; }
.journal-view-section ul { padding-left: 1.25rem; }
.emd-toggles-view { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.check-badge { font-size: 0.78rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 99px; }
.check-yes { background: #d1fae5; color: #065f46; }
.check-no  { background: #f3f4f6; color: #6b7280; }
.checklist-view-items { margin-top: 0.75rem; }
.checklist-view-item { padding: 0.5rem 0; font-size: 0.9rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.checklist-view-done { color: var(--text-muted); text-decoration: line-through; }

.emd-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.emd-checklist .checklist-label {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.journal-search-row {
  padding: 0.5rem 1rem 0;
}
.search-highlight {
  background: #fff3b0;
  border-radius: 3px;
  padding: 0 2px;
}

/* ── Expenses Page ───────────────────────────── */
.expense-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.expense-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.5rem;
  text-align: center;
}
.expense-summary-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
.expense-summary-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.claim-status-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.claim-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.claim-btn .claim-icon { font-size: 1.2rem; }
.claim-btn.active {
  border-color: var(--primary);
  background: rgba(6,12,62,0.06);
  color: var(--primary);
  font-weight: 700;
}
.expense-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.claim-status-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  display: inline-block;
  margin-top: 0.2rem;
}
.claim-not-submitted { background: #f3f4f6; color: #6b7280; }
.claim-submitted     { background: #dbeafe; color: #1e40af; }
.claim-approved      { background: #d1fae5; color: #065f46; }
.claim-partial       { background: #fef3c7; color: #92400e; }
.claim-reimbursed    { background: #dcfce7; color: #166534; }
.claim-denied        { background: #fee2e2; color: #991b1b; }
.text-success        { color: #059669; }

/* ── Contacts Page ───────────────────────────── */
.contact-group-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 0 0.4rem;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.contact-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.contact-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.contact-org {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}
.emergency-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: #fee2e2;
  color: #991b1b;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
}
.contact-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.contact-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s;
  word-break: break-all;
}
.contact-action-btn:hover { opacity: 0.8; }
.contact-call  { background: #d1fae5; color: #065f46; }
.contact-email { background: #dbeafe; color: #1e40af; }
.contact-web   { background: #f3f4f6; color: #374151; }

/* ── Profile Page ────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.profile-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0.4rem;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.plan-info-card { padding: 0.25rem 0; }
.plan-info-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.plan-info-features {
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.plan-info-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.profile-meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Profile Photo ───────────────────────────── */
.profile-avatar-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
}
.profile-avatar-wrapper .profile-avatar {
  width: 60px;
  height: 60px;
  overflow: hidden;
}
.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.profile-avatar-wrapper:hover .profile-avatar-overlay {
  opacity: 1;
}