/* =========================================================
   ArseSoft - Estilos (navy + dorado, basado en el diseño de referencia)
   ========================================================= */
:root {
  --navy: #1b2a4a;
  --navy-2: #22345c;
  --navy-3: #2d4270;
  --gold: #e5b742;
  --gold-soft: #f3d98c;
  --bg: #eef0f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dfe3ea;
  --sidebar-w: 250px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Poppins', system-ui, sans-serif; font-size: 13.5px; color: var(--text); background: var(--bg); }
a { color: var(--navy-3); }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--navy); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1030;
  transition: margin-left .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08); height: 56px; }
.brand-logo { width: 38px; height: 38px; border: 2px solid var(--gold); border-radius: 6px; display: grid; place-items: center; color: var(--gold); font-size: 18px; }
.brand-sigla { font-weight: 700; letter-spacing: .5px; line-height: 1; }
.brand-sub { font-size: 11px; color: var(--gold-soft); }
.brand-img { background: #fff; border-radius: 6px; padding: 4px 10px; height: 42px; width: 100%; display: flex; align-items: center; justify-content: center; border-bottom: 2px solid var(--gold); }
.brand-img img { max-height: 34px; max-width: 100%; object-fit: contain; }
.print-only { display: none; }
.menu-search { position: relative; margin: 12px 12px 6px; }
.menu-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9aa6c0; font-size: 12px; }
.menu-search input { width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 6px; padding: 7px 10px 7px 30px; font-size: 12.5px; outline: none; }
.menu-search input:focus { border-color: var(--gold); }
.menu-search input::placeholder { color: #9aa6c0; }
.menu { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.menu-item, .menu-group-title {
  display: flex; align-items: center; gap: 10px; width: 100%; color: #e6ebf5; text-decoration: none;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; background: none; border: 0; text-align: left;
}
.menu-item i, .menu-group-title i:first-child { width: 18px; text-align: center; color: var(--gold); }
.menu-item:hover, .menu-group-title:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu > .menu-item { border: 1px solid var(--gold); margin-bottom: 8px; background: rgba(255,255,255,.04); }
.menu-group { border: 1px solid transparent; border-radius: 8px; margin-bottom: 8px; }
.menu-group.open { border-color: var(--gold); background: rgba(255,255,255,.04); }
.menu-group-title .chev { margin-left: auto; font-size: 10px; transition: transform .2s; color: #cfd6e6; }
.menu-group.open .chev { transform: rotate(180deg); }
.menu-sub { display: none; padding: 2px 4px 6px 10px; }
.menu-group.open .menu-sub { display: block; }
.menu-sub .menu-item { font-size: 12.5px; padding: 6px 10px; }
.menu-item.active { background: rgba(229,183,66,.18); color: #fff; font-weight: 500; }
.menu-item.oculto, .menu-group.oculto { display: none !important; }
.menu-salir { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.menu-salir i { color: var(--gold); }
body.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }

/* ---------- Topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; background: var(--navy); color: #fff; display: flex; align-items: center; padding: 0 16px; position: sticky; top: 0; z-index: 1020; border-bottom: 3px solid var(--gold); }
.btn-toggle { background: none; border: 0; color: #fff; font-size: 18px; }
.topbar-title { flex: 1; text-align: center; line-height: 1.15; }
.topbar-title h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--gold); }
.topbar-user { color: var(--gold-soft); font-size: 12px; }
.topbar-right { width: 40px; text-align: right; }
.topbar-bell { color: #fff; position: relative; font-size: 17px; }
.bell-count { position: absolute; top: -7px; right: -9px; background: #dc3545; color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 5px; }

/* ---------- Encabezado de página ---------- */
.page-header { background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.page-header h2 { font-size: 18px; margin: 0; font-weight: 600; color: var(--navy); }
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.content { padding: 20px 22px 40px; }
.page-intro { margin: 8px 0 16px; }
.page-intro h3 { font-size: 18px; color: var(--navy); font-weight: 600; margin-bottom: 2px; }
.page-intro p { color: var(--muted); max-width: 640px; margin: 0; font-size: 12.5px; }

/* ---------- Botones ---------- */
.btn { font-size: 12.5px; border-radius: 5px; }
.btn-navy { background: var(--navy); color: #fff; border: 1px solid var(--navy); }
.btn-navy:hover, .btn-navy:focus { background: var(--navy-3); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); border: 1px solid var(--gold); font-weight: 500; }
.btn-gold:hover { background: #d4a52f; color: var(--navy); }
.btn-outline-navy { border: 1px solid var(--border); color: var(--navy); background: #fff; }
.btn-outline-navy:hover { background: #f3f5f9; color: var(--navy); }

/* ---------- Tarjetas ---------- */
.card-x { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-x-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.card-x-title { font-size: 14px; font-weight: 600; color: var(--navy); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-x-title i { color: var(--gold); }
.card-x-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.paso { font-size: 10.5px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }
.total-chip { background: #f3f5f9; border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.form-label { font-size: 12px; color: #374151; margin-bottom: 3px; }
.form-control, .form-select { font-size: 13px; border-color: #d4d9e2; }
.form-control:focus, .form-select:focus { border-color: var(--navy-3); box-shadow: 0 0 0 .15rem rgba(45,66,112,.15); }
.req::after { content: ' *'; color: #dc3545; }
.hint { font-size: 11.5px; color: var(--muted); }
.opcion-radio { border: 1px solid var(--border); border-radius: 6px; padding: 7px 14px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; background: #fff; }
.opcion-radio.activa { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); font-weight: 500; }

/* ---------- KPIs ---------- */
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; height: 100%; }
.kpi-icon { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; background: rgba(27,42,74,.08); color: var(--navy); }
.kpi-icon.gold { background: rgba(229,183,66,.18); color: #a37a12; }
.kpi-icon.red { background: rgba(220,53,69,.12); color: #b42331; }
.kpi-icon.green { background: rgba(25,135,84,.12); color: #146c43; }
.kpi-num { font-size: 22px; font-weight: 600; line-height: 1; color: var(--navy); }
.kpi-lbl { font-size: 12px; color: var(--muted); }

/* ---------- Tablas (DataTables) ---------- */
table.dataTable, .table-x { font-size: 12.5px; }
table.dataTable thead th, .table-x thead th { background: var(--navy) !important; color: #fff !important; font-weight: 500; text-align: center; border-color: #33466f !important; vertical-align: middle; }
table.dataTable tbody td { vertical-align: middle; }
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * { box-shadow: inset 0 0 0 9999px rgba(27,42,74,.035); }
table.dataTable > tbody > tr:hover > * { box-shadow: inset 0 0 0 9999px rgba(229,183,66,.12) !important; }
div.dt-container .dt-search input { font-size: 12.5px; }
div.dt-container .dt-paging .dt-paging-button { font-size: 12px !important; }
.dt-container .pagination .page-link { background: var(--navy); color: #fff; border: 1px solid var(--navy); margin-left: 3px; border-radius: 4px; padding: 4px 10px; font-size: 12px; }
.dt-container .pagination .page-item.active .page-link { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 600; }
.dt-container .pagination .page-item.disabled .page-link { opacity: .55; }
.dt-buttons .btn { background: #fff; border: 1px solid var(--border); color: var(--navy); font-size: 12px; padding: 4px 10px; }
.dt-buttons .btn:hover { background: #f3f5f9; }
div.dt-container div.dt-layout-row { margin: .4em 0; }
.dt-info { font-size: 12px; color: #374151; }
.acciones-tabla { white-space: nowrap; }
.acciones-tabla .btn { padding: 2px 7px; }
.filtros-col input, .filtros-col select { width: 100%; font-size: 11.5px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 3px; }

/* ---------- Pestañas ---------- */
.nav-tabs .nav-link { color: var(--navy); font-size: 13px; }
.nav-tabs .nav-link.active { font-weight: 600; border-top: 3px solid var(--gold); }

/* ---------- Zona de carga (RUT) ---------- */
.dropzone-x { border: 2px dashed #c3cad8; border-radius: 10px; padding: 22px; text-align: center; background: #fafbfd; cursor: pointer; transition: .2s; }
.dropzone-x:hover, .dropzone-x.drag { border-color: var(--gold); background: #fffbef; }
.dropzone-x i { font-size: 30px; color: var(--gold); }
.campo-leido { background: #fff9e6 !important; border-color: var(--gold) !important; }

/* ---------- Documentos ---------- */
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef0f4; }
.doc-row:last-child { border-bottom: 0; }
.doc-title { font-weight: 600; font-size: 13px; }
.doc-desc { font-size: 11.5px; color: var(--muted); }
.doc-meta { font-size: 11.5px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 32px 28px; border-top: 5px solid var(--gold); box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; color: var(--navy); font-weight: 700; margin: 10px 0 4px; }

/* ---------- Contrato ---------- */
.hoja-contrato { background: #fff; max-width: 850px; margin: 0 auto; padding: 50px 60px; border: 1px solid var(--border); font-family: 'Times New Roman', serif; font-size: 13.5px; line-height: 1.45; }
.hoja-contrato h2 { font-size: 16px; } .hoja-contrato h4 { font-size: 14px; margin-top: 16px; }
.hoja-contrato table { font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .sidebar { position: fixed; left: 0; margin-left: calc(var(--sidebar-w) * -1); }
  body.sidebar-open .sidebar { margin-left: 0; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .topbar-title h1 { font-size: 15px; }
  .content { padding: 14px; }
}

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .dt-buttons, .dt-search, .dt-length, .dt-paging { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .print-only { display: block; }
  .marca-agua-print { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: -1; }
  .marca-agua-print img { width: 55%; max-width: 480px; transform: rotate(-25deg); }
  .card-x { border: 0; box-shadow: none; }
  .hoja-contrato { border: 0; padding: 0; }
}

/* ===== Novedades del portal (v6) ===== */
.topbar-right { width: auto; display: flex; align-items: center; gap: 20px; justify-content: flex-end; }
.topbar-bell.nov-activa i { color: var(--gold); animation: novPulso 1.6s ease-in-out infinite; }
@keyframes novPulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22); } }
.nov-menu { width: 340px; padding: 0; overflow: hidden; border: 0; }
.nov-menu-head { background: var(--navy); color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.nov-menu-head i { color: var(--gold); }
.nov-item { display: flex; gap: 10px; align-items: flex-start; white-space: normal; font-size: 13px; border-bottom: 1px solid #eef0f4; padding: 9px 14px; }
.nov-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 30px; color: #fff; background: var(--navy-3); font-size: 13px; }
.nov-ic.nov-nuevo { background: #198754; } .nov-ic.nov-pago { background: var(--gold); color: var(--navy); } .nov-ic.nov-documento { background: #6c757d; }
.nov-menu-foot { text-align: center; padding: 8px; font-size: 13px; background: #f7f8fb; }
.aviso-novedades { display: flex; gap: 14px; align-items: center; background: linear-gradient(90deg, #fff8e3 0%, #fff 70%); border: 1px solid var(--gold); border-left: 6px solid var(--gold); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(229,183,66,.25); animation: novEntrada .5s ease-out; }
@keyframes novEntrada { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.aviso-nov-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-size: 19px; flex: 0 0 44px; animation: novPulso 1.6s ease-in-out infinite; }
.aviso-nov-tit { font-weight: 600; color: var(--navy); font-size: 15px; }
.aviso-nov-lista a { display: block; font-size: 13px; color: #333; text-decoration: none; padding: 2px 0; }
.aviso-nov-lista a:hover { color: var(--navy-3); text-decoration: underline; }
@media (max-width: 700px) { .aviso-novedades { flex-direction: column; align-items: stretch; } .aviso-nov-ic { display: none; } }

/* ===== Botón de WhatsApp del portal ===== */
.wa-burbuja { position: fixed; right: 22px; bottom: 22px; z-index: 1080; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.wa-burbuja .wa-btn { width: 60px; height: 60px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; font-size: 32px; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform .15s; position: relative; }
.wa-burbuja .wa-btn::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #25d366; animation: waOnda 2s ease-out infinite; }
@keyframes waOnda { from { transform: scale(1); opacity: .8; } to { transform: scale(1.55); opacity: 0; } }
.wa-burbuja:hover .wa-btn { transform: scale(1.08); }
.wa-burbuja .wa-txt { background: #fff; color: #1f2937; font-size: 13px; padding: 8px 12px; border-radius: 18px; box-shadow: 0 4px 14px rgba(0,0,0,.15); white-space: nowrap; animation: novEntrada .6s ease-out; }
@media (max-width: 576px) { .wa-burbuja .wa-txt { display: none; } .wa-burbuja { right: 14px; bottom: 14px; } }
@media print { .wa-burbuja { display: none !important; } }
