/* Solvia design tokens (sticker style), fonts, reset, app shell. */

@font-face {
  font-family: 'Outfit';
  src: url('../fonts/outfit.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/dm-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 500 700;
  font-display: swap;
}

:root {
  /* palette */
  --ink: #12242b;
  --ink-2: #3d5158;
  --ink-3: #5b6d73;
  --ink-4: #9aa7ab;
  --line-soft: #dfd9cb;
  --sunk: #f0ece2;
  --paper: #fdfbf6;
  --white: #ffffff;
  --teal-700: #0f8f8f;
  --teal-100: #d9f0ec;
  --teal-50: #edf8f6;
  --coral-500: #ff6b4a;
  --coral-700: #d9482a;
  --coral-100: #ffe7e0;
  --sun-700: #c9971a;
  --sun-500: #ffd23f;
  --sun-100: #fff6da;
  --danger: #e23d3d;

  /* semantic */
  --bg: var(--paper);
  --surface: var(--white);
  --surface-sunk: var(--sunk);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --muted: var(--ink-3);
  --faint: var(--ink-4);
  --border: var(--ink);
  --divider: var(--line-soft);
  --shadow-color: var(--ink);
  --primary: var(--coral-500);
  --on-primary: var(--white);
  --link: var(--teal-700);
  --pos: var(--teal-700);
  --pos-soft: var(--teal-100);
  --neg: var(--danger);
  --warn: var(--sun-500);
  --warn-soft: var(--sun-100);
  --selected: var(--ink);
  --on-selected: var(--paper);

  /* shape */
  --stroke: 2px;
  --stroke-inner: 1.5px;
  --radius-chip: 10px;
  --radius-control: 14px;
  --radius-button: 16px;
  --radius-card: 18px;
  --radius-sheet: 26px;
  --shadow: 3px 3px 0 var(--shadow-color);
  --shadow-lg: 4px 4px 0 var(--shadow-color);
  --shadow-pressed: 1px 1px 0 var(--shadow-color);

  /* type */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --tabbar-height: 58px;
  --max-width: 520px;
  color-scheme: light;
}

/* Dark: ink background, paper strokes, sun hard shadow (per design system). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --surface: #1a3039;
    --surface-sunk: #0d1b20;
    --text: var(--paper);
    --text-2: #c5d2d6;
    --muted: var(--ink-4);
    --faint: #6f8187;
    --border: var(--paper);
    --divider: #2e454e;
    --shadow-color: var(--sun-500);
    --link: #2bb3a3;
    --pos: #2bb3a3;
    --pos-soft: #123c3b;
    --neg: #ff7a6b;
    --warn-soft: #3a3214;
    --selected: var(--paper);
    --on-selected: var(--ink);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

code {
  font: 500 0.85em var(--font-mono);
  background: var(--surface-sunk);
  padding: 1px 5px;
  border-radius: 6px;
}

.muted {
  color: var(--muted);
}
.pos {
  color: var(--pos);
}
.neg {
  color: var(--neg);
}
.money {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

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

/* ---- shell ---- */

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  white-space: nowrap;
}
.topbar-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--coral-500);
  border: var(--stroke-inner) solid var(--ink);
  display: grid;
  place-items: center;
}
.brand-mark svg {
  width: 20px;
  height: 20px;
}

.view {
  flex: 1;
  padding: 0 16px calc(env(safe-area-inset-bottom) + var(--tabbar-height) + 10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--surface);
  border-top: var(--stroke) solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom);
  z-index: 10;
}
.tabbar button {
  background: none;
  border: 0;
  padding: 0 0 6px;
  min-height: 44px;
  font: 600 10px var(--font-display);
  color: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  --tab-accent: var(--faint);
}
.tab-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  border: var(--stroke) solid transparent;
}
.tab-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linejoin: miter;
}
.tab-icon .accent {
  fill: var(--tab-accent);
  stroke: none;
}
.tabbar button.active {
  color: var(--text);
  font-weight: 700;
  --tab-accent: var(--sun-500);
}
.tabbar button.active .tab-icon {
  background: var(--selected);
  border-color: var(--selected);
  color: var(--on-selected);
  box-shadow: 2px 2px 0 var(--sun-500);
}
