/* Dragon Life — dark wellness theme */
:root {
  --bg: #0a0f1c;
  --bg-2: #0e1424;
  --panel: #131a2c;
  --panel-2: #182137;
  --panel-3: #1e2843;
  --border: #202b47;
  --border-2: #2a375a;
  --text: #e6ebf5;
  --text-mid: #a4b0c8;
  --text-dim: #6b7691;
  --text-faint: #4c576e;

  --green: #22c55e;
  --green-2: #16a34a;
  --green-soft: rgba(34, 197, 94, .16);
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --blue-soft: rgba(59, 130, 246, .16);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, .16);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, .16);
  --pink: #ec4899;
  --pink-soft: rgba(236, 72, 153, .16);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, .16);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, .16);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); overscroll-behavior: none; }
body { min-height: 100vh; min-height: 100dvh; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Sidebar */
.sidebar {
  position: relative;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
}
.sidebar-panel {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  overflow: hidden;
}
.side-brand {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.side-brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--green-soft); color: var(--green);
  display: inline-flex; align-items: center; justify-content: center;
}
.side-brand-mark svg { width: 22px; height: 22px; }
.side-brand-name { font-weight: 700; font-size: 15px; letter-spacing: .1px; }
.side-brand-tag { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1 1 auto; margin-right: -6px; padding-right: 6px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.side-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  user-select: none;
}
.side-item:hover { background: var(--panel); color: var(--text); }
.side-item svg { width: 20px; height: 20px; flex: 0 0 20px; }
.side-item.is-active { background: var(--green-soft); color: var(--green); }
.side-item span { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1; }
.side-hour { font-size: 10px; color: var(--text-dim); background: var(--panel-2); padding: 2px 7px; border-radius: 999px; font-weight: 500; letter-spacing: .2px; }
.side-item.is-active .side-hour { background: rgba(34,197,94,.2); color: var(--green); }
.side-group {
  padding: 14px 12px 6px;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.side-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin-top: 8px;
  background: transparent; border: 0; color: var(--red);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; text-align: left;
}
.side-logout:hover { background: var(--red-soft); }
.side-logout svg { width: 20px; height: 20px; }

.sidebar-scrim { display: none; }

/* Phone frame */
.phone {
  position: relative;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.topbar-title { text-align: center; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
  cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn svg { width: 20px; height: 20px; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--panel); }

.screen {
  flex: 1 1 auto;
  padding: 6px 14px 96px;
  overflow-x: hidden;
}
.screen h1 { font-size: 22px; margin: 6px 0 2px; }
.screen h2 { font-size: 17px; margin: 18px 0 10px; letter-spacing: .1px; }
.screen p { color: var(--text-mid); font-size: 14px; }
.screen .muted { color: var(--text-dim); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { margin: 0; }
.section-title a, .section-title button.link { color: var(--green); font-size: 13px; background: transparent; border: 0; cursor: pointer; }

/* Bottom nav */
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0;
  width: 100%; max-width: 460px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 18, 32, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 20;
}

.notif-tray {
  top: calc(76px + env(safe-area-inset-top));
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; color: var(--text-dim);
  padding: 6px 4px; border-radius: 12px; cursor: pointer;
  font-size: 10px; font-weight: 500;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.is-active { color: var(--green); }
.nav-btn:hover { color: var(--text); }
.nav-btn.is-active:hover { color: var(--green); }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tight { padding: 12px; }
.card.tap { cursor: pointer; transition: background .15s, transform .15s; }
.card.tap:active { transform: scale(.99); background: var(--panel-2); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .1px; }
.card-head .chip { font-size: 11px; }

/* Grid utilities */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.center { display: flex; align-items: center; justify-content: center; }

/* Metric tiles (dashboard) */
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.metric .m-label { font-size: 12px; color: var(--text-dim); }
.metric .m-value { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.metric .m-sub { font-size: 11px; color: var(--text-dim); }
.metric .m-icon {
  width: 30px; height: 30px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green-soft); color: var(--green);
  margin-bottom: 4px;
}
.metric .m-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric .m-icon.amber { background: var(--amber-soft); color: var(--amber); }
.metric .m-icon.purple { background: var(--purple-soft); color: var(--purple); }
.metric .m-icon.pink { background: var(--pink-soft); color: var(--pink); }
.metric .m-icon.red { background: var(--red-soft); color: var(--red); }
.metric .m-icon.cyan { background: var(--cyan-soft); color: var(--cyan); }
.metric .m-icon svg { width: 18px; height: 18px; }

/* Balance score hero */
.balance-hero {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.balance-num { text-align: center; }
.balance-num .n { font-size: 32px; font-weight: 800; letter-spacing: -.5px; color: var(--green); line-height: 1; }
.balance-num .l { font-size: 10px; color: var(--text-dim); letter-spacing: .5px; text-transform: uppercase; }
.balance-txt .t { font-size: 14px; font-weight: 600; color: var(--green); }
.balance-txt .s { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Circular progress (SVG) */
.ring { position: relative; display: inline-block; }
.ring svg { display: block; }
.ring .ring-track { stroke: var(--border-2); }
.ring .ring-fill { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring .ring-fill.blue { stroke: var(--blue); }
.ring .ring-fill.amber { stroke: var(--amber); }
.ring .ring-fill.purple { stroke: var(--purple); }
.ring .ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.ring .ring-center .v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.ring .ring-center .l { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.ring .ring-center .sub { font-size: 10px; color: var(--green); margin-top: 2px; }

/* Chip / pill */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel-2); color: var(--text-mid);
  border-radius: 999px; padding: 3px 8px;
  font-size: 11px; font-weight: 500;
}
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.pink { background: var(--pink-soft); color: var(--pink); }
.chip.cyan { background: var(--cyan-soft); color: var(--cyan); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer;
  padding: 12px 16px; border-radius: 14px;
  font-weight: 600; font-size: 14px;
  background: var(--panel-2); color: var(--text);
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--panel-3); }
.btn.primary { background: var(--green); color: #0a0f1c; }
.btn.primary:hover { background: #16a34a; color: #fff; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--border-2); }
.btn svg { width: 16px; height: 16px; }

/* Tabs */
.tabs {
  display: inline-flex; gap: 4px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px;
  margin: 4px 0 12px;
}
.tab {
  border: 0; background: transparent; color: var(--text-mid);
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 500;
}
.tab.is-active { background: var(--green); color: #0a0f1c; font-weight: 700; }
.tabs.blk { background: var(--panel-2); }

/* Progress bar */
.pbar { position: relative; height: 8px; border-radius: 999px; background: var(--border-2); overflow: hidden; }
.pbar > i { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 999px; transition: width .4s ease; }
.pbar.blue > i { background: var(--blue); }
.pbar.amber > i { background: var(--amber); }
.pbar.purple > i { background: var(--purple); }
.pbar.pink > i { background: var(--pink); }
.pbar.red > i { background: var(--red); }
.pbar.cyan > i { background: var(--cyan); }
.pbar.multi > i { background: linear-gradient(90deg, var(--green), var(--cyan)); }

/* List rows */
.list-row {
  display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
.list-row .icn {
  width: 32px; height: 32px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--text-mid);
}
.list-row .icn.done { background: var(--green-soft); color: var(--green); }
.list-row .icn svg { width: 16px; height: 16px; }
.list-row .title { font-size: 14px; font-weight: 500; }
.list-row .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.list-row .arrow { color: var(--text-faint); }
.list-row .arrow svg { width: 16px; height: 16px; }
.list-row.done .title { color: var(--text-dim); text-decoration: line-through; }

/* Mood face selector */
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood-btn {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; color: var(--text-mid);
  font-size: 11px;
}
.mood-btn .emoji { font-size: 22px; }
.mood-btn.is-active { background: var(--green); color: #0a0f1c; border-color: var(--green); font-weight: 700; }
.mood-btn.is-active .emoji { filter: none; }

/* Sliders */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 999px;
  background: var(--border-2); outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); border: 3px solid #0a0f1c;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); border: 3px solid #0a0f1c;
  cursor: pointer;
}
.slider.red { background: linear-gradient(to right, var(--red) 0%, var(--red) var(--v, 50%), var(--border-2) var(--v, 50%)); }
.slider.red::-webkit-slider-thumb { background: var(--red); }
.slider.green { background: linear-gradient(to right, var(--green) 0%, var(--green) var(--v, 50%), var(--border-2) var(--v, 50%)); }
.slider.green::-webkit-slider-thumb { background: var(--green); }

/* Inputs */
.input, textarea.input, select.input {
  width: 100%;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px; font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--green); }
textarea.input { resize: vertical; min-height: 92px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-dim); }

/* Date-strip / week strip */
.week-strip {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-bottom: 10px;
}
.day-cell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 4px;
  text-align: center; cursor: pointer;
  color: var(--text-mid);
}
.day-cell .dow { font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.day-cell .dnum { font-size: 15px; font-weight: 600; margin-top: 2px; }
.day-cell.is-active { background: var(--green); color: #0a0f1c; border-color: var(--green); }
.day-cell.is-active .dow, .day-cell.is-active .dnum { color: #0a0f1c; }

/* Habit weekly dots */
.dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow-dot {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; color: var(--text-dim);
}
.dow-dot .d {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.dow-dot.done .d { background: var(--green); border-color: var(--green); color: #0a0f1c; }
.dow-dot.done .d::after { content: '✓'; font-size: 11px; font-weight: 700; }

/* Sleep bar row */
.sleep-row { display: grid; grid-template-columns: 12px 1fr 60px 40px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.sleep-row .dot { width: 10px; height: 10px; border-radius: 3px; }
.sleep-row .lbl { color: var(--text-mid); }
.sleep-row .val { font-weight: 600; text-align: right; }
.sleep-row .pct { color: var(--text-dim); text-align: right; font-size: 12px; }

/* Bar chart (hourly activity) */
.bars {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end;
  height: 120px; padding: 6px 0;
}
.bars .b { background: var(--green); border-radius: 3px 3px 0 0; min-height: 3px; }
.bars-x { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 9px; color: var(--text-dim); text-align: center; }
.bars-x span { display: none; }
.bars-x span:nth-child(1),
.bars-x span:nth-child(5),
.bars-x span:nth-child(9),
.bars-x span:nth-child(13),
.bars-x span:nth-child(17),
.bars-x span:nth-child(21) { display: inline; }

/* Line chart */
.linechart { display: block; width: 100%; height: 140px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
.modal-backdrop.center { align-items: center; }
.modal {
  width: 100%; max-width: 460px;
  background: var(--panel);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  border: 1px solid var(--border);
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  animation: slideup .25s cubic-bezier(.2,.9,.3,1);
}
.modal.centered { border-radius: 20px; margin: 20px; animation: pop .2s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close {
  background: transparent; border: 0; color: var(--text-mid);
  width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
}
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Toast */
#toastRoot { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 200; pointer-events: none; }
.toast {
  background: var(--panel-3);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  animation: slideup .2s ease;
}

/* Notification tray */
.notif-tray {
  position: fixed; top: 66px; right: 14px; z-index: 90;
  width: 300px; max-width: calc(100vw - 28px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; box-shadow: var(--shadow-lg);
}
.notif-item { padding: 8px; border-radius: 10px; }
.notif-item + .notif-item { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 12px; }
.notif-item .n-title { font-size: 13px; font-weight: 600; }
.notif-item .n-body { font-size: 12px; color: var(--text-mid); margin-top: 2px; }
.notif-item .n-time { font-size: 10px; color: var(--text-dim); margin-top: 4px; }

/* Empty */
.empty {
  text-align: center; padding: 32px 12px; color: var(--text-dim);
}
.empty .em-emoji { font-size: 32px; margin-bottom: 8px; }
.empty .em-title { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty .em-hint { font-size: 12px; }

/* Utility */
.hide { display: none !important; }
.right { text-align: right; }
.spacer { flex: 1 1 auto; }
.gap-6 { gap: 6px; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.mb-6 { margin-bottom: 6px; }
.mb-10 { margin-bottom: 10px; }
.big { font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.subtitle { font-size: 12px; color: var(--text-dim); }
.divider { height: 1px; background: var(--border); margin: 10px 0; }

/* Smoke counter circle */
.smoke-circle {
  width: 220px; height: 220px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(239,68,68,.28), rgba(239,68,68,.08));
  border: 3px solid var(--red);
  color: var(--red);
  font-size: 88px; font-weight: 800; letter-spacing: -2px;
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease, box-shadow .2s ease;
  box-shadow: 0 10px 40px rgba(239,68,68,.25), inset 0 2px 12px rgba(239,68,68,.15);
}
.smoke-circle:active { transform: scale(.96); box-shadow: 0 4px 16px rgba(239,68,68,.4), inset 0 2px 12px rgba(239,68,68,.25); }
.smoke-circle:hover { box-shadow: 0 12px 48px rgba(239,68,68,.35), inset 0 2px 12px rgba(239,68,68,.2); }

/* Timer (relaxation) */
.timer-face {
  width: 220px; height: 220px; margin: 12px auto;
  border-radius: 50%; background: var(--panel-2);
  border: 2px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.timer-face.pulse::after {
  content: ''; position: absolute; inset: -8px;
  border-radius: 50%; border: 2px solid var(--green);
  animation: breathe 8s ease-in-out infinite;
  opacity: .6;
}
@keyframes breathe {
  0%, 100% { transform: scale(.9); opacity: .3; }
  50%      { transform: scale(1.05); opacity: .8; }
}
.timer-face .t-time { font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.timer-face .t-phase { font-size: 12px; color: var(--text-dim); position: absolute; bottom: 32px; }

/* Search */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px;
  margin-bottom: 12px;
}
.searchbar svg { width: 16px; height: 16px; color: var(--text-dim); }
.searchbar input {
  flex: 1 1 auto; border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 14px; font-family: inherit;
}
.searchbar input::placeholder { color: var(--text-dim); }

/* Journal entry */
.entry {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 10px; cursor: pointer;
}
.entry:hover { background: var(--panel-2); }
.entry .e-head { display: flex; justify-content: space-between; align-items: center; }
.entry .e-title { font-weight: 600; font-size: 14px; }
.entry .e-time { font-size: 11px; color: var(--text-dim); }
.entry .e-body { font-size: 13px; color: var(--text-mid); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry .e-meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Habit card */
.habit-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 10px;
}
.habit-card.archived { opacity: .55; }
.habit-card .h-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.habit-card .h-name { font-weight: 600; font-size: 14px; }
.habit-card .h-streak { font-size: 12px; color: var(--green); margin-left: auto; }
.habit-card .h-action { background: transparent; border: 0; color: var(--text-mid); cursor: pointer; padding: 4px; }
.habit-card .h-action:hover { color: var(--text); }
.habit-card .h-action svg { width: 16px; height: 16px; }

/* Meal card */
.meal {
  background: var(--panel-2); border-radius: 12px; padding: 10px 12px;
  margin-bottom: 8px;
}
.meal-name { font-size: 13px; font-weight: 600; }
.meal-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.meal .kcal { font-size: 13px; font-weight: 700; color: var(--green); }

/* Segmented chart legend */
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-mid); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* Responsive — hide sidebar on narrow */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0; z-index: 90;
    pointer-events: none;
    background: transparent; border: 0;
    transition: background .2s ease;
    padding-top: env(safe-area-inset-top);
  }
  .sidebar.open { pointer-events: auto; background: rgba(0,0,0,.6); }
  .sidebar-panel {
    position: absolute; top: 0; left: 0;
    width: 82%; max-width: 320px; height: 100%;
    background: var(--bg-2); border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.9,.3,1);
  }
  .sidebar.open .sidebar-panel { transform: translateX(0); }
  .sidebar-scrim { display: block; position: absolute; inset: 0; }
}
@media (min-width: 901px) {
  #btnMenu { display: none; }
  .phone { max-width: 460px; }
}
