/* ============================================================================
   Casa Luma Inventario — sistema de diseño
   Marca oficial: reference/marca/BRANDING.md (tokens tomados del sitio v2).
   Esta hoja es la FUENTE. app/public/app.css es una copia — editar aquí.
   Las rutas de assets son relativas a app/public/; build.py las convierte a
   data: URI para que las maquetas de design/dist/ sean autocontenidas.
   ========================================================================== */

/* ---------- 1. Tipografías (mismas woff2 autoalojadas del sitio) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url(assets/fonts/fraunces.woff2) format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url(assets/fonts/inter.woff2) format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
  /* superficies — crema/marfil/avena de la marca */
  --ground: #FAF6F0;
  --surface: #FFFFFF;
  --surface-alt: #F1E9DD;
  --line: rgba(61, 46, 34, 0.12);
  --line-strong: rgba(61, 46, 34, 0.22);

  /* tinta — cocoa y piedra */
  --ink: #3D2E22;
  --ink-soft: #6B5748;
  --ink-faint: #8C7A6B;

  /* barra lateral — cocoa con tinta marfil */
  --sidebar: #3D2E22;
  --sidebar-ink: #F8F3E9;
  --sidebar-soft: #B5A28C;

  /* acento de marca — el marrón del logo */
  --luma: #7A5C3E;
  --luma-deep: #5C4530;
  --luma-fill: #7A5C3E;
  --luma-soft: #F1E9DD;
  --terracota: #C99B7A;
  --salvia: #7C8A6F;

  /* Siigo — azul reservado: identifica todo lo que toca Siigo */
  --siigo: #33607A;
  --siigo-soft: #E3EBF1;

  /* estado — nunca van solos: siempre con texto y con forma propia
     (círculo / anillo / rombo). Contraste de texto verificado ≥ 4,5:1
     sobre su propio fondo suave. */
  --good: #356B43;
  --good-soft: #E4EFE6;
  --warn: #856208;
  --warn-soft: #F5EBD2;
  --bad: #9C2E22;
  --bad-soft: #F7E4E0;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(61, 46, 34, 0.05), 0 2px 10px rgba(61, 46, 34, 0.04);

  --logo-crema: url(assets/casa-luma-crema.png);   /* tinta marfil, sobre el cocoa */
  --logo-color: url(assets/casa-luma-logo.png);    /* a todo color, sobre la crema */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--ground);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.app { display: flex; min-height: 100vh; }

/* ---------- 3. barra lateral ---------- */
.side {
  width: 216px;
  flex: 0 0 216px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
}
.brand { padding: 0 10px 16px; border-bottom: 1px solid rgba(248, 243, 233, 0.16); }
/* Dos versiones del mismo logo, no dos logos: a todo color sobre la crema del
   ingreso, en marfil sobre el cocoa de la barra. (Se probó mask-image para
   teñirlo desde CSS: Chrome no resuelve un var() con url() dentro de mask.) */
.brand .logo {
  width: 158px;
  height: 103px;
  background: var(--logo-crema) no-repeat center / contain;
}
.brand .sub {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--sidebar-soft);
  margin-top: 8px;
  padding-left: 2px;
}
.nav { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 6px;
  opacity: 0.8;
}
.nav a:hover { background: rgba(248, 243, 233, 0.09); opacity: 1; }
.nav a.active {
  background: var(--terracota);
  color: #2E2118;
  opacity: 1;
  font-weight: 600;
}
.nav .count {
  float: right;
  font-size: 11px;
  background: rgba(248, 243, 233, 0.16);
  border-radius: 999px;
  padding: 1px 7px;
}
.nav a.active .count { background: rgba(46, 33, 24, 0.16); }
.side .foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(248, 243, 233, 0.16); }
.userchip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--terracota);
  color: #2E2118;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.userchip .who { font-size: 12px; line-height: 1.25; }
.userchip .role { color: var(--sidebar-soft); font-size: 10.5px; }

/* ---------- 4. principal / barra superior ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
}
.topbar .grow { flex: 1; }
.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--siigo);
  background: var(--siigo-soft);
  border: 1px solid rgba(51, 96, 122, 0.25);
  padding: 5px 11px;
  border-radius: 999px;
}
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.sync .dot.warn { background: transparent; border: 2px solid var(--warn); }
.content { padding: 22px 26px 34px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- 5. botones y controles ---------- */
.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 15px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn.primary { background: var(--luma-fill); color: #FFFFFF; }
.btn.primary:hover { background: var(--luma-deep); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-alt); }
.btn.ghost { background: transparent; color: var(--luma-deep); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn:disabled, .btn.disabled { background: var(--surface-alt); color: var(--ink-faint); border-color: transparent; cursor: default; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--luma);
  outline-offset: 2px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 11px;
  width: 100%;
}
.input-mono { font-family: var(--mono) !important; font-size: 12.5px !important; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: 3px; gap: 2px; }
.seg button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 16px;
  border-radius: 5px;
  cursor: pointer;
}
.seg button.on { background: var(--luma); color: #FFFFFF; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.toggle .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; }
.toggle .track.on { background: var(--good); }
.toggle .knob { width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; position: absolute; top: 2px; left: 2px; }
.toggle .track.on .knob { left: 16px; }

/* ---------- 6. tarjetas, mosaicos, tablas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card h2 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  margin: 0 0 12px;
}
.card .cap { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.span-2 { grid-column: span 2; }
.tile .label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.tile .value {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.tile .unit { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-faint); }
.tile .delta { font-size: 12px; margin-top: 5px; color: var(--ink-soft); }
.tile .delta .up { color: var(--good); font-weight: 600; }
.tile .delta .down { color: var(--bad); font-weight: 600; }
.tile.flag { border-left: 4px solid var(--warn); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line-strong);
}
table.data td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.code { font-family: var(--mono); font-size: 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.rowdim td { opacity: 0.45; }

/* ---------- 7. píldoras / estado ----------
   La forma del indicador distingue el estado sin depender del color:
   círculo lleno = ok · anillo = pendiente · rombo = error.            */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2.5px 9px;
  white-space: nowrap;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.ok .d { background: var(--good); }
.pill.pend { background: var(--warn-soft); color: var(--warn); }
.pill.pend .d { background: transparent; border: 1.5px solid var(--warn); width: 7px; height: 7px; }
.pill.err { background: var(--bad-soft); color: var(--bad); }
.pill.err .d { background: var(--bad); border-radius: 1px; transform: rotate(45deg); }
.pill.info { background: var(--siigo-soft); color: var(--siigo); }
.pill.info .d { background: var(--siigo); }
.pill.mut { background: var(--surface-alt); color: var(--ink-soft); border: 1px solid var(--line); }
.pill.mut .d { background: var(--ink-faint); }
.qty { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; }
.qty.in { color: var(--good); }
.qty.out { color: var(--bad); }
.qty.adj { color: var(--siigo); }

/* ---------- 8. varios ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; }
.toolbar .search { flex: 1; max-width: 360px; position: relative; }
.note {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--luma-soft);
  border: 1px solid rgba(122, 92, 62, 0.24);
  border-radius: 6px;
  padding: 9px 12px;
}
.note.blue { background: var(--siigo-soft); border-color: rgba(51, 96, 122, 0.25); }
.steps { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-faint); }
.steps .st { display: flex; align-items: center; gap: 7px; }
.steps .n {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps .st.on { color: var(--ink); font-weight: 600; }
.steps .st.on .n { background: var(--luma); color: #FFFFFF; }
.steps .sep { width: 26px; height: 1px; background: var(--line-strong); }
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 34px;
  text-align: center;
  color: var(--ink-soft);
}
.dropzone strong { color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv dt { color: var(--ink-faint); margin: 0; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li { display: flex; gap: 9px; padding: 6px 0; align-items: baseline; }
.timeline .t { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

/* ---------- 9. ingreso ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ground);
  padding: 24px;
}
.login-box { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo {
  width: 210px;
  height: 137px;
  margin: 0 auto;
  background: var(--logo-color) no-repeat center / contain;
}
.login-brand .sub {
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 10px;
}
.login-foot { text-align: center; color: var(--ink-faint); font-size: 11.5px; margin-top: 18px; line-height: 1.6; }
