:root {
  color-scheme: light;
  --ink: #14382f;
  --ink-2: #274d41;
  --cream: #fbf9f5;
  --paper: #ffffff;
  --sand: #f0ebe1;
  --gold: #c59b4c;
  --gold-soft: #f8f3e6;
  --coral: #cf6b50;
  --sage: #5e7a6d;
  --sage-soft: #edf3f0;
  --muted: #6e7f77;
  --line: rgba(20, 56, 47, 0.08);
  --shadow-sm: 0 4px 12px rgba(20, 56, 47, 0.04);
  --shadow-md: 0 10px 30px rgba(20, 56, 47, 0.06);
  --shadow-lg: 0 20px 50px rgba(20, 56, 47, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -5%, rgba(197, 155, 76, 0.12), transparent 32rem),
    var(--cream);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

[hidden], .icon-button[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  background: var(--cream);
  padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px) * 0.4);
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 8px;
  background: #fbf9f5;
  border-bottom: 1px solid var(--line);
}

.brand {
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px 12px 4px 12px;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
  font-size: 19px;
  overflow: hidden;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-text strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: #14382f;
  line-height: 1.2;
  -webkit-text-fill-color: #14382f;
}

.brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #5e7a6d;
  -webkit-text-fill-color: #5e7a6d;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.water-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 56, 47, 0.05);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.water-pill svg {
  width: 14px;
  height: 14px;
  color: #2b7a78;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  color: var(--ink);
}

/* ==========================================================================
   MAIN VIEWS
   ========================================================================== */
main {
  padding: 16px 16px 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Common Card */
.card {
  background: var(--paper);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sage);
  display: block;
  margin-bottom: 4px;
}

.section-block {
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.counter {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sand);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

/* ==========================================================================
   HERO CARD
   ========================================================================== */
.hero-card {
  position: relative;
  background:
    radial-gradient(circle at 10% 90%, rgba(197, 155, 76, 0.25), transparent 50%),
    var(--ink);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}

.hero-content {
  flex: 1;
  min-width: 0;
}

.hero-content .eyebrow {
  color: var(--gold);
}

.hero-card h1 {
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: 800;
  line-height: 1.3;
  margin: 4px 0 8px;
  color: #fff;
  word-break: normal;
  overflow-wrap: break-word;
}

.hero-copy {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  word-break: normal;
  margin: 0;
}

.progress-ring-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.progress-ring-box small {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.progress-ring {
  --value: 0deg;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--value), rgba(255, 255, 255, 0.15) 0);
  display: grid;
  place-items: center;
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.progress-ring span {
  position: relative;
  z-index: 2;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

/* ==========================================================================
   WEEK STRIP
   ========================================================================== */
.week-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  margin: 12px 0 18px;
  background: var(--paper);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.nav-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease;
}

.nav-arrow-btn svg {
  width: 16px;
  height: 16px;
}

.nav-arrow-btn:active {
  transform: scale(0.92);
}

.week-strip-text {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.week-kicker {
  font-size: 11px;
  font-weight: 800;
  color: var(--coral);
  display: block;
}

.week-strip-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-button {
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--sage);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   07:00 AM MORNING INSIGHT & BIOLOGY CARD
   ========================================================================== */
.morning-insight-card {
  border: 1px solid rgba(197, 155, 76, 0.35);
  background: linear-gradient(180deg, #ffffff 0%, var(--gold-soft) 100%);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header-title .header-icon {
  width: 28px;
  height: 28px;
  color: var(--gold);
  flex-shrink: 0;
}

.card-header-title h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.notif-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(197, 155, 76, 0.5);
  background: #ffffff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.notif-toggle-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.notif-toggle-btn svg {
  width: 14px;
  height: 14px;
}

.morning-encouragement {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 14px;
}

.biology-box {
  background: rgba(255, 255, 255, 0.8);
  border-right: 3px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.biology-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--sage);
  margin-bottom: 4px;
}

.biology-header svg {
  width: 15px;
  height: 15px;
}

.biology-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
}

/* ==========================================================================
   DAILY FOCUS CARD
   ========================================================================== */
.focus-card {
  padding: 20px;
}

.focus-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.day-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sand);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
}

.focus-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 10px;
}

.lesson-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.micro-action {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(197, 155, 76, 0.2);
}

.action-icon {
  width: 22px;
  height: 22px;
  color: var(--coral);
  flex-shrink: 0;
  margin-top: 2px;
}

.action-content {
  flex: 1;
  min-width: 0;
}

.action-content small {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 2px;
}

.action-content strong {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.daily-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--sage-soft);
  border-right: 3px solid var(--sage);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
}

.tip-icon {
  width: 18px;
  height: 18px;
  color: var(--sage);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ==========================================================================
   TODAY'S TASKS (ANCHORS)
   ========================================================================== */
.task-list {
  display: grid;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-item:hover {
  border-color: rgba(20, 56, 47, 0.2);
}

.task-item.done {
  background: #f6faf7;
  border-color: rgba(94, 122, 109, 0.3);
}

.task-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #b8c4be;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-item input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.task-item input[type="checkbox"]:checked::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.task-label {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  flex: 1;
}

.task-item.done .task-label {
  color: var(--muted);
  text-decoration: line-through;
}

/* ==========================================================================
   WATER TRACKER WIDGET
   ========================================================================== */
.water-card {
  padding: 20px;
}

.water-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.water-bar-track {
  height: 10px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 16px;
}

.water-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5e7a6d, #2b7a78);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.water-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.water-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
}

.water-btn:hover {
  background: var(--sand);
}

.water-btn svg {
  width: 16px;
  height: 16px;
  color: #2b7a78;
}

.water-reset-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.water-reset-btn svg {
  width: 16px;
  height: 16px;
}

.water-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}

/* ==========================================================================
   DAILY CHECKIN WIDGET
   ========================================================================== */
.checkin-card {
  padding: 20px;
}

.checkin-grid {
  display: grid;
  gap: 16px;
  margin: 14px 0;
}

.checkin-grid label {
  display: block;
}

.checkin-grid label span {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 4px;
}

.checkin-grid output {
  float: left;
  font-size: 14px;
  font-weight: 800;
  color: var(--coral);
}

.checkin-grid input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.note-field {
  display: block;
  margin-bottom: 14px;
}

.note-field span {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 6px;
}

.note-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

/* Common Buttons */
.primary-button {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.primary-button:hover {
  opacity: 0.92;
}

.secondary-button {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

/* Quick Access to Mentor */
.mentor-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(20, 56, 47, 0.1);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: right;
  margin-top: 10px;
}

.mentor-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(197, 155, 76, 0.3);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}

.mentor-avatar.large {
  width: 52px;
  height: 52px;
  font-size: 24px;
}

.mentor-prompt-text {
  flex: 1;
}

.mentor-prompt-text small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.mentor-prompt-text strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}

.mentor-prompt-arrow {
  color: var(--sage);
}

.mentor-prompt-arrow svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   VIEW 2: PLAN (13 WEEKS)
   ========================================================================== */
.page-heading {
  margin-bottom: 22px;
}

.page-heading h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.page-heading p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.plan-progress {
  padding: 18px 20px;
}

.plan-progress-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-progress-header span {
  font-size: 28px;
  font-weight: 900;
  color: var(--ink);
}

.progress-track {
  height: 8px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.weeks-list {
  display: grid;
  gap: 12px;
}

.week-card {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.week-card.current {
  border-color: var(--gold);
  background: linear-gradient(180deg, #ffffff 0%, var(--gold-soft) 100%);
}

.week-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.week-card-number {
  font-size: 11px;
  font-weight: 800;
  color: var(--sage);
}

.week-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}

.week-card p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ==========================================================================
   VIEW 3: MENTOR & ADVISOR
   ========================================================================== */
.mentor-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.mentor-context-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--sand);
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 14px;
}

.mentor-intro {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.topic-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-chip:hover, .topic-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.mentor-answer {
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.mentor-answer h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}

.mentor-body-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
}

.mentor-protocol {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--sage-soft);
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--sage);
  font-size: 13px;
  line-height: 1.6;
}

.mentor-protocol ul {
  padding-right: 18px;
  margin-top: 6px;
}

.mentor-next {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
}

.ask-form {
  margin-bottom: 14px;
}

.ask-form label {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 6px;
}

.ask-input-row {
  display: flex;
  gap: 8px;
}

.ask-input-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
}

.ask-input-row button {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

.disclaimer {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ==========================================================================
   VIEW 4: TOOLS & PROTOCOLS
   ========================================================================== */
.tool-card {
  padding: 20px;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--sand);
  color: var(--ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tool-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.tool-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.tool-header small {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

.fasting-status-box {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}

.fasting-state {
  font-size: 13px;
  font-weight: 750;
  color: var(--coral);
}

.fasting-countdown {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0;
  color: var(--ink);
}

.fasting-presets {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.preset-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  cursor: pointer;
}

.preset-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.timer-display-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.timer-digits {
  font-size: 32px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.timer-btn {
  width: auto;
  min-width: 130px;
}

.density-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.density-inputs label {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.density-inputs input, .density-inputs select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 13px;
}

.density-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 650;
}

.density-result.good {
  background: #edf5ed;
  border-right: 3px solid #2e7d32;
  color: #1b5e20;
}

.density-result.warn {
  background: #fff8e8;
  border-right: 3px solid #f57c00;
  color: #e65100;
}

.density-result.alert {
  background: #faeceb;
  border-right: 3px solid #d32f2f;
  color: #b71c1c;
}

.breathing-circle-container {
  display: grid;
  place-items: center;
  margin: 18px 0;
}

.breathing-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--sage), var(--ink));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  transition: transform 1s ease-in-out;
  box-shadow: 0 10px 25px rgba(20, 56, 47, 0.15);
}

.breathing-circle.inhale {
  transform: scale(1.35);
  background: radial-gradient(circle, #7ca982, var(--ink));
}

.breathing-circle.hold {
  transform: scale(1.35);
  background: radial-gradient(circle, var(--gold), var(--ink));
}

.breathing-circle.exhale {
  transform: scale(0.9);
  background: radial-gradient(circle, var(--coral), var(--ink));
}

/* ==========================================================================
   VIEW 5: RECIPES & LEPTIN GUIDE
   ========================================================================== */
.view-subtabs {
  display: flex;
  margin-bottom: 16px;
  background: var(--sand);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
}

.subtab-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.subtab-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.search-field {
  position: relative;
  display: block;
  margin-bottom: 14px;
}

.search-field .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
}

.filter-row {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.recipe-card {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.recipe-card:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 56, 47, 0.2);
}

.recipe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.recipe-cat-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--sage);
}

.recipe-density-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf5ed;
  color: #1b5e20;
  font-size: 11px;
  font-weight: 800;
}

.recipe-card h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.4;
}

.recipe-card-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Recipe Modal */
.recipe-modal {
  width: min(calc(100% - 32px), 540px);
  max-height: 85vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  margin: auto;
}

.recipe-modal::backdrop {
  background: rgba(20, 56, 47, 0.5);
  backdrop-filter: blur(4px);
}

.recipe-modal-content {
  position: relative;
  padding: 24px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.recipe-modal-header {
  margin-bottom: 18px;
  padding-left: 40px;
}

.recipe-modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin: 6px 0;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.modal-section ul, .modal-section ol {
  padding-right: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.modal-tip-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: var(--gold-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 14px;
}

/* Guide Sections */
.guide-card {
  padding: 20px;
}

.guide-card h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.guide-card p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 14px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.guide-item {
  padding: 10px 12px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

/* ==========================================================================
   VIEW 6: PROFILE & SETTINGS
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stat {
  padding: 14px 8px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}

.stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.settings-card {
  padding: 20px;
}

.settings-card h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 14px;
}

.settings-card label {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 12px;
}

.settings-card input, .settings-card textarea {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 13px;
}

.notif-settings-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  margin-bottom: 14px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.test-notif-btn {
  width: fit-content;
  font-size: 12px;
  padding: 6px 12px;
}

.backup-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.file-upload-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
}

.danger-card {
  border-color: rgba(207, 107, 80, 0.3);
}

.danger-card h2 {
  color: var(--coral);
}

.danger-button {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--coral);
  background: rgba(207, 107, 80, 0.08);
  color: var(--coral);
  font-weight: 750;
  cursor: pointer;
  margin-top: 10px;
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR (STRICTLY 1 SINGLE ROW, COMPACT & TIGHT)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  z-index: 50;
  right: 50%;
  bottom: 0;
  transform: translateX(50%);
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 4px 2px calc(2px + env(safe-area-inset-bottom, 0px) * 0.35);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(20, 56, 47, 0.04);
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 2px 1px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: #6c7e75;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bottom-nav button.active {
  color: var(--ink);
  background: rgba(20, 56, 47, 0.07);
  font-weight: 800;
}

.bottom-nav button svg {
  width: 18px;
  height: 18px;
  margin-bottom: 1px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.bottom-nav button small {
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bottom-nav .mentor-nav.active {
  color: var(--coral);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  right: 50%;
  transform: translateX(50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  white-space: nowrap;
}

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

/* ==========================================================================
   LOCK SCREEN (OPTION 2)
   ========================================================================== */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--cream);
  display: grid;
  place-items: center;
  padding: 20px;
}

.lock-screen[hidden] {
  display: none !important;
}

.lock-card {
  width: min(100%, 350px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 32px 24px;
  text-align: center;
}

.lock-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.lock-brand .brand-mark {
  width: 52px;
  height: 52px;
  font-size: 26px;
  margin-bottom: 12px;
}

.lock-brand h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 2px;
}

.lock-brand small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.lock-instruction {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 18px;
}

.pin-input-wrap {
  margin-bottom: 12px;
}

.pin-input-wrap input {
  width: 100%;
  padding: 12px 16px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.25em;
  font-weight: 800;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: var(--cream);
  color: var(--ink);
}

.pin-input-wrap input:focus {
  outline: none;
  border-color: var(--ink);
}

.lock-error {
  font-size: 12px;
  color: var(--coral);
  font-weight: 700;
  margin-bottom: 10px;
}

.lock-submit-btn {
  margin-top: 6px;
}

.passcode-change-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 16px;
  padding: 14px;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.passcode-change-box label {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 0;
}

.passcode-change-box input {
  margin-top: 6px;
  font-size: 16px;
  letter-spacing: 0.15em;
  text-align: center;
}

.lock-app-btn {
  width: 100%;
  border-color: rgba(207, 107, 80, 0.4);
  color: var(--coral);
}

/* ==========================================================================
   RESPONSIVE DESIGN (NARROW SCREENS)
   ========================================================================== */
@media (max-width: 400px) {
  main {
    padding-inline: 12px;
  }
  .hero-card {
    padding: 16px 14px;
  }
  .progress-ring {
    width: 56px;
    height: 56px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
