/* =====================================================================
   Mesa de Ayuda TI – ICG Concha y Gana
   Paleta tomada de intranet.icgsa.cl y del logo corporativo
   ===================================================================== */
:root {
  --navy: #23255A;
  --navy-2: #2E3170;
  --navy-soft: #E7E8F2;
  --gold: #F5AF19;
  --gold-2: #E09E0C;
  --gold-soft: #FEF5E1;
  --blue: #2563EB;   --blue-soft: #EAF1FF;
  --orange: #D97706; --orange-soft: #FFF4E5;
  --green: #16A34A;  --green-soft: #E9F9EF;
  --purple: #9333EA; --purple-soft: #F6EDFF;
  --red: #DC2626;    --red-soft: #FDECEC;

  --bg: #F0F1F3;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --input: #FFFFFF;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --radius: 16px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0F1124;
  --card: #181B36;
  --text: #E5E7F0;
  --muted: #9CA3BC;
  --line: #2A2E52;
  --input: #11132A;
  --navy-soft: #262A55;
  --gold-soft: #3A2F12;
  --blue-soft: #18264A; --orange-soft: #3A2A12; --green-soft: #123321; --purple-soft: #2C1A45; --red-soft: #3D1A1A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue); text-decoration: none; }
[data-theme="dark"] a { color: #8AB4FF; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code { font-size: 12px; background: var(--navy-soft); padding: 2px 6px; border-radius: 6px; }

.ic { width: 18px; height: 18px; flex: none; }
.ic-lg { width: 30px; height: 30px; }
.ic-xl { width: 56px; height: 56px; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Barra superior ---------- */
.topbar { background: var(--card); box-shadow: 0 1px 0 var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text) !important; font-weight: 700; font-size: 18px; text-decoration: none !important; white-space: nowrap; }
.brand img { border-radius: 8px; }
.brand b { color: var(--gold); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; font-weight: 600; font-size: 13.5px; white-space: nowrap; border: 1px solid transparent; cursor: pointer; text-decoration: none !important; font-family: inherit; }
.pill-navy { background: var(--navy); color: #fff !important; }
.pill-navy:hover { background: var(--navy-2); }
.pill-gold { background: var(--gold); color: var(--on-gold, var(--navy)) !important; border-color: var(--gold-2); }
.pill-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.theme-btn { background: transparent; border: 0; color: var(--text); cursor: pointer; padding: 8px; border-radius: 10px; display: inline-flex; }
.theme-btn:hover { background: var(--navy-soft); }
.ic-sun { display: none; }
[data-theme="dark"] .ic-sun { display: block; }
[data-theme="dark"] .ic-moon { display: none; }
.menu-btn { display: none; margin-left: auto; background: var(--navy); color: #fff; border: 0; border-radius: 10px; padding: 8px; cursor: pointer; }
.usermenu { position: relative; }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 260px; padding: 8px; z-index: 30; }
.dropdown.open { display: block; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-head small { color: var(--muted); }
.dropdown a, .dropdown button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 10px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--navy-soft); }
.dropdown form { margin: 0; }

/* ---------- Contenedor ---------- */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 40px; flex: 1; }
.footer { background: var(--card); border-top: 1px solid var(--line); }
.footer-in { max-width: 1240px; margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; gap: 12px; }
.footer-in img { vertical-align: -3px; border-radius: 3px; }

/* ---------- Encabezado de página ---------- */
.pagehead { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; }
[data-theme="dark"] .pagehead-ic { color: #C9CCF5; }
.pagehead-ic .ic { width: 24px; height: 24px; }
.pagehead h1 { font-size: 26px; font-weight: 800; }
.pagehead p { margin: 2px 0 0; color: var(--muted); }
.pagehead-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; border: 1px solid transparent; }
[data-theme="dark"] .card { border-color: var(--line); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head h3 { font-size: 16px; }
.card-head p { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.card-head .link, .card-head .push { margin-left: auto; font-size: 14px; font-weight: 600; }
.card-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; flex: none; }
[data-theme="dark"] .card-ic { color: #C9CCF5; }
.card-ic.gold { background: var(--gold-soft); color: var(--gold-2); }
.subhead { margin: 22px 0 10px; font-size: 14px; }

/* Botones grandes (como la intranet) */
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.hero { display: flex; align-items: center; justify-content: center; gap: 16px; border-radius: var(--radius); padding: 28px; text-decoration: none !important; box-shadow: var(--shadow); transition: transform .15s ease; }
.hero:hover { transform: translateY(-2px); }
.hero b { display: block; font-size: 20px; }
.hero small { display: block; opacity: .85; }
.hero-navy { background: var(--navy); color: #fff !important; }
.hero-gold { background: var(--gold); color: var(--on-gold, var(--navy)) !important; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stats-6 { grid-template-columns: repeat(5, 1fr); }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; gap: 14px; align-items: flex-start; color: var(--text) !important; text-decoration: none !important; border: 1px solid transparent; }
[data-theme="dark"] .stat { border-color: var(--line); }
a.stat:hover { border-color: var(--line); }
.stat p { margin: 0; font-size: 13px; color: var(--muted); }
.stat b { display: block; font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat b.small { font-size: 18px; padding-top: 4px; }
.stat small { display: block; font-size: 12px; }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-ic .ic { width: 22px; height: 22px; }
.c-blue { background: var(--blue-soft); color: var(--blue); } .t-blue { color: var(--blue); }
.c-orange { background: var(--orange-soft); color: var(--orange); } .t-orange { color: var(--orange); }
.c-green { background: var(--green-soft); color: var(--green); } .t-green { color: var(--green); }
.c-purple { background: var(--purple-soft); color: var(--purple); } .t-purple { color: var(--purple); }

.grid-main { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(240px, 1fr); gap: 20px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2.gap { gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

.big-num { font-size: 34px; font-weight: 800; margin: 0 0 12px; color: var(--navy); }
[data-theme="dark"] .big-num { color: #fff; }
.big-num small { font-size: 14px; color: var(--muted); font-weight: 500; }
.bar-row { display: flex; justify-content: space-between; font-size: 14px; margin-top: 10px; }
.bar { width: 100%; height: 10px; display: block; margin-top: 6px; }
.bar-bg { fill: var(--line); }
.bar-asistencia { fill: var(--navy); }
[data-theme="dark"] .bar-asistencia { fill: #7C83E8; }
.bar-equipo { fill: var(--gold); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--navy-soft); }
.table .code, .code { white-space: nowrap; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .code { color: #C9CCF5; }
.subject { min-width: 200px; max-width: 380px; }
.table-eq input, .table-eq select { min-width: 120px; }
.tipo { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; }
.tipo .ic { width: 16px; height: 16px; }
.tipo-asistencia { color: var(--navy); }
[data-theme="dark"] .tipo-asistencia { color: #C9CCF5; }
.tipo-equipo { color: var(--gold-2); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-abierto { background: var(--blue-soft); color: var(--blue); }
.st-en_proceso { background: var(--orange-soft); color: var(--orange); }
.st-en_espera { background: var(--purple-soft); color: var(--purple); }
.st-completado { background: var(--green-soft); color: var(--green); }
.st-cerrado { background: var(--navy-soft); color: var(--muted); }
.st-anulado { background: var(--red-soft); color: var(--red); }
.pr-baja { background: var(--navy-soft); color: var(--muted); }
.pr-media { background: var(--blue-soft); color: var(--blue); }
.pr-alta { background: var(--orange-soft); color: var(--orange); }
.pr-critica { background: var(--red-soft); color: var(--red); }
.role-admin { background: var(--navy); color: #fff; }
.role-tecnico { background: var(--gold-soft); color: var(--gold-2); }
.role-usuario { background: var(--navy-soft); color: var(--muted); }
.us-activo { background: var(--green-soft); color: var(--green); }
.us-pendiente { background: var(--orange-soft); color: var(--orange); }
.us-inactivo { background: var(--red-soft); color: var(--red); }

/* ---------- Formularios ---------- */
.form { margin: 0; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(35, 37, 90, .15); }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,175,25,.2); }
select:disabled { opacity: .6; }
.readonly { padding: 10px 12px; border-radius: 10px; background: var(--navy-soft); font-size: 14px; min-height: 43px; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--navy-soft); color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.pw-rules { list-style: none; padding: 0; margin: -6px 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.pw-rules li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--navy-soft); color: var(--muted); }
.pw-rules li.ok { background: var(--green-soft); color: var(--green); }
.pw-rules li.ok::before { content: "✓ "; }
.check, .radio { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }
.check input, .radio input { width: 18px; height: 18px; accent-color: var(--navy); }
.radio-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.check-table { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.check-row { display: grid; grid-template-columns: 260px 180px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.check-row.sw { grid-template-columns: 260px 1fr; }
.check-row.on { border-color: var(--gold); background: var(--gold-soft); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.form-actions .check { margin-right: auto; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.filters .field { margin: 0; }
.filters-btn { display: flex; }
.quick-ranges { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none !important; white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-gold { background: var(--gold); color: var(--on-gold, var(--navy)) !important; border-color: var(--gold-2); }
.btn-gold:hover { background: var(--gold-2); }
.btn-navy { background: var(--navy); color: #fff !important; }
.btn-navy:hover { background: var(--navy-2); }
[data-theme="dark"] .btn-navy { background: #3A3E8C; }
.btn-ghost { background: transparent; color: var(--text) !important; border-color: var(--line); }
.btn-ghost:hover { background: var(--navy-soft); }
.btn-danger { background: var(--red-soft); color: var(--red) !important; border-color: var(--red-soft); }
.btn-block { width: 100%; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { display: inline-flex; gap: 8px; align-items: center; padding: 11px 18px; border-radius: 12px; background: var(--card); color: var(--text) !important; font-weight: 600; box-shadow: var(--shadow); text-decoration: none !important; }
.tab.on { background: var(--navy); color: #fff !important; }
.tab.on.gold { background: var(--gold); color: var(--on-gold, var(--navy)) !important; }

/* Alertas */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: rgba(22,163,74,.2); }
.alert-error { background: var(--red-soft); color: var(--red); border-color: rgba(220,38,38,.2); }
.alert-warning { background: var(--orange-soft); color: var(--orange); border-color: rgba(217,119,6,.2); }
.alert-info { background: var(--blue-soft); color: var(--blue); }

/* Detalle */
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.dl-2 { grid-template-columns: 170px 1fr; }
.dl-tight { grid-template-columns: 130px 1fr; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--gold-soft); border-radius: 10px; padding: 6px 12px; font-size: 14px; }
.timeline { list-style: none; margin: 0 0 18px; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.ev { position: relative; padding: 0 0 16px 14px; }
.ev::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy); border: 2px solid var(--card); }
.ev-estado::before { background: var(--gold); }
.ev-nota_interna::before { background: var(--purple); }
.ev-head { font-size: 14px; }
.ev-head time { display: block; font-size: 12px; color: var(--muted); }
.ev-body { margin-top: 6px; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.ev-nota_interna .ev-body { background: var(--purple-soft); }
.comment-form { border-top: 1px solid var(--line); padding-top: 16px; }
.maillog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.maillog li { display: flex; gap: 10px; align-items: flex-start; }
.maillog small { display: block; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.dot-enviado { background: var(--green); }
.dot-error { background: var(--red); }
.dot-deshabilitado { background: var(--muted); }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pager a, .pager span { min-width: 36px; padding: 6px 10px; text-align: center; border-radius: 10px; border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.pager a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state h1 { margin: 16px 0 8px; }

/* ---------- Pantallas de acceso ---------- */
.auth-body { background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-side { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.auth-side-in { max-width: 420px; position: relative; z-index: 1; }
.auth-logo { background: #fff; border-radius: 18px; padding: 14px 18px; display: inline-block; margin-bottom: 28px; }
.auth-logo img { display: block; height: 84px; width: auto; }
.auth-side h2 { font-size: 30px; margin-bottom: 10px; }
.auth-side p { opacity: .85; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .ic { color: var(--gold); }
.dots i { position: absolute; border-radius: 50%; background: var(--gold); opacity: .9; }
.dots i:nth-child(1) { width: 120px; height: 120px; right: -40px; top: -30px; }
.dots i:nth-child(2) { width: 70px; height: 70px; right: 80px; top: 40px; opacity: .7; }
.dots i:nth-child(3) { width: 36px; height: 36px; right: 160px; top: 20px; opacity: .5; }
.dots i:nth-child(4) { width: 90px; height: 90px; left: -30px; bottom: -20px; background: #3B5A9A; }
.dots i:nth-child(5) { width: 46px; height: 46px; left: 70px; bottom: 40px; background: #3B5A9A; opacity: .7; }
.dots i:nth-child(6) { width: 20px; height: 20px; left: 130px; bottom: 90px; opacity: .6; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; position: relative; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 34px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.auth-card .muted { margin: 0 0 20px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 14px; gap: 12px; flex-wrap: wrap; }
.theme-float { position: absolute; top: 16px; right: 16px; }

/* ---------- Documentos imprimibles ---------- */
.print-body { background: #e9eaee; display: block; }
.print-bar { display: flex; gap: 10px; justify-content: center; padding: 16px; }
.sheet { background: #fff; color: #111; width: 210mm; min-height: 297mm; margin: 0 auto 30px; padding: 16mm 16mm; box-shadow: var(--shadow); font-size: 12.5px; --card: #fff; --text: #111; --line: #d9dbe1; --muted: #555; --navy-soft: #eef0f6; --bg: #f5f6f8; }
.sheet .card { box-shadow: none; border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; break-inside: avoid; }
.sheet .stats { gap: 8px; margin-bottom: 12px; }
.sheet .stat { box-shadow: none; border: 1px solid var(--line); padding: 10px; }
.sheet .stat b { font-size: 18px; }
.sheet .stat-ic { display: none; }
.sheet .table { font-size: 11px; }
.sheet .table td, .sheet .table th { padding: 5px 6px; }
.sheet .grid-2.gap { grid-template-columns: 1fr; gap: 0; }
.sheet .grid-2 > *, .sheet .card { min-width: 0; }
.sheet .table-wrap { overflow: visible; margin: 0; }
.sheet .card-ic { display: none; }
.sheet .nowrap, .sheet .table th { white-space: normal; }
.sheet .table .code { white-space: nowrap; font-size: 10px; }
.sheet .card-head { margin-bottom: 8px; }
.sheet .stats-6 { grid-template-columns: repeat(5, 1fr); }
.sheet .stat p { font-size: 11px; }
.sheet .badge { padding: 2px 6px; font-size: 10px; }
.doc-head { display: flex; align-items: center; gap: 18px; border-bottom: 3px solid var(--gold); padding-bottom: 12px; margin-bottom: 16px; }
.doc-head img { height: 64px; }
.doc-head h1 { font-size: 17px; color: var(--navy); }
.doc-head p { margin: 4px 0 0; color: #555; font-size: 12px; }
.doc-h { font-size: 14px; color: var(--navy); margin: 18px 0 8px; padding: 6px 10px; background: #eef0f6; border-left: 4px solid var(--navy); }
.doc-kv, .doc-table { width: 100%; border-collapse: collapse; }
.doc-kv th, .doc-kv td, .doc-table th, .doc-table td { border: 1px solid #cfd2da; padding: 7px 8px; text-align: left; vertical-align: top; }
.doc-kv th { background: #f6f7fa; width: 22%; font-weight: 600; }
.doc-table th { background: var(--navy); color: #fff; font-weight: 600; }
.doc-table td { height: 30px; }
.doc-sw td:first-child { width: 30%; }
.doc-decl { text-align: justify; line-height: 1.7; }
.signs { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 70px; text-align: center; }
.signs .line { display: block; border-top: 1px solid #333; margin-bottom: 6px; }
.signs small { display: block; color: #555; }
.doc-foot { margin-top: 20px; color: #777; font-size: 11px; text-align: center; }

@media print {
  @page { size: A4; margin: 12mm; }
  .no-print { display: none !important; }
  .print-body { background: #fff; }
  .sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .doc-h, .doc-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats, .stats-6 { grid-template-columns: repeat(2, 1fr); }
  .grid-main, .grid-detail { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .check-row { grid-template-columns: 1fr 1fr; }
  .check-row > input:last-child { grid-column: 1 / -1; }
  .check-row.sw { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--card); padding: 12px 16px 16px; flex-direction: column; align-items: stretch; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav .pill { justify-content: flex-start; }
  .dropdown { position: static; box-shadow: none; margin-top: 8px; }
  .topbar { position: relative; }
}
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 24px; }
  .auth-points { display: none; }
  .hero-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .dl, .dl-2 { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
}
@media (max-width: 520px) {
  .container { padding: 20px 14px; }
  .stats, .stats-6 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .check-row { grid-template-columns: 1fr; }
  .pagehead h1 { font-size: 21px; }
  .card { padding: 16px; }
}

/* ---------- Configuración ---------- */
.mt { margin-top: 16px; }
.checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.cb { width: 18px; height: 18px; accent-color: var(--navy); }
.table-fields td { padding: 8px 10px; }
.table-fields input:not([type=checkbox]) { min-width: 200px; }
.table-fields small { display: block; margin-top: 4px; }
.color-row { display: flex; gap: 14px; align-items: flex-start; }
.color-row input[type=color] { width: 54px; height: 54px; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--input); cursor: pointer; margin-top: 4px; flex: none; }
.color-row .field { flex: 1; }
.color-row small { display: block; margin-top: 4px; }
.preview { border: 1px dashed var(--line); border-radius: 14px; padding: 16px; background: var(--bg); }
.preview-bar { display: flex; gap: 8px; align-items: center; background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.preview-bar b { margin-right: auto; }
.preview-heroes { gap: 10px; margin-bottom: 14px; }
.preview-heroes .hero { padding: 16px; }
.preview-heroes .hero b { font-size: 15px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span { display: inline-block; min-width: 52px; text-align: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: 14px; }
.day input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.day input:focus-visible + span { box-shadow: 0 0 0 3px rgba(35,37,90,.25); }
.recipients { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.rcpt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; align-items: flex-start; }
.rcpt span { display: flex; flex-direction: column; font-size: 14px; }
.rcpt small { color: var(--muted); font-size: 12px; }
.rcpt:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.cmd { background: var(--navy); color: #fff; border-radius: 10px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 8px 0; }

/* ---------- Detalle de equipos entregados ---------- */
.eq-list { display: flex; flex-direction: column; gap: 12px; }
.eq-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 2px; }
.eq-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.eq-title .ic { color: var(--gold-2); }
.eq-title .badge { margin-left: auto; }
.eq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.eq-grid .field { margin-bottom: 12px; }
.eq-grid .eq-obs { grid-column: span 2; }
.eq-dl { grid-template-columns: 130px 1fr; margin-bottom: 12px; }
@media (max-width: 860px) { .eq-grid { grid-template-columns: 1fr 1fr; } .eq-grid .eq-obs { grid-column: span 2; } }
@media (max-width: 520px) { .eq-grid { grid-template-columns: 1fr; } .eq-grid .eq-obs { grid-column: auto; } }
.doc-eq { font-size: 11px; }
.doc-eq th, .doc-eq td { padding: 6px 5px; }

/* ---------- Informe de equipos entregados ---------- */
.filters-eq { grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr auto; }
.table-eqrep td { font-size: 13px; }
.stat b.inline { display: inline; font-size: inherit; }
.sheet-landscape { width: 297mm; min-height: 210mm; padding: 12mm; }
.sheet .table-eqrep { font-size: 10px; }
.sheet .table-eqrep td { font-size: 10px; padding: 4px 5px; }
.sheet .table-eqrep .badge { font-size: 9px; }
@page landscape { size: A4 landscape; margin: 10mm; }
@media print { .sheet-landscape { page: landscape; width: auto; min-height: 0; padding: 0; } }
@media (max-width: 1080px) { .filters-eq { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .filters-eq { grid-template-columns: 1fr; } }
.container-wide { max-width: 1640px; }
.table-eqrep th { padding: 9px 7px; font-size: 11px; }
.table-eqrep td { padding: 10px 7px; font-size: 12.5px; }
.table-eqrep td.obs { min-width: 160px; }
.table-eqrep td small { font-size: 11px; }
.sheet .stats { grid-template-columns: repeat(4, 1fr); }
.sheet .stats-6 { grid-template-columns: repeat(5, 1fr); }
.sheet .table-eqrep td.nowrap { white-space: nowrap; }

/* ---------- Valor del equipo ---------- */
.money { position: relative; }
.money > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px !important; }
.eq-total { text-align: right; margin: 12px 4px 0; }
.blank { letter-spacing: 1px; }
.doc-table tfoot th { background: #eef0f6; color: var(--navy); }
.right { text-align: right !important; }

/* ---------- Empresas y declaración ---------- */
.new-row td { background: var(--gold-soft); }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 12.5px; font-family: ui-monospace, Consolas, monospace; cursor: pointer; text-align: left; display: flex; flex-direction: column; }
.chip-btn small { font-family: var(--font); color: var(--muted); font-size: 11px; }
.chip-btn:hover { border-color: var(--gold); background: var(--gold-soft); }
.decl-title { margin: 0 0 8px; color: var(--navy); }
[data-theme="dark"] .decl-title { color: #C9CCF5; }
.decl-preview { background: var(--bg); border-radius: 12px; padding: 14px; font-size: 14px; }
.filters-rep { grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto; }
@media (max-width: 1080px) { .filters-rep { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .filters-rep { grid-template-columns: 1fr; } }
.decl-preview { text-align: left; }
.eq-grid.nospecs .eq-obs { grid-column: span 1; }
@media (max-width: 860px) { .eq-grid.nospecs .eq-obs { grid-column: span 2; } }
