:root {
  --ink: #13283a;
  --ink-soft: #334e62;
  --muted: #6c8193;
  --line: #dcecf3;
  --line-strong: #c4e0ec;
  --paper: #eaf7fc;
  --surface: #ffffff;
  --surface-alt: #f4fbfe;
  --surface-hover: #e7f8fd;
  --primary: #1eb8db;
  --primary-dark: #1294b4;
  --primary-soft: #e3f9ff;
  --mint: #21dda9;
  --mint-soft: #e5fff6;
  --sky: #48d5e8;
  --sun: #ffdf42;
  --coral: #ff4e86;
  --coral-soft: #fff0f5;
  --amber: #fd9d35;
  --amber-soft: #fff5ea;
  --shadow-sm: 0 6px 20px rgba(20, 68, 92, 0.05);
  --shadow: 0 16px 42px rgba(20, 68, 92, 0.10);
  --shadow-lg: 0 28px 72px rgba(13, 45, 64, 0.20);
  --radius: 20px;
  --radius-sm: 13px;
  --font: 'Nunito', system-ui, -apple-system, sans-serif;
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

body.dark-mode {
  --ink: #e9f6fb;
  --ink-soft: #b8d3e0;
  --muted: #82a0b2;
  --line: #213a4b;
  --line-strong: #2c4e64;
  --paper: #0c1922;
  --surface: #132634;
  --surface-alt: #183040;
  --surface-hover: #1e3b4f;
  --primary: #39d0f2;
  --primary-dark: #21b2d4;
  --primary-soft: rgba(57, 208, 242, 0.14);
  --mint-soft: rgba(33, 221, 169, 0.15);
  --coral-soft: rgba(255, 78, 134, 0.15);
  --amber-soft: rgba(253, 157, 53, 0.15);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

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

button {
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* App Shell: Full Responsive Desktop by default, Phone Frame when toggled */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  transition: all 0.25s ease;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 15;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 24px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mascot {
  width: 44px;
  height: 44px;
  flex: none;
  filter: drop-shadow(0 4px 10px rgba(33, 221, 169, 0.28));
  transition: transform 0.2s ease;
}

.brand:hover .brand-mascot {
  transform: scale(1.07) rotate(-4deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font: 800 24px/1 var(--display);
  color: #25b9de;
  letter-spacing: -0.5px;
}

.brand-sub {
  font: 700 10px/1.2 var(--font);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-top: 3px;
}

.nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px;
  margin: 0 0 8px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  transition: 0.18s ease;
  position: relative;
}

.nav-item svg {
  height: 19px;
  width: 19px;
  stroke-width: 2;
  flex: none;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

body.dark-mode .nav-item.active {
  color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface-alt);
  color: var(--muted);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-mascot-card {
  background: linear-gradient(140deg, var(--primary-soft), var(--mint-soft));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 14px 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

.sidebar-mascot-card strong {
  display: block;
  color: var(--ink);
  font: 700 13px/1.3 var(--display);
  margin: 4px 0;
}

.sidebar-controls {
  display: flex;
  gap: 6px;
  margin: 0 4px 14px;
}

.control-pill {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink-soft);
  border-radius: 11px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: 0.15s;
}

.control-pill:hover, .control-pill.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

body.dark-mode .control-pill.active {
  color: var(--primary);
}

.control-pill svg {
  width: 14px;
  height: 14px;
}

.profile {
  border-top: 1px solid var(--line);
  padding: 14px 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #21dda9, #48d5e8);
  color: #0d2b36;
  font-size: 13px;
  font-weight: 800;
}

.profile b {
  font-size: 12px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

/* Main Area */
.main {
  min-width: 0;
  padding: 26px clamp(20px, 4vw, 48px) 64px;
}

.topbar {
  max-width: 1160px;
  margin: 0 auto 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.crumb {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crumb strong {
  font-weight: 800;
  color: var(--ink);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-soft);
  color: #d97706;
  border: 1px solid rgba(253, 157, 53, 0.35);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
}

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

.icon-button {
  height: 40px;
  width: 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  transition: 0.15s;
}

.icon-button:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.button-primary {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #27c9eb, #18a5c9);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 7px 18px rgba(30, 184, 219, 0.26);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.button-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 22px rgba(30, 184, 219, 0.34);
}

.button-primary svg {
  width: 16px;
  height: 16px;
}

.button-secondary {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12px;
  transition: 0.15s;
}

.button-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.content {
  max-width: 1160px;
  margin: auto;
}

/* Page Head */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 800;
  font-size: 11px;
  margin: 0 0 4px;
}

.page-head h1 {
  font: 800 clamp(25px, 2.8vw, 34px)/1.12 var(--display);
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--ink);
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.date-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Grids & Cards */
.grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Check-in Card */
.checkin-card {
  padding: 22px 24px 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 45%, var(--surface-alt) 100%);
}

.checkin-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  right: -50px;
  top: -65px;
  border: 1px solid rgba(72, 213, 232, 0.28);
  box-shadow: 0 0 0 20px rgba(72, 213, 232, 0.08), 0 0 0 42px rgba(33, 221, 169, 0.05);
  pointer-events: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.card-kicker {
  margin: 0;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.checkin-card h2 {
  font: 800 22px/1.25 var(--display);
  margin: 6px 0 4px;
}

.checkin-card .subcopy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.edit-link {
  border: 1px solid var(--line-strong);
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.mood-choices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.mood-choice {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 11px 4px 10px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mood-choice:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(30, 184, 219, 0.12);
}

.mood-blob-svg {
  width: 42px;
  height: 42px;
  display: block;
  transition: transform 0.2s ease;
}

.mood-choice:hover .mood-blob-svg {
  transform: scale(1.1);
}

.mood-choice span:last-child {
  font-size: 11px;
  font-weight: 800;
}

.mood-choice.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(30, 184, 219, 0.16);
}

body.dark-mode .mood-choice.selected {
  color: var(--primary);
}

.today-summary-strip {
  margin-top: 14px;
  padding: 11px 13px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.checkin-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.checkin-foot-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkin-foot svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* Streak Card */
.streak-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, var(--primary-soft) 0%, var(--surface) 100%);
}

.streak-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streak-top span {
  font-size: 10px;
  color: var(--primary-dark);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
}

body.dark-mode .streak-top span {
  color: var(--primary);
}

.streak-top .icon-bubble {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--coral-soft);
  border-radius: 12px;
  color: var(--coral);
}

.icon-bubble svg {
  width: 18px;
  height: 18px;
}

.streak-number {
  font: 800 38px/1 var(--display);
  letter-spacing: -1px;
  margin: 12px 0 2px;
  color: var(--ink);
}

.streak-copy {
  color: var(--muted);
  font-size: 12px;
}

.streak-days {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  gap: 4px;
}

.streak-day {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 10px;
  transition: background 0.15s;
}

.streak-day:hover {
  background: rgba(30, 184, 219, 0.1);
}

.streak-day i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-style: normal;
  font-weight: 800;
  margin: 0 auto 4px;
  color: var(--muted);
}

.streak-day.done i {
  background: var(--mint);
  border-color: var(--mint);
  color: #0b372b;
}

.streak-day.today i {
  border: 2px solid var(--primary);
  color: var(--primary-dark);
}

.streak-day svg {
  width: 14px;
  height: 14px;
}

/* Stats Row */
.stats-row {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.stat-icon {
  height: 42px;
  width: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.green {
  background: var(--mint-soft);
  color: #10b981;
}

.stat-icon.peach {
  background: var(--coral-soft);
  color: var(--coral);
}

.stat-icon.blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.stat-value {
  font: 800 20px/1.15 var(--display);
  margin: 2px 0;
}

.stat-meta {
  font-size: 10px;
  color: var(--muted);
}

/* Two-col & Chart + Calendar */
.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.85fr);
  margin-top: 16px;
}

.chart-card, .calendar-card, .recent-card {
  padding: 20px 22px;
}

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

.section-title h3, .recent-header h3 {
  font: 800 17px/1.2 var(--display);
  margin: 0;
  color: var(--ink);
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-select {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink-soft);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
}

.chart-wrap {
  height: 175px;
  position: relative;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-area {
  fill: url(#areaFill);
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-energy {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 2.5;
  cursor: pointer;
  transition: r 0.15s;
}

.chart-point:hover {
  r: 6;
}

.chart-label {
  font: 700 10px var(--font);
  fill: var(--muted);
}

.chart-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  margin-top: 6px;
}

.chart-legend-items {
  display: flex;
  gap: 14px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.legend-dot.energy {
  background: var(--amber);
}

/* Calendar */
.calendar-mini-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  margin: 10px 0;
}

.calendar-arrows {
  display: flex;
  gap: 5px;
}

.calendar-arrows button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
}

.calendar-arrows svg {
  width: 14px;
  height: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.calendar-weekday {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  padding: 4px 0;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: var(--surface-alt);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  position: relative;
  transition: transform 0.12s, border-color 0.12s;
}

.calendar-day:hover:not(:disabled) {
  transform: scale(1.08);
  border-color: var(--primary);
}

.calendar-day.other {
  opacity: 0.32;
  background: transparent;
}

.calendar-day.today {
  border: 2px solid var(--primary);
  font-weight: 800;
}

.calendar-day.has-entry {
  color: #0e2433;
  font-weight: 800;
}

.calendar-legend {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.calendar-mood-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.calendar-mood-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Recent Check-ins & Entries */
.recent-card {
  margin-top: 16px;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 9px;
}

body.dark-mode .text-button {
  color: var(--primary);
}

.text-button:hover {
  background: var(--primary-soft);
}

.text-button svg {
  width: 14px;
  height: 14px;
}

.entry-list {
  display: grid;
  gap: 9px;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.entry-item:hover {
  border-color: var(--primary);
  transform: translateX(2px);
}

.entry-emoji {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 21px;
  flex: none;
}

.entry-body {
  flex: 1;
  min-width: 0;
}

.entry-body b {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.entry-body small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-date {
  text-align: right;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.entry-date strong {
  display: block;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 11px;
}

/* Privacy Blur */
body.privacy-blur .blur-target {
  filter: blur(5px);
  transition: filter 0.2s ease;
}

body.privacy-blur .blur-target:hover {
  filter: blur(0);
}

/* Insights Page */
.page-tabs {
  display: flex;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px;
}

.page-tab {
  border: 0;
  background: transparent;
  border-radius: 99px;
  color: var(--muted);
  padding: 6px 13px;
  font-size: 11px;
  font-weight: 800;
}

.page-tab.active {
  background: var(--primary);
  color: #fff;
}

.insights-top {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

.insight-highlight {
  padding: 18px;
}

.insight-highlight label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.insight-highlight b {
  display: block;
  font: 800 24px/1.15 var(--display);
  margin: 6px 0 3px;
}

.insight-highlight small {
  color: var(--muted);
  font-size: 10px;
}

.insight-chart {
  padding: 20px 22px;
}

.insight-chart .chart-wrap {
  height: 210px;
}

.insight-bottom {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.mood-breakdown {
  padding: 20px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.breakdown-row .mood-name {
  width: 92px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-bar {
  height: 9px;
  border-radius: 99px;
  background: var(--surface-alt);
  flex: 1;
  overflow: hidden;
}

.breakdown-bar i {
  height: 100%;
  display: block;
  border-radius: inherit;
}

.breakdown-count {
  width: 34px;
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

/* Weekday & Factor Correlation */
.weekday-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 135px;
  padding-top: 18px;
}

.weekday-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.weekday-fill-wrap {
  width: 100%;
  max-width: 30px;
  flex: 1;
  background: var(--surface-alt);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.weekday-fill {
  width: 100%;
  border-radius: 8px;
  transition: height 0.3s ease;
}

.weekday-col span {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.weekday-col small {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--ink-soft);
}

/* Journal Page */
.journal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  padding: 8px 14px;
  min-width: 230px;
  flex: 1;
  color: var(--muted);
}

.search-box svg {
  width: 15px;
  height: 15px;
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 12px;
  color: var(--ink);
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  transition: 0.15s;
}

.filter-pill.active, .filter-pill:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

body.dark-mode .filter-pill.active {
  color: var(--primary);
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.journal-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.journal-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.journal-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journal-card-head b {
  font-size: 13px;
  font-weight: 800;
  display: block;
}

.journal-card-head small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.card-actions {
  display: flex;
  gap: 4px;
}

.card-action-btn {
  border: 0;
  background: var(--surface-alt);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  transition: 0.15s;
}

.card-action-btn:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.card-action-btn.starred {
  color: #f59e0b;
  background: var(--amber-soft);
}

.journal-card p {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 12px 0 0;
  white-space: pre-wrap;
}

.win-box {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--mint-soft);
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
}

body.dark-mode .win-box {
  color: var(--mint);
}

.tag-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.tag.activity-tag {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-dark);
}

body.dark-mode .tag.activity-tag {
  color: var(--primary);
}

/* Toolkit / Suggestions Page */
.resources-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.resource-icon {
  height: 44px;
  width: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  font-size: 21px;
}

.resource-icon.sage {
  background: var(--mint-soft);
  color: #10b981;
}

.resource-icon.peach {
  background: var(--coral-soft);
  color: var(--coral);
}

.resource-icon.lav {
  background: var(--primary-soft);
  color: var(--primary);
}

.resource-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.resource-card h3 {
  font: 800 16px/1.25 var(--display);
  margin: 0 0 6px;
}

.resource-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

.resource-card button {
  align-self: flex-start;
  margin-top: auto;
  border: 0;
  background: var(--primary-soft);
  padding: 7px 13px;
  border-radius: 99px;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.dark-mode .resource-card button {
  color: var(--primary);
}

.prompt-card {
  margin-top: 16px;
  padding: 20px 22px;
  background: linear-gradient(115deg, var(--primary-soft), var(--mint-soft));
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.prompt-card .prompt-emoji {
  font-size: 28px;
}

.prompt-card h3 {
  font: 800 16px var(--display);
  margin: 0 0 3px;
}

.prompt-card p {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}

.prompt-card-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Interactive Breathing Pacer Modal */
.breath-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 12px;
  text-align: center;
}

.breath-orb-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  display: grid;
  place-items: center;
  margin: 12px 0 18px;
}

.breath-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(33, 221, 169, 0.25), rgba(72, 213, 232, 0.08));
  border: 2px dashed rgba(30, 184, 219, 0.4);
  transition: transform 1s linear;
}

.breath-orb {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #21dda9, #48d5e8);
  display: grid;
  place-items: center;
  color: #0b2e3a;
  font: 800 26px var(--display);
  box-shadow: 0 14px 36px rgba(33, 221, 169, 0.35);
  transition: transform 0.95s ease-in-out;
}

.breath-phase-label {
  font: 800 20px var(--display);
  color: var(--ink);
  margin-bottom: 4px;
}

/* Grounding Stepper */
.grounding-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.grounding-step-item input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
}

/* Dialog / Modal */
dialog {
  border: 1px solid var(--line);
  padding: 0;
  border-radius: 24px;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(12, 29, 41, 0.48);
  backdrop-filter: blur(5px);
}

.modal {
  padding: 22px 24px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font: 800 22px/1.2 var(--display);
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.close-button {
  border: 0;
  background: var(--surface-alt);
  color: var(--muted);
  border-radius: 10px;
  height: 32px;
  width: 32px;
  font-size: 20px;
  line-height: 1;
}

.modal-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 8px;
}

.modal-moods {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.modal-mood {
  border: 1.5px solid var(--line);
  background: var(--surface-alt);
  border-radius: 14px;
  padding: 9px 4px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modal-mood.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

body.dark-mode .modal-mood.active {
  color: var(--primary);
}

.energy-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.energy-btn {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.energy-btn.active {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: #d97706;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 99px;
  padding: 6px 11px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.chip.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary);
}

body.dark-mode .chip.active {
  color: var(--primary);
}

.journal-input {
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 13px;
  padding: 10px 12px;
  resize: vertical;
  font-size: 12px;
  color: var(--ink);
}

.win-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 11px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-foot small {
  font-size: 10px;
  color: var(--muted);
}

/* Toast */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast {
  background: #122b3d;
  color: #ffffff;
  border-radius: 13px;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease both;
}

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

.mobile-header, .bottom-nav {
  display: none;
}

/* =========================================================
   PHONE FRAME PREVIEW MODE (Toggleable anytime!)
   ========================================================= */
body.phone-mode .app-shell {
  display: block;
  position: relative;
  width: min(100%, 444px);
  min-height: calc(100vh - 34px);
  margin: 17px auto 88px;
  background: var(--surface);
  border: 8px solid #111;
  border-bottom-width: 18px;
  border-radius: 39px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(10, 40, 54, 0.24);
}

body.phone-mode .sidebar,
body.phone-mode .topbar {
  display: none !important;
}

body.phone-mode .main {
  padding: 14px 16px 110px;
}

body.phone-mode .mobile-header {
  display: flex !important;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}

body.phone-mode .dashboard-grid,
body.phone-mode .two-col,
body.phone-mode .insight-bottom,
body.phone-mode .journal-grid,
body.phone-mode .resources-grid {
  grid-template-columns: 1fr;
}

body.phone-mode .stats-row,
body.phone-mode .insights-top {
  grid-template-columns: repeat(2, 1fr);
}

body.phone-mode .bottom-nav {
  display: flex !important;
  position: fixed;
  z-index: 20;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: min(426px, calc(100% - 34px));
  justify-content: space-around;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 32px rgba(37, 90, 114, 0.18);
}

body.phone-mode .bottom-nav .nav-item {
  height: 48px;
  flex: 1;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  font-size: 9px;
  border-radius: 13px;
}

body.phone-mode .bottom-nav .nav-badge {
  display: none;
}

/* Responsive Breakpoints for Real Mobile/Tablet Screens */
@media (max-width: 860px) {
  .app-shell {
    display: block;
  }
  .sidebar, .topbar {
    display: none;
  }
  .main {
    padding: 16px 16px 96px;
  }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .bottom-nav {
    position: fixed;
    z-index: 20;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item {
    height: 50px;
    flex: 1;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    border-radius: 12px;
  }
  .bottom-nav .nav-badge {
    display: none;
  }
  .dashboard-grid, .two-col, .insight-bottom, .journal-grid, .resources-grid {
    grid-template-columns: 1fr;
  }
  .stats-row, .insights-top {
    grid-template-columns: repeat(2, 1fr);
  }
}
