/* Life OS — one dominant ink + ONE accent (acid lime). Layered bg, never flat.
   Font: Be Vietnam Pro (full Vietnamese diacritics). Signature motion: spring sheet. */

:root {
  --ink: #0B0E13;
  --surface: #141922;
  --surface-2: #1B212C;
  --line: #262E3B;
  --text: #E8EDF5;
  --muted: #8994A6;
  --faint: #5A6577;
  --accent: #C6F24E;
  --accent-ink: #10160A;
  --pos: #46E39B;
  --neg: #FF7A6B;
  --warn: #FFC24E;
  --r: 18px;
  --r-sm: 12px;
  --pad: 16px;
  --spring: cubic-bezier(.2, 1.25, .35, 1);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --rail: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--ink);
  background-image:
    radial-gradient(120% 70% at 8% -8%, rgba(198, 242, 78, .10), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(78, 160, 242, .08), transparent 55%),
    radial-gradient(140% 90% at 50% 110%, rgba(255, 194, 78, .05), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Be Vietnam Pro', 'Segoe UI Variable Text', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  width: 100%;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(transparent, transparent); }
::placeholder { color: var(--faint); }

/* ---------- shell ---------- */

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) var(--pad) 128px;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand {
  font-weight: 800;
  letter-spacing: -.03em;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  width: 11px; height: 11px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(198, 242, 78, .7);
}

.spacer { flex: 1; }

.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: .18s;
}
.chip-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- cards ---------- */

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
}

.card.tight { padding: 12px 14px; }

.card-h {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.card-h h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-h .side {
  margin-left: auto;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- hero number ---------- */

.hero-amt {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
}
.hero-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-top: 14px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #8FD62B);
  transition: width .6s var(--spring);
}
.bar.over > i { background: linear-gradient(90deg, var(--neg), #C93F32); }

.split { display: flex; gap: 10px; }
.split > * { flex: 1; }

/* money stats wrap instead of clipping — a cut-off number is a wrong number */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }

.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; min-width: 0; }
.stat b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.03em; overflow-wrap: anywhere; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- rows ---------- */

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }

.row .ic {
  width: 36px; height: 36px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 16px;
}
.row .body { min-width: 0; flex: 1; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }

.row.done .t { text-decoration: line-through; color: var(--faint); }

.tick {
  width: 24px; height: 24px; flex: none;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
  font-size: 13px; color: transparent;
  transition: .18s var(--spring);
}
.tick.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.empty {
  text-align: center;
  color: var(--faint);
  padding: 22px 10px;
  font-size: 13px;
}

/* ---------- tags / pills ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.link { color: var(--accent); border-color: rgba(198,242,78,.35); }

.pills { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- nav ---------- */

.nav {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  width: min(492px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(20, 25, 34, .82);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 7px;
  box-shadow: var(--shadow);
  z-index: 40;
}

.nav button {
  flex: 1;
  border-radius: 15px;
  padding: 8px 2px 7px;
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--faint);
  transition: .2s;
}
.nav button .g { font-size: 17px; line-height: 1; }
.nav button.on { color: var(--text); background: var(--surface-2); }

.fab {
  flex: none !important;
  width: 52px; height: 44px;
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  font-size: 24px !important;
  font-weight: 800;
  display: grid; place-items: center;
  border-radius: 15px;
  box-shadow: 0 6px 22px rgba(198, 242, 78, .34);
}
.fab:active { transform: scale(.93); }

/* ---------- sheet (signature motion) ---------- */

.scrim {
  position: fixed; inset: 0;
  background: rgba(5, 7, 10, .68);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  z-index: 50;
}
.scrim.on { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 108%);
  width: min(520px, 100vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 10px var(--pad) calc(env(safe-area-inset-bottom) + 18px);
  box-shadow: var(--shadow);
  z-index: 60;
  transition: transform .42s var(--spring), opacity .25s, visibility .25s;
  max-height: 92vh;
  overflow-y: auto;
  /* a closed sheet must never eat a click — on PC it sits mid-screen at opacity 0 */
  visibility: hidden;
  pointer-events: none;
}
.sheet.on { transform: translate(-50%, 0); visibility: visible; pointer-events: auto; }

.grab {
  width: 42px; height: 4px;
  border-radius: 9px;
  background: var(--line);
  margin: -30px auto 14px;
  cursor: pointer;
}
.grab::after { content: ''; display: block; height: 26px; margin-top: -11px; }

/* a sheet can cover the whole phone screen — there must always be a way out.
   sticky, so the X stays reachable even after scrolling a long sheet. */
.sheet-x {
  position: sticky;
  top: 4px;
  margin: 0 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 3;
}
.sheet-x:active { transform: scale(.92); }

.sheet h3 { margin: 0 0 12px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }

.btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  border-radius: 14px;
  padding: 13px;
  letter-spacing: -.01em;
  transition: transform .15s var(--spring);
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn.danger { background: var(--surface-2); color: var(--neg); border: 1px solid var(--line); }

.field { margin-bottom: 11px; }
.field > label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.capture-in {
  font-size: 17px;
  font-weight: 600;
  padding: 15px 14px;
  border-radius: 15px;
}

.guess {
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  margin: 11px 0;
  font-size: 13px;
  color: var(--muted);
  transition: .2s;
}
.guess b { color: var(--text); }
.guess.hit { border-color: rgba(198, 242, 78, .45); border-style: solid; }

/* stamp pop on save */
@keyframes stamp {
  0% { transform: scale(.6); opacity: 0; }
  55% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 96px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 80;
  animation: stamp .45s var(--spring);
  box-shadow: 0 8px 26px rgba(198, 242, 78, .3);
}

/* ---------- misc ---------- */

.seg { display: flex; gap: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border-radius: 10px; padding: 8px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

.screen { display: none; animation: fade .3s ease; }
.screen.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.cat-line { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.cat-line .nm { width: 104px; flex: none; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-line .tr { flex: 1; height: 7px; border-radius: 9px; background: var(--line); overflow: hidden; }
.cat-line .tr > i { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .6s var(--spring); }
.cat-line .vl { width: 78px; text-align: right; font-weight: 700; font-size: 12px; }

.note-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  margin-bottom: 10px;
}
.note-card.learn { border-left-color: #4EA0F2; }
.note-card.cold { border-left-color: var(--warn); }
.note-card h4 { margin: 0 0 5px; font-size: 15px; font-weight: 700; }
.note-card p { margin: 0 0 8px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-grid .dh { text-align: center; font-size: 10px; color: var(--faint); font-weight: 700; text-transform: uppercase; padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  position: relative;
  font-size: 13px;
  font-weight: 600;
}
.cal-cell.out { opacity: .28; }
.cal-cell.today { border-color: var(--accent); color: var(--accent); }
.cal-cell.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal-cell .dots { position: absolute; bottom: 5px; display: flex; gap: 2px; }
.cal-cell .dots i { width: 4px; height: 4px; border-radius: 9px; background: var(--muted); }
.cal-cell .dots i.a { background: var(--accent); }
.cal-cell.sel .dots i { background: var(--accent-ink); }

.linkbox { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

.hint { font-size: 12px; color: var(--faint); line-height: 1.5; }
kbd {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; font-size: 11px; font-family: inherit; color: var(--text);
}

/* ---------- PC layout ---------- */

@media (min-width: 940px) {
  .app {
    max-width: 1080px;
    padding: 30px 30px 40px 132px;
  }
  .nav {
    left: 22px;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 84px;
    flex-direction: column;
    border-radius: 26px;
    padding: 10px 8px;
  }
  .nav button { width: 100%; padding: 11px 2px; font-size: 10px; }
  .fab { width: 100%; height: 50px; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .cols > .card { margin-bottom: 0; }
  .wide { grid-column: 1 / -1; }
  .sheet { border-radius: 26px; bottom: 50%; transform: translate(-50%, 60%) scale(.96); opacity: 0; }
  .sheet.on { transform: translate(-50%, 50%) scale(1); opacity: 1; }
}

/* ==================== v2 ==================== */

.sync-dot {
  width: 8px; height: 8px; border-radius: 9px;
  background: var(--faint); flex: none; margin-right: 2px;
  transition: background .25s;
}
.sync-dot.ok { background: var(--pos); }
.sync-dot.busy { background: var(--warn); animation: pulse 1s infinite; }
.sync-dot.bad { background: var(--neg); }
@keyframes pulse { 50% { opacity: .3; } }

.btn.rec-on { background: var(--neg); color: #fff; animation: pulse 1.2s infinite; }

/* --- bottles --- */
.bottle { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bottle:last-of-type { border-bottom: 0; }
.bottle-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.bottle-top b { font-size: 15px; font-weight: 700; }
.bottle-top span { margin-left: auto; font-weight: 700; font-size: 14px; letter-spacing: -.02em; }
.tr { height: 7px; border-radius: 9px; background: var(--line); overflow: hidden; margin-bottom: 5px; }
.tr > i { display: block; height: 100%; border-radius: 9px; background: var(--accent); transition: width .6s var(--spring); }
.tr.over > i { background: var(--neg); }

/* --- vision board --- */
.vision { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
.vcard {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 13px; cursor: pointer;
  transition: transform .18s var(--spring), border-color .18s;
}
.vcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.vcard b { display: block; font-size: 14px; margin-bottom: 6px; }
.vcard p { margin: 0 0 8px; }
.vemo { font-size: 27px; line-height: 1; margin-bottom: 8px; }

/* --- knowledge graph --- */
.graph-wrap { width: 100%; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.graph { width: 100%; height: auto; display: block; }
.graph line { stroke: var(--line); stroke-width: 1.4; }
.graph text { fill: var(--muted); font-size: 13px; text-anchor: middle; font-family: inherit; }
.graph .gn { cursor: pointer; }
.graph .gn:hover circle { stroke: var(--text); stroke-width: 2.5; }
.graph .gn:hover text { fill: var(--text); }

/* ==================== calm theme (Minimalist Phone school: text first, no noise) ==================== */

body.calm {
  --ink: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --line: #E4E1D9;
  --text: #14161A;
  --muted: #6E7278;
  --faint: #9DA1A6;
  --accent: #14161A;
  --accent-ink: #FFFFFF;
  --pos: #1B7F4A;
  --neg: #B4302A;
  --warn: #9A6A00;
  --shadow: 0 10px 30px rgba(0, 0, 0, .07);
  background-image: none;
  background: var(--ink);
}
body.calm .card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}
body.calm .dot { background: var(--text); box-shadow: none; }
body.calm .fab { box-shadow: none; }
body.calm .hero-amt { font-weight: 700; letter-spacing: -.045em; }
body.calm .card-h h2 { letter-spacing: .14em; font-weight: 600; }
body.calm .nav { background: rgba(255, 255, 255, .92); }
body.calm .row .ic { background: var(--surface-2); }
body.calm .toast { box-shadow: none; }
body.calm .bar > i, body.calm .tr > i { background: var(--text); }
body.calm .bar.over > i, body.calm .tr.over > i { background: var(--neg); }
body.calm .cat-line .tr > i { background: var(--text); }
body.calm .graph line { stroke: #D8D5CD; }

/* pie/share bar */
.pibar { display:flex; height:14px; border-radius:99px; overflow:hidden; gap:2px; background:var(--line); }
.pibar > i { display:block; height:100%; transition:flex .5s var(--spring); }
