/* Daily Journal: same dark purple glass look as the wallet app, mobile first. */
:root {
  --bg1: #0f0c29; --bg2: #302b63; --bg3: #24243e;
  --a1: #ff6ec4; --a2: #7873f5; --a3: #4ade80; --danger: #fb7185;
  --glass: rgba(255,255,255,.08); --line: rgba(255,255,255,.18);
  --muted: rgba(255,255,255,.68);
  --tab-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: #fff; line-height: 1.4; overflow-x: hidden;
  background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3)) fixed;
  min-height: 100vh;
}
.orb { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .35; z-index: 0; pointer-events: none; }
.orb.one { width: 300px; height: 300px; background: var(--a1); top: -90px; left: -90px; }
.orb.two { width: 340px; height: 340px; background: var(--a2); bottom: -120px; right: -100px; }

.view {
  position: relative; z-index: 1; max-width: 640px; margin: 0 auto;
  padding: 16px 16px calc(var(--tab-h) + 96px + env(safe-area-inset-bottom));
}
h1 { font-size: 1.4rem; margin: 4px 0 14px; background: linear-gradient(90deg, var(--a1), var(--a2), var(--a3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 1rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.muted { color: var(--muted); }
small, .small { font-size: .82rem; }
.up { color: var(--a3); } .down { color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 22px 0; }

.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.18);
  margin-bottom: 14px;
}
.label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* buttons and inputs */
button { font: inherit; color: #fff; cursor: pointer; }
.btn {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 14px; font-weight: 600;
  background: linear-gradient(90deg, var(--a1), var(--a2));
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.btn.danger { background: rgba(251,113,133,.18); border: 1px solid var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
.iconbtn { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: rgba(255,255,255,.08); font-size: 1.1rem; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--a3); outline-offset: 2px;
}
label.f, div.f { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
input, textarea {
  font: inherit; color: #fff; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid var(--line); outline: none;
}
textarea { resize: none; overflow: hidden; min-height: 120px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: rgba(255,255,255,.4); }
input[type="date"] { color-scheme: dark; }
.search { margin-bottom: 8px; }

/* segmented toggle */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: rgba(255,255,255,.08); border-radius: 14px; margin-bottom: 12px; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--muted); padding: 0 2px; font-size: .88rem; }
.seg.five button { font-size: .76rem; }
.seg.scroll { overflow-x: auto; grid-auto-columns: minmax(78px, 1fr); scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { white-space: nowrap; padding: 0 8px; }
.seg button[aria-pressed="true"] { color: #fff; background: linear-gradient(90deg, var(--a1), var(--a2)); }

/* day navigation */
.daynav { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center; margin-bottom: 12px; }
.daynav .datebtn { min-height: 52px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.1); font-weight: 700; padding: 4px 8px; line-height: 1.2; }
.daynav .datebtn small { display: block; font-weight: 400; color: var(--muted); }

/* mood */
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 1.7rem; padding: 0; line-height: 1; }
.mood[aria-pressed="true"] { background: linear-gradient(135deg, rgba(255,110,196,.45), rgba(120,115,245,.45)); border-color: var(--a2); box-shadow: 0 0 0 3px rgba(120,115,245,.3); }

/* quick add */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.quick .btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; }

/* entry cards */
.day { display: flex; justify-content: space-between; margin: 16px 2px 6px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; }
.entry { display: block; width: 100%; text-align: left; padding: 12px; margin-bottom: 10px; border-radius: 18px; min-height: 56px; }
.entry > span { display: block; }
.entry-top { display: flex !important; align-items: center; gap: 10px; }
.ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 auto; background: rgba(120,115,245,.25); }
.ico.k-note { background: rgba(251,191,36,.22); }
.ico.k-memory { background: rgba(255,110,196,.25); }
.ico.k-proof { background: rgba(74,222,128,.22); }
.ico.k-food { background: rgba(251,146,60,.25); }
.tx-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { color: var(--muted); font-size: .8rem; }
.amt { font-weight: 700; white-space: nowrap; color: var(--a3); }
.preview { margin: 8px 0 0; color: rgba(255,255,255,.85); font-size: .92rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
.thumbs { display: flex !important; gap: 6px; margin-top: 8px; overflow: hidden; }
.thumbs img, .thumbs .more { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: rgba(255,255,255,.1); }
.thumbs .more { display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.tagline { display: flex !important; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { padding: 1px 9px; border-radius: 99px; font-size: .74rem; background: rgba(120,115,245,.3); border: 1px solid var(--a2); }
.pin { color: #fbbf24; }

/* photo grid and viewer */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.08); }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; animation: slide .22s ease-out; }
.v-head, .v-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(20,17,50,.9); }
.v-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.v-foot .btn { flex: 1 1 90px; padding: 0 8px; font-size: .85rem; }
.v-info { flex: 1; min-width: 0; line-height: 1.25; }
.v-info b, .v-info small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; touch-action: pan-y; }
.v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(0,0,0,.45); font-size: 1.4rem; }
.v-nav.prev { left: 6px; } .v-nav.next { right: 6px; }

/* full-page sheets (editor, pickers) */
.sheet { position: fixed; inset: 0; z-index: 50; overflow-y: auto; overflow-x: hidden; background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3)); animation: slide .22s ease-out; }
.sheet-in { max-width: 640px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 0; background: rgba(20,17,50,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sheet-head h1 { margin: 0; flex: 1; font-size: 1.15rem; }
.sec { margin-bottom: 12px; }

/* time editor */
.time-show { display: block; width: 100%; text-align: center; font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 8px; letter-spacing: 1px; }
.time-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 12px; }
.tstep { min-height: 44px; padding: 0; font-size: .85rem; font-variant-numeric: tabular-nums; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.1); }
.tstep:nth-child(3) { margin-right: 6px; }
.tstep:nth-child(4) { margin-left: 6px; }

/* tags */
.chiplist { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chipbtn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--muted); font: inherit; font-size: .85rem; }
.chipbtn.on { color: #fff; border-color: var(--a2); background: rgba(120,115,245,.35); }

/* switch row */
.switch { display: flex; align-items: center; justify-content: space-between; min-height: 48px; width: 100%; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.08); text-align: left; }
.switch[aria-pressed="true"] { border-color: #fbbf24; background: rgba(251,191,36,.18); }

/* editor photos */
.ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.08); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph button { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 1.1rem; }
.ph button::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: rgba(0,0,0,.65); z-index: -1; }

/* amount steppers */
.amount-in { font-size: 2rem; font-weight: 700; text-align: center; min-height: 60px; }
.amt-steps { display: grid; grid-template-columns: repeat(4, 1fr) .8fr; gap: 4px; margin: 6px 0 12px; }
.astep { min-height: 44px; padding: 0; font-size: .85rem; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.1); font-variant-numeric: tabular-nums; }
.aclear { color: var(--danger); font-weight: 700; }

/* lists (wallet picker, settings) */
.pick-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; color: inherit; text-align: left; font: inherit; }
.pick-row + .pick-row { border-top: 1px solid rgba(255,255,255,.06); }
.pick-row small { display: block; color: var(--muted); }
.pick-row.on { background: rgba(120,115,245,.22); }
.pick-row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sec { padding: 10px 12px 4px; font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.pick-list { padding: 6px; }
.linked { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--a3); background: rgba(74,222,128,.12); }
.bar { height: 10px; border-radius: 10px; background: rgba(255,255,255,.1); overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--a1), var(--a2)); }
.stack { display: grid; gap: 8px; }

/* food: Today card, editor rows, Food tab */
.mealrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.mealchip { min-height: 60px; padding: 4px 2px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--muted); font-size: .76rem; line-height: 1.25; display: grid; place-items: center; align-content: center; }
.mealchip span { font-size: 1.3rem; line-height: 1.2; }
.mealchip[aria-pressed="true"] { color: #fff; border-color: var(--a3); background: rgba(74,222,128,.18); }
.drinks { display: grid; gap: 4px; margin-bottom: 10px; }
.drink { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.qbtn { min-width: 44px; min-height: 44px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.1); font-weight: 700; font-variant-numeric: tabular-nums; }
.qn { min-width: 32px; text-align: center; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
details.wf { margin-top: 12px; }
details.wf summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.wrow { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.wrow .grow b, .wrow .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow small { color: var(--muted); }
.wrow .btn { min-width: 60px; padding: 0 12px; }
.irow { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 6px; align-items: center; margin-bottom: 8px; }
.qty { display: flex; align-items: center; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big { font-size: 1.7rem; font-weight: 700; margin: 4px 0; }
.toprow { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); overflow-wrap: anywhere; }
.statgrid .toprow:first-of-type { border-top: 0; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin: 8px 0 4px; }
.bars i { flex: 1; min-height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(0deg, var(--a2), var(--a1)); }

/* fab + tab bar */
.fab {
  position: fixed; z-index: 20; right: 18px; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; font-size: 2rem; line-height: 1;
  background: linear-gradient(135deg, var(--a1), var(--a2)); box-shadow: 0 10px 28px rgba(120,115,245,.6);
}
.tabbar {
  position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(20,17,50,.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button { background: none; border: 0; display: grid; place-items: center; align-content: center; gap: 0; color: var(--muted); min-height: 48px; }
.tabbar button span { font-size: 1.3rem; line-height: 1.2; }
.tabbar button b { font-size: .68rem; font-weight: 600; }
.tabbar button[aria-current="page"] { color: #fff; }
.tabbar button[aria-current="page"] b { background: linear-gradient(90deg, var(--a1), var(--a2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.toast { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); max-width: 90vw; padding: 10px 16px; border-radius: 14px; background: #1b1840; border: 1px solid var(--a2); box-shadow: 0 8px 24px rgba(0,0,0,.5); }

@keyframes slide { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
