:root {
  --tinta: #1d1f20; --acero: #5980a6; --acero-claro: #a9bed3; --acero-prof: #26384b; --papel: #f2f2f3;
  --papel-2: #ffffff; --papel-linea: #cfd5dc; --papel-suave: #5c6672; --placa: #0b1219; --senal: #e0b15a;
  --verde: #2f8a5b; --rojo: #b9443f; --logo-acento: var(--acero-claro);
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif; --sans: "Barlow", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  --radio: 10px; --sombra: 0 1px 2px rgba(11,18,25,.06), 0 8px 24px -12px rgba(11,18,25,.25);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font: 15px/1.45 var(--sans); color: var(--tinta); background: var(--papel); -webkit-font-smoothing: antialiased; }
a { color: var(--acero); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--cond); font-weight: 800; letter-spacing: .01em; margin: 0; text-transform: uppercase; }
h1 { font-size: 30px; line-height: 1; } h2 { font-size: 22px; } h3 { font-size: 17px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.suave { color: var(--papel-suave); }

/* barra superior */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: 58px; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right)); background: var(--placa); color: var(--papel); }
.marca { display: flex; align-items: baseline; gap: 8px; color: var(--papel); text-decoration: none; }
.logo { width: 116px; height: 30px; color: var(--papel); }
.marca-sub { font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: .12em; color: var(--acero-claro); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 12px; border-radius: 6px; color: var(--acero-claro); text-decoration: none; font-family: var(--cond); font-weight: 700; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.activa { background: var(--acero-prof); color: #fff; }
.barra-der { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.buscar input { width: 220px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.06); color: #fff; outline: none; }
.buscar input::placeholder { color: rgba(255,255,255,.45); }
.buscar input:focus { border-color: var(--acero-claro); background: rgba(255,255,255,.1); }
.boton-nuevo { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--senal); color: var(--placa); font-family: var(--cond); font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }
.boton-nuevo:hover { filter: brightness(1.06); }
.usuario { position: relative; }
.usuario-btn { border: 0; background: none; padding: 0; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--acero); color: #fff; font-family: var(--cond); font-weight: 800; font-size: 16px; }
.menu { position: absolute; right: 0; top: 44px; min-width: 220px; padding: 6px; background: #fff; color: var(--tinta); border-radius: 10px; box-shadow: var(--sombra); border: 1px solid var(--papel-linea); }
.menu-nombre { padding: 8px 10px 10px; font-weight: 600; border-bottom: 1px solid var(--papel-linea); margin-bottom: 4px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--tinta); }
.menu button:hover, .menu a:hover { background: var(--papel); }

/* contenido */
.contenido { max-width: 1280px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right)) 90px max(16px, env(safe-area-inset-left)); }
.encabezado { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.encabezado p { margin: 4px 0 0; color: var(--papel-suave); }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.boton { padding: 8px 14px; border: 1px solid var(--papel-linea); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 500; }
.boton:hover { border-color: var(--acero); }
.boton.primario { background: var(--acero-prof); border-color: var(--acero-prof); color: #fff; }
.boton.primario:hover { background: var(--acero); border-color: var(--acero); }
.boton.peligro { color: var(--rojo); }
.boton.peligro:hover { border-color: var(--rojo); }
.boton.chico { padding: 5px 10px; font-size: 13px; }
.segmento { display: inline-flex; border: 1px solid var(--papel-linea); border-radius: 8px; overflow: hidden; background: #fff; }
.segmento button { padding: 7px 12px; border: 0; background: none; cursor: pointer; font-weight: 500; }
.segmento button.activo { background: var(--acero-prof); color: #fff; }
select.filtro { padding: 7px 10px; border: 1px solid var(--papel-linea); border-radius: 8px; background: #fff; }

/* tarjetas kpi */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { padding: 14px 16px; background: #fff; border: 1px solid var(--papel-linea); border-radius: var(--radio); }
.kpi .eti { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--papel-suave); }
.kpi .val { font-family: var(--cond); font-weight: 800; font-size: 32px; line-height: 1.1; margin-top: 4px; }
.kpi .val.num { font-family: var(--mono); font-size: 24px; font-weight: 500; }
.kpi .pie { font-size: 13px; color: var(--papel-suave); margin-top: 4px; }
.kpi.alerta .val { color: var(--rojo); }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bloque { background: #fff; border: 1px solid var(--papel-linea); border-radius: var(--radio); padding: 16px; }
.bloque h2 { margin-bottom: 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bloque h2 small { font: 500 13px var(--sans); text-transform: none; letter-spacing: 0; color: var(--papel-suave); }
.vacio { padding: 26px 12px; text-align: center; color: var(--papel-suave); }

/* listas y tablas */
.tabla { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--papel-linea); border-radius: var(--radio); overflow: hidden; }
.tabla-envoltura { overflow-x: auto; border-radius: var(--radio); }
.tabla th, .tabla td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--papel-linea); vertical-align: top; }
.tabla th { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--papel-suave); background: #fafbfc; white-space: nowrap; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover { background: #f6f8fa; }
.tabla td.der, .tabla th.der { text-align: right; }
.fila-titulo { font-weight: 600; }
.etiqueta { display: inline-block; padding: 2px 8px; border-radius: 999px; font-family: var(--cond); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; background: #e7ecf1; color: var(--acero-prof); white-space: nowrap; }
.etiqueta.ganado { background: #dff3e7; color: var(--verde); }
.etiqueta.perdido { background: #f8e3e2; color: var(--rojo); }
.etiqueta.negociacion, .etiqueta.propuesta { background: #fbefd5; color: #8a6413; }
.etiqueta.tipo { background: #eef2f6; color: var(--papel-suave); }
.vencida { color: var(--rojo); font-weight: 600; }
.hoy { color: #8a6413; font-weight: 600; }

/* lista de actividad */
.linea { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--papel-linea); }
.linea:last-child { border-bottom: 0; }
.linea .icono { width: 30px; height: 30px; border-radius: 8px; background: #eef2f6; display: grid; place-items: center; font-family: var(--cond); font-weight: 800; font-size: 13px; color: var(--acero-prof); text-transform: uppercase; }
.linea .icono.tarea { background: #fbefd5; color: #8a6413; }
.linea .icono.hecho { background: #dff3e7; color: var(--verde); }
.linea .titulo { font-weight: 600; }
.linea .meta { font-size: 13px; color: var(--papel-suave); }
.linea .meta a { color: var(--acero); text-decoration: none; }
.linea .meta a:hover { text-decoration: underline; }
.linea .detalle { white-space: pre-wrap; margin-top: 3px; font-size: 14px; }
.linea .fecha { font-size: 13px; color: var(--papel-suave); white-space: nowrap; text-align: right; }
.linea .cuando { font-family: var(--mono); font-size: 12px; }
.palomita { width: 18px; height: 18px; accent-color: var(--verde); cursor: pointer; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.columna { background: #e9edf1; border-radius: var(--radio); padding: 10px; min-height: 60vh; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.columna.sobre { outline: 2px dashed var(--acero); outline-offset: -4px; background: #e2e9f0; }
.columna-cab { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 6px; }
.columna-cab h3 { font-size: 16px; }
.columna-cab .num { font-size: 12px; color: var(--papel-suave); }
.tarjeta { background: #fff; border: 1px solid var(--papel-linea); border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 1px rgba(11,18,25,.04); }
.tarjeta:active { cursor: grabbing; }
.tarjeta.arrastrando { opacity: .4; }
.tarjeta .t { font-weight: 600; line-height: 1.3; }
.tarjeta .c { font-size: 13px; color: var(--papel-suave); margin-top: 2px; }
.tarjeta .pie { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; }
.tarjeta .resp { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--acero-claro); color: var(--placa); font-family: var(--cond); font-weight: 800; font-size: 11px; }
.tarjeta .paso { margin-top: 6px; font-size: 13px; padding-top: 6px; border-top: 1px dashed var(--papel-linea); }

/* panel lateral (detalle / formulario) */
.lateral { position: fixed; inset: 0; z-index: 30; }
.lateral-fondo { position: absolute; inset: 0; background: rgba(11,18,25,.45); }
.lateral-caja { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--papel); box-shadow: -8px 0 32px rgba(11,18,25,.25); overflow-y: auto; display: flex; flex-direction: column; animation: entra .18s ease-out; }
@keyframes entra { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.lateral-cab { position: sticky; top: 0; z-index: 2; display: flex; align-items: start; gap: 10px; padding: 16px 18px 12px; background: var(--papel); border-bottom: 1px solid var(--papel-linea); }
.lateral-cab h2 { flex: 1; font-size: 24px; line-height: 1.05; text-transform: none; }
.lateral-cab .sub { color: var(--papel-suave); font-size: 13px; margin-top: 4px; font-family: var(--sans); text-transform: none; letter-spacing: 0; font-weight: 500; }
.cerrar { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--papel-suave); padding: 0 4px; }
.lateral-cuerpo { padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 18px; }
.ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--papel-linea); border-radius: var(--radio); }
.ficha .dato { min-width: 0; }
.ficha .dato .k { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--papel-suave); }
.ficha .dato .v { overflow-wrap: anywhere; }
.ficha .dato.ancho { grid-column: 1 / -1; white-space: pre-wrap; }
.seccion h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.seccion .lista { background: #fff; border: 1px solid var(--papel-linea); border-radius: var(--radio); padding: 4px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 10px; background: #fff; border: 1px solid var(--papel-linea); border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--tinta); font-size: 14px; }
.chip:hover { border-color: var(--acero); }
.chip b { font-weight: 600; }

/* formularios */
form.formulario { display: flex; flex-direction: column; gap: 12px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo.ancho { grid-column: 1 / -1; }
.campo > span { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--papel-suave); }
.campo input, .campo select, .campo textarea { padding: 9px 11px; border: 1px solid var(--papel-linea); border-radius: 8px; background: #fff; outline: none; width: 100%; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--acero); box-shadow: 0 0 0 3px rgba(89,128,166,.18); }
.campo textarea { min-height: 84px; resize: vertical; }
.form-pie { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding-top: 4px; }
.form-pie .der { display: flex; gap: 8px; margin-left: auto; }
.rapida { display: flex; gap: 8px; align-items: start; }
.rapida select { flex: 0 0 auto; }
.rapida .campo { flex: 1; }
.error { color: var(--rojo); font-size: 14px; margin: 0; min-height: 1.2em; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #1a2a3a, var(--placa)); }
.login-caja { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px 28px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; color: var(--papel); }
.logo-login { width: 200px; height: 52px; margin: 0 auto 2px; }
.login-sub { margin: 0 0 8px; text-align: center; color: var(--acero-claro); font-size: 14px; }
.login-caja label { display: flex; flex-direction: column; gap: 5px; font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; color: var(--acero-claro); }
.login-caja input { padding: 11px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(255,255,255,.06); color: #fff; font-family: var(--sans); font-size: 16px; outline: none; }
.login-caja input:focus { border-color: var(--acero-claro); }
.login-caja .boton.primario { padding: 12px; font-family: var(--cond); font-weight: 800; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; background: var(--senal); border-color: var(--senal); color: var(--placa); }
.login-error { margin: 0; color: #f3a29e; font-size: 14px; min-height: 1.2em; }

/* aviso */
.aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; padding: 10px 16px; background: var(--placa); color: #fff; border-radius: 10px; box-shadow: var(--sombra); font-weight: 500; max-width: calc(100% - 32px); }
.aviso.error { background: var(--rojo); }

/* móvil */
.nav-movil { display: none; }
@media (max-width: 860px) {
  .nav { display: none; }
  .buscar input { width: 140px; }
  .barra { gap: 10px; }
  .boton-nuevo { padding: 8px 10px; }
  .rejilla-2, .campos, .ficha { grid-template-columns: 1fr; }
  .campo.ancho { grid-column: auto; }
  .nav-movil { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--placa); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); }
  .nav-movil a { text-align: center; padding: 8px 2px; color: var(--acero-claro); text-decoration: none; font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; }
  .nav-movil a.activa { color: #fff; background: var(--acero-prof); }
  .kanban { grid-auto-columns: 84vw; }
  .linea { grid-template-columns: 30px 1fr; }
  .linea .fecha { grid-column: 2; text-align: left; }
}
@media (max-width: 480px) { .buscar { display: none; } }
