/*
 * styles.css — layout, RTL, and every class a screen file assumes exists
 * without defining it: `.btn`/`.btn--primary`/`.btn--quiet`, `.pill` plus its
 * status colors, `.bar`/`.bar__fill`, `.chip` plus its transaction-type
 * colors, and `.num`. A screen's own stylesheet is the arrangement of these,
 * never a second definition of one — see frontend/README.md.
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  overflow-x: hidden; /* nothing on this app scrolls sideways, ever */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-inline-size: 100%; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

/* The one wrapper every screen mounts inside: a phone-first column, centered
   and readable on a wider viewport, with a safe side gutter at every width. */
#app {
  inline-size: 100%;
  max-inline-size: 480px;
  margin-inline: auto;
  padding: 16px;
  padding-block-end: 48px;
}

/* ---- Numbers: tabular, and always LTR even inside RTL text -------------- */

.num {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: plaintext;
  display: inline-block;
}

/* ---- Buttons: the black full-width pill is the signature ---------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  min-block-size: var(--touch-min);
  border: none;
  border-radius: var(--radius-pill);
  padding-inline: 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}
.btn--primary:hover { filter: brightness(1.15); }

.btn--quiet {
  background: var(--surface);
  color: var(--text);
}
.btn--quiet:hover { filter: brightness(0.97); }

/* ---- Status pill: 10-14px radius, not a full pill despite the name ------ */

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  white-space: nowrap;
}

.pill--active { background: color-mix(in srgb, var(--pos) 14%, var(--surface)); color: var(--pos); }
.pill--completed { background: var(--surface); color: var(--text-muted); }
.pill--on_hold { background: var(--surface); color: var(--text-muted); font-style: italic; }
.pill--unknown { background: var(--surface); color: var(--text-muted); }

/* ---- Budget bar: a slim neutral progress bar, never a stat badge -------- */

.bar {
  block-size: 6px;
  border-radius: var(--radius-pill);
  background: var(--border);
  overflow: hidden;
}

.bar__fill {
  block-size: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: inline-size 0.2s ease;
}

/* ---- Category chip: tinted, not a colored dot ---------------------------
   Income is the one place color appears; every expense category stays
   neutral, told apart by icon rather than hue — BUILD-PROMPT.md's own rule. */

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  block-size: 32px;
  inline-size: 32px;
  flex: none;
}

.chip--income { background: color-mix(in srgb, var(--pos) 16%, transparent); color: var(--pos); }
.chip--materials,
.chip--labor,
.chip--other { background: var(--surface); color: var(--text-muted); }

/* ---- Quality floor -------------------------------------------------------- */

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

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
