/* ============================================================
   Flor de Cera · Design Tokens
   Sistema de Inventario de Vino · Valle de Guadalupe
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ===== COLOR · Brand · purple from logo ===== */
  --purple-950: #1a1326;   /* deep ink (logotype dark base) */
  --purple-900: #2a1842;
  --purple-800: #3d1f5c;   /* logotype */
  --purple-700: #5a3284;
  --purple-600: #7449a3;
  --purple-500: #8a5fa8;   /* flower icon */
  --purple-400: #a883c2;
  --purple-300: #c9a8d9;
  --purple-200: #e0c8ec;
  --purple-100: #efe2f4;
  --purple-50:  #f8f3fb;

  /* ===== COLOR · Neutrals ===== */
  --ink:        #1a1326;
  --ink-2:      #3a324a;
  --ink-3:      #5a536b;
  --ink-4:      #8a8395;
  --ink-5:      #b8b2bf;
  --line:       #e4dfe9;
  --line-2:     #f0ebf3;
  --surface:    #ffffff;
  --surface-2:  #faf8fc;
  --bg:         #f5f3f7;

  /* ===== COLOR · Semantic ===== */
  --wine:       #7a1f26;   /* accent for fiscal/critical actions */
  --wine-bg:    #fbeef0;
  --risk:       #dc2626;
  --risk-bg:    #fee2e2;
  --ok:         #16a34a;
  --ok-bg:      #dcfce7;
  --warn:       #d97706;   /* 72h countdown warnings */
  --warn-bg:    #fef3c7;
  --info:       #1e40af;
  --info-bg:    #dbeafe;

  /* ===== COLOR · Process domain tints (from spec) ===== */
  --d-enol:    #e8d5b7;    /* Enólogo · Producción */
  --d-almacen: #c4d4e0;    /* Almacén · Embotellado */
  --d-fiscal:  #d4c4e0;    /* Responsable fiscal */
  --d-ventas:  #e0c4c4;    /* Ventas · tienda */
  --d-sist:    #d4e0c4;    /* Sistema */

  /* ===== TYPE · Families ===== */
  --font-display: "Oswald", "Bebas Neue", "Impact", sans-serif;
  --font-sans:    "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ===== TYPE · Scale ===== */
  --t-xs:   11px;
  --t-sm:   12px;
  --t-base: 13px;
  --t-md:   14px;
  --t-lg:   16px;
  --t-xl:   18px;
  --t-2xl:  22px;
  --t-3xl:  28px;
  --t-4xl:  36px;
  --t-5xl:  48px;
  --t-display: 64px;

  /* ===== SPACING ===== */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* ===== RADII ===== */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;
  --r-full: 999px;

  /* ===== SHADOW ===== */
  --sh-sm: 0 1px 2px rgba(26, 19, 38, 0.06);
  --sh-md: 0 4px 12px rgba(26, 19, 38, 0.08);
  --sh-lg: 0 12px 32px rgba(26, 19, 38, 0.12);
  --sh-purple: 0 8px 24px rgba(116, 73, 163, 0.18);

  /* ===== LAYOUT ===== */
  --sidebar-w: 240px;
  --header-h: 56px;
}

/* ===== Base resets ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Semantic helpers ===== */
.h1 { font-family: var(--font-display); font-size: var(--t-4xl); font-weight: 600; letter-spacing: 0.5px; line-height: 1.1; }
.h2 { font-family: var(--font-display); font-size: var(--t-3xl); font-weight: 500; letter-spacing: 0.3px; line-height: 1.15; }
.h3 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.2px; }
.h4 { font-size: var(--t-lg); font-weight: 600; }
.eyebrow {
  font-family: var(--font-display);
  font-size: var(--t-xs);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--purple-600);
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--t-base)/1 var(--font-sans);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--purple-400); color: var(--purple-700); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--purple-800);
  border-color: var(--purple-800);
  color: white;
}
.btn-primary:hover { background: var(--purple-700); border-color: var(--purple-700); color: white; }
.btn-fiscal {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}
.btn-fiscal:hover { background: #9a2731; color: white; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--purple-50); }
.btn-sm { padding: 6px 10px; font-size: var(--t-sm); }
.btn-lg { padding: 11px 18px; font-size: var(--t-md); }

/* ===== Inputs ===== */
.input, .select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font: 400 var(--t-base) var(--font-sans);
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px var(--purple-100);
}
.input::placeholder { color: var(--ink-4); }
.label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 18px; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font: 500 var(--t-xs) var(--font-sans);
  border: 1px solid transparent;
}
.badge-ok    { background: var(--ok-bg);    color: var(--ok); }
.badge-risk  { background: var(--risk-bg);  color: var(--risk); }
.badge-warn  { background: var(--warn-bg);  color: var(--warn); }
.badge-info  { background: var(--info-bg);  color: var(--info); }
.badge-neutral { background: var(--line-2); color: var(--ink-3); }
.badge-purple  { background: var(--purple-100); color: var(--purple-700); }
.badge-wine    { background: var(--wine-bg); color: var(--wine); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}

/* ===== Tables ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--purple-50); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--purple-50); }
.tbl tr.clickable:active td { background: var(--purple-100); }

/* ===== Page headers (used in all views) ===== */
.page-head {
  display: flex; align-items: end; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-head > div:first-child { flex: 1; min-width: 240px; }
.page-head h1, .page-head h2 { letter-spacing: 0.5px; margin: 0; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* ===== Scroll ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-5); }
