/* System fonts only: no web font download on expensive data. */
:root {
  --bg: #f8f3ec;
  --surface: #ffffff;
  --surface-2: #f1e9de;
  --text: #2b211a;
  --muted: #6e6056;
  --line: #e2d6c7;
  --accent: #a63d1c;
  --accent-text: #fff8f2;
  --good: #2d7a4b;
  --warn: #9a6200;
  --danger: #b3261e;
  --event: #2f6690;
  --hunger: #df7a2c;
  --energy: #d9a21b;
  --mood: #8a5fd0;
  --family: #2f9a62;
  --night: #1d2a4a;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161210;
    --surface: #211b17;
    --surface-2: #2b241f;
    --text: #f3ebe3;
    --muted: #b2a497;
    --line: #3b3029;
    --accent: #e2733f;
    --accent-text: #1b0f08;
    --good: #6cc391;
    --warn: #e3a83c;
    --danger: #f2877c;
    --event: #7db5e0;
    --hunger: #f0904a;
    --energy: #efbd3c;
    --mood: #a985ea;
    --family: #55c084;
    --night: #2b3a63;
  }
}

:root[data-theme="dark"] {
  --bg: #161210;
  --surface: #211b17;
  --surface-2: #2b241f;
  --text: #f3ebe3;
  --muted: #b2a497;
  --line: #3b3029;
  --accent: #e2733f;
  --accent-text: #1b0f08;
  --good: #6cc391;
  --warn: #e3a83c;
  --danger: #f2877c;
  --event: #7db5e0;
  --hunger: #f0904a;
  --energy: #efbd3c;
  --mood: #a985ea;
  --family: #55c084;
  --night: #2b3a63;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px 48px;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

.primary {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}

.primary:disabled { opacity: 0.6; }

.link {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--muted);
  text-decoration: underline;
}

/* Welcome ------------------------------------------------------------- */

.welcome {
  display: grid;
  gap: 14px;
  padding-top: 8vh;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome h1 { font-size: 40px; letter-spacing: -0.02em; }
.lede { font-size: 19px; }

#join {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

#join label { font-weight: 650; }

#join input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.hint { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }

/* Header -------------------------------------------------------------- */

.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }

.top {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -12px -16px 12px;
  padding: 10px 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.clock {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
}
.clock .sky-icon { grid-row: span 2; width: 26px; height: 26px; color: var(--energy); }
.clock .time { font-size: 22px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.clock .clock-day { font-size: 13px; color: var(--muted); }
.cash { display: flex; align-items: center; gap: 6px; font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cash .icon { color: var(--good); }
.weather { color: var(--muted); font-size: 13px; margin-top: 2px; }
.weather.raining { color: var(--event); font-weight: 600; }

/* Cards and scene ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.place { padding: 0; overflow: hidden; }

.scene-wrap { position: relative; line-height: 0; }
.scene { display: block; width: 100%; height: auto; aspect-ratio: 360 / 170; }
.scene-wrap.faded .scene { filter: grayscale(0.85) brightness(0.8); }

/* SVG people and things that take the theme's accent: you. */
.you-shirt, .you-mark, .you-door { fill: var(--accent); }
.rain { animation: rainfall 0.7s linear infinite; }
@keyframes rainfall { to { transform: translateY(170px); } }

.news { display: grid; gap: 6px; border-left: 4px solid var(--accent); }
.news p { font-size: 15px; }
.news .good { color: var(--good); }
.news .bad { color: var(--danger); }
.news .event { color: var(--event); font-weight: 600; }

/* Vitals --------------------------------------------------------------- */

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

.ring { position: relative; display: grid; justify-items: center; }
.ring-svg { width: 58px; height: 58px; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.ring-fill { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 400ms ease; }
.ring.hunger .ring-fill, .ring.hunger .ring-icon { stroke: var(--hunger); color: var(--hunger); }
.ring.energy .ring-fill, .ring.energy .ring-icon { stroke: var(--energy); color: var(--energy); }
.ring.mood .ring-fill, .ring.mood .ring-icon { stroke: var(--mood); color: var(--mood); }
.ring.family .ring-fill, .ring.family .ring-icon { stroke: var(--family); color: var(--family); }
.ring.critical .ring-fill { stroke: var(--danger); }
.ring.critical .ring-icon { color: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.ring-icon { position: absolute; top: 18px; width: 22px; height: 22px; }
.ring-value { font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.ring.low .ring-value { color: var(--warn); }
.ring.critical .ring-value { color: var(--danger); }
.ring-label { color: var(--muted); font-size: 12px; }

@keyframes pulse { 50% { transform: scale(1.15); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vitals .chips { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 10px 4px 8px;
  font-size: 13px;
  background: var(--surface);
}

.chip .icon { width: 15px; height: 15px; color: var(--muted); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.danger { border-color: var(--danger); color: var(--danger); font-weight: 600; }
.chip.good { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); color: var(--good); }
.chip.warn .icon, .chip.danger .icon, .chip.good .icon { color: inherit; }

/* Welcome form -------------------------------------------------------- */

#setup { display: grid; gap: 10px; margin-top: 12px; }
.field-label { font-weight: 650; }

#setup input[type="text"], #setup input:not([type]) , #username {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.choices { border: 0; padding: 0; margin: 6px 0 0; }
.choices legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }

.choice span {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-weight: 600;
}

.choice input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Today ------------------------------------------------------------------ */

.up-next {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
}

.up-next .icon { color: var(--accent); width: 16px; height: 16px; }

.news p { display: flex; align-items: flex-start; gap: 8px; }
.news p .icon { margin-top: 2px; width: 16px; height: 16px; }

.amt { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.in { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.amt.out { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.group { margin-bottom: 18px; }

.group > h3, .group h3:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 2px;
}

.group h3 .icon { width: 16px; height: 16px; }
.mini-label { color: var(--muted); font-size: 13px; margin: 0 0 6px 2px; }

.work-card {
  margin-bottom: 18px;
  padding: 14px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.work-head { display: flex; align-items: center; gap: 12px; }
.work-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); }
.work-icon .icon { width: 24px; height: 24px; }
.work-title { font-weight: 700; font-size: 17px; }
.work-employer { color: var(--muted); font-size: 13px; }
.shift-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }

.shift-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.shift-pill.done { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.shift-pill .icon { width: 14px; height: 14px; }
.work-go { display: grid; gap: 2px; text-align: center; }
.work-go small { font-weight: 500; opacity: 0.85; font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tiles.three, .tiles.modes { grid-template-columns: repeat(3, 1fr); }

.tile {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.tile:hover:not(:disabled) { border-color: var(--accent); }
.tile:active:not(:disabled) { transform: translateY(1px); }
.tile:disabled { cursor: default; background: transparent; }
.tile:disabled .tile-name { color: var(--muted); }
.tile:disabled:not(.done) .tile-icon { opacity: 0.45; }

.tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--mood) 15%, var(--surface));
  color: var(--mood);
}

.tile-icon .icon { width: 22px; height: 22px; }
.tile-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.tile-cost { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tile-stats { color: var(--muted); font-size: 12px; line-height: 1.3; }

.tile.eat .tile-icon { background: color-mix(in srgb, var(--hunger) 15%, var(--surface)); color: var(--hunger); }
.tile.routine .tile-icon { background: color-mix(in srgb, var(--event) 15%, var(--surface)); color: var(--event); }
.tile.hustle .tile-icon, .tile.money .tile-icon { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }
.tile.home .tile-icon { background: color-mix(in srgb, var(--night) 25%, var(--surface)); color: var(--event); }
.tile.travel .tile-icon { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }
.tile.done { border-style: dashed; }
.tile.done .tile-icon { background: var(--good); color: var(--bg); }

.mode .tile-icon { background: color-mix(in srgb, var(--event) 15%, var(--surface)); color: var(--event); }
.mode.boda .tile-icon, .mode.own-boda .tile-icon { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent); }
.mode.walk .tile-icon { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }

.trip { margin-top: 10px; }
.trip-to { font-weight: 650; margin: 0 0 6px 2px; }

.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; margin-bottom: 8px; }

.segmented button {
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.segmented button:hover { border-color: var(--accent); }
.trip-picker { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.trip-picker button { font-size: 13px; font-weight: 600; }
.trip-picker button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.ghost {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 14px; }
.hint.center, .center { text-align: center; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 400ms ease; }

[data-tab].ring { cursor: pointer; }

/* Phone call ----------------------------------------------------------- */

.phone-call {
  margin-bottom: 18px;
  padding: 20px 16px 16px;
  border-radius: 24px;
  background: linear-gradient(170deg, #1f2b46, #12192b);
  color: #f3f0ea;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.caller { display: flex; align-items: center; gap: 14px; }

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #e2733f;
  color: #1b0f08;
  font-weight: 800;
  font-size: 20px;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #6cc391;
  animation: ring 1.4s ease-out infinite;
}

@keyframes ring {
  from { transform: scale(0.9); opacity: 1; }
  to { transform: scale(1.25); opacity: 0; }
}

.incoming { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #9fd7b5; }
.incoming .icon { width: 14px; height: 14px; }
.phone-call h2 { font-size: 24px; }

.bubble {
  position: relative;
  margin: 16px 0 10px;
  padding: 12px 14px;
  border-radius: 4px 16px 16px 16px;
  background: rgba(255, 255, 255, 0.1);
}

.ask { font-size: 15px; margin-bottom: 14px; color: #d7d2c8; }
.ask strong { color: #fff; font-size: 18px; }

.answers { display: grid; gap: 8px; }

.answer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border: 0;
  border-radius: 99px;
  text-align: left;
}

.answer .act-detail { color: inherit; opacity: 0.85; flex-shrink: 0; }
.answer.full { background: #3f9f66; color: #fff; }
.answer.half { background: #e3a83c; color: #231705; }
.answer.none { background: rgba(255, 255, 255, 0.08); color: #ffb3aa; border: 1px solid rgba(255, 140, 130, 0.5); }
.answer:disabled { opacity: 0.4; cursor: default; }


/* Family ----------------------------------------------------------------- */

.family-head { display: flex; align-items: center; gap: 16px; }
.family-head .ring { flex-shrink: 0; }
.family-head h2 { font-size: 20px; margin-bottom: 4px; }
.event-card { margin-bottom: 0; display: grid; gap: 6px; }
.event-when { display: flex; align-items: center; gap: 6px; color: var(--event); font-weight: 650; font-size: 14px; }
.event-when .icon { width: 16px; height: 16px; }
.event-title { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
.event-card .primary { margin-top: 6px; }

.member { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 12px; }
.member-avatar { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; background: color-mix(in srgb, var(--family) 20%, var(--surface)); color: var(--family); font-weight: 800; }
.member-text { min-width: 0; flex: 1; }
.member-name { font-weight: 650; }
.member .muted { font-size: 13px; }
.amounts { display: flex; gap: 6px; }

.amounts button {
  min-width: 44px;
  padding: 8px 8px;
  border: 1px solid color-mix(in srgb, var(--family) 45%, var(--line));
  border-radius: 99px;
  background: var(--surface);
  color: var(--family);
  font-weight: 700;
  font-size: 13px;
}

.amounts button:hover:not(:disabled) { background: var(--family); color: var(--bg); }
.amounts button:disabled { opacity: 0.4; cursor: default; }

/* Goals ------------------------------------------------------------------ */

.dream h2 { font-size: 22px; margin: 4px 0; }
.dream-cash { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; }
.dream-cash .icon { color: var(--good); }

.goal-ladder { list-style: none; margin: 0 0 18px; padding: 0; }
.goal-step { position: relative; display: flex; gap: 12px; }
.goal-step:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: -4px; width: 2px; background: var(--line); }
.goal-step.done:not(:last-child)::before { background: var(--good); }

.goal-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.goal-dot .icon { width: 18px; height: 18px; }
.goal-step.done .goal-dot { background: var(--good); border-color: var(--good); color: var(--bg); }
.goal-step.ready .goal-dot { border-color: var(--accent); color: var(--accent); }
.goal-card { flex: 1; min-width: 0; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.goal-top h3 { font-size: 16px; margin: 0; text-transform: none; letter-spacing: 0; color: var(--text); }
.goal-cost { font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.goal-card .muted { margin-top: 4px; }
.goal-done { display: flex; align-items: center; gap: 4px; color: var(--good); font-weight: 650; margin-top: 8px; }
.goal-done .icon { width: 16px; height: 16px; }
.career .up-next { margin-top: 8px; }
.profile { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }

/* Diary ------------------------------------------------------------------ */

.diary { display: grid; gap: 8px; }

.day {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.day summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.day summary::-webkit-details-marker { display: none; }
.day-name { flex: 1; font-weight: 700; }
.day-name small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.day-money { display: flex; gap: 4px; }
.day-chevron { color: var(--muted); transition: transform 200ms ease; }
.day[open] .day-chevron { transform: rotate(90deg); }
.day[open] summary { border-bottom: 1px solid var(--line); }

.entries { list-style: none; margin: 0; padding: 8px 14px 12px; }

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 44px 28px 1fr;
  gap: 8px;
  padding: 6px 0;
}

.entry:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 65px;
  top: 32px;
  bottom: -6px;
  width: 2px;
  background: var(--line);
}

.entry time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 5px; }

.entry-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.entry-dot .icon { width: 15px; height: 15px; }
.entry.good .entry-dot { background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--good); }
.entry.bad .entry-dot { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.entry.event .entry-dot { background: color-mix(in srgb, var(--event) 18%, var(--surface)); color: var(--event); }
.entry-body { min-width: 0; padding-top: 3px; }
.entry-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.entry-text { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }

/* Tabs ------------------------------------------------------------------- */

/* Room for the tab bar and the City Guide button. */
main { padding-bottom: 150px; }

.tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 560px;
  transform: translateX(-50%);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

.tabs[hidden] { display: none; }

.tabs button {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tabs button .icon { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.badge { position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

/* Ending --------------------------------------------------------------- */

.ending { padding: 0; overflow: hidden; }
.ending-body { padding: 16px; }
.ending h2 { font-size: 28px; margin-bottom: 8px; }
.ending.won h2 { color: var(--good); }
.ending.lost h2 { color: var(--danger); }

.ending dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 16px 0;
}

.ending dt { color: var(--muted); }
.ending dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }


.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .tiles.modes, .tiles.three { grid-template-columns: repeat(2, 1fr); }
  .member { flex-wrap: wrap; }
  .ring-svg { width: 50px; height: 50px; }
  .ring-icon { top: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .rain, .avatar::after, .ring.critical .ring-icon, .drive, .cloud, .bell.ringing .icon, .guide-fab, .chat-msg, .chat-note, .typing i, .sheet { animation: none; }
  .ring-fill, .bar span, .toast, .day-chevron { transition: none; }
}

.act-label { font-weight: 650; }
.act-detail { font-size: 13px; }

/* Sections: one part of the day at a time ----------------------------------- */

.section-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.section-head { display: flex; align-items: center; gap: 12px; }

.section-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

.section-icon .icon { width: 24px; height: 24px; }
.section-titles { flex: 1; min-width: 0; }
.section-titles h2 { font-size: 20px; }
.section-time { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.section-time .icon { width: 14px; height: 14px; }
.section-time { flex-wrap: wrap; }
.section-time b { color: var(--text); font-weight: 650; white-space: nowrap; }
.section-time .left::before { content: "·"; margin: 0 4px 0 2px; color: var(--muted); font-weight: 400; }

.pick-hint {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.section-intro {
  margin: 12px 0 14px;
  font-size: 16px;
  line-height: 1.5;
}

.section-card .tiles + .tiles, .section-card .tiles + .trip-to { margin-top: 8px; }
.section-card .work-go { margin-bottom: 8px; }
.work-go span { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }

.via { display: grid; gap: 6px; margin-top: 10px; }

.via-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 14px;
}

.via-btn span { flex: 1; font-weight: 600; }
.via-btn small { color: var(--muted); }
.via-btn .icon { color: var(--good); width: 18px; height: 18px; }
.via-btn:hover { border-color: var(--accent); }

.section-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.skip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-weight: 650;
  font-size: 14px;
}

.skip .icon { width: 16px; height: 16px; }
.skip.continue { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.section-foot small { color: var(--muted); font-size: 12px; }

.tile-flag {
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--good) 16%, transparent);
  color: var(--good);
}

.tile.risky .tile-flag { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tile.late .tile-flag { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.segmented button { display: grid; gap: 1px; }
.segmented button small { color: var(--muted); font-size: 11px; font-weight: 500; }

.also { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 16px; }
.also .mini-label { margin: 0 4px 0 2px; }

.also-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}

.also-chip .icon { width: 15px; height: 15px; color: var(--accent); }
.also-chip small { color: var(--muted); font-weight: 500; }

.quiet { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* What just happened --------------------------------------------------------- */

.news { display: grid; gap: 10px; }
.news-item { display: flex; gap: 10px; }
.news-icon { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.news-icon .icon { width: 16px; height: 16px; }
.news-item.good .news-icon { color: var(--good); }
.news-item.bad .news-icon { color: var(--danger); }
.news-item.event .news-icon { color: var(--event); }
.news-title { font-weight: 650; }
.news-text { color: var(--muted); font-size: 14px; line-height: 1.45; margin-top: 2px; }

/* Bills ---------------------------------------------------------------------- */

.bills { display: grid; gap: 12px; }
.bill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bill-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--event); flex-shrink: 0; }
.bill-icon .icon { width: 18px; height: 18px; }
.bill-text { flex: 1; min-width: 120px; }
.bill-text p:first-child { font-weight: 650; }
.bill-status { color: var(--muted); font-size: 13px; }
.bill-status.warn { color: var(--warn); }
.bill-status.danger { color: var(--danger); font-weight: 600; }
.bill-actions { display: flex; gap: 6px; }

.bill-btn {
  display: grid;
  justify-items: center;
  min-width: 64px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
}

.bill-btn small { color: var(--muted); font-weight: 500; font-size: 11px; }
.bill-btn:hover:not(:disabled) { border-color: var(--accent); }
.bill-btn:disabled { opacity: 0.45; cursor: default; }

/* More, today so far, time breakdown ----------------------------------------- */

.more { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px; }
.more summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; list-style: none; font-weight: 650; }
.more summary::-webkit-details-marker { display: none; }
.more summary small { color: var(--muted); font-weight: 500; flex: 1; }
.more-chevron { color: var(--muted); transition: transform 200ms ease; }
.more[open] .more-chevron { transform: rotate(90deg); }
.more[open] { padding-bottom: 12px; }
.more .tiles + .tiles { margin-top: 8px; }

.report { padding: 14px; }
.report .entries, .day-body .entries { padding: 8px 0 0; }
.day-body { padding: 12px 14px; }

.time-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.time-bar .tk { display: block; height: 100%; }
.time-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 8px 0 4px; padding: 0; font-size: 12px; color: var(--muted); }
.time-legend li { display: inline-flex; align-items: center; gap: 4px; }
.time-legend b { color: var(--text); font-weight: 650; }
.time-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.tk.sleep { background: var(--night); }
.tk.work { background: var(--accent); }
.tk.travel { background: var(--event); }
.tk.food { background: var(--hunger); }
.tk.routine { background: var(--energy); }
.tk.faith { background: var(--mood); }
.tk.leisure { background: var(--good); }
.tk.family { background: var(--family); opacity: 0.6; }
.entry-title small { color: var(--muted); font-weight: 500; font-size: 12px; }

/* Goals: remove, add, ask ------------------------------------------------------ */

.icon-btn {
  width: 28px;
  height: 28px;
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.icon-btn:hover { border-color: var(--danger); color: var(--danger); }
.goal-top .goal-cost { margin-left: auto; }
.cat-chip { padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-weight: 600; font-size: 14px; }
.cat-chip small { color: var(--muted); font-weight: 500; }
.cat-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.cat-chip[aria-pressed="true"] small { color: inherit; }
.group .chips-select { margin-bottom: 10px; }
.goal-add .tile-stats { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.request { margin-top: 12px; display: grid; gap: 10px; }
.request .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.request-form { display: grid; gap: 10px; }
.request-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }

.request-form input, .request-form select, .request-form textarea,
.sched-form input, .sched-form select, .chat-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.row-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.requests { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.requests li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.requests small { color: var(--muted); }
.requests li.added small { color: var(--good); font-weight: 600; }
.requests li.declined small { color: var(--danger); }

/* Motion ----------------------------------------------------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(0.96); opacity: 0.2; } }
@keyframes fold { to { opacity: 0; transform: translateY(-10px) scale(0.98); } }

.enter { animation: rise 360ms cubic-bezier(.2, .8, .2, 1) both; }
.section-card.enter .tile, .section-card.enter .via-btn, .section-card.enter .work-go, .section-card.enter .segmented button {
  animation: rise 360ms cubic-bezier(.2, .8, .2, 1) both;
}
.section-card.enter .tile:nth-child(2) { animation-delay: 50ms; }
.section-card.enter .tile:nth-child(3) { animation-delay: 100ms; }
.section-card.enter .tile:nth-child(4) { animation-delay: 150ms; }
.section-card.enter .tile:nth-child(5) { animation-delay: 200ms; }
.section-card.enter .tile:nth-child(n + 6) { animation-delay: 250ms; }

.tile, .bill-btn, .via-btn, .skip, .segmented button, .also-chip {
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 200ms ease;
}

.tile:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); transform: translateY(-2px); }
.tile:active:not(:disabled), .bill-btn:active, .via-btn:active, .skip:active, .segmented button:active { transform: scale(0.97); }

.chosen { animation: pop 280ms ease forwards; border-color: var(--accent) !important; }
.section-card.picking :is(.tile, .via-btn):not(.chosen) { opacity: 0.55; }
.section-card.leaving { animation: fold 280ms ease forwards; }

@media (prefers-reduced-motion: reduce) {
  .enter, .section-card.enter *, .chosen, .section-card.leaving { animation: none !important; }
  .tile, .bill-btn, .via-btn, .skip, .segmented button, .also-chip, .more-chevron { transition: none; }
}

/* Tagline -------------------------------------------------------------------- */

.tagline {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent);
}

/* More tab --------------------------------------------------------------------- */

.page-title { font-size: 22px; margin: 4px 2px 12px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
}

.menu { padding: 4px 0; }

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}

.menu-row:last-child { border-bottom: 0; }
.menu-row > .icon:first-child { color: var(--accent); width: 22px; height: 22px; }
.menu-row span { flex: 1; display: grid; font-weight: 650; }
.menu-row small { color: var(--muted); font-weight: 500; font-size: 13px; }
.menu-row > .icon:last-child { color: var(--muted); }

/* The phones ------------------------------------------------------------------ */

.phone-frame { margin: 0 auto 14px; }

.kabiriti {
  width: 150px;
  padding: 16px 14px 18px;
  border-radius: 26px 26px 34px 34px;
  background: linear-gradient(160deg, #3a3a40, #1d1d22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.kabiriti-screen {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 6px;
  background: #9fbf7a;
  color: #1f2a14;
  font-family: ui-monospace, Menlo, monospace;
  text-align: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.kabiriti-screen b { font-size: 22px; }
.kabiriti-screen span { font-size: 10px; }
.kabiriti-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }

.kabiriti-keys i {
  display: grid;
  place-items: center;
  height: 22px;
  border-radius: 8px;
  background: #4a4a52;
  color: #e9e6df;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}

.smart {
  max-width: 340px;
  padding: 14px 12px 20px;
  border: 8px solid #1d1d22;
  border-radius: 32px;
  background: linear-gradient(170deg, #26334f, #4a2f4f 70%, #a63d1c);
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

.phone-status { display: flex; justify-content: space-between; font-size: 12px; font-weight: 650; padding: 0 6px 12px; }
.phone-status span { display: inline-flex; align-items: center; gap: 4px; }
.phone-status .icon { width: 13px; height: 13px; }
.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.apps.flat { margin-bottom: 14px; }

.app {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
  transition: transform 140ms ease;
}

.smart .app { border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; }
.app:active:not(:disabled) { transform: scale(0.95); }
.app:disabled { opacity: 0.5; cursor: default; }
.app-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
.smart .app-icon { background: rgba(255, 255, 255, 0.92); color: #a63d1c; }
.app-icon .icon { width: 22px; height: 22px; }
.app-name { font-size: 13px; font-weight: 650; line-height: 1.2; }
.app small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.smart .app small { color: rgba(255, 255, 255, 0.75); }
.phone-goal .bar { margin: 8px 0; }

.phone-hint, .phone-goal { margin-bottom: 18px; }

/* Goal savings ------------------------------------------------------------------ */

.dream-money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.dream-money p { display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.dream-money span { display: grid; font-size: 12px; color: var(--muted); }
.dream-money b { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.dream-money .icon { color: var(--good); }

.saved-line { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.saved-line b { color: var(--good); }
.bar.two { display: flex; margin: 6px 0 10px; }
.bar.two span { border-radius: 0; }
.bar.two .pot { background: var(--good); }
.bar.two .wallet { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, transparent) 0 4px, transparent 4px 8px); }

.save-form { display: grid; gap: 6px; margin-bottom: 10px; }
.save-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }

.save-row input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.save-btn, .take-btn { padding: 9px 12px; border-radius: 10px; font-weight: 650; font-size: 14px; border: 1px solid var(--line); background: var(--surface); }
.save-btn { background: var(--good); border-color: var(--good); color: var(--bg); }
.save-btn:disabled, .take-btn:disabled { opacity: 0.45; cursor: default; }
.fill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fill-chips button { padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; background: transparent; font-size: 12px; font-weight: 600; color: var(--muted); }
.fill-chips button:hover { color: var(--text); border-color: var(--accent); }

/* Phone animations ------------------------------------------------------------ */

.kabiriti-screen, .smart { position: relative; overflow: hidden; }

.phone-anim {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 8px;
  text-align: center;
  animation: rise 220ms ease both;
}

.kabiriti-screen .phone-anim, .is-kabiriti .phone-anim { background: #9fbf7a; color: #1f2a14; font-family: ui-monospace, Menlo, monospace; }
.smart .phone-anim, .is-smart .phone-anim { background: linear-gradient(170deg, #26334f, #4a2f4f); color: #fff; border-radius: 18px; }
.phone-anim b { font-size: 12px; }
.smart .phone-anim b { font-size: 16px; }

.anim-envelope { display: inline-flex; animation: fly 1.1s ease-in-out both; }
.anim-envelope .icon { width: 26px; height: 26px; }
@keyframes fly { 0% { transform: translateX(-30px) scale(0.8); opacity: 0; } 40% { transform: none; opacity: 1; } 75% { transform: translateX(10px); } 100% { transform: translateX(60px) translateY(-20px) scale(0.6); opacity: 0; } }

.anim-done { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; opacity: 0; animation: appear 300ms ease 1.1s forwards; }
.anim-done .icon { width: 12px; height: 12px; }
@keyframes appear { to { opacity: 1; } }

.anim-dots { display: inline-flex; gap: 4px; }
.anim-dots em { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 900ms ease-in-out infinite; }
.anim-dots em:nth-child(2) { animation-delay: 150ms; }
.anim-dots em:nth-child(3) { animation-delay: 300ms; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.anim-caller {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 800;
}

.kabiriti-screen .anim-caller, .is-kabiriti .anim-caller { background: #1f2a14; color: #9fbf7a; }
.smart .anim-caller, .is-smart .anim-caller { background: #e2733f; color: #1b0f08; }
.anim-caller::before, .anim-caller::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #1f2a14; animation: ring 1.1s ease-out infinite; }
.smart .anim-caller::before, .smart .anim-caller::after, .is-smart .anim-caller::before, .is-smart .anim-caller::after { border-color: #6cc391; }
.anim-caller::after { animation-delay: 0.5s; }

.anim-snake { position: relative; display: flex; gap: 1px; width: 100%; height: 8px; }
.anim-snake em { width: 7px; height: 7px; background: #1f2a14; animation: slither 1.4s steps(14) infinite; }
@keyframes slither { from { transform: translateX(-40px); } to { transform: translateX(70px); } }
.anim-food { width: 6px; height: 6px; background: #1f2a14; justify-self: end; margin-right: 10px; animation: blink 500ms steps(2) infinite; }

.anim-feed { display: grid; gap: 5px; width: 80%; height: 60px; overflow: hidden; }
.anim-feed em { height: 14px; border-radius: 4px; background: rgba(255, 255, 255, 0.3); animation: feed 1.3s linear infinite; }
.anim-feed em:nth-child(odd) { width: 70%; }
@keyframes feed { from { transform: translateY(20px); } to { transform: translateY(-40px); } }

.anim-progress { width: 70%; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.anim-progress em { display: block; height: 100%; background: #6cc391; animation: fill 1.3s ease-out forwards; }
@keyframes fill { from { width: 0; } to { width: 100%; } }

/* The pop-up phone when the action came from Today. */
.phone-pop {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 10;
  width: 150px;
  padding: 14px 12px 22px;
  transform: translateX(-50%);
  border-radius: 24px 24px 30px 30px;
  background: linear-gradient(160deg, #3a3a40, #1d1d22);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  animation: pop-in 260ms cubic-bezier(.2, .8, .2, 1) both;
}

.phone-pop.is-smart { width: 170px; padding: 10px; border-radius: 26px; border: 6px solid #1d1d22; background: #26334f; }
.phone-pop-screen { position: relative; height: 110px; border-radius: 6px; overflow: hidden; }
.phone-pop.leaving { animation: pop-out 260ms ease forwards; }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 30px) scale(0.9); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pop-out { to { opacity: 0; transform: translate(-50%, 30px) scale(0.9); } }

/* Create account / log in ------------------------------------------------------- */

.auth { padding-top: 4vh; }
.auth-card { padding: 16px; margin-top: 8px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 99px; background: var(--surface-2); }
.auth-tabs button { padding: 10px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-weight: 650; }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
#auth { display: grid; gap: 8px; }

#auth input, .password-box input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.password-field { position: relative; display: flex; align-items: center; }
.reveal { position: absolute; right: 8px; padding: 6px; border: 0; background: none; color: var(--muted); }
#auth .primary { margin-top: 8px; background: var(--good); color: var(--bg); }

/* Gigs ---------------------------------------------------------------------------- */

.gigs { display: grid; gap: 12px; }
.gig { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; }
.gig + .gig { padding-top: 12px; border-top: 1px solid var(--line); }
.gig-time { display: grid; text-align: center; font-variant-numeric: tabular-nums; }
.gig-time small { color: var(--muted); font-size: 11px; }
.gig-title { font-weight: 650; }
.gig .muted { font-size: 13px; }
.gig-warn { display: flex; gap: 4px; align-items: center; margin-top: 4px; color: var(--warn); font-size: 12px; font-weight: 600; }
.gig-warn .icon { width: 14px; height: 14px; }
.gig-go { padding: 8px 14px; border: 0; border-radius: 99px; background: var(--good); color: var(--bg); font-weight: 700; }
.gig-status { color: var(--muted); font-size: 12px; max-width: 90px; text-align: right; }
.gig.done { opacity: 0.6; }
.gig.live .gig-time b { color: var(--good); }

/* Account ------------------------------------------------------------------------- */

.account { display: grid; gap: 6px; }
.account-name { font-weight: 700; font-size: 17px; }
.password-box summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; }
#password-form { display: grid; gap: 8px; margin-top: 8px; }
.account-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.logout { width: auto; display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* Header bell: gigs posted and bills due ------------------------------------- */

.top-row .clock { flex: 1; }
.bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}
.bell .icon { width: 20px; height: 20px; }
.bell.ringing .icon { color: var(--accent); transform-origin: 50% 10%; animation: ring-bell 2.4s ease-in-out infinite; }
.bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
@keyframes ring-bell { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 82% { transform: rotate(-12deg); } 89% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }

/* Place card: the picture, where you are on it, and your stats under it ------------ */

.place-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 20px);
  padding: 5px 10px 5px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, #14100d 62%, transparent);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.place-tag .icon { width: 14px; height: 14px; }
.place-tag small { margin-left: 4px; font-weight: 500; opacity: 0.8; }

.place .vitals { padding: 8px 10px 10px; }
.place .rings { gap: 2px; }
.place .ring-svg { width: 40px; height: 40px; }
.place .ring-icon { top: 11px; width: 18px; height: 18px; }
.place .ring-value { font-size: 13px; margin-top: 0; }
.place .ring-label { font-size: 11px; line-height: 1.1; }
.place .vitals .chips { margin-top: 8px; padding-top: 8px; gap: 4px; }
.place .chip { padding: 3px 8px; font-size: 12px; }
.place .chip .icon { width: 13px; height: 13px; }

/* My schedule ---------------------------------------------------------------- */

.head-link { margin-left: auto; font-size: 14px; font-weight: 650; text-transform: none; letter-spacing: 0; }
.sched-list { list-style: none; padding: 4px 12px; display: grid; }
.sched-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sched-row:last-child { border-bottom: 0; }
.sched-row time { width: 44px; flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.sched-icon { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--surface-2); color: var(--accent); }
.sched-icon .icon { width: 16px; height: 16px; }
.sched-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sched-text b { font-weight: 650; }
.sched-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-status { color: var(--muted); font-size: 12px; font-weight: 650; }
.sched-row.now { margin: 0 -12px; padding: 9px 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sched-row.now .sched-status { color: var(--accent); }
.sched-row.now .sched-icon { animation: pulse 1.6s ease-in-out infinite; }
.sched-row.done { opacity: 0.6; }
.sched-row.done .sched-icon { color: var(--good); }
.sched-row.missed .sched-status { color: var(--warn); }
.sched-go { padding: 7px 14px; border: 0; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-weight: 700; }
.sched-tools { display: flex; }
.sched-tools .icon-btn { display: grid; place-items: center; width: 34px; height: 34px; }
.sched-tools .icon-btn .icon { width: 16px; height: 16px; }
.sched-tools .icon-btn:first-child:hover { border-color: var(--accent); color: var(--accent); }
.sched-row.editing { display: block; }
.sched-row.editing .sched-form { margin: 4px 0; border-color: var(--accent); }
.sched-empty p { color: var(--muted); }
.sched-empty-actions { display: flex; gap: 8px; margin-top: 10px; }
.ghost.small { width: auto; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-style: solid; color: var(--text); font-weight: 600; font-size: 14px; }
.ghost.wide { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 18px; }
.sched-form { display: grid; gap: 10px; }
.sched-form label { display: grid; gap: 4px; font-size: 14px; }
.sched-form select, .sched-form input { min-height: 44px; }
.sched-form fieldset { display: grid; gap: 10px; margin: 0; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius); }
.sched-form fieldset[hidden] { display: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.form-actions .ghost { width: auto; padding: 10px 16px; }
.form-actions .primary { width: auto; padding: 10px 18px; }
.bills-due .bills { border-color: var(--danger); }

/* Sheets: notifications and the City Guide ---------------------------------------- */

body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.42);
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--bg);
  overflow: auto;
  animation: sheet-up 260ms cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 14px 0 10px; background: var(--bg); }
.sheet-head h2 { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 19px; }
.sheet-head .icon-btn { display: grid; place-items: center; width: 36px; height: 36px; }
.notices { list-style: none; margin: 0; padding: 0 0 8px; display: grid; gap: 8px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.notice.new { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.notice.urgent { border-color: var(--danger); }
.notice-icon { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--surface-2); color: var(--accent); }
.notice.bill .notice-icon { color: var(--warn); }
.notice.urgent .notice-icon { color: var(--danger); }
.notice-text { flex: 1; min-width: 0; }
.notice-title { font-weight: 650; }
.notice-when { color: var(--muted); font-size: 13px; }
.notice .ghost.small, .notice .gig-go { align-self: center; }
.notices-empty { padding: 24px 0; }

/* City Guide ------------------------------------------------------------------- */

.guide-fab {
  position: fixed;
  right: max(16px, calc(50% - 264px));
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px 11px 13px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 750;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  animation: fab-in 400ms cubic-bezier(.2, .8, .2, 1) both, fab-breathe 3.2s ease-in-out 1s infinite;
}
.guide-fab[hidden] { display: none; }
.guide-fab .icon { width: 20px; height: 20px; }
@keyframes fab-in { from { transform: translateY(20px) scale(0.8); opacity: 0; } }
@keyframes fab-breathe { 50% { box-shadow: 0 6px 18px rgb(0 0 0 / 0.22), 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); } }
.toast { z-index: 6; bottom: 136px; }

.guide-sheet { height: 86vh; overflow: hidden; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.guide-head p { color: var(--muted); font-size: 13px; }
.guide-head h2 { font-size: 18px; }
.guide-head div { flex: 1; }
.guide-avatar, .chat-avatar { display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
.guide-avatar { width: 40px; height: 40px; }
.guide-avatar .icon { width: 22px; height: 22px; }
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 12px; overscroll-behavior: contain; }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; animation: rise 280ms cubic-bezier(.2, .8, .2, 1) both; }
.chat-msg p { padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.theirs p { border: 1px solid var(--line); border-bottom-left-radius: 4px; background: var(--surface); }
.chat-msg.mine { align-self: flex-end; }
.chat-msg.mine p { border-bottom-right-radius: 4px; background: var(--accent); color: var(--accent-text); }
.chat-msg.pending p { opacity: 0.7; }
.chat-avatar { width: 28px; height: 28px; }
.chat-avatar .icon { width: 15px; height: 15px; }
.chat-note { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); font-size: 13px; font-weight: 650; animation: rise 280ms cubic-bezier(.2, .8, .2, 1) both; }
.chat-note .icon { width: 14px; height: 14px; }
.chat-error { align-self: center; color: var(--danger); font-size: 13px; text-align: center; }
.typing p { display: flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
.chat-suggest { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chat-suggest[hidden] { display: none; }
.chip-btn { flex-shrink: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-btn:hover { border-color: var(--accent); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; width: auto; min-width: 0; border-radius: 99px; padding-left: 16px; background: var(--surface); }
.send { display: grid; place-items: center; width: 46px; height: 46px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
.send:disabled { opacity: 0.5; }
.chat-left { color: var(--muted); font-size: 12px; text-align: center; margin-top: 6px; min-height: 1em; }

/* Scenes in motion: traffic on the road, clouds drifting --------------------------- */

.drive { animation: drive-east 12s linear infinite; }
.drive.west { animation-name: drive-west; }
.drive.d1 { animation-duration: 9s; animation-delay: -3s; }
.drive.d2 { animation-duration: 14s; animation-delay: -9s; }
.drive.d3 { animation-duration: 11s; animation-delay: -6s; }
.drive.d4 { animation-duration: 16s; animation-delay: -1s; }
.drive.boda { animation-duration: 7s; }
@keyframes drive-east { from { transform: translateX(-440px); } to { transform: translateX(440px); } }
@keyframes drive-west { from { transform: translateX(440px); } to { transform: translateX(-440px); } }
.cloud { animation: drift 60s linear infinite alternate; }
.cloud.c2 { animation-duration: 80s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }
@media (prefers-reduced-motion: reduce) { .sched-row.now .sched-icon { animation: none; } }

/* Bank and loans --------------------------------------------------------------- */

.bank { display: grid; gap: 10px; }
.bank-head { display: flex; align-items: center; gap: 10px; }
.bank-name { font-weight: 700; }
.loan-status { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.loan-status.soon { box-shadow: inset 3px 0 0 var(--warn); }
.loan-status.late { box-shadow: inset 3px 0 0 var(--danger); }
.loan-status.late b { color: var(--danger); }
.bank-note { display: flex; gap: 6px; align-items: flex-start; }
.bank-note .icon { margin-top: 2px; }

/* Connection and updates: a quiet pill while the server restarts, a nudge when a release lands. */

.net-status {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  padding: 8px 8px 8px 14px;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.2);
  animation: rise 240ms cubic-bezier(.2, .8, .2, 1) both;
}
.net-status[hidden] { display: none; }
.net-status .icon { width: 16px; height: 16px; color: var(--energy); }
.net-status button { margin-left: 4px; padding: 5px 12px; border: 0; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-weight: 700; }
.net-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .net-status, .net-spin { animation: none; } }

/* The logo, and the boda riding past under it ------------------------------------- */

.brand { display: grid; justify-items: center; gap: 4px; text-align: center; }
.brand + .tagline { text-align: center; }
.logo { display: grid; justify-items: center; gap: 10px; margin: 0; }
.logo-mark { width: 68px; height: 68px; filter: drop-shadow(0 6px 14px rgb(166 61 28 / 0.28)); }
.logo-sky { fill: var(--accent); }
.logo-name { font-size: 42px; font-weight: 850; letter-spacing: -0.035em; line-height: 1; }
.logo-name em { position: relative; font-style: normal; color: var(--accent); }
.logo-name em::after {
  content: '';
  position: absolute;
  left: 2%;
  right: -2%;
  bottom: -7px;
  height: 5px;
  border-radius: 99px;
  background: var(--energy);
  transform: rotate(-2deg);
}

.boda-ride { display: block; width: 100%; max-width: 420px; height: auto; margin-top: 6px; overflow: hidden; }
.ride-road { stroke: var(--line); stroke-width: 2; }
.ride-dash { stroke: var(--line); stroke-width: 1.4; stroke-dasharray: 10 12; }
.ride-shadow { fill: rgb(0 0 0 / 0.14); }
.ride-dust { fill: var(--muted); opacity: 0.35; }
.ride { animation: ride-west 6.5s linear infinite; }
@keyframes ride-west { from { transform: translateX(260px); } to { transform: translateX(-260px); } }
.ride-bob { animation: bob 0.32s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-1.3px); } }
.spokes { transform-box: fill-box; transform-origin: center; animation: spin 0.45s linear infinite; }
.ride-dust circle { animation: dust 0.9s ease-out infinite; }
.ride-dust circle:nth-child(2) { animation-delay: 0.3s; }
.ride-dust circle:nth-child(3) { animation-delay: 0.6s; }
@keyframes dust { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .ride, .ride-bob, .spokes, .ride-dust circle { animation: none; }
}
