/* BR-Budget — design tokens & globals
   Editorial × mono × minimalist. Light + dark. */

:root {
  /* Surface — light */
  --paper: #faf9f7;
  --paper-2: #f3f1ec;
  --paper-3: #ecebe5;
  --ink: #0e0e0c;
  --ink-2: #2a2a26;
  --ink-3: #56544c;
  --ink-4: #8a8780;
  --ink-5: #b6b3aa;
  --line: rgba(14, 14, 12, 0.08);
  --line-2: rgba(14, 14, 12, 0.14);
  --hairline: rgba(14, 14, 12, 0.06);
  --tint: rgba(14, 14, 12, 0.04);
  --tint-2: rgba(14, 14, 12, 0.07);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 8px 28px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 16px 48px rgba(0, 0, 0, 0.10);

  /* Semantic */
  --pos: #0a7c4a;          /* income / good */
  --pos-soft: #d6efe1;
  --neg: #a01f1f;          /* overspend */
  --neg-soft: #f4dada;
  --warn: #8a6512;
  --warn-soft: #f4e6c0;

  /* Type */
  --font-sans: "Geist", "Söhne", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-serif: "GT Sectra", "Source Serif 4", "Spectral", Georgia, serif;
  --font-mono: "Geist Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Sizes */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --r-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --header-h: 56px;
  --side-w: 232px;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0c0c0a;
  --paper-2: #141412;
  --paper-3: #1c1c19;
  --ink: #f5f3ee;
  --ink-2: #e5e3dc;
  --ink-3: #b3b0a6;
  --ink-4: #807d75;
  --ink-5: #56544d;
  --line: rgba(245, 243, 238, 0.10);
  --line-2: rgba(245, 243, 238, 0.18);
  --hairline: rgba(245, 243, 238, 0.06);
  --tint: rgba(245, 243, 238, 0.04);
  --tint-2: rgba(245, 243, 238, 0.08);
  --glass: rgba(28, 28, 25, 0.6);
  --glass-strong: rgba(28, 28, 25, 0.85);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 48px rgba(0, 0, 0, 0.6);
  --pos: #4eb487;
  --pos-soft: rgba(78, 180, 135, 0.12);
  --neg: #d97373;
  --neg-soft: rgba(217, 115, 115, 0.12);
  --warn: #d4a85b;
  --warn-soft: rgba(212, 168, 91, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

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

::selection { background: var(--ink); color: var(--paper); }

.mono   { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "ss01" 1; letter-spacing: -0.01em; }
.serif  { font-family: var(--font-serif); font-feature-settings: "ss01" 1; letter-spacing: -0.015em; }
.tabular { font-variant-numeric: tabular-nums; }

/* Tiny label (eyebrow) */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Generic chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--ink-3);
  border: 0.5px solid var(--line);
}
.chip.pos { color: var(--pos); background: var(--pos-soft); border-color: transparent; }
.chip.neg { color: var(--neg); background: var(--neg-soft); border-color: transparent; }
.chip.warn{ color: var(--warn); background: var(--warn-soft); border-color: transparent; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-2);
  background: var(--ink); color: var(--paper);
  border: 0;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  transition: transform .12s, background .12s;
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Dark-mode explicit override — var(--ink) wasn't repainting on theme switch */
[data-theme="dark"] .btn {
  background: #f5f3ee;
  color: #0c0c0a;
}
[data-theme="dark"] .btn:hover { background: #e5e3dc; }
[data-theme="dark"] .btn.ghost {
  background: transparent;
  color: #f5f3ee;
  border: 1px solid rgba(245,243,238,0.18);
}
[data-theme="dark"] .btn.ghost:hover { background: rgba(245,243,238,0.04); }

/* Card */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.card.flat { border-radius: 0; border-left: 0; border-right: 0; }
.card.glass {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: var(--shadow-1);
}

/* Big number — editorial hero amount */
.bignum {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.92;
  font-feature-settings: "tnum" 1;
  display: inline-flex;
  align-items: baseline;
  gap: 0.04em;
}
.bignum .grosze {
  font-size: 0.42em;
  letter-spacing: -0.01em;
  color: var(--ink-3);
  align-self: flex-start;
  margin-top: 0.26em;
  margin-left: 0.05em;
}
.bignum .currency {
  font-family: var(--font-mono);
  font-size: 0.28em;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  margin-left: 0.4em;
  align-self: center;
}
.bignum .neg { color: var(--neg); }
.bignum .pos { color: var(--pos); }

/* Kbd */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink-3);
}

/* Progress bar — flat, monolithic */
.bar {
  position: relative;
  height: 6px;
  background: var(--tint-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--ink);
  border-radius: var(--r-pill);
}
.bar.thin { height: 3px; }
.bar.over > i { background: var(--neg); }
.bar.full > i { background: var(--pos); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* Subtle paper noise + grid undertones for editorial vibe */
body::before {
  content: ""; position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(circle at 0% 0%, var(--tint) 0, transparent 40%),
    radial-gradient(circle at 100% 100%, var(--tint) 0, transparent 50%);
  opacity: .8;
}
#root { position: relative; z-index: 1; }

/* App shell layout */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}
.app.no-sidebar { grid-template-columns: 1fr; }

/* Page padding */
.page {
  padding: 28px 40px 80px;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}

/* Rule (horizontal in editorial style) */
.rule {
  border: 0; border-top: 1px solid var(--line);
  margin: var(--space-5) 0;
}

/* Tag (category color dot) */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-4);
  flex-shrink: 0;
}
.dot.lg { width: 10px; height: 10px; }

/* Anim */
@keyframes brFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: brFadeIn .25s cubic-bezier(.2,.7,.3,1) both; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
  border-radius: 4px;
}
