/* ============================================================
   Life Dashboard — vibrant multi-color theme (blue/teal lead)
   ============================================================ */
:root {
  --bg: #eef4fb;
  --bg-tint: #dcecff;
  --panel: #ffffff;
  --panel-2: #f1f6fc;
  --border: #e2e8f2;
  --border-strong: #cdd8e8;
  --text: #10203a;
  --muted: #64748b;
  --muted-2: #94a3b8;

  /* Primary accent (blue/teal) — overridden per section below. */
  --accent: #0ea5e9;
  --accent-2: #06b6d4;
  --accent-soft: #d9f2fe;

  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;

  --shadow: 0 2px 6px rgba(14,165,233,.06), 0 8px 24px rgba(16,32,58,.07);
  --shadow-lg: 0 12px 34px rgba(16,32,58,.16);
  --shadow-color: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent);
  --radius: 18px;
  --radius-sm: 13px;
  --nav-h: 66px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1120;
    --bg-tint: #10203a;
    --panel: #131c30;
    --panel-2: #1a2540;
    --border: #24304a;
    --border-strong: #35435f;
    --text: #eaf1fb;
    --muted: #9fb0c8;
    --muted-2: #5f7091;
    --accent-soft: #10283b;
    --shadow: 0 2px 6px rgba(0,0,0,.35), 0 10px 26px rgba(0,0,0,.45);
    --shadow-lg: 0 14px 38px rgba(0,0,0,.6);
  }
}

/* ---- Per-section theming: the whole UI shifts color by tab ---- */
body.s-today   { --accent:#0ea5e9; --accent-2:#06b6d4; --accent-soft:#d9f2fe; }
body.s-habits  { --accent:#8b5cf6; --accent-2:#a855f7; --accent-soft:#ede9fe; }
body.s-gym     { --accent:#f97316; --accent-2:#fb923c; --accent-soft:#ffedd5; }
body.s-tasks   { --accent:#3b82f6; --accent-2:#2563eb; --accent-soft:#dbeafe; }
body.s-journal { --accent:#ec4899; --accent-2:#f472b6; --accent-soft:#fce7f3; }
body.s-weight  { --accent:#14b8a6; --accent-2:#2dd4bf; --accent-soft:#ccfbf1; }
body.s-money   { --accent:#10b981; --accent-2:#34d399; --accent-soft:#d1fae5; }
body.s-more    { --accent:#0ea5e9; --accent-2:#8b5cf6; --accent-soft:#d9f2fe; }
@media (prefers-color-scheme: dark) {
  body.s-habits  { --accent-soft:#241a3d; }
  body.s-gym     { --accent-soft:#3a2410; }
  body.s-tasks   { --accent-soft:#14203c; }
  body.s-journal { --accent-soft:#331226; }
  body.s-weight  { --accent-soft:#0c2e2a; }
  body.s-money   { --accent-soft:#0c2e22; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 380px at 100% -8%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 60%),
    radial-gradient(900px 340px at -10% 0%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 1.06rem; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.icon { display: block; flex: none; }

/* ---- Layout ---- */
.container { max-width: 780px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 34px); }
@media (min-width: 820px) { .container { padding-bottom: 48px; } }
.page-head { margin-bottom: 20px; }
.page-head h1 {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-head .sub { color: var(--muted); font-size: .92rem; margin-top: 3px; }
.section { margin-top: 26px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title h2 { display: flex; align-items: center; gap: 8px; }
.eyebrow { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow .icon { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.tiny { font-size: .75rem; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.hide-mobile { display: none; }
@media (min-width: 560px) { .hide-mobile { display: inline; } }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff;
  box-shadow: var(--shadow-color);
}
.topnav { display: none; gap: 3px; }
@media (min-width: 820px) { .topnav { display: flex; } }
.topnav a { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 11px; font-size: .9rem; font-weight: 650; color: var(--muted); transition: all .15s; }
.topnav a:hover { background: var(--panel); color: var(--text); }
.topnav a.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow-color); }
.topnav a.active .icon { color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.userchip { font-size: .85rem; color: var(--muted); font-weight: 600; }

/* ---- Bottom nav (mobile) — every tab its own color ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-top: 1px solid var(--border);
}
@media (min-width: 820px) { .bottomnav { display: none; } }
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted-2); font-size: .66rem; font-weight: 700; letter-spacing: .01em;
  position: relative; transition: color .15s;
}
.bottomnav a .icon { transition: transform .18s cubic-bezier(.34,1.56,.64,1); }
.bottomnav a:nth-child(1) { --nc:#0ea5e9; }
.bottomnav a:nth-child(2) { --nc:#8b5cf6; }
.bottomnav a:nth-child(3) { --nc:#f97316; }
.bottomnav a:nth-child(4) { --nc:#3b82f6; }
.bottomnav a:nth-child(5) { --nc:#ec4899; }
.bottomnav a .icon { color: color-mix(in srgb, var(--nc) 55%, var(--muted-2)); }
.bottomnav a.active { color: var(--nc); }
.bottomnav a.active .icon { color: var(--nc); transform: translateY(-3px) scale(1.12); }
.bottomnav a.active::after {
  content: ""; position: absolute; top: 8px; width: 40px; height: 32px; border-radius: 12px;
  background: color-mix(in srgb, var(--nc) 16%, transparent); z-index: -1;
}

/* ---- Cards ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card-pad-lg { padding: 20px; }
.card-link { transition: transform .14s ease, box-shadow .14s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.empty { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px 18px; text-align: center; color: var(--muted); font-size: .92rem; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
.empty a { color: var(--accent); font-weight: 700; }

/* ---- Stat tiles: bold gradients, white text ---- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .tiles.cols-4 { grid-template-columns: repeat(4, 1fr); } .tiles.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.tile {
  border: none; border-radius: var(--radius-sm); padding: 15px; color: #fff;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  box-shadow: 0 8px 20px rgba(16,32,58,.14);
  background: linear-gradient(140deg, #0ea5e9, #06b6d4);
}
.tiles .tile:nth-child(6n+1) { background: linear-gradient(140deg, #0ea5e9, #22d3ee); }
.tiles .tile:nth-child(6n+2) { background: linear-gradient(140deg, #8b5cf6, #6366f1); }
.tiles .tile:nth-child(6n+3) { background: linear-gradient(140deg, #fb7185, #f97316); }
.tiles .tile:nth-child(6n+4) { background: linear-gradient(140deg, #10b981, #14b8a6); }
.tiles .tile:nth-child(6n+5) { background: linear-gradient(140deg, #ec4899, #d946ef); }
.tiles .tile:nth-child(6n+6) { background: linear-gradient(140deg, #3b82f6, #2563eb); }
.tile .k { font-size: .74rem; color: rgba(255,255,255,.9) !important; font-weight: 700; letter-spacing: .02em; }
.tile .v { font-size: 1.55rem; font-weight: 850; letter-spacing: -.02em; color: #fff !important; }
.tile .v small { font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.85) !important; }
.tile .foot { font-size: .75rem; color: rgba(255,255,255,.85) !important; font-weight: 600; }
.tile .spark { margin-top: 4px; height: 30px; width: 100%; }
.tile .spark polyline { stroke: #fff !important; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: none; cursor: pointer; font: inherit; font-weight: 700; font-size: .92rem;
  padding: 11px 17px; border-radius: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-color); transition: filter .12s ease, transform .06s ease;
}
.btn:hover { filter: brightness(1.07) saturate(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-sm { padding: 8px 13px; font-size: .85rem; border-radius: 11px; }
.btn-ghost { background: var(--panel); color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: none; }
.btn-ghost:hover { background: var(--accent-soft); filter: none; }
.btn-soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; font-weight: 700; }
.btn-soft:hover { filter: brightness(.98); }
.link-btn { background: none; border: none; cursor: pointer; font: inherit; color: var(--muted); font-size: .85rem; padding: 6px 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.link-btn:hover { background: var(--panel-2); color: var(--text); }
.link-btn.danger:hover { color: var(--red); }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted-2); padding: 6px; border-radius: 9px; display: inline-grid; place-items: center; transition: all .12s; }
.icon-btn:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.inline { display: inline; margin: 0; }

/* Floating action button */
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  z-index: 25; width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border: none; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .12s;
}
.fab:active { transform: scale(.94); }
@media (min-width: 820px) { .fab { display: none; } }

/* ---- Forms ---- */
label.field { display: block; }
label.field .lbl { display: block; font-size: .77rem; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 11px; padding: 10px 12px; transition: border-color .12s, background .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { resize: vertical; min-height: 84px; }
input[type=color] { padding: 3px; height: 44px; width: 52px; cursor: pointer; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Segmented control */
.segmented { display: inline-flex; background: var(--panel-2); border: 1.5px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 13px; border-radius: 9px; font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; transition: all .12s; }
.segmented input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* ---- Badges & chips ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.green { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge.amber { background: color-mix(in srgb, var(--amber) 20%, transparent); color: #b45309; }
.badge.red { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.badge.gray { background: var(--panel-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.amber { color: var(--amber); } }

/* ---- Lists / rows ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { margin-bottom: 10px; }
.rowcard { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); }
.rowcard.button { cursor: pointer; font: inherit; color: var(--text); transition: background .12s, transform .06s; }
.rowcard.button:hover { background: var(--panel-2); }
.rowcard.button:active { transform: scale(.99); }

/* Checkbox pill */
.check-box { width: 23px; height: 23px; border-radius: 50%; border: 2.5px solid var(--border-strong); display: grid; place-items: center; color: #fff; flex: none; transition: all .12s; }
.check-box .icon { width: 14px; height: 14px; opacity: 0; }
.done .check-box .icon { opacity: 1; }
.done .check-label { color: var(--muted); text-decoration: line-through; }
.check-label { font-weight: 550; }

/* ---- Habits ---- */
.habit-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 8%, transparent); }
.habit-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-stats { display: flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--muted); flex: none; font-weight: 600; }
.habit-stats .stat { display: inline-flex; align-items: center; gap: 4px; }
.habit-stats .stat .icon { color: #f97316; }
.day-grid { display: flex; gap: 6px; margin-top: 13px; }
.day-cell { flex: 1; border: none; cursor: pointer; border-radius: 10px; padding: 9px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .7rem; background: var(--panel-2); color: var(--muted-2); transition: transform .07s; }
.day-cell:active { transform: scale(.92); }
.day-cell .dow { opacity: .85; font-weight: 700; }
.day-cell .mark { font-weight: 800; font-size: .9rem; }
.day-cell.done { color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---- Charts ---- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; font-weight: 600; }
.spark { display: block; }
.ring { display: block; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent) 30%, transparent)); }
.ring-text { fill: var(--text); font-size: 22px; font-weight: 850; }

/* Heatmap */
.heatmap { overflow-x: auto; padding-bottom: 4px; }
.heatmap-grid { display: inline-flex; gap: 3px; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--panel-2); display: block; }
.hm-cell.future { background: transparent; }
.legend { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); margin-top: 8px; font-weight: 600; }
.legend .hm-cell { width: 11px; height: 11px; }

/* ---- Gym ---- */
.ex-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.ex-card + .ex-card { margin-top: 14px; }
.set-grid { display: grid; grid-template-columns: 1.6rem 1fr 1fr 1.8rem; gap: 8px; align-items: center; }
.set-grid .head { font-size: .72rem; color: var(--muted); font-weight: 700; }
.set-num { text-align: center; color: var(--muted-2); font-size: .85rem; font-weight: 700; }
.add-link { background: none; border: none; cursor: pointer; color: var(--accent); font: inherit; font-size: .87rem; font-weight: 700; padding: 8px 0 2px; display: inline-flex; align-items: center; gap: 5px; }
.add-link:hover { text-decoration: underline; }
.add-ex { width: 100%; border: 2px dashed var(--border-strong); background: none; cursor: pointer; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 700; padding: 14px; border-radius: var(--radius); margin-top: 14px; transition: all .12s; }
.add-ex:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.exlist { list-style: none; margin: 10px 0 0; padding: 0; }
.exlist li { font-size: .9rem; padding: 6px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }
.exlist li:first-child { border-top: none; }
.exlist .exname { font-weight: 700; color: var(--accent); }
.exlist .setinfo { color: var(--muted); text-align: right; font-weight: 500; }
.session-notes { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
.pr-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.pr-item:first-child { border-top: none; }
.pr-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pr-val { text-align: right; }
.pr-val b { font-size: 1.05rem; color: var(--accent); }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Journal / mood ---- */
.mood-row { display: flex; gap: 8px; }
.mood-opt { flex: 1; }
.mood-opt input { position: absolute; opacity: 0; }
.mood-opt span { display: block; text-align: center; font-size: 1.6rem; padding: 9px 0; border-radius: 13px; background: var(--panel-2); border: 2px solid var(--border); cursor: pointer; filter: grayscale(.55) opacity(.7); transition: all .14s; }
.mood-opt input:checked + span { filter: none; border-color: var(--accent); background: var(--accent-soft); transform: scale(1.08); }
.journal-entry .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.journal-entry .note { white-space: pre-wrap; font-size: .92rem; }
.mood-face { font-size: 1.4rem; }

/* ---- Finances ---- */
.txn { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.txn:first-child { border-top: none; }
.txn .ti { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.txn .amt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.txn .amt.in { color: var(--green); }
.cat-bar { height: 9px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.cat-bar > span { display: block; height: 100%; border-radius: 999px; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .dash-grid.two { grid-template-columns: 1fr 1fr; } }

/* Utility */
.divider { height: 1px; background: var(--border); margin: 14px 0; border: none; }
.error { color: var(--red); font-size: .9rem; font-weight: 600; }
.ok { color: var(--green); font-size: .9rem; font-weight: 600; }
.flex-end { display: flex; align-items: center; gap: 12px; }
.mt { margin-top: 14px; }
.nowrap { white-space: nowrap; }
