/* ============================================================
   BSS — Panel del hosting (facturación electrónica y licencias)
   Colores del logo de Baez Service Solutions: azul marino + verde agua.
   Pensado primero para el celular: menú que se abre con ☰, tablas que
   pasan a tarjetas (data-label lo pone footer.php) y botones grandes.
   ============================================================ */

:root {
  --navy:        #1b2462;
  --navy-2:      #131a4a;
  --navy-3:      #262f78;
  --teal:        #009a92;
  --teal-dark:   #007f78;
  --teal-soft:   #e3f5f4;

  --accent:      var(--navy);
  --accent-dark: var(--navy-2);
  --success:     #15803d;
  --danger:      #c62828;
  --warning:     #b45309;

  --body-bg:     #f3f5fa;
  --card-bg:     #ffffff;
  --text:        #1d2433;
  --muted:       #667085;
  --border:      #e4e8f0;
  --shadow:      0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg:   0 12px 32px rgba(19,26,74,.18);
  --radius:      14px;
  --sidebar-w:   252px;
  --topbar-h:    60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; word-break: break-all; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Menú lateral ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.sidebar-brand { padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.sidebar-brand .logo-icon {
  width: 42px; height: 42px; border-radius: 11px; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sidebar-brand .logo-icon img { width: 36px; height: 36px; object-fit: contain; }
.sidebar-brand .logo-text { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-brand .logo-sub  { color: rgba(255,255,255,.55); font-size: 11.5px; }

.sidebar-menu { flex: 1; padding: 10px 10px; overflow-y: auto; }
.sidebar-section {
  padding: 14px 10px 6px;
  color: rgba(255,255,255,.38);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
}
/* grupos del menú que se abren y cierran */
.sidebar-plegar {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.sidebar-plegar:hover { color: rgba(255,255,255,.7); }
.sidebar-plegar:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.sidebar-plegar svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.sidebar-grupo.cerrado .sidebar-plegar svg { transform: rotate(-90deg); }
.sidebar-grupo.cerrado .sidebar-grupo-items { display: none; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  color: rgba(255,255,255,.78); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
.sidebar-menu a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-menu a.active { background: var(--teal); color: #fff; box-shadow: 0 4px 14px rgba(0,154,146,.35); }
.sidebar-menu a .ico { width: 20px; display: inline-flex; justify-content: center; }
.sidebar-menu a .ico svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.6); font-size: 12.5px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-footer .quien { color: #fff; font-weight: 600; font-size: 13px; }
.sidebar-footer .rol { color: rgba(255,255,255,.5); font-size: 11.5px; }
.sidebar-footer a { color: rgba(255,255,255,.75); text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }
.btn-instalar {
  display: none; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18);
  padding: 9px 12px; border-radius: 10px; font: 600 13px inherit; cursor: pointer;
}
.btn-instalar.visible { display: flex; }
.btn-instalar:hover { background: rgba(255,255,255,.16); }

.sidebar-fondo { display: none; }

/* ── Principal ──────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 100;
}
.menu-boton {
  display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.menu-boton svg { width: 22px; height: 22px; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; fill: none; }
.topbar-title { font-weight: 700; font-size: 17px; color: var(--navy); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filtro-empresa { display: flex; align-items: center; gap: 8px; }
.filtro-empresa select {
  height: 38px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  padding: 0 32px 0 12px; font: 500 13px inherit; color: var(--text); max-width: 260px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.filtro-empresa select.activo { border-color: var(--teal); background-color: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.topbar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--teal)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}

.content { flex: 1; padding: 24px; max-width: 1400px; width: 100%; }

/* ── Tarjetas de números ───────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 18px 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.stat-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.blue   { background: #e8ebf8; color: var(--navy); }
.stat-icon.green  { background: #e3f5ec; color: var(--success); }
.stat-icon.red    { background: #fdecec; color: var(--danger); }
.stat-icon.yellow { background: #fdf3e2; color: var(--warning); }
.stat-icon.teal   { background: var(--teal-soft); color: var(--teal-dark); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ── Tarjeta genérica ──────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-header > div { display: flex; gap: 8px; flex-wrap: wrap; }
.card-title { font-weight: 700; font-size: 15px; color: var(--navy); }
.card-body  { padding: 20px; }

/* ── Tablas ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 11px 14px; background: #f7f8fc;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfe; }

/* ── Etiquetas ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green  { background: #e3f5ec; color: #146c3a; }
.badge-red    { background: #fdecec; color: #a32020; }
.badge-yellow { background: #fdf3e2; color: #8a4b08; }
.badge-gray   { background: #eef0f5; color: #4b5563; }
.badge-blue   { background: #e8ebf8; color: var(--navy); }
.badge-teal   { background: var(--teal-soft); color: var(--teal-dark); }

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; min-height: 40px; border-radius: 10px;
  font: 600 13.5px inherit; font-family: inherit; cursor: pointer;
  text-decoration: none; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 2px 6px rgba(0,154,146,.28); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-outline:hover { background: #f5f7fc; border-color: #cfd5e3; }
.btn-danger  { background: #fff; color: var(--danger); border-color: #f3c4c4; }
.btn-danger:hover { background: #fdecec; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 12.5px; border-radius: 9px; }

/* ── Formularios ────────────────────────────────────────────── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.form-control {
  padding: 10px 12px; min-height: 42px; border: 1px solid #d6dbe7; border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--text); background: #fff; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,154,146,.14); }
.form-control:disabled, .form-control[readonly] { background: #f5f7fb; color: #475467; }
select.form-control { cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); }
input[type="text"]:not(.form-control) { padding: 8px 10px; border: 1px solid #d6dbe7; border-radius: 9px; font: inherit; }
.form-actions { display: flex; gap: 10px; padding-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
h3 { color: var(--navy) !important; }

/* ── Avisos ─────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; transition: opacity .4s; border: 1px solid; }
.alert-success { background: #ecf8f1; color: #146c3a; border-color: #bfe6cf; }
.alert-danger  { background: #fdf0f0; color: #a32020; border-color: #f5c9c9; }
.alert-warning { background: #fdf6ea; color: #8a4b08; border-color: #f4dcb0; }
.alert-info    { background: var(--teal-soft); color: var(--teal-dark); border-color: #b9e4e1; }

/* ── Paginación ─────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; border: 1px solid var(--border); color: var(--navy); background: #fff;
}
.pagination a:hover { background: #f5f7fc; }
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Inicio de sesión ───────────────────────────────────────── */
.login-page {
  min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(0,154,146,.35), transparent 60%),
              linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 70%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box { background: #fff; border-radius: 20px; padding: 34px 30px; width: 100%; max-width: 410px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 10px; }
.login-logo h1 { font-size: 20px; color: var(--navy); font-weight: 700; }
.login-logo p  { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.login-box .btn-primary { min-height: 48px; font-size: 15px; border-radius: 12px; }
.login-box .btn-primary:disabled { opacity: .75; cursor: wait; }
.login-pie { text-align: center; margin-top: 20px; color: #98a2b3; font-size: 12px; }

/* Login en dos paneles: la marca a la izquierda y el formulario a la derecha */
.login-panel {
  display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 900px;
  background: #fff; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.login-panel .login-box { box-shadow: none; border-radius: 0; max-width: none; padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-panel .login-logo { text-align: left; margin-bottom: 26px; }
.login-panel .login-logo h1 { font-size: 26px; }
.login-panel .login-logo .solo-celular { display: none; }
.login-marca {
  background: radial-gradient(500px 300px at 0% 0%, rgba(0,154,146,.45), transparent 70%),
              linear-gradient(160deg, var(--navy-3) 0%, var(--navy) 45%, var(--navy-2) 100%);
  color: #fff; padding: 46px 40px; display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.login-marca-logo { width: 96px; height: 96px; background: #fff; border-radius: 22px; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin-bottom: 8px; }
.login-marca-logo img { width: 84px; height: 84px; object-fit: contain; }
.login-marca h2 { font-size: 24px; line-height: 1.25; }
.login-marca p { color: rgba(255,255,255,.75); font-size: 14.5px; }
.login-marca ul { list-style: none; display: grid; gap: 10px; margin-top: 10px; }
.login-marca li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.88); font-size: 14px; }
.login-marca li::before {
  content: ''; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat;
}
.login-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; font-size: 12.5px; flex-wrap: wrap; }
.login-fila a { margin-left: auto; }
.aviso-mayus { color: var(--warning); font-weight: 600; }

/* Campo con ícono a la izquierda y, en las contraseñas, el ojo a la derecha */
.campo-icono { position: relative; }
.campo-icono > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; stroke: #98a2b3; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.campo-icono .form-control { padding-left: 42px; min-height: 48px; border-radius: 12px; }
.campo-icono.sin-icono .form-control { padding-left: 12px; }
.campo-icono.con-ojo .form-control { padding-right: 48px; }
.campo-icono:focus-within > svg { stroke: var(--teal); }
.ojo {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: #667085;
}
.ojo:hover { background: #f2f4f8; color: var(--navy); }
.ojo:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.ojo svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
input::-ms-reveal, input::-ms-clear { display: none; }   /* el ojo propio de Edge: ya está el nuestro */

@media (max-width: 760px) {
  .login-page { padding: 20px 14px; }
  .login-panel { grid-template-columns: 1fr; border-radius: 20px; }
  .login-marca { display: none; }
  .login-panel .login-box { padding: 30px 22px; }
  .login-panel .login-logo { text-align: center; }
  .login-panel .login-logo .solo-celular { display: block; }
  .login-panel .login-logo h1 { font-size: 22px; }
}

/* ── Datos sueltos ──────────────────────────────────────────── */
.token-box {
  background: var(--navy-2); color: #8ee6df; padding: 10px 14px; border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all;
}
.upload-area {
  border: 2px dashed #cfd5e3; border-radius: 12px; padding: 26px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; color: var(--navy); font-weight: 600;
}
.upload-area:hover { border-color: var(--teal); background: var(--teal-soft); }
.upload-area p { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 400; }
pre { white-space: pre-wrap; word-break: break-all; }
.vacio { text-align: center; color: #98a2b3; padding: 30px !important; }
.solo-lectura { display: flex; gap: 10px; align-items: center; }

[hidden] { display: none !important; }

/* ── Formulario compacto (grilla de 12 columnas, campos bajos) ── */
.fc { display: flex; flex-direction: column; gap: 14px; }
.fc-seccion { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; background: #fbfcfe; }
.fc-titulo {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--navy);
}
.fc-titulo::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--teal); }
.fc-titulo small { margin-left: auto; font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.fc-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.fc-grid > * { min-width: 0; }
.fc .form-group { gap: 4px; }
.fc .form-label { font-size: 11.5px; }
.fc .form-control { min-height: 36px; padding: 6px 10px; font-size: 14px; border-radius: 8px; background: #fff; }
.fc-par { display: grid; grid-template-columns: 76px minmax(0, 1fr); }
.fc-par .form-control:first-child { border-radius: 8px 0 0 8px; border-right: none; text-align: center; background: #f5f7fb; }
.fc-par .form-control:last-child { border-radius: 0 8px 8px 0; }
.fc-check { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; font-size: 13.5px; }
.fc-ayuda { font-size: 12px; color: var(--muted); }
.fc-ayuda:empty { display: none; }
.fc-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 0 14px; }
.fc-modulos .fc-check { min-height: 30px; }
.s1{grid-column:span 1}.s2{grid-column:span 2}.s3{grid-column:span 3}.s4{grid-column:span 4}.s5{grid-column:span 5}
.s6{grid-column:span 6}.s7{grid-column:span 7}.s8{grid-column:span 8}.s9{grid-column:span 9}.s12{grid-column:span 12}
@media (max-width: 1100px) {
  .fc-grid > * { grid-column: span 6; }
  .fc-grid > .s12, .fc-grid > .t12 { grid-column: span 12; }
  .fc-grid > .t3 { grid-column: span 3; }
}
@media (max-width: 600px) {
  .fc-grid > *, .fc-grid > .t3 { grid-column: span 12; }
  .fc-grid > .m6 { grid-column: span 6; }
  .fc-seccion { padding: 10px 12px 12px; }
}

/* ── Celular y tablet ───────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-fondo { position: fixed; inset: 0; background: rgba(15,20,50,.45); z-index: 150; }
  .sidebar.open + .sidebar-fondo { display: block; }
  .main { margin-left: 0; }
  .menu-boton { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-user .nombre { display: none; }
  .content { padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-grid-3 .form-group[style*="span"] { grid-column: auto !important; }
}

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 12px; flex-direction: column; align-items: flex-start; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-value { font-size: 22px; }

  .filtro-empresa select { max-width: 150px; font-size: 12.5px; }
  .topbar-title { font-size: 16px; }

  /* Tablas como tarjetas: cada fila es una tarjeta y cada celda muestra su título (data-label) */
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table-wrap tbody tr:last-child { border-bottom: none; }
  .table-wrap tbody tr:hover td { background: transparent; }
  .table-wrap tbody td {
    border: none; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    text-align: right !important; max-width: none !important; white-space: normal !important;
  }
  .table-wrap tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; max-width: 45%;
  }
  .table-wrap tbody td[data-label=""]::before { display: none; }
  .table-wrap tbody td:first-child { font-size: 15px; padding-bottom: 6px; }
  .table-wrap tbody td.acciones, .table-wrap tbody td:last-child:has(.btn) { justify-content: flex-end; flex-wrap: wrap; padding-top: 8px; }
  .table-wrap tbody td[colspan] { display: block; text-align: center !important; }
  .table-wrap tbody td[colspan]::before { display: none; }

  .card-header { padding: 13px 14px; }
  .card-body { padding: 16px 14px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .pagination { justify-content: center; }
}

/* En la app instalada no hace falta el botón "Instalar" */
@media (display-mode: standalone) {
  .btn-instalar { display: none !important; }
}
