/* Uses Nexa theme params injected by the SDK (--nexa-* on :root) with sensible
   fallbacks so it also looks fine when opened standalone. */
:root {
  --bg: var(--nexa-bg-color, #ffffff);
  --bg2: var(--nexa-secondary-bg-color, #f4f5f7);
  --text: var(--nexa-text-color, #1c1d21);
  --hint: var(--nexa-hint-color, #8a8f98);
  --accent: var(--nexa-button-color, #5b67f1);
  --on-accent: var(--nexa-button-text-color, #ffffff);
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over author `display` rules (e.g. .sheet /
   .footer use display:flex, which would otherwise override the UA [hidden]
   rule and show the Add-expense sheet on load). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 96px;
  min-height: 100%;
}

.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.topbar h1 { font-size: 20px; margin: 4px 0 12px; }
.who { color: var(--hint); font-size: 13px; }

.status { color: var(--hint); padding: 24px 0; text-align: center; }
.status.error { color: #d23f3f; }

.summary {
  background: var(--bg2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border-radius: 12px;
  padding: 10px 12px;
}
.item-main { display: flex; flex-direction: column; min-width: 0; }
.cat { font-weight: 600; text-transform: capitalize; }
.note { color: var(--hint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { color: var(--hint); font-size: 12px; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.empty { color: var(--hint); text-align: center; padding: 32px 0; }

.fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: 28px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.sheet {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  width: 100%; max-width: 640px;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.sheet-card h2 { margin: 0 0 4px; font-size: 17px; }
.sheet-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--hint); }
.sheet-card input {
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--hint) 40%, transparent);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: var(--bg2); color: var(--text); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.footer { margin-top: 16px; display: flex; justify-content: center; }
