:root {
  --blue: #007cff;
  --blue-dark: #002bff;
  --navy: #152036;
  --navy-2: #152036;
  --cyan: #00ccff;
  --teal: #00ffdf;
  --green: #00ffdf;
  --amber: #ff8c9f;
  --red: #fd306b;
  --violet: #6e59e2;
  --violet-strong: #2700ff;
  --ink: #152036;
  --muted: rgba(21, 32, 54, .66);
  --line: rgba(21, 32, 54, .12);
  --surface: #ffffff;
  --bg: rgba(0, 124, 255, .035);
  --soft-blue: rgba(0, 124, 255, .09);
  --shadow: 0 20px 48px rgba(21, 32, 54, .10);
  --shadow-sm: 0 8px 24px rgba(21, 32, 54, .07);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar: 272px;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/Poppins-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Zain";
  src: url("../fonts/Zain-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(0, 123, 255, .25);
  outline-offset: 2px;
}
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: #fff; padding: 12px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, var(--navy) 0%, #0b1830 100%);
  color: #fff;
  z-index: 20;
  overflow-y: auto;
}
.portal-cliente .sidebar {
  color: var(--ink);
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand-block { display: flex; align-items: center; gap: 12px; color: inherit; margin: 0 6px 26px; }
.brand-logo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50% 50% 50% 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -1px;
  box-shadow: 0 12px 26px rgba(0, 123, 255, .28);
}
.brand-logo span { color: var(--cyan); }
.brand-logo.large { width: 68px; height: 68px; font-size: 28px; }
.brand-copy { display: grid; line-height: 1.25; }
.brand-copy strong { font-size: 17px; }
.brand-copy small { color: #9caac0; font-size: 12px; }
.portal-cliente .brand-copy small { color: var(--muted); }
.portal-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  border-radius: 15px;
}
.portal-cliente .portal-identity { background: #eafafa; border-color: #ccefee; }
.portal-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(0, 214, 199, .13); }
.portal-identity div { display: grid; line-height: 1.25; }
.portal-identity b { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.portal-identity small { color: #99a8bf; font-size: 11px; }
.portal-cliente .portal-identity small { color: var(--teal); }
.side-nav { display: grid; gap: 5px; }
.nav-label { color: #76879f; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin: 17px 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; color: #c7d0df; padding: 11px 12px; border-radius: 13px; font-size: 13px; font-weight: 650; transition: .18s ease; }
.side-nav a:hover { color: #fff; background: rgba(255, 255, 255, .09); transform: translateX(2px); }
.portal-cliente .side-nav a { color: #48576c; }
.portal-cliente .side-nav a:hover { color: var(--teal); background: #ecfbfa; }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.07); font-size: 14px; font-weight: 900; }
.portal-cliente .nav-icon { background: #edf5f7; }
.sidebar-footer { margin-top: auto; padding: 20px 5px 0; border-top: 1px solid rgba(255, 255, 255, .10); display: grid; gap: 13px; }
.portal-cliente .sidebar-footer { border-top-color: var(--line); }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-card > span:last-child { display: grid; min-width: 0; }
.user-card b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.user-card small { color: #93a1b5; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, var(--blue), #43b7ff); color: #fff; font-weight: 800; }
.avatar.small { width: 34px; height: 34px; font-size: 12px; }
.avatar.large { width: 66px; height: 66px; font-size: 24px; }
.logout { width: 100%; border: 0; background: transparent; color: #a9b5c6; display: flex; justify-content: space-between; padding: 8px 2px; cursor: pointer; font-weight: 650; font-size: 12px; }
.portal-cliente .logout { color: var(--muted); }

.app-shell { min-height: 100vh; margin-left: var(--sidebar); padding: 28px 34px 16px; max-width: 1800px; }
.mobile-header { display: none; }
.app-footer { margin-top: 34px; padding: 18px 2px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.breadcrumbs { min-height: 26px; display: flex; align-items: center; gap: 8px; margin-bottom: 22px; color: #8a97a9; font-size: 12px; }
.breadcrumbs a, .breadcrumbs span { color: #8a97a9; }
.breadcrumbs b { color: var(--ink); font-weight: 700; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
  font-family: "Zain", "Poppins", Arial, sans-serif;
  font-weight: 500;
  letter-spacing: -.015em;
}
h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.05; margin-bottom: 10px; }
h2 { font-size: 21px; line-height: 1.2; margin-bottom: 8px; }
h3 { font-size: 16px; }
p { color: var(--muted); }
.eyebrow, .section-kicker, .login-kicker { display: inline-block; text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 850; }
.eyebrow { color: rgba(255, 255, 255, .82); }
.eyebrow.dark, .section-kicker, .login-kicker { color: var(--blue); }
.portal-cliente .eyebrow.dark, .portal-cliente .section-kicker { color: var(--teal); }

.hero {
  min-height: 230px;
  padding: 38px 40px;
  border-radius: 40px 40px 40px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  color: #fff;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 999px; pointer-events: none; }
.hero::before { width: 250px; height: 250px; right: 10%; top: -155px; background: rgba(255,255,255,.10); }
.hero::after { width: 115px; height: 260px; right: -25px; bottom: -95px; background: var(--cyan); opacity: .8; }
.hero-ays { background: linear-gradient(130deg, var(--navy) 0%, #073c7b 65%, var(--blue) 100%); }
.hero-cliente { background: linear-gradient(130deg, var(--navy-2) 0%, #006b78 60%, var(--teal) 100%); }
.hero-copy, .hero-actions { position: relative; z-index: 1; }
.hero h1 { max-width: 700px; margin: 8px 0 12px; }
.hero h1 strong { color: var(--cyan); font-weight: 800; }
.hero p { color: rgba(255,255,255,.78); margin: 0; max-width: 650px; }
.hero-actions, .heading-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.page-heading, .detail-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin: 0 0 24px; }
.page-heading h1, .detail-header h1 { margin: 4px 0 8px; }
.page-heading p, .detail-header p { margin: 0; }
.detail-header { padding: 20px 0 12px; align-items: center; }
.title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-line h1 { margin-right: 3px; }
.person-heading { display: flex; align-items: center; gap: 16px; }

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 24px 24px 24px 7px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .65; cursor: wait; }
.btn.primary { background: var(--blue); color: #fff; }
.portal-cliente .btn.primary { background: var(--teal); }
.btn.secondary { background: var(--navy); color: #fff; }
.btn.light { background: #fff; color: var(--navy); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.ghost { border-color: var(--line); background: #fff; color: #3d4b60; }
.btn.success { background: var(--green); color: #fff; }
.btn.warning { background: #fff5d8; color: #8a5a00; border-color: #f6d47c; }
.btn.danger-outline { background: #fff; color: var(--red); border-color: #f1b9be; }
.btn.full { width: 100%; }
.text-link { font-size: 12px; font-weight: 800; white-space: nowrap; }
.row-link { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--soft-blue); font-weight: 900; transition: .15s; }
.row-link:hover { color: #fff; background: var(--blue); transform: translateX(2px); }

.metric-grid { display: grid; gap: 14px; margin: 20px 0; }
.metric-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: 23px 23px 23px 7px; background: #fff; box-shadow: var(--shadow-sm); display: flex; gap: 14px; align-items: flex-start; }
.metric-card > div { display: grid; }
.metric-card small { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { font-size: 32px; line-height: 1; margin: 7px 0 6px; color: var(--navy); }
.metric-card em { color: #8b98aa; font-size: 10px; font-style: normal; }
.metric-card .metric-date { font-size: 18px; margin-top: 12px; }
.metric-card .metric-status { font-size: 15px; line-height: 1.2; margin-top: 12px; }
.metric-icon { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50% 50% 50% 9px; display: grid; place-items: center; font-weight: 900; }
.metric-icon.blue { background: #e6f2ff; color: var(--blue); }
.metric-icon.cyan { background: #ddfbf8; color: var(--teal); }
.metric-icon.green { background: #e5f8ef; color: var(--green); }
.metric-icon.amber { background: #fff3d7; color: var(--amber); }
.metric-icon.red { background: #ffebed; color: var(--red); }
.metric-icon.violet { background: #efebff; color: var(--violet); }

.dashboard-grid, .detail-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 18px; margin: 18px 0; align-items: start; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.detail-grid > .span-8 { display: grid; gap: 18px; }
.detail-aside, .detail-grid > aside { display: grid; gap: 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) var(--radius) 8px; padding: 23px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.panel-head.compact { margin-bottom: 8px; }
.panel-head h2 { margin: 3px 0 5px; }
.panel-head p { margin: 0; font-size: 12px; }
.table-panel { padding: 20px 0 8px; overflow: hidden; }
.table-panel > .panel-head { padding: 0 22px; }
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th { padding: 12px 14px; background: #f6f9fc; color: #7b889b; text-align: left; text-transform: uppercase; letter-spacing: .07em; font-size: 9px; font-weight: 850; white-space: nowrap; }
.table td { padding: 14px; border-bottom: 1px solid #edf1f5; vertical-align: middle; font-size: 12px; }
.table tbody tr { transition: .15s ease; }
.table tbody tr:hover { background: #fbfdff; }
.table td small { display: block; color: #8a97a8; margin-top: 3px; font-size: 10px; }
.table td b, .cell-title { color: var(--ink); font-weight: 750; }
.row-overdue { box-shadow: inset 3px 0 var(--red); }
.text-danger, .age.overdue { color: var(--red); font-style: normal; font-weight: 800; }

.badge { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; background: #edf1f5; color: #566579; font-size: 9px; font-weight: 850; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.badge.BORRADOR, .badge.CARGADO { background: #eef1f5; color: #5d6878; }
.badge.EN_REVISION, .badge.PENDIENTE_CONFIRMACION, .badge.ACTIVO_AJUSTE { background: #fff2d1; color: #895b00; }
.badge.REQUIERE_CORRECCION, .badge.CON_ERRORES, .badge.POR_VENCER { background: #fff0da; color: #a15b00; }
.badge.APROBADO, .badge.CONFIRMADO, .badge.CERRADO, .badge.ACTIVA, .badge.ACTIVO, .badge.ACTIVO_SIN_COBRO { background: #e4f7ed; color: #16764a; }
.badge.ENVIADO_ASEGURADORA, .badge.APLICADO_ZOHO, .badge.PROGRAMADA { background: #e6f2ff; color: #0862bc; }
.badge.RECHAZADO, .badge.FALLIDO, .badge.VENCIDA, .badge.EXCLUIDO, .badge.EXCLUIDO_CON_COBRO, .badge.CANCELADO, .badge.overdue { background: #ffe8eb; color: #b22c39; }
.badge.INACTIVA, .badge.CONGELADO { background: #edf0f4; color: #626e7e; }

.filter-panel { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 16px; margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: 20px 20px 20px 7px; box-shadow: var(--shadow-sm); }
.filter-panel label { min-width: 140px; display: grid; gap: 5px; flex: 1; }
.filter-panel .search-field { min-width: 240px; flex: 2; position: relative; }
.filter-panel label > span, .form-field label { color: #536277; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.filter-panel input, .filter-panel select, .form-field input, .form-field select, .form-field textarea, .comment-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #dbe3ec;
  border-radius: 13px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
}
.filter-panel input:focus, .filter-panel select:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,123,255,.09); outline: none; }
.search-field i { position: absolute; right: 13px; bottom: 10px; color: #8997a8; font-style: normal; }
.compact-filter label { max-width: 420px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 10px; color: var(--muted); font-size: 11px; }
.pagination > div { display: flex; gap: 8px; }
.empty-state { grid-column: 1 / -1; width: 100%; min-height: 260px; display: grid; place-items: center; align-content: center; text-align: center; padding: 36px; background: #fff; border: 1px dashed #d6e0eb; border-radius: var(--radius); }
.empty-state.small { min-height: 180px; background: transparent; border: 0; box-shadow: none; }
.empty-state > span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--soft-blue); color: var(--blue); font-size: 22px; }
.empty-state h3 { margin: 10px 0 3px; }
.empty-state p { margin: 0; }
.empty-inline { display: grid; gap: 3px; justify-content: center; text-align: center; padding: 22px; color: var(--muted); }
.empty-inline b { color: var(--ink); }
.empty-inline span { font-size: 11px; }

.quick-actions, .stack-list, .activity-list, .analyst-list { display: grid; }
.quick-actions a, .stack-list a { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid #edf1f5; color: var(--ink); }
.quick-actions a:last-child, .stack-list a:last-child { border-bottom: 0; }
.quick-actions a > span:first-child { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; background: var(--soft-blue); color: var(--blue); font-weight: 900; }
.portal-cliente .quick-actions a > span:first-child { background: #e5f8f6; color: var(--teal); }
.quick-actions div, .stack-list div { display: grid; flex: 1; }
.quick-actions small, .stack-list small, .activity-list small, .analyst-list small { color: #8b98a9; font-size: 10px; }
.quick-actions em, .stack-list em { color: var(--blue); font-style: normal; font-weight: 900; }
.file-icon { width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; background: #e4f7ed; color: #168254; border-radius: 12px; font-size: 9px; font-weight: 900; }
.activity-list > div, .analyst-list > div { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #edf1f5; }
.activity-list > div:last-child, .analyst-list > div:last-child { border: 0; }
.activity-list > div > span:nth-child(2), .analyst-list > div > span:nth-child(2) { display: grid; flex: 1; }
.activity-list em { font-style: normal; color: #8d99a9; font-size: 9px; }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px #e8f3ff; }
.analyst-list strong { width: 32px; height: 32px; display: grid; place-items: center; background: #f0f4f8; border-radius: 50%; }

.help-banner, .help-hero { border-radius: 30px 30px 30px 9px; padding: 30px; color: #fff; background: linear-gradient(135deg, var(--blue), #009fdb 60%, var(--cyan)); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.help-banner small, .help-hero .eyebrow { color: rgba(255,255,255,.8); text-transform: uppercase; font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.help-banner h2 { font-size: 26px; max-width: 330px; margin: 8px 0; }
.help-banner p { color: rgba(255,255,255,.82); max-width: 380px; }
.help-symbol { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50% 50% 50% 13px; background: rgba(255,255,255,.18); color: #fff; font-size: 24px; font-weight: 900; }
.help-symbol.small { width: 42px; height: 42px; background: var(--soft-blue); color: var(--blue); }
.help-card .help-symbol { margin-bottom: 14px; }

.policy-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.policy-card { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 24px 24px 24px 8px; box-shadow: var(--shadow-sm); }
.policy-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.branch-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50% 50% 50% 11px; background: var(--soft-blue); color: var(--blue); font-weight: 900; }
.policy-card > small { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.policy-card h2 { font-size: 25px; margin: 3px 0; }
.policy-card p { font-size: 11px; min-height: 34px; }
.policy-stats, .policy-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 13px 0; }
.policy-stats span, .policy-dates span { padding: 11px; background: #f7f9fc; border-radius: 13px; display: grid; }
.policy-stats b { font-size: 19px; }
.policy-stats small, .policy-dates small { color: var(--muted); font-size: 9px; }
.policy-dates b { margin-top: 3px; font-size: 11px; }
.card-link { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 11px; font-weight: 850; }
.quick-inline { display: flex; flex-wrap: wrap; gap: 20px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.quick-inline a { font-weight: 800; font-size: 11px; }

.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 18px 0 0; }
.data-grid > div { padding: 14px 5px; border-bottom: 1px solid #edf1f5; }
.data-grid dt { color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.data-grid dd { margin: 5px 0 0; font-size: 13px; font-weight: 650; }
.note-box, .info-note { margin-top: 18px; padding: 16px; border-radius: 15px; background: #f5f8fc; border-left: 3px solid var(--blue); }
.note-box p, .info-note p { margin: 5px 0 0; font-size: 12px; }
.source-card { margin-top: 16px; padding: 13px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); }
.source-card > span:nth-child(2) { display: grid; flex: 1; }
.source-card small { color: var(--muted); }
.source-card em { font-style: normal; color: var(--blue); font-size: 11px; font-weight: 800; }
.finance-value { display: grid; padding: 22px 0; border-bottom: 1px solid var(--line); }
.finance-value small { color: var(--muted); }
.finance-value strong { margin-top: 5px; font-size: 32px; }
.money-row { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); }
.money-row.emphasis { color: var(--teal); }

.timeline { position: relative; display: grid; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 12px; bottom: 12px; width: 2px; background: #e5ebf2; }
.timeline-item { display: grid; grid-template-columns: 32px 1fr; gap: 13px; padding: 9px 0 18px; position: relative; }
.timeline-mark { width: 32px; height: 32px; z-index: 1; display: grid; place-items: center; border-radius: 50%; background: var(--soft-blue); color: var(--blue); font-size: 11px; font-weight: 900; }
.timeline-item.comentario .timeline-mark { background: #e4faf7; color: var(--teal); }
.timeline-title { display: flex; justify-content: space-between; gap: 12px; }
.timeline-title time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.timeline-item small { color: var(--muted); font-size: 10px; }
.timeline-item p { margin: 7px 0 0; padding: 10px 12px; background: #f7f9fc; border-radius: 12px; font-size: 11px; }
.comment-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.comment-form p { display: grid; gap: 6px; }
.comment-form label { font-size: 11px; font-weight: 800; color: var(--ink); }
.comment-form input[type="checkbox"] { width: auto; min-height: auto; }
.status-actions { display: grid; gap: 8px; margin-top: 16px; }
.state-message { padding: 14px; border-radius: 13px; background: #f5f7fa; color: var(--muted); font-size: 11px; }

.stepper { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(5,1fr); background: #fff; border: 1px solid var(--line); border-radius: 20px 20px 20px 7px; box-shadow: var(--shadow-sm); overflow: hidden; }
.stepper li { padding: 15px; display: flex; align-items: center; gap: 10px; position: relative; color: #8d99aa; }
.stepper li:not(:last-child)::after { content: ""; position: absolute; right: 0; width: 1px; height: 38px; background: var(--line); }
.stepper li > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #edf1f5; font-weight: 850; font-size: 10px; }
.stepper li div { display: grid; }
.stepper li b { font-size: 11px; }
.stepper li small { font-size: 9px; }
.stepper li.active, .stepper li.done { color: var(--ink); }
.stepper li.active > span { background: var(--blue); color: #fff; }
.stepper li.done > span { background: var(--green); color: #fff; }
.stepper.compact li { justify-content: center; }
.template-section { margin-bottom: 18px; }
.template-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.template-card { min-width: 0; padding: 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 17px 17px 17px 6px; color: var(--ink); transition: .16s; }
.template-card:hover { border-color: #a8d1fa; background: #f8fbff; transform: translateY(-2px); }
.template-card .branch-icon { width: 34px; height: 34px; }
.template-card > div { display: grid; flex: 1; min-width: 0; }
.template-card strong { font-size: 11px; }
.template-card small { color: var(--muted); font-size: 8px; }
.template-card em { color: var(--blue); font-style: normal; font-weight: 900; }
.upload-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .6fr); gap: 18px; }
.upload-card form { display: grid; gap: 15px; }
.dropzone { min-height: 155px; padding: 24px; display: grid; place-items: center; align-content: center; text-align: center; border: 2px dashed #cad9e9; border-radius: 18px; background: #f8fbff; position: relative; }
.dropzone > div { display: grid; }
.dropzone small { color: var(--muted); font-size: 10px; }
.dropzone input[type="file"] { margin-top: 12px; max-width: 100%; }
.upload-icon { width: 42px; height: 42px; margin-bottom: 8px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: #fff; font-size: 20px; }
.shield { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50% 50% 50% 14px; background: #e4f7ed; color: var(--green); font-size: 22px; font-weight: 900; }
.check-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.check-list li { position: relative; padding-left: 23px; color: #536277; font-size: 11px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 900; }
.result-banner { padding: 28px; display: flex; align-items: center; gap: 18px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue)); border-radius: 30px 30px 30px 9px; }
.result-banner.CON_ERRORES, .result-banner.FALLIDO { background: linear-gradient(135deg, #711d2a, var(--red)); }
.result-banner.CONFIRMADO { background: linear-gradient(135deg, #0f5d42, var(--green)); }
.result-banner > div:nth-child(2) { flex: 1; }
.result-banner h1 { font-size: 28px; margin: 4px 0; }
.result-banner p { color: rgba(255,255,255,.8); margin: 0; }
.result-icon, .confirmation-icon { width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 22px; font-weight: 900; }
.count-pill { padding: 7px 10px; border-radius: 999px; color: var(--red); background: #ffe9ec; font-size: 10px; font-weight: 850; }
.error-message { color: #9c3038; }
.panel-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 17px; }
.confirmation-card { margin-top: 18px; padding: 23px; display: flex; align-items: center; gap: 17px; border-radius: 24px 24px 24px 8px; background: #eef7ff; border: 1px solid #cfe5fa; }
.confirmation-card.success { background: #eaf8f1; border-color: #c5ead8; }
.confirmation-card .confirmation-icon { background: var(--blue); color: #fff; }
.confirmation-card > div { flex: 1; }
.confirmation-card h2 { margin: 3px 0; }
.confirmation-card p { margin: 0; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: grid; gap: 6px; }
.form-field.full-width { grid-column: 1 / -1; }
.form-field label span { color: var(--red); }
.form-field textarea { min-height: 105px; resize: vertical; }
.form-field > small { color: var(--muted); font-size: 9px; }
.errorlist { list-style: none; padding: 0; margin: 2px 0; color: var(--red); font-size: 10px; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.help-hero { min-height: 220px; display: flex; align-items: center; justify-content: space-between; padding: 40px; }
.help-hero h1 { margin: 7px 0; }
.help-hero p { color: rgba(255,255,255,.8); }
.help-hero-mark { font-size: 160px; line-height: .7; color: rgba(255,255,255,.14); font-weight: 900; }
.guide-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; margin: 18px 0; }
.guide-grid > a { padding: 18px; display: flex; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; color: var(--ink); }
.guide-grid > a > span { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--soft-blue); color: var(--blue); font-weight: 900; }
.guide-grid h2 { font-size: 14px; margin: 0 0 3px; }
.guide-grid p { font-size: 10px; margin: 0; }
.guide-content { display: grid; gap: 17px; }
.guide-article { display: grid; grid-template-columns: 70px 1fr; gap: 20px; scroll-margin-top: 20px; }
.guide-number { color: #dbe5f0; font-size: 38px; font-weight: 900; }
.guide-article ol { padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; counter-reset: steps; }
.guide-article li { min-height: 74px; padding: 13px; background: #f7f9fc; border-radius: 14px; display: grid; }
.guide-article li b { font-size: 12px; }
.guide-article li span { color: var(--muted); font-size: 10px; }
.state-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.state-guide > div { padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.state-guide p { margin: 8px 0 0; font-size: 10px; }

.audit-stream { display: grid; }
.audit-stream article { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.activity-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--soft-blue); color: var(--blue); border-radius: 50%; font-size: 11px; font-weight: 900; }
.audit-title { display: flex; align-items: center; gap: 8px; }
.process-pill { padding: 4px 7px; border-radius: 999px; background: #f0f3f7; color: var(--muted); font-size: 8px; text-transform: uppercase; font-weight: 800; }
.audit-stream p { margin: 4px 0; font-size: 11px; }
.audit-stream small { color: #8996a8; font-size: 9px; }

.login-shell { margin: 0; padding: 0; max-width: none; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-brand { padding: 7vw; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: linear-gradient(135deg, var(--navy) 0%, #043c71 60%, var(--blue) 100%); position: relative; overflow: hidden; }
.login-brand::before, .login-brand::after { content: ""; position: absolute; border-radius: 999px; }
.login-brand::before { width: 180px; height: 420px; right: 8%; top: -120px; background: var(--cyan); opacity: .85; }
.login-brand::after { width: 180px; height: 330px; right: -90px; bottom: -80px; background: rgba(255,255,255,.13); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand h1 { font-size: clamp(48px, 6vw, 78px); max-width: 700px; }
.login-brand h1 strong { color: var(--cyan); }
.login-brand p { color: rgba(255,255,255,.78); max-width: 570px; font-size: 17px; }
.login-features { display: flex; flex-wrap: wrap; gap: 16px; color: rgba(255,255,255,.8); font-size: 11px; }
.login-panel { padding: 50px; display: grid; place-items: center; background: #f7f9fc; }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 30px 30px 30px 10px; background: #fff; box-shadow: var(--shadow); }
.login-card h2 { margin: 7px 0; font-size: 30px; }
.login-card form { display: grid; gap: 16px; margin-top: 24px; }
.login-support { display: grid; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); text-align: center; }
.login-support span { font-size: 11px; font-weight: 800; }
.login-support small { color: var(--muted); font-size: 9px; }

.toast-stack { position: fixed; top: 18px; right: 20px; z-index: 50; display: grid; gap: 8px; max-width: 390px; }
.toast { display: flex; align-items: center; gap: 9px; padding: 13px 16px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); font-size: 11px; font-weight: 700; }
.toast-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.toast.success .toast-mark { background: var(--green); }
.toast.warning .toast-mark { background: var(--amber); }
.toast.error .toast-mark { background: var(--red); }
.global-loader { position: fixed; left: var(--sidebar); right: 0; top: 0; height: 3px; z-index: 100; opacity: 0; overflow: hidden; pointer-events: none; }
.global-loader span { display: block; width: 35%; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); animation: loading 1s infinite ease-in-out; }
.is-loading .global-loader { opacity: 1; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(390%); } }

@media (max-width: 1280px) {
  .metric-grid.five { grid-template-columns: repeat(3, 1fr); }
  .template-grid { grid-template-columns: repeat(3,1fr); }
  .policy-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 980px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .app-shell { margin-left: 0; padding: 18px; }
  .mobile-header { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; font-weight: 800; }
  .mobile-header .brand-logo { width: 40px; height: 40px; font-size: 16px; }
  .global-loader { left: 0; }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 1; }
  .metric-grid.five, .metric-grid.four { grid-template-columns: repeat(2,1fr); }
  .guide-grid { grid-template-columns: repeat(2,1fr); }
  .upload-grid, .form-layout { grid-template-columns: 1fr; }
  .stepper li div { display: none; }
  .stepper li { justify-content: center; }
  .template-grid { grid-template-columns: repeat(2,1fr); }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 420px; padding: 50px 28px; }
  .login-panel { padding: 28px 18px; }
}

@media (max-width: 640px) {
  .app-shell { padding: 14px; }
  .breadcrumbs { margin-bottom: 14px; }
  .page-heading, .detail-header, .result-banner, .confirmation-card { align-items: flex-start; flex-direction: column; }
  .page-heading h1, .detail-header h1 { font-size: 31px; }
  .hero { min-height: 300px; padding: 28px 23px; flex-direction: column; align-items: flex-start; justify-content: flex-end; border-radius: 28px 28px 28px 8px; }
  .hero h1 { font-size: 36px; }
  .hero-actions, .heading-actions { width: 100%; }
  .hero-actions .btn, .heading-actions .btn { flex: 1; }
  .metric-grid.five, .metric-grid.four { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .policy-grid, .guide-grid, .template-grid { grid-template-columns: 1fr; }
  .filter-panel { display: grid; }
  .filter-panel label, .filter-panel .search-field { width: 100%; min-width: 0; max-width: none; }
  .form-grid, .data-grid, .state-guide { grid-template-columns: 1fr; }
  .form-field.full-width { grid-column: span 1; }
  .panel { padding: 18px; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 10px; }
  .guide-article { grid-template-columns: 1fr; }
  .guide-article ol { grid-template-columns: 1fr; }
  .help-hero { padding: 28px; }
  .help-hero-mark { display: none; }
  .login-brand { min-height: 360px; }
  .login-brand h1 { font-size: 46px; }
  .login-features { display: grid; }
  .login-card { padding: 25px; }
  .app-footer { flex-direction: column; gap: 4px; }
}
