/* ============================================================
   SYMPHO OS — design system
   Monochrome / neutral base, harmonized per-app accent hues
   (all accents share lightness + chroma, vary only in hue).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- neutral base (cool slate, very low chroma) ---- */
  --bg:        oklch(0.165 0.012 264);
  --bg-2:      oklch(0.195 0.013 264);
  --surface:   oklch(0.218 0.013 264);
  --surface-2: oklch(0.252 0.014 264);
  --surface-3: oklch(0.295 0.014 264);
  --line:      oklch(1 0 0 / 0.09);
  --line-2:    oklch(1 0 0 / 0.14);
  --line-strong: oklch(1 0 0 / 0.22);

  --text:      oklch(0.965 0.004 264);
  --text-2:    oklch(0.78 0.012 264);
  --text-3:    oklch(0.62 0.014 264);
  --text-4:    oklch(0.50 0.014 264);

  /* ---- per-app accent hues (L 0.72 / C 0.135) ---- */
  --sympho:  oklch(0.72 0.135 274);   /* brand — indigo  */
  --ek:      oklch(0.72 0.135 152);   /* CRM — green     */
  --muluk:   oklch(0.78 0.135 86);    /* facturación — gold */
  --manik:   oklch(0.72 0.135 178);   /* custodia — teal */
  --pakal:   oklch(0.72 0.135 232);   /* inventario — blue */
  --zamna:   oklch(0.72 0.135 32);    /* proyectos — coral */
  --eb:      oklch(0.70 0.12 52);    /* distribución — terracota */
  --kukul:   oklch(0.72 0.135 312);   /* (reserva) */

  /* dim variants for fills */
  --sympho-dim: oklch(0.72 0.135 274 / 0.16);
  --ek-dim:     oklch(0.72 0.135 152 / 0.16);
  --muluk-dim:  oklch(0.78 0.135 86 / 0.16);
  --manik-dim:  oklch(0.72 0.135 178 / 0.16);
  --pakal-dim:  oklch(0.72 0.135 232 / 0.16);
  --zamna-dim:  oklch(0.72 0.135 32 / 0.16);
  --eb-dim:     oklch(0.70 0.12 52 / 0.16);

  /* semantic */
  --ok:   oklch(0.74 0.14 152);
  --warn: oklch(0.80 0.13 78);
  --bad:  oklch(0.66 0.17 26);

  /* the active accent — overridden per app context */
  --accent: var(--sympho);
  --accent-dim: var(--sympho-dim);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --rail-w: 64px;
  --side-w: 248px;
  --top-h: 56px;

  --shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 8px 24px -8px oklch(0 0 0 / 0.5);
  --shadow-lg: 0 24px 64px -16px oklch(0 0 0 / 0.66);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --ui:   'IBM Plex Sans', system-ui, sans-serif;
  --disp: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---- light theme ---- */
[data-theme="light"] {
  --bg:        oklch(0.965 0.004 264);
  --bg-2:      oklch(0.98 0.003 264);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.975 0.004 264);
  --surface-3: oklch(0.95 0.006 264);
  --line:      oklch(0.2 0.02 264 / 0.10);
  --line-2:    oklch(0.2 0.02 264 / 0.16);
  --line-strong: oklch(0.2 0.02 264 / 0.28);
  --text:      oklch(0.24 0.02 264);
  --text-2:    oklch(0.40 0.02 264);
  --text-3:    oklch(0.54 0.018 264);
  --text-4:    oklch(0.64 0.016 264);
  --shadow: 0 1px 2px oklch(0.3 0.02 264 / 0.08), 0 12px 28px -12px oklch(0.3 0.04 264 / 0.18);
  --shadow-lg: 0 28px 64px -20px oklch(0.3 0.04 264 / 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#root { height: 100vh; }

::selection { background: color-mix(in oklch, var(--accent) 38%, transparent); }

/* density */
[data-density="compact"] { --pad: 14px; --gap: 10px; --row-h: 38px; }
[data-density="regular"] { --pad: 18px; --gap: 14px; --row-h: 44px; }
[data-density="comfy"]   { --pad: 24px; --gap: 18px; --row-h: 52px; }
:root { --pad: 18px; --gap: 14px; --row-h: 44px; }

/* ---------- scrollbars ---------- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   typographic helpers
   ============================================================ */
.disp { font-family: var(--disp); letter-spacing: -0.02em; }
.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-4);
}
.muted { color: var(--text-3); }

/* ============================================================
   primitives
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-2 { background: var(--surface-2); }

.btn {
  font-family: var(--ui);
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.16s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: oklch(0.16 0.02 264);
  font-weight: 600;
}
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, white); filter: brightness(1.04); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-icon { width: 38px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 30px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  font-family: var(--mono); letter-spacing: 0.01em;
}
.chip-accent { background: var(--accent-dim); border-color: color-mix(in oklch, var(--accent) 40%, transparent); color: color-mix(in oklch, var(--accent) 75%, white); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.ok   { background: color-mix(in oklch, var(--ok) 18%, transparent);   color: color-mix(in oklch, var(--ok) 80%, white); }
.badge.warn { background: color-mix(in oklch, var(--warn) 20%, transparent); color: color-mix(in oklch, var(--warn) 78%, white); }
.badge.bad  { background: color-mix(in oklch, var(--bad) 22%, transparent);  color: color-mix(in oklch, var(--bad) 82%, white); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.dot:not(.badge) { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* avatar */
.avatar {
  border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600;
  color: oklch(0.16 0.02 264);
  letter-spacing: -0.01em;
  overflow: hidden;
}

/* app tile glyph */
.glyph {
  border-radius: 13px;
  display: grid; place-items: center;
  font-family: var(--disp); font-weight: 600;
  color: oklch(0.16 0.02 264);
  flex: none;
  position: relative;
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.25);
}
.glyph svg { width: 54%; height: 54%; }

/* progress */
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-family: var(--mono); font-weight: 500;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-4); padding: 0 14px 10px; white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: oklch(1 0 0 / 0.022); }
.tbl td.num { font-family: var(--mono); text-align: right; color: var(--text); }

input.field, select.field {
  font-family: var(--ui); font-size: 13.5px;
  height: 38px; padding: 0 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input.field:focus, select.field:focus {
  border-color: color-mix(in oklch, var(--accent) 60%, var(--line-2));
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input.field::placeholder { color: var(--text-4); }

/* generic scroll area */
.scroll { overflow-y: auto; overflow-x: hidden; }

/* slide entrance — never rests at opacity:0 so content stays visible
   even when the animation timeline is paused (backgrounded iframe). */
@keyframes riseIn { from { transform: translateY(9px); } to { transform: none; } }
.rise { animation: riseIn 0.42s var(--ease) both; }

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