/* Shobha — plain CSS, no build step.
   Warm near-black + brass palette, refined from the original gold-on-black
   brand carried over from the marketing site; light theme follows the OS.
   A serif display face (Fraunces, loaded in layouts/app.blade.php) is used
   only for money figures and headings — everything else stays system fonts,
   so the one webfont request is the only new network cost this adds. */

:root {
  color-scheme: light dark;

  --bg: #faf8f4;
  --surface: #ffffff;
  --raised: #ffffff;
  --border: #e8e1d3;
  --text: #211d15;
  --muted: #7c7362;
  --accent: #a3773a;
  --accent-contrast: #ffffff;
  --positive: #3f7d52;
  --negative: #b64632;
  --alert: #b8792b;

  --positive-bg: #dcefe0;
  --negative-bg: #f7e2dc;
  --alert-bg: #f6e6d2;
  --alert-border: rgba(184, 121, 43, 0.35);
  --muted-bg: #f0ece1;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0a08;
    --surface: #171310;
    --raised: #1f1a14;
    --border: #2c261d;
    --text: #f3ede0;
    --muted: #a89b82;
    --accent: #cd9f52;
    --accent-contrast: #171310;
    --positive: #7ea86e;
    --negative: #c06552;
    --alert: #d99a3f;

    --positive-bg: rgba(126, 168, 110, 0.16);
    --negative-bg: rgba(192, 101, 82, 0.16);
    --alert-bg: rgba(217, 154, 63, 0.14);
    --alert-border: rgba(217, 154, 63, 0.4);
    --muted-bg: #1c1812;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

.page { padding: calc(1.25rem + var(--safe-top)) 1rem calc(5.5rem + var(--safe-bottom)); max-width: 42rem; margin: 0 auto; }

h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1rem; font-weight: 600; }

.label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.right { text-align: right; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.accent { color: var(--accent); }

.stack { display: flex; flex-direction: column; gap: 0.6rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.section { margin-bottom: 1.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.1rem;
  box-shadow: 0 1px 2px rgba(20, 16, 8, 0.04);
}
.card.accent-edge { border-left: 3px solid var(--accent); }
.card.positive-edge { border-left: 3px solid var(--positive); }

.headline { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.01em; }
.figure { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

/* ---------- forms ---------- */

input, select, textarea, button { font: inherit; color: inherit; }

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.amount-input {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
  height: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  min-height: 44px;
  border: none;
  border-radius: 0.75rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-sm { padding: 0.45rem 0.9rem; min-height: 38px; font-size: 0.85rem; width: auto; }

/* WhatsApp nudge — its own tint so it doesn't read as "just another grey
   button" next to Mark received/Settle. */
.btn-whatsapp { background: var(--positive-bg); color: var(--positive); border: none; }

/* Segmented choices — equal-width, mutually exclusive: direction, currency, person */
.choices { display: flex; gap: 0.5rem; }
.choice {
  flex: 1;
  padding: 0.75rem;
  min-height: 44px;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.choice[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.choice.in[aria-pressed="true"] { background: var(--positive); border-color: var(--positive); color: #fff; }
.choice.out[aria-pressed="true"] { background: var(--negative); border-color: var(--negative); color: #fff; }

/* Wrapping pill tags — categories: unlike .choices, these don't stretch to
   equal width, so "Other expense" doesn't cramp next to "Software". */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.55rem 0.95rem;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* Status badges — invoices/payables (overdue, due soon, sent, partial, paid) */
.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-overdue { background: var(--negative-bg); color: var(--negative); }
.pill-soon, .pill-partial { background: var(--alert-bg); color: var(--alert); }
.pill-paid { background: var(--positive-bg); color: var(--positive); }
.pill-sent, .pill-due, .pill-draft, .pill-written_off { background: var(--muted-bg); color: var(--muted); }

/* The "needs follow-up" banner on Summary, and the reminder digest on Collections */
.alert-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
}
.alert-card .icon-badge {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background: var(--alert-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--alert);
}
.alert-card .chev { flex-shrink: 0; color: var(--alert); }

.field { display: flex; flex-direction: column; gap: 0.3rem; }

.error { color: var(--negative); font-size: 0.85rem; }

.flash {
  background: var(--positive);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* A destructive action that shouldn't compete with the primary button on the
   screen. Still a full 44px tap target, just visually quiet. */
.btn-link {
  background: none;
  border: 0;
  padding: 0.5rem 0;
  min-height: 44px;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:hover,
.btn-link:focus-visible {
  color: var(--negative);
}

/* Rejected input, shown at the top of the screen it bounced back to. */
.flash-error {
  background: var(--negative);
}

.flash-error div + div {
  margin-top: 0.3rem;
}

/* ---------- bottom nav ---------- */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--raised);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 40;
}

.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.7rem;
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 500;
}
.nav a.active { color: var(--accent); }
.nav svg { display: block; }

.nav .fab {
  width: 3.25rem; height: 3.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  transform: translateY(-0.5rem);
  box-shadow: 0 4px 14px rgba(20, 16, 8, 0.25);
  padding: 0;
}

/* ---------- charts (pure CSS bars, no JS library) ---------- */

.bars { display: flex; align-items: flex-end; gap: 0.4rem; height: 10rem; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; }
.bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar.in { background: var(--positive); }
.bar.out { background: var(--negative); }
.bar-label { font-size: 0.65rem; color: var(--muted); }

.centered { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.narrow { width: 100%; max-width: 24rem; }

code.codes {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  line-height: 1.9;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}
