/* ICE · tokens y layout (Manual de Identidad 2025)
 * ── navy / green / teal ──
 * Fuente única de navy / green / teal / radius / shadow / motion.
 * Lo consume el shell y erp.html. No reescribe reglas de negocio.
 *
 * Capa `ice-tokens`: el CSS sin capa (estilos inline del shell y los
 * bloques posteriores a </html>, p. ej. formularios BC `.bcq-*` y
 * el tema oscuro ya existente) gana por cascada. No se añade un
 * modo oscuro nuevo ni más !important.
 */

@layer ice-tokens {

:root {
  --navy: #182540;
  --navy2: #233660;
  --ink: #0e1a2b;
  --green: #4fae32;
  --green-d: #3a8a24;
  --teal: #0cb2ab;
  --amber: #e8a13a;
  --red: #e05a5a;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --bg: #e9eff6;
  --panel: #f2f6fa;
  --card: #ffffff;
  --line: #dde6ef;
  --muted: #64748b;
  --ink2: #33475a;
  --accent: #4fae32;
  --bg2: #f2f6fa;
  --border: #dde6ef;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 51, .04), 0 8px 22px rgba(16, 35, 51, .06);
  --shadow-lg: 0 24px 64px rgba(16, 35, 51, .22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 620px at 95% -10%, rgba(12, 178, 171, .08), transparent 60%),
    radial-gradient(900px 540px at -10% 30%, rgba(79, 174, 50, .06), transparent 55%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c3cfdc; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #aebccc; }
*:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 8px; }

/* ===== MOTION ===== */
@keyframes fxUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fxDash { to { stroke-dashoffset: 0; } }
@keyframes fxPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 90, 90, .5); }
  55% { box-shadow: 0 0 0 5px rgba(224, 90, 90, 0); }
}
@keyframes iceShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none !important; }
}

::view-transition-old(ice-main),
::view-transition-new(ice-main) { animation-duration: 180ms; }

/* ===== LOGIN ===== */
#login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50; overflow: hidden;
  background: radial-gradient(1200px 700px at 15% -10%, #24406e 0%, var(--navy) 52%, #070c18 100%);
}
#login::before {
  content: ""; position: absolute; width: 540px; height: 540px; left: -170px; bottom: -220px;
  border-radius: 50%; background: radial-gradient(circle, rgba(79, 174, 50, .16), transparent 65%);
}
#login::after {
  content: ""; position: absolute; width: 480px; height: 480px; right: -150px; top: -170px;
  border-radius: 50%; background: radial-gradient(circle, rgba(12, 178, 171, .18), transparent 65%);
}
.login-card {
  position: relative; z-index: 1; background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .65);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: 26px; box-shadow: var(--shadow-lg); width: 100%; max-width: 430px;
  padding: 40px 36px; text-align: center;
  animation: fxUp .5s cubic-bezier(.2, .7, .3, 1) both;
}
.login-card img.logo { height: 46px; margin: 0 auto 8px; display: block; }
.login-tag { font-size: 12px; color: var(--muted); margin-bottom: 22px; font-weight: 600; letter-spacing: .2px; }
.login-h { font-weight: 800; font-size: 16px; margin-bottom: 18px; color: var(--navy); letter-spacing: -.2px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--ink2); display: block; margin-bottom: 6px; letter-spacing: .2px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; font-family: inherit; outline: none; transition: .18s; background: #fbfdfe;
}
.field input:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 4px rgba(12, 178, 171, .13); }
.btn {
  border: none; border-radius: 12px; padding: 13px 16px; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer; width: 100%; transition: .18s;
}
.btn-green { background: linear-gradient(135deg, var(--green), #3f9a28); color: #fff; box-shadow: 0 8px 22px rgba(79, 174, 50, .35); }
.btn-green:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(79, 174, 50, .42); }
.btn-green:active { transform: none; }
.btn-ms {
  background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff; margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-ms:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(24, 37, 64, .35); }
.login-foot { font-size: 11px; color: var(--muted); margin-top: 18px; line-height: 1.55; }
.err { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.login-links { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.login-links a {
  text-decoration: none; color: var(--navy); font-weight: 700; font-size: 12px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px;
}

/* ===== APP SHELL ===== */
#app {
  display: grid; grid-template-columns: 256px 1fr; grid-template-rows: 62px 1fr;
  height: 100vh; grid-template-areas: "side top" "side main";
}
aside {
  grid-area: side;
  background: linear-gradient(180deg, var(--navy) 0%, #111c33 65%, #0b1322 100%);
  color: #dbe6ef; display: flex; flex-direction: column; overflow-y: auto; position: relative;
}
aside::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(440px 260px at 0% 0%, rgba(12, 178, 171, .13), transparent 60%),
    radial-gradient(440px 320px at 100% 100%, rgba(79, 174, 50, .10), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; position: relative; }
.brand .logowrap { background: #fff; border-radius: 10px; padding: 6px 9px; display: inline-flex; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.brand .logowrap img { height: 18px; display: block; }
.brand small { font-size: 10px; letter-spacing: 1.5px; color: #8fb6c6; font-weight: 700; }
nav.menu { padding: 2px 10px 14px; flex: 1; position: relative; }
nav.menu details.grp { margin: 0; border: 0; background: transparent; }
nav.menu details.grp > summary {
  font-size: 10px; letter-spacing: 1.2px; color: #6b8799; text-transform: uppercase;
  padding: 7px 10px; font-weight: 800; cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none; border-radius: 8px; transition: color .15s, background .15s;
}
nav.menu details.grp > summary::-webkit-details-marker { display: none; }
nav.menu details.grp > summary::after {
  content: ""; width: 5px; height: 5px; border-right: 1.5px solid #6b8799; border-bottom: 1.5px solid #6b8799;
  transform: rotate(-45deg); margin-right: 3px; transition: transform .16s ease, border-color .15s;
}
nav.menu details.grp > summary:hover { color: #c5d8e4; background: rgba(255, 255, 255, .04); }
nav.menu details.grp > summary:hover::after { border-color: #c5d8e4; }
nav.menu details.grp[open] > summary { color: #9ec9d6; padding-bottom: 4px; }
nav.menu details.grp[open] > summary::after { transform: rotate(45deg); border-color: #9ec9d6; }
nav.menu details.grp[open] { margin-bottom: 4px; }
nav.menu a {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px;
  color: #c6d4e0; text-decoration: none; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s; position: relative;
}
nav.menu a .mi { width: 18px; text-align: center; font-size: 14px; line-height: 1; flex: 0 0 auto; }
nav.menu a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
nav.menu a.active { background: linear-gradient(90deg, rgba(79, 174, 50, .30), rgba(12, 178, 171, .08)); color: #fff; }
nav.menu a.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 3px; background: var(--green); box-shadow: 0 0 10px rgba(79, 174, 50, .85);
}
.side-foot { padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 11px; color: #7f9aad; position: relative; line-height: 1.45; }

header.top {
  grid-area: top; background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; position: relative; z-index: 10;
}
.search { flex: 1; max-width: 420px; position: relative; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border: 1.5px solid transparent;
  border-radius: var(--radius-sm); background: var(--panel); font-size: 13px;
  font-family: inherit; outline: none; transition: .18s;
}
.search input:focus { background: #fff; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(12, 178, 171, .10); }
.search::before { content: "🔍"; position: absolute; left: 11px; top: 8px; font-size: 13px; opacity: .55; }
.top-sp { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; cursor: pointer; position: relative;
  font-size: 16px; transition: .15s; border: 1px solid transparent;
}
.icon-btn:hover { background: var(--panel); border-color: var(--line); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  background: var(--red); border-radius: 50%; border: 2px solid #fff; animation: fxPulse 2.6s infinite;
}
.icon-btn .badge {
  position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff; border: 2px solid #fff;
  font-size: 9px; font-weight: 850; display: none; align-items: center; justify-content: center;
}
.notification-panel {
  position: absolute; right: 18px; top: 66px; width: 390px; max-width: calc(100vw - 24px);
  max-height: 520px; overflow: hidden; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 80;
}
.notification-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notification-list { max-height: 430px; overflow: auto; padding: 8px; }
.notification-item {
  width: 100%; text-align: left; border: 0; border-radius: 12px; background: transparent;
  padding: 11px; display: flex; gap: 10px; cursor: pointer; color: var(--ink);
}
.notification-item:hover { background: var(--panel); }
.notification-item.unread { background: rgba(12, 178, 171, .08); }
.notification-sev { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--muted); }
.notification-sev.danger { background: var(--red); }
.notification-sev.warning { background: #e59b1b; }
.notification-sev.info { background: var(--teal); }
.notification-sev.success { background: var(--green); }
.notification-copy b { display: block; font-size: 12.5px; }
.notification-copy span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.prof { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--teal)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
  background-size: cover; background-position: center; box-shadow: 0 3px 10px rgba(16, 35, 51, .2);
}
.who b { display: block; font-size: 13px; line-height: 1.2; }
.who span { font-size: 11px; color: var(--muted); }
.top-clock {
  font-size: 11.5px; font-weight: 700; color: var(--ink2); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
@media (max-width: 1100px) { .top-clock { display: none; } }

main { grid-area: main; overflow-y: auto; padding: 22px 26px 56px; view-transition-name: ice-main; }
@media (max-width: 900px) {
  #app { grid-template-columns: 0 1fr; }
  aside { position: fixed; z-index: 60; width: 262px; height: 100%; transform: translateX(-100%); transition: .25s cubic-bezier(.2, .7, .3, 1); }
  aside.open { transform: none; box-shadow: var(--shadow-lg); }
  main { padding: 18px 16px 60px; }
}

/* ===== COMPONENTS ===== */
.page-head { margin-bottom: 16px; animation: fxUp .4s cubic-bezier(.2, .7, .3, 1) both; }
.page-head .crumb { font-size: 11px; color: var(--teal); font-weight: 800; letter-spacing: 1.05px; text-transform: uppercase; }
.page-head h1 { font-size: 22px; font-weight: 800; color: var(--navy); margin-top: 2px; letter-spacing: -.4px; line-height: 1.2; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 720px; line-height: 1.5; }
.page-actions { margin: -4px 0 16px; }
.stack-6 { margin-top: 6px; } .stack-10 { margin-top: 10px; } .stack-12 { margin-top: 12px; }
.stack-14 { margin-top: 14px; } .stack-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.toolbar-row { margin-bottom: 10px; } .grow { flex: 1; min-width: 0; }
.section-lead { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.45; }
.agent-procesos { font-size: 12px; color: var(--ink2); line-height: 1.45; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .g4, .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s;
  animation: fxUp .45s cubic-bezier(.2, .7, .3, 1) both;
}
.card:hover { border-color: #cfdbe8; box-shadow: 0 2px 4px rgba(16, 35, 51, .04), 0 12px 28px rgba(16, 35, 51, .08); }
.card h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card h3 .t { display: flex; align-items: center; gap: 8px; }

.kpi { position: relative; overflow: hidden; padding-bottom: 44px; transition: transform .22s, box-shadow .22s, border-color .22s; }
.kpi:hover { transform: translateY(-3px); border-color: rgba(12, 178, 171, .4); }
.kpi .ic {
  position: absolute; right: 16px; top: 14px; font-size: 20px; width: 42px; height: 42px;
  border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(79, 174, 50, .13), rgba(12, 178, 171, .15));
  border: 1px solid rgba(12, 178, 171, .14);
}
.kpi .lbl { font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.kpi .val { font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 8px; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 11.5px; font-weight: 650; margin-top: 5px; color: var(--muted); }
.kpi .delta.up { color: var(--green-d); } .kpi .delta.down { color: var(--red); }
.kpi.link { cursor: pointer; }
.kpi.link:focus { outline: 3px solid rgba(12, 178, 171, .28); outline-offset: 2px; }
.kpi.link::after { content: 'Abrir →'; position: absolute; right: 14px; bottom: 10px; font-size: 10px; font-weight: 800; color: var(--teal); z-index: 2; }
.grid > *:nth-child(2) { animation-delay: .05s; }
.grid > *:nth-child(3) { animation-delay: .10s; }
.grid > *:nth-child(4) { animation-delay: .15s; }
.grid > *:nth-child(5) { animation-delay: .20s; }
.grid > *:nth-child(6) { animation-delay: .25s; }
.party-list { display: grid; gap: 10px; }
.party { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.party[open] { border-color: rgba(12, 178, 171, .45); box-shadow: 0 8px 22px rgba(16, 35, 51, .08); }
.party summary { list-style: none; cursor: pointer; padding: 13px 15px; display: grid; grid-template-columns: minmax(220px, 1fr) 120px 145px 24px; gap: 12px; align-items: center; }
.party summary::-webkit-details-marker { display: none; }
.party summary:hover { background: var(--panel); }
.party summary .arr { font-size: 17px; color: var(--teal); transition: .2s; }
.party[open] summary .arr { transform: rotate(90deg); }
.party-body { border-top: 1px solid var(--line); padding: 15px; background: #fbfdfe; }
.party-facts { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
.party-fact { padding: 10px 11px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.party-fact span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 750; }
.party-fact b { display: block; margin-top: 3px; font-size: 12.5px; word-break: break-word; }
@media (max-width: 850px) {
  .party summary { grid-template-columns: 1fr 90px 22px; }
  .party summary .party-code { display: none; }
  .party-facts { grid-template-columns: repeat(2, 1fr); }
}
.kspark { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; width: 100%; color: var(--teal); opacity: .9; pointer-events: none; display: block; }
.kpi:nth-child(even) .kspark { color: var(--green); }
.kspark .ln { stroke-dasharray: 260; stroke-dashoffset: 260; animation: fxDash 1.4s .15s cubic-bezier(.2, .7, .3, 1) forwards; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3.5px 10px; border-radius: 999px; border: 1px solid transparent; }
.c-ok { background: #e7f6ea; color: #2f8f42; border-color: #d2ecd8; }
.c-info { background: #e7f0fb; color: #2f6fd0; border-color: #d5e4f7; }
.c-warn { background: #fbf1e0; color: #b7791f; border-color: #f3e3c4; }
.c-red { background: #fbe7e7; color: #c0392b; border-color: #f3d3d3; }
.c-mut { background: #eef2f6; color: #67788a; border-color: #e2e9f0; }
.c-teal { background: #e2f5f3; color: #1f8e86; border-color: #cdebe8; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid #f0f4f7; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.trow { transition: background .12s; }
.trow:hover { background: #f4f8fb; }

.btn-sm { border: none; border-radius: 9px; padding: 8px 13px; font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer; transition: .15s; }
.b-green { background: linear-gradient(135deg, var(--green), #3f9a28); color: #fff; box-shadow: 0 3px 10px rgba(79, 174, 50, .25); }
.b-green:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79, 174, 50, .35); }
.b-navy { background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff; }
.b-navy:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(24, 37, 64, .3); }
.b-ghost { background: var(--panel); color: var(--ink2); border: 1px solid var(--line); }
.b-ghost:hover { border-color: #c0cedd; background: #fff; }

.note { background: var(--panel); border-left: 3px solid var(--teal); border-radius: 10px; padding: 11px 13px; font-size: 12.5px; color: var(--ink2); margin-top: 10px; }
.note.g { border-left-color: var(--green); } .note.w { border-left-color: var(--amber); }
.pill-tabs { display: flex; gap: 5px; background: rgba(16, 35, 51, .05); padding: 5px; border-radius: 14px; margin-bottom: 16px; flex-wrap: wrap; border: 1px solid rgba(16, 35, 51, .04); }
.pill-tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 650; font-family: inherit; color: var(--muted); cursor: pointer; transition: .15s; }
.pill-tabs button:hover { color: var(--navy); }
.pill-tabs button.active { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(16, 35, 51, .10); font-weight: 750; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-top: 8px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--teal), #bfe9e5); border-radius: 3px; min-height: 3px; }
.bar { height: 8px; background: #e8eef5; border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--teal)); border-radius: 6px; transition: width .8s cubic-bezier(.2, .7, .3, 1); }

/* ===== SKELETON + LISTAS LARGAS ===== */
.ice-skel { display: grid; gap: 10px; padding: 8px 0; }
.ice-skel-row {
  height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--panel) 0%, #e8eef5 46%, var(--panel) 90%);
  background-size: 200% 100%;
  animation: iceShimmer 1.2s ease-in-out infinite;
}
.ice-skel-row.wide { width: 92%; }
.ice-skel-row.mid { width: 68%; }
.ice-skel-row.short { width: 44%; height: 12px; }
.ice-list-virtual {
  content-visibility: auto;
  contain-intrinsic-size: 1px 720px;
}

}
