/* ============================================================
   JM Web Service · Dashboard
   Sistema visual: vidrio sobre negro, verde neón de la marca.
   ============================================================ */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
}

:root {
  --ink: #040705;
  --text: #f4fbf6;
  --muted: #a3b8aa;
  --faint: #6a8072;
  --neon: #3dff7a;
  --neon-dim: rgba(61, 255, 122, 0.18);
  --amber: #ffb454;
  --sky: #5cc8ff;
  --rose: #ff7a8a;
  --violet: #c79bff;

  /* ---- Liquid glass: ajusta estas 4 líneas para más o menos transparencia ---- */
  --glass-bg: linear-gradient(145deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.03) 38%, rgba(255,255,255,0.012) 64%, rgba(255,255,255,0.06) 100%);
  --glass-blur: blur(22px) saturate(165%) brightness(1.06);
  --rim: inset 1px 1px 0 rgba(255,255,255,0.40), inset -1px -1px 0 rgba(255,255,255,0.10), inset 0 0 0 1px rgba(255,255,255,0.07);
  --glass-shadow: 0 26px 54px -30px rgba(0,0,0,0.55), 0 6px 16px -10px rgba(0,0,0,0.35);

  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --glass-line: rgba(255, 255, 255, 0.18);
  --glass-line-soft: rgba(255, 255, 255, 0.09);

  /* Color de las ventanas que salen (formularios, confirmaciones, avisos): sigue al fondo elegido */
  /* Acento de las tarjetas flotantes y las gráficas: sigue al fondo elegido (por defecto, el verde de la marca) */
  --accent-rgb: 61, 255, 122;
  --accent: rgb(var(--accent-rgb));
  --accent-dim: rgba(var(--accent-rgb), 0.18);

  --tint-rgb: 60, 86, 68;
  --deep-rgb: 14, 24, 18;

  --r-xl: 32px;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --titlebar: 40px;
  --sidebar-w: 236px;
  --widgets-w: 300px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
html { background: #050706; }
html[data-see="1"] { background: transparent; }

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }

/* El vidrio es muy transparente: una sombra suave mantiene el texto legible */
.view, .sidebar, .widget, .titlebar { text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55); }
.btn.primary, .chip, .avatar, .input, .select, .textarea, option { text-shadow: none; }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--neon-dim); }

/* Barras de scroll discretas */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Fondo de la aplicación (se elige en Ajustes → Fondo) ----------
   transparent: deja ver tu escritorio (Windows 11 + app de escritorio). Los demás son colores. */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: #101315;
}
/* Transparente: solo un velo suave para que el texto se lea sobre cualquier escritorio.
   Sube o baja el 0.30 para ver más o menos tu escritorio. */
html[data-bg="transparent"] .ambient { background: rgba(5, 9, 7, 0.30); }
/* Cristal: un vidrio con tinte frío y destellos diagonales, como un panel de cristal.
   En la app de escritorio con Windows 11 deja ver tu escritorio; en los demás casos usa una base oscura. */
html[data-bg="cristal"] {
  --cristal-layers:
    linear-gradient(115deg, rgba(255,255,255,0) 16%, rgba(255,255,255,0.11) 23%, rgba(255,255,255,0.025) 30%, rgba(255,255,255,0) 42%, rgba(255,255,255,0.08) 57%, rgba(255,255,255,0) 66%),
    radial-gradient(900px 600px at 0% 0%, rgba(170,225,255,0.24), transparent 62%),
    radial-gradient(900px 640px at 100% 100%, rgba(150,255,225,0.15), transparent 62%);
  --glass-bg: linear-gradient(145deg, rgba(255,255,255,0.17) 0%, rgba(255,255,255,0.05) 40%, rgba(255,255,255,0.03) 62%, rgba(255,255,255,0.11) 100%);
  --rim: inset 1px 1px 0 rgba(255,255,255,0.55), inset -1px -1px 0 rgba(255,255,255,0.16), inset 0 0 0 1px rgba(255,255,255,0.09);
}
html[data-bg="cristal"] .ambient { background: var(--cristal-layers), #0b141a; }
html[data-bg="cristal"][data-glass="1"] .ambient { background: var(--cristal-layers), rgba(150,205,235,0.07); }
html[data-bg="negro"] .ambient { background: #040605; }
html[data-bg="grafito"] .ambient {
  background: radial-gradient(1000px 640px at 12% -10%, rgba(255,255,255,0.10), transparent 62%),
              radial-gradient(900px 600px at 100% 110%, rgba(255,255,255,0.06), transparent 62%), #0f1215;
}
html[data-bg="verde"] .ambient {
  background: radial-gradient(1100px 720px at 8% -12%, rgba(40,170,95,0.60), transparent 62%),
              radial-gradient(960px 640px at 104% 108%, rgba(20,140,150,0.50), transparent 62%), #050b07;
}
html[data-bg="azul"] .ambient {
  background: radial-gradient(1100px 720px at 8% -12%, rgba(60,110,255,0.55), transparent 62%),
              radial-gradient(960px 640px at 104% 108%, rgba(40,190,255,0.40), transparent 62%), #050912;
}
html[data-bg="morado"] .ambient {
  background: radial-gradient(1100px 720px at 8% -12%, rgba(150,90,255,0.55), transparent 62%),
              radial-gradient(960px 640px at 104% 108%, rgba(255,90,200,0.35), transparent 62%), #0a0614;
}
html[data-bg="atardecer"] .ambient {
  background: radial-gradient(1100px 720px at 8% -12%, rgba(255,150,60,0.50), transparent 62%),
              radial-gradient(960px 640px at 104% 108%, rgba(255,70,110,0.38), transparent 62%), #120905;
}
html[data-bg="cuarto"] .ambient::before {
  content: "";
  position: absolute;
  inset: -4%;
  background: linear-gradient(rgba(2, 6, 4, 0.22), rgba(2, 6, 4, 0.40)), url("../assets/ambient.jpg") center / cover no-repeat;
  animation: room-drift 46s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes room-drift { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.09) translate3d(-1.6%, -1.2%, 0); } }

/* Tinte de las ventanas emergentes según el fondo elegido (--tint-rgb: color claro, --deep-rgb: base oscura) */
html[data-bg="transparent"] { --tint-rgb: 120, 140, 130; --deep-rgb: 8, 12, 10; --accent-rgb: 61, 255, 122; }
html[data-bg="cristal"]     { --tint-rgb: 170, 225, 255; --deep-rgb: 10, 20, 28; --accent-rgb: 140, 210, 255; }
html[data-bg="negro"]       { --tint-rgb: 95, 100, 98;   --deep-rgb: 4, 6, 5; --accent-rgb: 61, 255, 122; }
html[data-bg="grafito"]     { --tint-rgb: 150, 160, 172; --deep-rgb: 14, 17, 20; --accent-rgb: 205, 215, 226; }
html[data-bg="verde"]       { --tint-rgb: 40, 170, 95;   --deep-rgb: 4, 16, 9; --accent-rgb: 61, 255, 122; }
html[data-bg="azul"]        { --tint-rgb: 70, 120, 255;  --deep-rgb: 5, 10, 26; --accent-rgb: 96, 150, 255; }
html[data-bg="morado"]      { --tint-rgb: 150, 95, 255;  --deep-rgb: 11, 5, 24; --accent-rgb: 176, 125, 255; }
html[data-bg="atardecer"]   { --tint-rgb: 255, 140, 70;  --deep-rgb: 22, 9, 5; --accent-rgb: 255, 150, 80; }
html[data-bg="cuarto"]      { --tint-rgb: 70, 112, 88;   --deep-rgb: 8, 14, 11; --accent-rgb: 61, 255, 122; }

/* Selector de fondo (Ajustes) */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; }
.swatch { display: flex; flex-direction: column; gap: 8px; align-items: stretch; background: none; border: 0; padding: 0; color: var(--muted); font-size: 12.5px; text-align: center; }
.swatch-prev { height: 62px; border-radius: 18px; box-shadow: inset 1px 1px 0 rgba(255,255,255,0.40), inset -1px -1px 0 rgba(255,255,255,0.10), 0 10px 18px -12px rgba(0,0,0,0.7); transition: transform .15s; }
.swatch:hover .swatch-prev { transform: translateY(-2px); }
.swatch.on { color: var(--text); }
.swatch.on .swatch-prev { outline: 2px solid var(--neon); outline-offset: 3px; }

/* ---------- Estructura de la app ---------- */
.app-root {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.titlebar {
  height: var(--titlebar);
  flex: 0 0 var(--titlebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  -webkit-app-region: drag;
  user-select: none;
}
body.is-electron .titlebar { padding-right: 150px; }
.titlebar > * { -webkit-app-region: no-drag; }
.titlebar .tb-title { -webkit-app-region: drag; color: var(--muted); font-size: 12px; }

.presence { display: flex; align-items: center; gap: 10px; }
.presence .sync {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.dot.off { background: var(--rose); box-shadow: 0 0 10px var(--rose); }
.dot.wait { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; }

.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--widgets-w);
  gap: 18px;
  padding: 0 18px 18px;
}

/* ---------- LIQUID GLASS ----------
   Vidrio casi transparente: desenfoque ligero, color realzado, borde con brillo
   especular arriba-izquierda y un destello que sigue al puntero. */
.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-bg);
  border-radius: var(--r-lg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--rim), var(--glass-shadow);
}
.glass::before, .glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
}
.glass::before {
  background:
    radial-gradient(130% 90% at 0% 0%, rgba(255,255,255,0.13), transparent 46%),
    radial-gradient(90% 70% at 100% 100%, rgba(255,255,255,0.06), transparent 52%);
}
.glass::after {
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,0.22), transparent 62%);
  opacity: 0;
  transition: opacity .3s ease;
}
.glass:hover::after { opacity: 1; }

/* ---------- Barra lateral ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  min-height: 0;
  border-radius: var(--r-xl);
}
.brand { display: flex; flex-direction: column; align-items: center; padding: 4px 6px 16px; }
.brand img, .brand svg { width: 100%; max-width: 150px; height: auto; display: block; }
.auth-card .brand img, .auth-card .brand svg { max-width: 230px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  border: 0; background: transparent;
  border-radius: 999px;
  color: var(--muted);
  text-align: left;
  transition: background .2s, color .2s, box-shadow .2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.nav-item.active {
  background: linear-gradient(145deg, rgba(255,255,255,0.24), rgba(255,255,255,0.07));
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.50), inset -1px -1px 0 rgba(255,255,255,0.13), inset 0 0 0 1px rgba(255,255,255,0.06), 0 8px 18px -8px rgba(0,0,0,0.5);
  color: var(--text);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 11px; bottom: 11px; width: 3px;
  background: var(--neon); border-radius: 0 3px 3px 0; box-shadow: 0 0 14px var(--neon);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-item .badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px;
  font-size: 11px; font-weight: 600; text-align: center;
  background: var(--neon-dim); color: var(--neon); border-radius: 20px;
}
.nav-sep { height: 1px; background: var(--glass-line-soft); margin: 8px 6px; }
.me {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 4px; margin-top: 6px;
  border-top: 1px solid var(--glass-line-soft);
}
.me .who { min-width: 0; line-height: 1.2; }
.me .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: var(--muted); }

/* ---------- Panel principal ---------- */
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: none;
}
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 28px 30px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.05; letter-spacing: -0.01em; }
.view-head .sub { color: var(--muted); margin-top: 6px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Widgets flotantes (el momento memorable) ---------- */
.widgets {
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  perspective: 1400px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 4px 4px 0;
}
.widget {
  padding: 18px 18px 16px;
  border-radius: var(--r-xl);
  transform: rotateY(-9deg) translateZ(0);
  transform-origin: left center;
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.widget:hover { transform: rotateY(0deg); }
.widget:nth-child(1) { background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-rgb), 0.04) 58%), var(--glass-bg); }
.widget .w-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
.widget .w-big { font-family: var(--serif); font-size: 44px; line-height: 1.05; margin: 6px 0 2px; }
.widget .w-note { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.widget svg.chart { display: block; width: 100%; margin-top: 12px; overflow: visible; }
.round-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; color: #04120a;
  background: radial-gradient(circle at 30% 22%, #ffffff, #c9e8d3 75%);
  box-shadow: inset 0 -2px 3px rgba(0,60,20,0.25), 0 6px 14px -4px rgba(0,0,0,0.6);
  transition: transform .15s, box-shadow .15s;
}
.round-btn:hover { transform: scale(1.08); box-shadow: 0 0 0 5px var(--accent-dim), 0 6px 14px -4px rgba(0,0,0,0.6); }
.round-btn svg { width: 16px; height: 16px; }

/* ---------- Tarjetas y bloques ---------- */
.panel { padding: 18px 20px; border-radius: var(--r-lg); }
.panel h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-21 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }

.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 40px; line-height: 1.1; margin-top: 4px; text-shadow: 0 2px 18px rgba(0,0,0,0.35); }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.up { color: var(--neon); }
.down { color: var(--rose); }

.legend { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.legend .row { display: flex; align-items: center; gap: 9px; }
.legend .sw { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend .row b { margin-left: auto; font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-wrap svg { flex: 0 0 auto; }

.feed { display: flex; flex-direction: column; gap: 2px; }
.feed .item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--glass-line-soft); font-size: 13px; }
.feed .item:last-child { border-bottom: 0; }
.feed .item .when { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.feed .item .txt { min-width: 0; }
.feed .item .txt span { color: var(--muted); }

.empty { color: var(--muted); padding: 18px 4px; font-size: 13.5px; }
.empty b { color: var(--text); font-weight: 600; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  border: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.50), inset -1px -1px 0 rgba(255,255,255,0.13), inset 0 0 0 1px rgba(255,255,255,0.06), 0 8px 16px -8px rgba(0,0,0,0.55);
  transition: background .2s, transform .12s, box-shadow .2s;
}
.btn:hover { background: linear-gradient(145deg, rgba(255,255,255,0.32), rgba(255,255,255,0.10)); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(165deg, #8bffb0 0%, #3dff7a 46%, #1fcf5c 100%);
  color: #03150a; font-weight: 600;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.75), inset -1px -2px 0 rgba(0,70,25,0.28), 0 10px 26px -8px rgba(61,255,122,0.75);
}
.btn.primary:hover { background: linear-gradient(165deg, #a6ffc2 0%, #5bff90 46%, #2fdf6c 100%); }
.btn.danger { color: var(--rose); background: linear-gradient(145deg, rgba(255,122,138,0.20), rgba(255,122,138,0.05)); }
.btn.danger:hover { background: linear-gradient(145deg, rgba(255,122,138,0.30), rgba(255,122,138,0.10)); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255,255,255,0.10); transform: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  padding: 10px 14px;
  color: var(--text);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.35), 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color .15s, box-shadow .15s;
}
.select option { background: #0b120d; color: var(--text); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--neon); box-shadow: inset 0 2px 8px rgba(0,0,0,0.35), 0 0 0 3px var(--neon-dim); }
.textarea { resize: vertical; min-height: 80px; }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 34px; width: 230px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: rgba(0,0,0,0.24); border-radius: 999px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.10); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; font-size: 13px; transition: background .2s, color .2s; }
.seg button.on { background: linear-gradient(145deg, rgba(255,255,255,0.28), rgba(255,255,255,0.08)); color: var(--text); box-shadow: inset 1px 1px 0 rgba(255,255,255,0.50), inset -1px -1px 0 rgba(255,255,255,0.13), inset 0 0 0 1px rgba(255,255,255,0.06), 0 6px 12px -6px rgba(0,0,0,0.6); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--glass-strong); color: var(--text);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.accent { color: var(--accent); background: var(--accent-dim); }
.chip.green { color: var(--neon); background: var(--neon-dim); }
.chip.amber { color: var(--amber); background: rgba(255,180,84,0.14); }
.chip.sky { color: var(--sky); background: rgba(92,200,255,0.14); }
.chip.rose { color: var(--rose); background: rgba(255,122,138,0.14); }
.chip.violet { color: var(--violet); background: rgba(199,155,255,0.14); }
.chip.gray { color: var(--muted); background: var(--glass); }

.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #04120a;
  border: 2px solid rgba(5, 8, 6, 0.9);
  flex: 0 0 auto;
}
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.avatar.ghost { background: var(--glass-strong) !important; color: var(--muted); border-color: transparent; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--glass-line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--glass-line-soft); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(255,255,255,0.07); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.tbl-foot { display: flex; justify-content: space-between; padding: 12px 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- Kanban de leads ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(236px, 1fr); gap: 12px; align-items: start; padding-bottom: 8px; overflow-x: auto; }
.col { padding: 12px; border-radius: 24px; min-height: 160px; transition: background .2s, box-shadow .2s; }
.col.over { background: linear-gradient(145deg, rgba(61,255,122,0.28), rgba(61,255,122,0.08)); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.col-head b { font-weight: 600; }
.col-head .sum { color: var(--muted); font-size: 12px; }
.cards { display: flex; flex-direction: column; gap: 9px; max-height: calc(100vh - 300px); min-height: 60px; overflow-y: auto; padding: 1px 3px 4px 1px; }
.lead-card {
  padding: 12px 13px; border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  border: 0;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.50), inset -1px -1px 0 rgba(255,255,255,0.13), inset 0 0 0 1px rgba(255,255,255,0.06), 0 10px 18px -12px rgba(0,0,0,0.7);
  cursor: grab; text-align: left; width: 100%;
  transition: transform .18s, background .2s;
}
.lead-card:hover { background: linear-gradient(145deg, rgba(255,255,255,0.19), rgba(255,255,255,0.05)); transform: translateY(-2px); }
.lead-card.dragging { opacity: .4; }
.lead-card .t { font-weight: 600; }
.lead-card .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.lead-card .f { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; font-size: 12.5px; }
.lead-card .when.late { color: var(--rose); }

/* ---------- Proyectos ---------- */
.project { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.project .p-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.project .p-name { font-weight: 600; font-size: 15px; }
.project .p-client { color: var(--muted); font-size: 12.5px; }
.progress { position: relative; height: 9px; border-radius: 9px; background: rgba(0,0,0,0.30); box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.10); overflow: hidden; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1fbf58, var(--neon)); border-radius: 8px; box-shadow: 0 0 14px rgba(61,255,122,0.5); transition: width .3s; }
input[type=range].slider { width: 100%; accent-color: var(--neon); }
.p-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }

/* ---------- Tareas ---------- */
.quick-add { display: flex; gap: 10px; margin-bottom: 16px; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--glass-line-soft); }
.task:last-child { border-bottom: 0; }
.check {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 7px;
  border: 1.5px solid var(--faint); background: transparent;
  display: grid; place-items: center; padding: 0;
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--neon); }
.check.on { background: var(--neon); border-color: var(--neon); color: #03150a; }
.check svg { width: 13px; height: 13px; opacity: 0; }
.check.on svg { opacity: 1; }
.task .title { flex: 1; min-width: 0; cursor: pointer; }
.task.done .title { color: var(--faint); text-decoration: line-through; }
.task .tools { gap: 10px; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; }
.cal-head h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--text); margin: 0 8px 0 0; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-radius: 26px; overflow: hidden; margin-top: 14px; }
.cal .dow { padding: 10px 12px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.025); border-bottom: 1px solid var(--glass-line-soft); }
.cal .day { min-height: 104px; padding: 7px 7px 6px; border-right: 1px solid var(--glass-line-soft); border-bottom: 1px solid var(--glass-line-soft); background: transparent; text-align: left; border-top: 0; border-left: 0; border-radius: 0; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: var(--glass); }
.cal .day.other { opacity: .38; }
.cal .day .n { font-size: 12.5px; color: var(--muted); align-self: flex-end; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .n { background: var(--neon); color: #03150a; font-weight: 700; }
.cal .ev { font-size: 11.5px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; text-align: left; width: 100%; cursor: pointer; }
.ev.k-event { background: var(--neon-dim); color: var(--neon); }
.ev.k-task { background: var(--glass-strong); color: var(--text); }
.ev.k-project { background: rgba(255,180,84,0.16); color: var(--amber); }
.ev.k-payment { background: rgba(92,200,255,0.16); color: var(--sky); }
.cal .more { font-size: 11px; color: var(--muted); padding-left: 6px; }
.cal-legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* ---------- Gráficas ---------- */
.bar { transform-origin: bottom; transform-box: fill-box; animation: grow .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s ease-out .15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--sans); }
.fade-in { animation: fade .5s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* Sin re-animar gráficas cuando solo llegan cambios en vivo */
.no-anim .bar, .no-anim .draw, .no-anim.fade-in, .no-anim .fade-in { animation: none !important; }
.no-anim .draw { stroke-dashoffset: 0; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(var(--deep-rgb), 0.46);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  backdrop-filter: blur(10px) saturate(130%);
  animation: fade .18s ease both;
  padding: 20px;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  background: linear-gradient(145deg, rgba(var(--tint-rgb), 0.46), rgba(var(--deep-rgb), 0.68) 55%, rgba(var(--tint-rgb), 0.30));
  border-radius: var(--r-xl);
  -webkit-backdrop-filter: blur(30px) saturate(190%) brightness(1.08);
  backdrop-filter: blur(30px) saturate(190%) brightness(1.08);
  box-shadow: var(--rim), 0 50px 110px -24px rgba(0,0,0,0.9);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 6px; }
.modal-head h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; }
.modal-body { padding: 14px 24px 6px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 16px 24px 22px; }
.modal-foot .right { display: flex; gap: 10px; margin-left: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--rose); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px;
  background: linear-gradient(145deg, rgba(var(--tint-rgb), 0.50), rgba(var(--deep-rgb), 0.72));
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: var(--rim), 0 22px 50px -16px rgba(0,0,0,0.9);
  max-width: 400px; font-size: 13.5px;
  animation: toast-in .3s cubic-bezier(.2,.7,.2,1) both;
}
.toast.err { box-shadow: var(--rim), 0 0 0 1px rgba(255,122,138,0.55), 0 22px 50px -16px rgba(0,0,0,0.9); }
.toast.out { animation: toast-out .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Pantallas de acceso ---------- */
.center-screen { flex: 1; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.auth-card { width: min(420px, 100%); padding: 32px 30px 28px; border-radius: var(--r-xl); }
.auth-card .brand { padding-bottom: 8px; }
.auth-card h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; text-align: center; margin: 6px 0 4px; }
.auth-card p.lead { text-align: center; color: var(--muted); margin-bottom: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { justify-content: center; padding: 11px 14px; }
.auth-card ol { color: var(--muted); padding-left: 20px; line-height: 1.7; }
.auth-card code { background: rgba(0,0,0,0.4); padding: 1px 6px; border-radius: 6px; color: var(--text); }

.banner { margin: 0 18px 12px; padding: 8px 14px; border-radius: 12px; font-size: 13px; background: rgba(255,180,84,0.14); border: 1px solid rgba(255,180,84,0.4); color: var(--amber); }

/* ---------- Adaptación a ventanas más pequeñas ---------- */
@media (max-width: 1360px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .widgets { display: none; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 74px; }
  .sidebar .nav-item span, .sidebar .nav-item .badge, .me .who, .brand .brand-text { display: none; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-item.active::before { left: -12px; }
  .brand img, .brand svg { max-width: 52px; }
  .grid.cols-21, .grid.cols-3, .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 20px 18px 24px; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 32px; }
  .searchbox .input { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .widget { transform: none; }
}
