/* Hugo · administrador.
 * Línea visual tomada de la referencia que eligió Rubén (Behance "ERP/POS System", sep 2026):
 * marco gris translúcido con malla pastel, píldoras, lima para lo activo, tarjetas blancas muy
 * redondeadas y cifras en tonos pastel (durazno, lavanda, agua). Tipografía Inter.
 * El tema oscuro se activa con data-theme="dark" en <html> (lo pone el script del <head>). */

:root {
  --pagina: #ECECEE;
  --marco-base: #D8D8DB;
  --vidrio: rgba(255, 255, 255, .40);
  --vidrio-fuerte: rgba(255, 255, 255, .66);
  --panel: rgba(255, 255, 255, .92);
  --panel-solido: #FFFFFF;
  --campo: #F1F1F3;
  --tinta: #26282B;
  --suave: #7B7E85;
  --linea: rgba(38, 40, 43, .09);
  --borde-btn: rgba(38, 40, 43, .55);

  --lima: #EAFB8C;
  --lima-tinta: #26282B;
  --oscuro: #26282B;
  --oscuro-tinta: #FFFFFF;

  --durazno: #FFF4E8;  --durazno-2: #FFE4C4;  --naranja: #F2A93B;  --naranja-tinta: #B86E0B;
  --lavanda: #F3EEFF;  --lavanda-2: #E3D8FF;  --violeta: #8B6CF6;  --violeta-tinta: #6446D8;
  --agua: #E4F8FA;     --agua-2: #C8EFF4;     --cian: #22C3D6;     --cian-tinta: #0B8795;
  --rosa: #FDECEA;     --rojo: #E5534B;
  --verde-2: #E2F6E9;  --verde: #1FA855;

  /* nombres que usan los scripts en estilos en línea */
  --acento: var(--violeta);
  --ingreso: var(--cian);
  --gasto: var(--naranja);
  --peligro: var(--rojo);
  --ok: var(--verde);
  --alerta: var(--naranja);
  --trabajo: var(--violeta);
  --personal: var(--naranja);
  --cliente: var(--cian);

  --sombra: 0 1px 2px rgba(20, 20, 30, .04), 0 12px 32px rgba(20, 20, 30, .05);
  --r-marco: 36px;
  --r: 24px;
  --r-chico: 14px;
  --malla:
    radial-gradient(52% 44% at 78% 90%, rgba(150, 170, 228, .55), transparent 70%),
    radial-gradient(36% 40% at 100% 62%, rgba(206, 212, 180, .55), transparent 70%),
    radial-gradient(42% 42% at 48% 104%, rgba(196, 184, 232, .52), transparent 70%),
    radial-gradient(30% 32% at 100% 100%, rgba(166, 210, 204, .62), transparent 70%);
  --letra: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --pagina: #111214;
  --marco-base: #1A1B1E;
  --vidrio: rgba(255, 255, 255, .05);
  --vidrio-fuerte: rgba(255, 255, 255, .10);
  --panel: rgba(37, 38, 42, .94);
  --panel-solido: #26272B;
  --campo: #303136;
  --tinta: #ECECEE;
  --suave: #9B9EA5;
  --linea: rgba(255, 255, 255, .08);
  --borde-btn: rgba(255, 255, 255, .28);
  --lima: #E2F57C;
  --oscuro: #ECECEE;
  --oscuro-tinta: #1A1B1E;
  --durazno: rgba(242, 169, 59, .12);  --durazno-2: rgba(242, 169, 59, .24);  --naranja-tinta: #F5B85C;
  --lavanda: rgba(139, 108, 246, .14); --lavanda-2: rgba(139, 108, 246, .28); --violeta-tinta: #B4A0FF;
  --agua: rgba(34, 195, 214, .12);     --agua-2: rgba(34, 195, 214, .26);     --cian-tinta: #5FD6E4;
  --rosa: rgba(229, 83, 75, .16);
  --verde-2: rgba(31, 168, 85, .18);
  --sombra: none;
  --malla:
    radial-gradient(52% 44% at 78% 90%, rgba(110, 120, 200, .20), transparent 70%),
    radial-gradient(42% 42% at 48% 104%, rgba(140, 110, 220, .18), transparent 70%),
    radial-gradient(30% 32% at 100% 100%, rgba(80, 170, 165, .20), transparent 70%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--letra); background: var(--pagina); color: var(--tinta); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 500; }
h1 { font-size: 27px; letter-spacing: -.02em; }
h2 { font-size: 18px; letter-spacing: -.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 600; }
a { color: var(--tinta); text-underline-offset: 3px; }
.muted { color: var(--suave); margin: 3px 0 0; }
.error { color: var(--rojo); margin: 8px 0 0; font-weight: 500; }
.espacio { flex: 1; }
svg.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- botones y campos ---------- */
.btn {
  font: 500 14px/1.1 var(--letra); border: 1px solid var(--borde-btn); background: var(--panel-solido); color: var(--tinta);
  padding: 11px 18px; border-radius: 999px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--tinta); }
.btn:active { transform: scale(.98); }
.btn.primario { background: var(--oscuro); border-color: var(--oscuro); color: var(--oscuro-tinta); }
.btn.primario:hover { filter: brightness(1.15); }
.btn.lima { background: var(--lima); border-color: transparent; color: var(--lima-tinta); }
.btn.fantasma { background: transparent; border-color: transparent; }
.btn.fantasma:hover { background: var(--vidrio-fuerte); }
.btn.peligro { color: var(--rojo); border-color: transparent; background: var(--rosa); }
.btn.pequeño { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: 15px/1.3 var(--letra); color: var(--tinta); background: var(--campo); width: 100%;
  border: 1px solid transparent; border-radius: var(--r-chico); padding: 11px 14px; transition: box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; background: var(--panel-solido); border-color: var(--linea); box-shadow: 0 0 0 3px var(--lima); }
textarea { resize: vertical; min-height: 76px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--suave) 50%), linear-gradient(135deg, var(--suave) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--suave); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--oscuro); padding: 0; }
.check { display: flex; align-items: center; gap: 9px; color: var(--tinta); font-weight: 500; font-size: 14px; }

/* búsqueda en píldora con lupa */
.busqueda { position: relative; display: block; min-width: 180px; flex: 1 1 200px; max-width: 320px; }
.busqueda svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--suave); pointer-events: none; }
.busqueda input { background: var(--panel-solido); border-radius: 999px; padding-left: 40px; }

/* ---------- entrada ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--malla), var(--marco-base); }
.login-caja { width: min(380px, 100%); display: grid; gap: 16px; background: var(--panel-solido); padding: 34px; border-radius: 32px; box-shadow: var(--sombra); }
.marca-grande { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.login .btn { justify-content: center; }

/* ---------- marca ---------- */
.logo { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; padding: 0 6px; }
.logo .apellido { font-weight: 400; color: var(--suave); margin-left: -5px; }
/* La marca no sigue a --oscuro: en tema oscuro ese token se aclara y la "H" lima desaparecía. */
.logo-marca { width: 36px; height: 36px; border-radius: 50%; background: #26282B; color: #EAFB8C; display: grid; place-items: center; font: 700 17px/1 var(--letra); flex: none; }
:root[data-theme="dark"] .logo-marca { background: #EAFB8C; color: #26282B; }
.marca-grande .logo-marca { width: 44px; height: 44px; font-size: 20px; }

/* ---------- estructura: el marco ---------- */
.app {
  margin: 16px; min-height: calc(100vh - 32px); border-radius: var(--r-marco);
  background: var(--malla), var(--marco-base); display: grid; grid-template-columns: 248px minmax(0, 1fr);
}
.lateral { position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 26px; padding: 28px 18px 22px; }
nav { display: grid; gap: 10px; flex: 1; align-content: start; }
nav a {
  display: flex; align-items: center; gap: 13px; height: 50px; padding: 0 18px; border-radius: 999px;
  background: var(--vidrio); color: var(--tinta); text-decoration: none; font-weight: 500; font-size: 15px; transition: background .15s;
}
nav a:hover { background: var(--vidrio-fuerte); }
nav a.activo { background: var(--lima); color: var(--lima-tinta); font-weight: 600; }
nav a i { display: grid; font-style: normal; }
#salir { justify-content: center; background: var(--vidrio); border-color: transparent; }

.principal { padding: 28px 28px 48px 6px; min-width: 0; }
.cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.cabecera p { font-size: 15px; }
.cabecera-der { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.capsula { display: flex; align-items: center; gap: 2px; background: var(--vidrio); border-radius: 999px; padding: 5px; }
.capsula button, .capsula a {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--tinta); display: grid; place-items: center; cursor: pointer; position: relative;
}
.capsula button:hover, .capsula a:hover { background: var(--vidrio-fuerte); }
.capsula .avatar { width: 38px; height: 38px; margin-left: 4px; border-radius: 50%; background: var(--lima); color: var(--lima-tinta); display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.insignia { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--rojo); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.vista { display: grid; gap: 18px; }

/* ---------- tarjetas ---------- */
.rejilla { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); }
.tarjeta { background: var(--panel); border-radius: var(--r); box-shadow: var(--sombra); padding: 22px; min-width: 0; }
.tarjeta > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tarjeta > header a { font-size: 13.5px; color: var(--suave); }
.tarjeta > header a:hover { color: var(--tinta); }
.vacio { color: var(--suave); padding: 8px 0; font-size: 14px; }

/* cifras en tono pastel */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); }
.stat { --t: var(--panel); --t2: var(--campo); --tf: var(--tinta); background: var(--t); border-radius: 22px; padding: 18px 20px; display: grid; gap: 14px; align-content: space-between; box-shadow: var(--sombra); }
.stat.durazno { --t: var(--durazno); --t2: var(--durazno-2); --tf: var(--naranja-tinta); }
.stat.lavanda { --t: var(--lavanda); --t2: var(--lavanda-2); --tf: var(--violeta-tinta); }
.stat.agua { --t: var(--agua); --t2: var(--agua-2); --tf: var(--cian-tinta); }
.stat-cab { display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 50px; height: 50px; border-radius: 15px; background: var(--t2); color: var(--tf); display: grid; place-items: center; flex: none; }
.stat-ico svg { width: 24px; height: 24px; }
.stat b { display: block; font-size: 29px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .etq { font-size: 13.5px; color: var(--tinta); opacity: .75; }
.stat .nota { font-size: 13.5px; color: var(--suave); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat .nota svg { width: 17px; height: 17px; }
.sube { color: var(--verde); font-weight: 600; }
.baja { color: var(--rojo); font-weight: 600; }

.cifras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.cifra { background: var(--panel); border-radius: 20px; padding: 14px 16px; box-shadow: var(--sombra); }
.cifra b { display: block; font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cifra span { font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.ingreso { color: var(--cian-tinta); }
.gasto { color: var(--naranja-tinta); }

/* ---------- listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; display: grid; }
.fila { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--linea); cursor: pointer; border-radius: 12px; }
.fila:last-child { border-bottom: 0; }
.fila:hover { background: var(--campo); }
.fila .cuando { font-size: 13.5px; font-weight: 600; color: var(--tinta); min-width: 70px; font-variant-numeric: tabular-nums; }
.fila .que { min-width: 0; }
.fila .que b { display: block; font-weight: 500; overflow-wrap: anywhere; }
.fila .que small { color: var(--suave); display: block; overflow-wrap: anywhere; font-size: 13px; }
.fila .que .etiqueta { margin-top: 5px; }
.fila.hecho .que b { text-decoration: line-through; color: var(--suave); }
.fila .lado { display: flex; gap: 6px; align-items: center; }
.dia-sep { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); padding: 16px 8px 6px; }
.dia-sep:first-child { padding-top: 0; }

.caja-check { width: 24px; height: 24px; border-radius: 8px; border: 1.6px solid var(--borde-btn); background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--lima-tinta); font-size: 13px; font-weight: 700; }
.caja-check:hover { background: var(--lima); border-color: var(--lima); }
.caja-check.lleno { background: var(--lima); border-color: var(--lima); }

.etiqueta { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--campo); color: var(--suave); white-space: nowrap; }
.etiqueta.alerta { background: var(--durazno-2); color: var(--naranja-tinta); }
.etiqueta.ok { background: var(--verde-2); color: var(--verde); }
.etiqueta.peligro { background: var(--rosa); color: var(--rojo); }
.etiqueta.trabajo { background: var(--lavanda-2); color: var(--violeta-tinta); }
.etiqueta.cliente { background: var(--agua-2); color: var(--cian-tinta); }

/* ---------- tablas: encabezado en píldora gris ---------- */
.tabla-caja { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th { text-align: left; font-size: 13px; font-weight: 500; color: var(--tinta); padding: 12px 14px; background: var(--campo); white-space: nowrap; }
th:first-child { border-radius: 999px 0 0 999px; }
th:last-child { border-radius: 0 999px 999px 0; }
td { padding: 13px 14px; border-bottom: 1px solid var(--linea); vertical-align: top; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--campo); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- filtros: barra en píldora ---------- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--vidrio); border-radius: 28px; padding: 8px; }
.filtros > label:not(.check):not(.busqueda) { min-width: 140px; flex: 0 1 180px; }
.filtros > label:not(.check):not(.busqueda) input { background: var(--panel-solido); }
.filtros .check { padding: 0 8px; }
.pestañas { display: inline-flex; gap: 3px; background: var(--vidrio); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.filtros .pestañas { background: transparent; padding: 0; }
.pestañas button { font: 500 14px/1 var(--letra); border: 0; background: transparent; color: var(--suave); padding: 10px 15px; border-radius: 999px; cursor: pointer; }
.pestañas button:hover { color: var(--tinta); }
.pestañas button.activo { background: var(--panel-solido); color: var(--tinta); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.pestañas.pequeñas button { padding: 6px 11px; font-size: 12.5px; }
.tarjeta .pestañas { background: var(--campo); }

/* ---------- barras y columnas (finanzas) ---------- */
.barras { display: grid; gap: 12px; }
.barra-fila { display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13.5px; }
.barra-fila .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.barra { height: 8px; border-radius: 99px; background: var(--campo); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--gasto); border-radius: 99px; }
.meses { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); gap: 8px; align-items: end; height: 180px; overflow-x: auto; padding-bottom: 4px; }
.mes { display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; }
.mes .col { display: flex; gap: 4px; align-items: end; justify-content: center; }
.mes .col i { width: 12px; border-radius: 6px 6px 3px 3px; min-height: 3px; }
.mes .col i.in { background: var(--ingreso); }
.mes .col i.out { background: var(--gasto); }
.mes small { text-align: center; color: var(--suave); font-size: 11.5px; }
.leyenda { display: flex; gap: 16px; font-size: 13px; color: var(--suave); margin-top: 10px; flex-wrap: wrap; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* ---------- chat ---------- */
.chat { display: grid; gap: 12px; }
.burbujas { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.burbuja { padding: 10px 14px; border-radius: 18px; max-width: 88%; white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.burbuja.usuario { background: var(--lima); color: var(--lima-tinta); justify-self: end; border-bottom-right-radius: 6px; }
.burbuja.asistente { background: var(--campo); justify-self: start; border-bottom-left-radius: 6px; }
.burbuja small { display: block; opacity: .6; font-size: 11px; margin-top: 3px; }
.chat form { display: flex; gap: 8px; align-items: center; }
.chat form input { border-radius: 999px; }
.btn-mic { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--campo); color: var(--tinta); display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.btn-mic:hover { background: var(--lima); color: var(--lima-tinta); }
.btn-mic:disabled { opacity: .5; cursor: default; }
.btn-mic.grabando { background: var(--rojo); color: #fff; animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 83, 75, .45); } 50% { box-shadow: 0 0 0 9px rgba(229, 83, 75, 0); } }
@media (prefers-reduced-motion: reduce) { .btn-mic.grabando { animation: none; } }

/* ---------- estado del sistema ---------- */
.estado { display: grid; gap: 10px; font-size: 14px; }
.estado div { display: flex; justify-content: space-between; gap: 10px; }
.estado b { font-weight: 500; }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--suave); }
.punto.ok { background: var(--verde); }
.punto.mal { background: var(--rojo); }
.punto.medio { background: var(--naranja); }
.codigo { font: 600 20px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; background: var(--lima); color: var(--lima-tinta); padding: 10px 14px; border-radius: 14px; display: inline-block; }

.telegram { background: var(--campo); border-radius: 18px; padding: 16px; white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }

/* ---------- configuración ---------- */
.config-grupo { display: grid; gap: 14px; align-content: start; }
.config-grupo .dos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ayuda { font-size: 12.5px; color: var(--suave); font-weight: 400; }
.agenda-publica .link-caja { background: var(--campo); border-radius: 18px; padding: 14px 16px; }
.agenda-publica .link-caja p { margin: 0 0 8px; }
.agenda-publica code { font-size: 13.5px; overflow-wrap: anywhere; background: var(--panel-solido); padding: 3px 8px; border-radius: 8px; }
.etq-campo { display: block; font-size: 13px; font-weight: 500; color: var(--suave); margin-bottom: 8px; }
.dias-check { display: flex; gap: 6px; flex-wrap: wrap; }
.pastilla { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; background: var(--campo); font-size: 13.5px; color: var(--tinta); font-weight: 500; cursor: pointer; }
.pastilla:has(input:checked) { background: var(--lima); color: var(--lima-tinta); }
.pastilla input { width: 15px; height: 15px; }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; border-radius: 28px; width: min(580px, calc(100vw - 24px)); background: var(--panel-solido); color: var(--tinta); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal::backdrop { background: rgba(20, 20, 26, .38); backdrop-filter: blur(3px); }
.modal form { display: grid; gap: 16px; padding: 24px; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-cab { display: flex; justify-content: space-between; align-items: center; }
.modal-cab h2 { font-size: 20px; }
.cerrar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--campo); font-size: 15px; cursor: pointer; color: var(--tinta); }
.campos { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.campos .ancho { grid-column: 1 / -1; }
.modal-pie { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.aviso {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--oscuro); color: var(--oscuro-tinta); padding: 12px 20px; border-radius: 999px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: calc(100vw - 30px);
}
.aviso.mal { background: var(--rojo); color: #fff; }

/* ---------- lo que cuesta Hugo ---------- */
.costo-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.costo-total b { font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.costo-proy { margin: 4px 0 0; }
.lista.costos { margin: 12px 0 14px; }
.fila-costo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.fila-costo:last-child { border-bottom: 0; }
.fila-costo b { font-weight: 500; }
.fila-costo small { display: block; color: var(--suave); font-size: 12.5px; margin-top: 2px; }
.fila-costo .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra-fila.costo-limite { grid-template-columns: auto minmax(0, 1fr) auto; }
.costo-nota { margin: 12px 0 0; }

/* ---------- calendario semanal ---------- */
.cal-controles { align-items: center; }
.cal-rango { font-size: 16px; font-weight: 600; padding: 0 6px; }
.cal-leyenda { display: flex; gap: 16px; flex-wrap: wrap; margin: 0; font-size: 13px; color: var(--suave); padding: 0 6px; }
.cal-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.l-trabajo { background: var(--violeta); } .l-personal { background: var(--naranja); } .l-cliente { background: var(--cian); }
.l-atencion { background: var(--lima); }
.cal-tarjeta { padding: 0; overflow: hidden; }
.cal-caja { overflow-x: auto; }
.cal { display: grid; grid-template-columns: 60px repeat(7, minmax(106px, 1fr)); min-width: 800px; }
.cal-esquina, .cal-etq, .cal-horas { position: sticky; left: 0; z-index: 3; background: var(--panel-solido); }
.cal-cab { text-align: center; padding: 14px 4px 10px; border-left: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.cal-cab span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); font-weight: 600; }
.cal-cab b { font-size: 20px; font-weight: 600; display: inline-grid; place-items: center; width: 36px; height: 36px; margin-top: 2px; }
.cal-cab.hoy b { background: var(--lima); color: var(--lima-tinta); border-radius: 50%; }
.cal-esquina { border-bottom: 1px solid var(--linea); }
.cal-etq { font-size: 10.5px; color: var(--suave); padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--linea); }
.cal-todo { border-left: 1px solid var(--linea); border-bottom: 1px solid var(--linea); padding: 4px; display: grid; gap: 4px; align-content: start; min-height: 32px; }
.cal-horas span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--suave); white-space: nowrap; }
.cal-horas span:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--linea); cursor: copy; background-image: linear-gradient(var(--linea) 1px, transparent 1px); }
.cal-atencion { position: absolute; left: 0; right: 0; background: var(--lima); opacity: .2; pointer-events: none; }
/* Sobre fondo oscuro, el lima al 20% se veía oliva y pesado. */
:root[data-theme="dark"] .cal-atencion { opacity: .07; }
.cal-ev, .cal-chip { --t: var(--campo); --tf: var(--suave); background: var(--t); color: var(--tinta); border: 0; border-left: 3px solid var(--tf); cursor: pointer; text-align: left; }
.cal-ev { position: absolute; border-radius: 10px; padding: 4px 7px; font: 12px/1.28 var(--letra); overflow: hidden; z-index: 1; }
.cal-ev b { font-weight: 600; margin-right: 2px; }
/* Evento de media hora o menos: una sola línea con "…"; si no, solo se veía la hora. */
.cal-ev.corto { white-space: nowrap; text-overflow: ellipsis; padding-top: 3px; padding-bottom: 3px; }
.cal-chip { font: 500 11.5px/1.3 var(--letra); border-radius: 8px; padding: 4px 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev.trabajo, .cal-chip.trabajo { --t: var(--lavanda-2); --tf: var(--violeta); }
.cal-ev.personal, .cal-chip.personal { --t: var(--durazno-2); --tf: var(--naranja); }
.cal-ev.cliente, .cal-chip.cliente { --t: var(--agua-2); --tf: var(--cian); }
.cal-ev:hover, .cal-chip:hover { filter: brightness(.97); }
.cal-ev.hecho, .cal-chip.hecho { opacity: .5; }
.cal-ev.no-bloquea { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 6px, transparent 6px 12px); }
.cal-ahora { position: absolute; left: 0; right: 0; height: 2px; background: var(--rojo); z-index: 2; pointer-events: none; }
.cal-ahora::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rojo); }

/* ---------- chat flotante con Hugo ---------- */
.chat-boton {
  position: fixed; right: 28px; bottom: 28px; z-index: 40; width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: #26282B; color: #EAFB8C; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24); transition: transform .15s, background .15s;
}
.chat-boton:hover { transform: scale(1.06); }
.chat-boton svg { width: 26px; height: 26px; stroke-width: 1.8; }
.chat-boton.abierto { background: var(--lima); color: #26282B; }
:root[data-theme="dark"] .chat-boton { background: #EAFB8C; color: #26282B; }
.chat-panel {
  position: fixed; right: 28px; bottom: 102px; z-index: 40; width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 132px));
  display: flex; flex-direction: column; background: var(--panel-solido); border-radius: 28px; box-shadow: 0 24px 70px rgba(0, 0, 0, .26); overflow: hidden;
}
.chat-panel > header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--linea); }
.chat-panel > header div { flex: 1; display: grid; line-height: 1.25; }
.chat-panel > header b { font-weight: 600; }
.chat-panel > header small { color: var(--suave); font-size: 12.5px; }
.chat-panel .burbujas { flex: 1; max-height: none; overflow-y: auto; padding: 16px 16px 10px; align-content: start; }
.chat-panel form { display: flex; gap: 8px; align-items: center; padding: 12px 14px 14px; border-top: 1px solid var(--linea); }
.chat-panel form input { border-radius: 999px; }
.btn-enviar { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--oscuro); color: var(--oscuro-tinta); display: grid; place-items: center; cursor: pointer; }
.btn-enviar:hover { filter: brightness(1.15); }
.chat-vacio { text-align: center; padding: 34px 12px; line-height: 1.6; }
.burbuja img { display: block; max-width: 190px; max-height: 240px; border-radius: 12px; margin-bottom: 4px; object-fit: cover; }
td a.etiqueta, .fila a.etiqueta { text-decoration: none; }

/* ---------- paleta de tipos de evento (8 colores) ----------
 * Cada clase c-<color> define --cf (fuerte), --c2 (fondo pastel) y --ct (texto), y ya deja
 * listos --t/--tf para las piezas del calendario. Va después de .cal-ev para ganarle. */
:root {
  --c-violeta: #8B6CF6; --c-violeta-2: #E6DDFF; --c-violeta-t: #5B3FCC;
  --c-cian: #1FBFD3;    --c-cian-2: #CFF3F7;    --c-cian-t: #0B7F8C;
  --c-naranja: #F2A33A; --c-naranja-2: #FFE6C7; --c-naranja-t: #A9620A;
  --c-rosa: #EC5C8A;    --c-rosa-2: #FFDCE7;    --c-rosa-t: #B42F5B;
  --c-verde: #2FB36B;   --c-verde-2: #D6F3E2;   --c-verde-t: #1B7A45;
  --c-azul: #4C7DF0;    --c-azul-2: #DCE6FF;    --c-azul-t: #2A55C0;
  --c-ambar: #E3B20C;   --c-ambar-2: #FFF1BF;   --c-ambar-t: #866600;
  --c-pizarra: #6B7A8C; --c-pizarra-2: #E1E6EC; --c-pizarra-t: #414E5E;
}
:root[data-theme="dark"] {
  --c-violeta-2: rgba(139, 108, 246, .28); --c-violeta-t: #B9A6FF;
  --c-cian-2: rgba(31, 191, 211, .24);     --c-cian-t: #6FDCEA;
  --c-naranja-2: rgba(242, 163, 58, .25);  --c-naranja-t: #F7C27A;
  --c-rosa-2: rgba(236, 92, 138, .25);     --c-rosa-t: #F59AB8;
  --c-verde-2: rgba(47, 179, 107, .24);    --c-verde-t: #7ED7A5;
  --c-azul-2: rgba(76, 125, 240, .26);     --c-azul-t: #93B2FF;
  --c-ambar-2: rgba(227, 178, 12, .22);    --c-ambar-t: #F2D25E;
  --c-pizarra-2: rgba(140, 155, 175, .24); --c-pizarra-t: #AEB9C6;
}
.c-violeta { --cf: var(--c-violeta); --c2: var(--c-violeta-2); --ct: var(--c-violeta-t); }
.c-cian { --cf: var(--c-cian); --c2: var(--c-cian-2); --ct: var(--c-cian-t); }
.c-naranja { --cf: var(--c-naranja); --c2: var(--c-naranja-2); --ct: var(--c-naranja-t); }
.c-rosa { --cf: var(--c-rosa); --c2: var(--c-rosa-2); --ct: var(--c-rosa-t); }
.c-verde { --cf: var(--c-verde); --c2: var(--c-verde-2); --ct: var(--c-verde-t); }
.c-azul { --cf: var(--c-azul); --c2: var(--c-azul-2); --ct: var(--c-azul-t); }
.c-ambar { --cf: var(--c-ambar); --c2: var(--c-ambar-2); --ct: var(--c-ambar-t); }
.c-pizarra { --cf: var(--c-pizarra); --c2: var(--c-pizarra-2); --ct: var(--c-pizarra-t); }
.cal-ev[class*=" c-"], .cal-chip[class*=" c-"] { --t: var(--c2); --tf: var(--cf); }
.etiqueta.tipo { background: var(--c2); color: var(--ct); }
.punto-tipo { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--cf); margin-right: 6px; }
.cal-leyenda a.ayuda { text-decoration: underline; }

/* pastillas de tipo en el formulario del evento */
.grupo-campo { display: grid; gap: 8px; }
.pastillas-tipo { display: flex; flex-wrap: wrap; gap: 6px; }
.pastilla-tipo { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; background: var(--campo); border: 1.5px solid transparent;
  font-size: 13.5px; font-weight: 500; color: var(--tinta); cursor: pointer; }
.pastilla-tipo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pastilla-tipo i { width: 10px; height: 10px; border-radius: 50%; background: var(--cf); }
.pastilla-tipo:hover { border-color: var(--cf); }
.pastilla-tipo:has(input:checked) { background: var(--c2); color: var(--ct); border-color: var(--cf); font-weight: 600; }
.pastilla-tipo:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--lima); }

/* editor de tipos en Configuración */
.tipos-lista { display: grid; gap: 8px; }
.tipo-fila { display: grid; grid-template-columns: 24px minmax(150px, 1fr) 130px auto 34px; gap: 10px; align-items: center; }
.tipo-fila .muestra { width: 24px; height: 24px; border-radius: 8px; background: var(--c2); box-shadow: inset 0 0 0 2px var(--cf); }
.tipo-fila .colores { display: flex; gap: 6px; flex-wrap: wrap; }
.tipo-fila .color { width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; background: var(--cf); cursor: pointer; }
.tipo-fila .color.activo { box-shadow: 0 0 0 2px var(--panel-solido), 0 0 0 4px var(--cf); }
.tipo-fila .quitar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--campo); color: var(--suave); cursor: pointer; }
.tipo-fila .quitar:hover { background: var(--rosa); color: var(--rojo); }
.tipo-fila .fijo { text-align: center; font-size: 15px; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .app { margin: 0; border-radius: 0; min-height: 100vh; grid-template-columns: minmax(0, 1fr); }
  .lateral {
    position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px; top: auto; height: auto; z-index: 20;
    flex-direction: row; gap: 0; padding: 6px; border-radius: 999px; background: var(--panel-solido); box-shadow: 0 10px 40px rgba(0, 0, 0, .16);
  }
  .logo, #salir { display: none; }
  nav { display: flex; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  nav a { flex-direction: column; justify-content: center; gap: 3px; height: 56px; min-width: 68px; padding: 0 8px; font-size: 10.5px; background: transparent; }
  nav a i svg { width: 21px; height: 21px; }
  .principal { padding: 20px 14px 112px; }
  .cabecera { flex-direction: column; }
  .cabecera-der { width: 100%; justify-content: space-between; }
  .campos { grid-template-columns: minmax(0, 1fr); }
  .barra-fila { grid-template-columns: 84px minmax(0, 1fr) 92px; }
  h1 { font-size: 23px; }
  .filtros { border-radius: 22px; }
  .busqueda { max-width: none; }
  /* Chat: el botón queda sobre el menú de abajo; abierto, el chat ocupa casi toda la pantalla y trae su propio ✕. */
  .chat-boton { right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  .chat-boton.abierto { display: none; }
  .chat-panel { left: 8px; right: 8px; width: auto; bottom: calc(8px + env(safe-area-inset-bottom)); height: min(80vh, calc(100vh - 24px)); z-index: 45; border-radius: 24px; }
  .tipo-fila { grid-template-columns: 24px minmax(0, 1fr) 34px; padding: 8px 0; border-bottom: 1px solid var(--linea); }
  .tipo-fila .tipo-ambito, .tipo-fila .colores { grid-column: 2 / 3; }
}
