/* M2 - hoja de estilos del sitio (base: Tickets/estilos.css; mantener el mismo estilo) */

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #0f1b2d;
  --muted: #5b6b82;
  --border: #e2e7f0;
  --brand: #0b2a55;
  --brand-2: #16427f;
  --accent: #8ec5ff;
  --accent-ink: #062044;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --ok: #1b7f4b;
  --ok-bg: #e7f6ee;
  --warn: #8a6100;
  --warn-bg: #fff6d6;
  --msg-usuario: #fbf3ea;
  --msg-usuario-bd: #ecd9c3;
  --msg-equipo: #eef4ff;
  --msg-equipo-bd: #cfdcf5;
  --msg-privado: #eaf7ee;
  --msg-privado-bd: #c4e6cf;
  --msg-memo: #fff8d1;
  --msg-memo-bd: #f0dd86;
  --fila-alterna: #f4f7fc;
  --fila-hover: #e6eefb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 20px rgba(15, 27, 45, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c121e;
    --surface: #141c2c;
    --surface-2: #192336;
    --text: #e6ebf4;
    --muted: #97a5bc;
    --border: #253048;
    --danger-bg: #3a1c1c;
    --ok-bg: #15301f;
    --warn-bg: #3a3014;
    --danger: #ff8a7a;
    --ok: #6fd69b;
    --warn: #f3cf6a;
    --msg-usuario: #2a2219;
    --msg-usuario-bd: #4a3a28;
    --msg-equipo: #17233a;
    --msg-equipo-bd: #2b3d60;
    --msg-privado: #142b1d;
    --msg-privado-bd: #285238;
    --msg-memo: #2e2a12;
    --msg-memo-bd: #5c5220;
    --fila-alterna: #18223a;
    --fila-hover: #22304d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sin esto, una tabla ancha estira <main> (hijo flex) y la pagina se sale de la pantalla en moviles */
main { flex: 1 0 auto; min-width: 0; width: 100%; }

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { a { color: #8fb6ff; } }

img { max-width: 100%; }

/* ---------- Cabecera ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}

.bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }

.mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.03em;
  flex: none;
}

.bar-right { display: flex; align-items: center; gap: 14px; }

.user {
  font-size: 13px;
  color: rgba(255, 255, 255, .8);
  white-space: nowrap;
}
.role {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.site-link { color: rgba(255, 255, 255, .8); font-size: 13px; white-space: nowrap; }
.site-link:hover { color: #fff; }

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px 10px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  color: rgba(255, 255, 255, .82);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav a.salir { margin-left: auto; }

@media (max-width: 640px) {
  .user, .site-link { display: none; }
  .nav a.salir { margin-left: 0; }
}

/* ---------- Pie ---------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.site-footer .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  display: grid;
  gap: 10px;
}
.site-footer .row { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }
.site-footer small { font-size: 12px; }

/* ---------- Estructura ---------- */

.page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}
.page.narrow { max-width: 760px; }

.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head.split { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 6px;
}
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--accent); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2, .section-title {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: -.01em;
}
.section-title { margin-top: 30px; }
.card > :last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Formularios ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 18px;
}
.form-grid .wide { grid-column: 1 / -1; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.field .readonly {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
}
.input, select.input, textarea.input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(22, 66, 127, .18);
}
textarea.input { line-height: 1.5; resize: vertical; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.check { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-weight: 500; }
.check input { width: 18px; height: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .05s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(.96); border-color: var(--accent); color: var(--accent-ink); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }

.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.actions.left { justify-content: flex-start; }
.actions .spacer { flex: 1; }

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 14px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, .25);
}
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(27, 127, 75, .25); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(138, 97, 0, .25); }
.alert.info { background: var(--surface-2); color: var(--text); border-color: var(--border); font-weight: 500; }

/* ---------- Filtros y tablas ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0 12px;
  align-items: end;
}
.filters .field { margin-bottom: 12px; }
.filters .field label { font-size: 12px; margin-bottom: 4px; }
.filters .input { padding: 8px 10px; font-size: 14px; }
.filters .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; grid-column: 1 / -1; justify-content: flex-end; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl th, .tbl td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.nowrap { white-space: nowrap; }
.tbl .strong { font-weight: 600; }
.tbl td.asunto { min-width: 220px; }
.tbl td.asunto a { font-weight: 600; }
.tbl .email-dest { color: var(--ok); font-weight: 600; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.abierto { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.cerrado { background: var(--surface-2); color: var(--muted); }
.badge.privado { background: var(--msg-privado); color: var(--ok); border-color: var(--msg-privado-bd); }
.badge.memo { background: var(--msg-memo); color: var(--warn); border-color: var(--msg-memo-bd); }
.badge.pend { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.pager .pages { display: flex; flex-wrap: wrap; gap: 4px; }
.pager a, .pager span.cur {
  min-width: 34px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  color: var(--text);
}
.pager a:hover { border-color: var(--brand-2); text-decoration: none; }
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager span.off { opacity: .45; padding: 5px 10px; }

/* ---------- ABM (Admin.asp) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips a {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.chips a:hover { border-color: var(--brand-2); text-decoration: none; }
.chips a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 280px; max-width: 640px; }
.toolbar form .input[type=search] { flex: 1 1 180px; width: auto; }
.toolbar .tam-pagina { flex: none; }
.toolbar .tam-pagina .input { width: auto; }
.tbl td.acciones { white-space: nowrap; text-align: right; }
.tbl td.acciones form { display: inline; }
.abm { font-size: 13px; }
.abm .page-head h1 { font-size: clamp(20px, 3vw, 26px); }
.abm .tbl { font-size: 11px; line-height: 1.35; }
.abm .tbl th, .abm .tbl td { padding: 5px 8px; white-space: nowrap; }
.abm .tbl thead th { font-size: 10px; letter-spacing: .03em; }
.abm .tbl td.acciones .btn-sm { font-size: 11px; padding: 3px 8px; }
/* Columna de acciones fija a la derecha: Editar/Borrar siempre visibles
   aunque la tabla sea mas ancha que la pantalla y se desplace */
.abm .tbl td.acciones, .abm .tbl th.acciones {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: -8px 0 8px -8px rgba(15, 27, 45, .25), -1px 0 0 var(--border);
}
.abm .tbl thead th.acciones { background: var(--surface-2); z-index: 2; }
/* Filas alternadas para seguir mejor cada registro */
.abm .tbl tbody tr:nth-child(even) td { background: var(--fila-alterna); }
.abm .tbl tbody tr:hover td { background: var(--fila-hover); }
.abm .card h2 { font-size: 16px; }
.abm .field label { font-size: 12px; margin-bottom: 4px; }
.abm .input, .abm .field .readonly { font-size: 13px; padding: 8px 10px; }
.abm .btn { font-size: 13px; padding: 8px 14px; }
.abm .btn-sm { font-size: 12px; padding: 5px 10px; }

/* ---------- Ficha del ticket ---------- */

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px 22px;
  margin: 0;
}
.meta div { min-width: 0; }
.meta dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Conversacion ---------- */

.thread { display: grid; gap: 14px; margin-bottom: 18px; }
.msg {
  border: 1px solid var(--msg-equipo-bd);
  background: var(--msg-equipo);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 0;
}
.msg.usuario { background: var(--msg-usuario); border-color: var(--msg-usuario-bd); }
.msg.privado { background: var(--msg-privado); border-color: var(--msg-privado-bd); }
.msg.memo { background: var(--msg-memo); border-color: var(--msg-memo-bd); }
.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.msg-head .autor { font-weight: 700; color: var(--text); font-size: 14px; }
.msg-head .acc { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.msg-body { overflow-wrap: anywhere; font-size: 15px; }
.msg-body img { height: auto; }
.msg-body table { max-width: 100%; }
.msg-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.adj {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.adj::before { content: "\1F4CE"; font-size: 12px; }
/* Imagen adjunta (captura): miniatura que abre la imagen completa */
.adj-img { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.adj-img img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.adj-img a:hover img { border-color: var(--brand-2); }

.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; display: inline-block; }

.reply-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}
@media (max-width: 760px) { .reply-grid { grid-template-columns: minmax(0, 1fr); } }

details.tool { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 12px; }
details.tool summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; }
details.tool .tool-body { padding: 0 14px 14px; }

/* ---------- Subida de adjuntos ---------- */

.upl-list { margin-top: 8px; display: grid; gap: 6px; }
.upl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 2px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
}
.upl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-msg { grid-column: 1 / -1; font-size: 12px; }
.upl-msg.ok { color: var(--ok); font-weight: 600; }
.upl-msg.ko { color: var(--danger); font-weight: 600; }
.upl-x { grid-row: 1; grid-column: 3; padding: 2px 10px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--brand-2); transition: width .2s; }
.upl-row.error .progress span { background: var(--danger); }

.adj-pegar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; }
kbd {
  font: 600 11px ui-monospace, Consolas, monospace;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}

/* Elegir de Files (administrador) */
.srv-lista { max-height: 260px; overflow-y: auto; display: grid; gap: 4px; margin-top: 8px; }
.srv-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.srv-item:hover { border-color: var(--brand-2); }
.srv-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.srv-d { color: var(--muted); white-space: nowrap; flex: none; }

/* ---------- Diagnostico ---------- */

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.checklist li.ok::before { content: "\2713"; background: var(--ok-bg); color: var(--ok); }
.checklist li.ko::before { content: "\2715"; background: var(--danger-bg); color: var(--danger); }
.checklist li.pend::before { content: "?"; background: var(--surface-2); color: var(--muted); }

/* ---------- Texto informativo ---------- */

.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }

.highlight {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 10px 0 14px;
}

/* ---------- Acceso (login) ---------- */

.auth {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(142, 197, 255, .28), transparent 60%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 18px;
  padding: 30px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.auth-card.wide { max-width: 560px; }
.auth-card .brand { color: var(--text); justify-content: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-card .help { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.auth-card .note { font-size: 12px; color: var(--muted); margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Ventana emergente (VerMensaje) ---------- */

.popup { padding: 20px; }

/* ---------- Moviles ---------- */

/* iOS hace zoom al enfocar campos con letra menor a 16px */
@media (max-width: 640px) {
  .input, select.input, textarea.input, .filters .input, .abm .input { font-size: 16px; }
  .card { padding: 16px; }
  .page { padding-top: 20px; }
  .msg { padding: 12px 14px; }
  .actions .btn { flex: 1 1 auto; }
}

/* Pantallas tactiles: botones y enlaces con area de toque comoda */
@media (pointer: coarse) {
  .btn-sm, .abm .btn-sm, .abm .tbl td.acciones .btn-sm { min-height: 40px; padding: 8px 14px; }
  .btn, .abm .btn { min-height: 44px; }
  .chips a { padding: 9px 14px; }
  .nav a { padding: 10px 14px; }
  .pager a, .pager span.cur { min-height: 40px; padding: 9px 12px; }
  .check input { width: 22px; height: 22px; }
}

/* =========================================================
   Sitio M2 (agregado sobre la hoja de Tickets)
   ========================================================= */

/* Menu: boton Comprar a la derecha */
.nav a.destacado { margin-left: auto; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700; }
.nav a.destacado:hover { background: rgba(255, 255, 255, .22); }
.nav a.destacado.active { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 640px) { .nav a.destacado { margin-left: 0; } }

/* Bloque principal de portada y de producto */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
  margin-bottom: 26px;
}
.hero .eyebrow { color: var(--accent); }
.hero h1 { margin: 0 0 10px; font-size: clamp(26px, 4.4vw, 40px); line-height: 1.15; letter-spacing: -.02em; }
.hero p { margin: 0 0 18px; color: rgba(255, 255, 255, .86); font-size: 16px; }
.hero .actions { justify-content: flex-start; margin-top: 0; }
.hero .btn { border-color: rgba(255, 255, 255, .35); background: transparent; color: #fff; }
.hero .btn:hover { border-color: #fff; color: #fff; }
.hero .btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hero .btn-accent:hover { color: var(--accent-ink); }
.hero figure { margin: 0; text-align: center; }
.hero figure img { max-height: 260px; border-radius: var(--radius-sm); }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero figure { order: -1; }
  .hero figure img { max-height: 180px; }
}

/* Grilla de tarjetas (productos, descargas, trabajos) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.tile .tile-img { text-align: center; margin: -4px 0 14px; }
.tile .tile-img img { max-height: 140px; }
.tile h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.01em; }
.tile p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.tile .actions { margin-top: auto; justify-content: flex-start; }

/* Texto largo (paginas de contenido) */
.prose { font-size: 15px; }
.prose h2 { font-size: 20px; margin: 28px 0 10px; letter-spacing: -.01em; }
.prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose figure { margin: 18px 0; text-align: center; }
.prose figure img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }
.prose > :first-child { margin-top: 0; }

/* Noticia destacada de la portada */
.news-item .fecha { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.news-item h2 { margin-bottom: 8px; }

/* Precios */
.precios { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.precio { display: flex; flex-direction: column; }
.precio .monto { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.precio .antes { color: var(--muted); text-decoration: line-through; font-size: 14px; }
.precio .detalle { color: var(--muted); font-size: 13px; margin: 6px 0 16px; }
.precio form { margin-top: auto; }

/* Zona de descargas */
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.migas { font-size: 13px; color: var(--muted); margin-bottom: 10px; overflow-wrap: anywhere; }
.migas a { color: var(--muted); }
.migas span { color: var(--text); font-weight: 600; }

.carpetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 22px; }
.carpeta {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-weight: 600; font-size: 14px; overflow-wrap: anywhere;
}
.carpeta::before { content: ""; flex: none; width: 18px; height: 14px; border-radius: 3px; background: var(--accent); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12); }
.carpeta:hover { border-color: var(--brand-2); text-decoration: none; }

.bloques { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.bloque { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.bloque-img { display: grid; place-items: center; height: 110px; background: #fff; border-radius: 6px; overflow: hidden; }
.bloque-img img { max-height: 106px; object-fit: contain; }
.bloque-ext { font-weight: 800; color: var(--brand-2); letter-spacing: .05em; }
.bloque-nombre { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager.bloques-pager, .page .pager { justify-content: center; margin: 10px 0; }

/* Portada */
.historia { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; align-items: center; }
.historia figure { margin: 0; text-align: center; }
.historia img { border-radius: var(--radius-sm); }
.historia h2 { font-size: clamp(18px, 2.4vw, 24px); margin: 0 0 8px; }
.historia-remate { font-size: 18px; font-weight: 700; color: var(--brand-2); margin: 0 0 10px; }
@media (prefers-color-scheme: dark) { .historia-remate { color: var(--accent); } }
@media (max-width: 640px) { .historia { grid-template-columns: 1fr; } }
.recomendado { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.recomendado img { background: #fff; border-radius: 6px; padding: 4px; }
.hero p s { opacity: .7; }

/* Paginas de M2*Arq */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 22px; }
.galeria figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.galeria img { display: block; width: 100%; height: 170px; object-fit: contain; background: #fff; border-radius: 6px; }
.galeria figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.llamado { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.llamado h2 { margin: 0 0 4px; }
.llamado p { margin: 0; }
.llamado .actions { margin-top: 0; }
.video-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.video-lista video { width: 100%; border-radius: 6px; background: #000; }

/* Videos con Ruffle (/m2arq/videos.asp) */
.video-caja { position: relative; width: 100%; aspect-ratio: 790 / 545; background: #0b1220; border-radius: 6px; overflow: hidden; display: grid; place-items: center; margin-bottom: 10px; }
.video-caja ruffle-player, .video-caja ruffle-object, .video-caja video { width: 100%; height: 100%; display: block; }
.video.reproduciendo { grid-column: 1 / -1; }
.video.reproduciendo .video-caja { max-width: 1000px; margin-left: auto; margin-right: auto; }

/* Soporte: preguntas frecuentes y test */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style-position: inside; }
.faq summary:hover { color: var(--brand-2); }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq details .prose { padding: 14px 16px; }
.faq-pregunta { font-size: 20px; line-height: 1.35; }
.test-pregunta { border: 1px solid var(--border); }
.test-pregunta legend { padding: 0 6px; }
.test-enunciado { font-weight: 600; margin: 0 0 8px; }
.test-pregunta .check { align-items: flex-start; padding: 6px 0; }
.test-pregunta .check input { margin-top: 3px; flex: none; }
.test-lista li { margin-bottom: 10px; }
.test-bien strong { color: var(--ok); }
.test-mal strong { color: var(--danger); }
.test-resultado { text-align: center; }

/* Paginador con filas por pagina (Usuarios de sistemas) */
.card .pager { justify-content: space-between; margin: 10px 0; }
.tam-pagina { display: flex; align-items: center; gap: 8px; margin: 0; }
.tam-pagina label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.tam-pagina select.input { width: auto; padding: 5px 8px; font-size: 13px; }

/* ABM de ACT: titulos de columna que ordenan */
.tbl th a.orden { color: inherit; text-decoration: none; white-space: nowrap; }
.tbl th a.orden:hover { text-decoration: underline; }
.tbl th a.orden.activo { font-weight: 800; }

/* Tablas ordenables en el navegador (portal Multiplus, listado por llave) */
.tbl th.ordenable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.ordenable:hover { text-decoration: underline; }
.tbl th[data-orden="asc"]::after { content: " \25B2"; font-size: .8em; }
.tbl th[data-orden="desc"]::after { content: " \25BC"; font-size: .8em; }
