* { box-sizing: border-box; margin: 0; }
/* The HTML hidden attribute loses to any author display rule (e.g. the old
   #nav{display:flex} kept the nav visible on the login page). Make it win. */
[hidden] { display: none !important; }
:root {
  --bg: #0b1220; --card: #141d31; --text: #e8edf7; --muted: #8b97ad;
  --accent: #34d399; --danger: #f87171; --warn: #fbbf24; --line: #24304a;
}
body { background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, sans-serif; min-height: 100vh; }
#topbar { display: flex; justify-content: space-between; align-items: center;
  gap: .8rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10; }
.brand { font-weight: 700; white-space: nowrap; }
/* nowrap + scroll: five links no longer wrap under the brand on phones */
#nav { display: flex; gap: .9rem; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a { color: var(--muted); text-decoration: none; font-size: .9rem;
  white-space: nowrap; padding: .15rem 0; }
#nav a:hover { color: var(--text); }
#nav a.active { color: var(--accent); font-weight: 600;
  border-bottom: 2px solid var(--accent); }
main { padding: 1rem; max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
h2 { margin-bottom: .8rem; font-size: 1.15rem; }
input, select, button, textarea { width: 100%; padding: .65rem .8rem;
  margin-bottom: .6rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 1rem; }
button { background: var(--accent); color: #06281c; font-weight: 700;
  border: none; cursor: pointer; }
button.secondary { background: var(--card); color: var(--text);
  border: 1px solid var(--line); }
button.danger { background: var(--danger); color: #2b0606; }
label { display: block; font-size: .85rem; color: var(--muted);
  margin-bottom: .15rem; }
.row { display: flex; gap: .6rem; }
.row > * { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem;
  margin-bottom: 1rem; }
@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
.tile { background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: .8rem; }
.tile .v { font-size: 1.3rem; font-weight: 700; }
.tile .l { font-size: .75rem; color: var(--muted); }
.tile.hero { margin-bottom: .6rem; padding: 1.1rem 1rem;
  background: linear-gradient(135deg, #0e2a22, #10233f);
  border-color: #1d4b3c; }
.tile.hero .v { font-size: 2.2rem; color: #34d399; }
.tile.hero .unit { font-size: 1rem; color: var(--muted); font-weight: 600; }
.delta { font-size: .72rem; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--danger); }   /* spending more than last month */
.delta.down { color: var(--accent); }
.charts { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 900px) {
  .charts { grid-template-columns: 1fr 1fr; gap: 0 1rem; }
}
.filters label { font-size: .72rem; }
.empty-state { text-align: center; padding: 2.2rem 1rem; }
.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: .4rem; }
.empty-state h2 { margin-bottom: .4rem; }
.empty-state p { margin-bottom: 1rem; }
.empty-state button { margin: 0 auto; }
.mini-table { width: 100%; border-collapse: collapse; margin-top: .6rem;
  font-size: .85rem; }
.mini-table th { text-align: left; color: var(--muted); font-weight: 600;
  font-size: .72rem; padding: .3rem .4rem;
  border-bottom: 1px solid var(--line); }
.mini-table td { padding: .35rem .4rem; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: .35rem; vertical-align: baseline; }
.list-item { display: flex; justify-content: space-between; gap: .5rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.muted { color: var(--muted); font-size: .85rem; }
.warn { color: var(--warn); font-size: .85rem; }
.badge { font-size: .7rem; padding: .1rem .5rem; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--accent); border-color: var(--accent); }
.badge.bad { color: var(--danger); border-color: var(--danger); }
.badge.bench { color: var(--warn); border-color: var(--warn); }
#toast { position: fixed; bottom: 1.2rem; left: 50%;
  transform: translateX(-50%); background: var(--card); color: var(--text);
  padding: .7rem 1.2rem; border-radius: 10px; border: 1px solid var(--line);
  z-index: 99; max-width: 92vw; }
#toast.error { background: #2a1215; border-color: var(--danger);
  color: #fca5a5; font-weight: 600; }
.form-error { background: rgba(248, 113, 113, .12);
  border: 1px solid var(--danger); color: #fca5a5; padding: .6rem .8rem;
  border-radius: 8px; margin-bottom: .8rem; font-size: .9rem; }
.hint { color: var(--muted); font-size: .78rem; margin: -.3rem 0 .6rem; }
.edit-btn { width: auto; padding: .45rem .7rem; }
.photo-thumb { width: 100%; max-height: 180px; object-fit: contain;
  border-radius: 8px; background: #000; }
.fab { position: fixed; right: 1.2rem; bottom: 1.2rem; width: 56px;
  height: 56px; border-radius: 50%; font-size: 1.6rem; line-height: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.4); }
canvas { max-width: 100%; }
