/* CentralPerks design system — tokens first, then components (leon-tracker
   structure, Central Perk café palette: espresso green, cream, burgundy). */

:root {
  --bg: #14291e;            /* espresso green, the café wall */
  --surface: #1d3628;
  --surface-2: #24402f;
  --line: #35523f;
  --cream: #f3ead9;         /* menu-board lettering */
  --cream-dim: #cdbfa6;
  --muted: #8fa396;
  --burgundy: #b0524a;      /* velvet couch */
  --gold: #c9973f;          /* frame gold */
  --green-ok: #7fbf8e;
  --danger: #e07a70;
  --radius: 14px;
  --pad: 16px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------------ topbar */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
  border-bottom: 1px solid var(--line);
}
#brand { font-family: Georgia, serif; font-size: 20px; color: var(--cream); text-decoration: none; }
#brand b { color: var(--gold); font-weight: 700; }
#topbar nav a {
  color: var(--cream-dim); text-decoration: none; font-size: 14px; margin-left: 14px;
  padding: 6px 2px;
}
#topbar nav a.active { color: var(--gold); border-bottom: 2px solid var(--gold); }

main { max-width: 640px; margin: 0 auto; padding: 12px var(--pad) 90px; }
.pad { padding: var(--pad); }
.muted { color: var(--muted); }
h2 { font-family: Georgia, serif; font-weight: 700; font-size: 17px; margin: 22px 2px 10px; color: var(--cream-dim); }
h2:first-child { margin-top: 8px; }

/* ------------------------------------------------------------------- cards */
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.row:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 15px; font-weight: 600; }
.row .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row .amount { font-size: 16px; font-weight: 700; white-space: nowrap; }

.badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  white-space: nowrap;
}
.badge.urgent { background: #4a2420; color: var(--danger); }
.badge.soon { background: #423520; color: var(--gold); }
.badge.later { background: #24402f; color: var(--green-ok); }
.badge.done { background: #24402f; color: var(--green-ok); }
.badge.hidden { background: var(--surface-2); color: var(--muted); }

.owner-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: 1px;
}
.owner-dot.alex { background: var(--gold); }
.owner-dot.laura { background: var(--burgundy); }

/* chips */
.chips { display: flex; gap: 8px; margin: 10px 0 14px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--cream-dim);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--gold); border-color: var(--gold); color: #241a08; font-weight: 700; }

/* meters */
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: var(--green-ok); }
.meter.warn > div { background: var(--gold); }

/* ------------------------------------------------------------------- sheet */
#sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9;
}
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  padding: 18px var(--pad) calc(24px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
}
#sheet h3 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 18px; }
#sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

button.primary, button.ghost, button.danger {
  display: block; width: 100%; border-radius: 12px; padding: 14px;
  font-size: 16px; font-weight: 700; margin-top: 10px; cursor: pointer;
  border: 1px solid transparent;
}
button.primary { background: var(--gold); color: #241a08; }
button.ghost { background: transparent; border-color: var(--line); color: var(--cream); }
button.danger { background: transparent; border-color: #4a2420; color: var(--danger); }
button:active { filter: brightness(.9); }

input[type=number], input[type=text], input[type=password], select {
  width: 100%; padding: 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--cream); font-size: 16px; margin-top: 8px;
}

/* ------------------------------------------------------------------ login */
.login-wrap { text-align: center; padding-top: 8vh; }
.login-wrap .cup { font-size: 64px; }
.login-wrap h1 { font-family: Georgia, serif; font-size: 28px; margin: 8px 0 2px; }
.login-wrap h1 b { color: var(--gold); }
.login-wrap p { color: var(--muted); font-size: 14px; }
.login-wrap button { max-width: 320px; margin-left: auto; margin-right: auto; }
a.subtle { color: var(--muted); font-size: 13px; display: inline-block; margin-top: 18px; }

/* ----------------------------------------------------------------- footer */
#appfoot {
  margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); text-align: center;
}

.section-total { font-size: 12.5px; color: var(--muted); margin: -4px 2px 10px; }
.notice { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--cream-dim); margin-bottom: 10px; }
.fee-line { display: flex; justify-content: space-between; font-size: 13.5px; margin: 6px 0; color: var(--cream-dim); }
.fee-line b { color: var(--cream); }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.history-item .x { color: var(--danger); cursor: pointer; padding: 4px 8px; }
