/* ===========================================================
   Finanzas · Simplificando — Design system (lean)
   Solo lo que la app usa hoy: tokens + base + componentes.
   Los tokens son idénticos al sistema "papel · tinta · olivo".
   ========================================================= */
:root {
  /* Neutros tibios */
  --paper: #f6f3ed;
  --paper-2: #efeae0;
  --ink: #1d1b16;
  --ink-2: #3a3730;
  --ink-3: #6b665b;
  --ink-4: #9b9588;
  --line: #e3ddd0;
  --line-2: #d2cbbb;
  --card: #fbf9f4;
  --card-elev: #ffffff;

  /* Acentos */
  --olive: #4a5d3a;          /* primario */
  --olive-2: #3a4a2c;
  --olive-soft: #c9d3b8;
  --olive-tint: #e8ecdb;

  --rust: #b15534;           /* gasto / atención */
  --rust-soft: #efd2c4;
  --rust-tint: #f8e6dc;

  --sand: #c98f3c;           /* warning */
  --sand-tint: #f3e2c4;

  --plum: #6b3f5e;           /* categorías */
  --plum-tint: #e7d4e0;

  --teal: #2d6a6a;
  --teal-tint: #cce0df;

  /* Status */
  --ok: #4a5d3a;
  --warn: #c98f3c;
  --err: #b15534;

  /* Type */
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  /* Spacing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(29, 27, 22, 0.04), 0 1px 3px rgba(29, 27, 22, 0.04);
  --shadow-md: 0 2px 4px rgba(29, 27, 22, 0.04), 0 8px 24px rgba(29, 27, 22, 0.06);
  --shadow-lg: 0 24px 48px rgba(29, 27, 22, 0.12);
}

[data-theme="dark"] {
  --paper: #15140f;
  --paper-2: #1c1a14;
  --ink: #f1ede1;
  --ink-2: #d4cfbf;
  --ink-3: #9b9583;
  --ink-4: #66614f;
  --line: #2a2720;
  --line-2: #3a362b;
  --card: #1c1a14;
  --card-elev: #22201a;
  --olive: #a9bd8f;
  --olive-2: #c5d3ad;
  --olive-soft: #4a5d3a;
  --olive-tint: #2c3424;
  --rust: #d68969;
  --rust-tint: #3a241b;
  --sand-tint: #3a2f1b;
  --plum-tint: #2e1f2a;
  --teal-tint: #1f2e2e;
  --shadow-md: 0 2px 4px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.5);
}

/* ============== Base ============== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#root { min-height: 100svh; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ============== Marca ============== */
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  flex-shrink: 0;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--olive);
  bottom: 4px; right: 4px;
}

/* ============== Nav ============== */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  font-size: 13px;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--line); }
.nav-item.active { background: var(--ink); color: var(--paper); }
.nav-item svg { flex-shrink: 0; }

/* ============== Botones ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}
.btn:hover { background: var(--line); border-color: var(--line-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.olive { background: var(--olive); color: #fff; border-color: var(--olive); }
.btn.olive:hover { background: var(--olive-2); }
.btn.lg { padding: 14px 22px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line); }
.btn.danger { color: var(--rust); }
.btn svg { width: 14px; height: 14px; }

/* ============== Cards ============== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* ============== Tags ============== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  max-width: 100%;
  min-width: 0;
}
.tag span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag.olive { background: var(--olive-tint); color: var(--olive-2); }
.tag.rust { background: var(--rust-tint); color: var(--rust); }
.tag.sand { background: var(--sand-tint); color: #8a5d20; }
.tag.plum { background: var(--plum-tint); color: var(--plum); }
.tag.teal { background: var(--teal-tint); color: var(--teal); }
.tag.neutral { background: var(--paper-2); color: var(--ink-3); border-color: var(--line); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }

/* ============== Inputs ============== */
/* Sin width:100% a propósito: el ancho lo da el contexto (grid/flex) o un
   override inline puntual, para no estirar los controles de las filas. */
.input {
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--olive-tint);
}
.input.mono { font-family: var(--mono); letter-spacing: 0.04em; }
