/* ==========================================================================
   PROTEL 2.0 — Hoja de estilos principal
   Colores de marca tomados del logotipo PROIMCA
   ========================================================================== */
:root {
  --brand: #029348;
  --brand-600: #027a3c;
  --brand-700: #01632f;
  --brand-50: #e7f5ed;
  --brand-100: #cdebd9;
  --accent: #e40f83;
  --accent-50: #fde7f3;
  --blue: #2f6fdb;
  --blue-50: #e8f0fd;
  --amber: #d97706;
  --amber-50: #fef3e2;
  --red: #dc2f45;
  --red-50: #fde9ec;
  --violet: #7c3aed;
  --violet-50: #f1ebfe;

  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --border: #e2e8e4;
  --border-strong: #cfd8d3;
  --text: #17211c;
  --text-2: #3a4741;
  --muted: #69766f;
  --track: #edf1ef;

  --sidebar-bg: #0c1c14;
  --sidebar-bg-2: #10251a;
  --sidebar-text: #aebfb6;
  --sidebar-head: #6f8579;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 22, .05);
  --shadow: 0 1px 2px rgba(15, 30, 22, .04), 0 6px 20px rgba(15, 30, 22, .06);
  --shadow-lg: 0 10px 40px rgba(15, 30, 22, .14);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 264px;
}

[data-tema="oscuro"] {
  --brand-50: rgba(2, 147, 72, .16);
  --brand-100: rgba(2, 147, 72, .28);
  --accent-50: rgba(228, 15, 131, .16);
  --blue-50: rgba(47, 111, 219, .18);
  --amber-50: rgba(217, 119, 6, .18);
  --red-50: rgba(220, 47, 69, .18);
  --violet-50: rgba(124, 58, 237, .2);
  --bg: #0d1210;
  --surface: #141b18;
  --surface-2: #19221e;
  --border: #25302b;
  --border-strong: #33413a;
  --text: #e5ece8;
  --text-2: #c3cec8;
  --muted: #8d9c94;
  --track: #212b26;
  --sidebar-bg: #08100c;
  --sidebar-bg-2: #0b1711;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: .925rem;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }
[data-tema="oscuro"] a { color: #3fc47d; }
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 650; letter-spacing: -.01em; }
.text-secondary, .text-muted { color: var(--muted) !important; }
hr { border-color: var(--border); opacity: 1; }
::selection { background: var(--brand-100); }
kbd { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); font-size: .72rem; padding: 1px 6px; border-radius: 5px; box-shadow: none; }
code { color: var(--accent); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; }
.fw-650 { font-weight: 650; }

/* ---------- Estructura ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text); display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .04);
  transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: #fff; text-decoration: none !important; }
.brand-logo { width: 46px; height: 46px; background: #fff; border-radius: 12px; display: grid; place-items: center; flex: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.brand-logo img { width: 38px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.15rem; letter-spacing: .04em; color: #fff; }
.brand-text small { font-size: .74rem; color: var(--sidebar-head); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-head); padding: 16px 12px 6px; font-weight: 650; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 1px 0;
  border-radius: 10px; color: var(--sidebar-text) !important; text-decoration: none !important; font-weight: 500;
  position: relative; transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff !important; }
.nav-item.active { background: rgba(2, 147, 72, .22); color: #fff !important; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-item.active i { color: #4fd18b; opacity: 1; }
.sidebar-foot { padding: 14px 20px; font-size: .74rem; color: var(--sidebar-head); border-top: 1px solid rgba(255, 255, 255, .05); }
.sidebar-backdrop { display: none; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-search { flex: 1; max-width: 560px; position: relative; display: flex; align-items: center; }
.topbar-search i { position: absolute; left: 14px; color: var(--muted); font-size: .9rem; }
.topbar-search kbd { position: absolute; right: 10px; }
.topbar-search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 40px 0 40px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.topbar-search input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-50); }
.btn-icon { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; flex: none; margin-left: auto; }
.topbar .btn-icon[data-accion="abrir-menu"] { margin-left: 0; }
.btn-icon:hover { background: var(--surface-2); color: var(--brand); }
.icon-oscuro { display: none; }
[data-tema="oscuro"] .icon-claro { display: none; }
[data-tema="oscuro"] .icon-oscuro { display: inline-block; color: #fbbf24; }
.user-chip { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 4px 6px; border-radius: 12px; color: var(--text); }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82rem; color: #fff; background: linear-gradient(135deg, var(--brand), #00b36b); flex: none; }
.user-meta { flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.user-meta strong { font-size: .86rem; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: .74rem; }

.content { padding: 24px 28px 32px; width: 100%; max-width: 1480px; margin: 0 auto; flex: 1; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 28px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.55rem; margin: 0; font-weight: 700; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.crumbs i { font-size: .6rem; opacity: .6; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .menu-abierto .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-abierto .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1035; }
  .app-main { margin-left: 0; }
  .content { padding: 18px 16px 28px; }
  .topbar { padding: 0 14px; }
}

/* ---------- Componentes Bootstrap adaptados ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--text); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 14px 18px; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-header .ch-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: .85rem; }
.card-header .ms-auto { font-weight: 400; }
.card-body { padding: 18px; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: 12px 18px; }

.btn { border-radius: 10px; font-weight: 550; padding: .48rem .95rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { padding: .3rem .65rem; border-radius: 8px; font-size: .82rem; }
.btn-lg { padding: .7rem 1.25rem; border-radius: 12px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600); border-color: var(--brand-600); }
.btn-primary:active { background: var(--brand-700) !important; border-color: var(--brand-700) !important; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #c40c70; border-color: #c40c70; color: #fff; }
.btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn-light:hover { background: var(--track); border-color: var(--border-strong); color: var(--text); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-700); }
.btn-soft-danger { background: var(--red-50); color: var(--red); border: 1px solid transparent; }
.btn-soft-danger:hover { background: var(--red); color: #fff; }
.btn-soft-warning { background: var(--amber-50); color: var(--amber); border: 1px solid transparent; }
.btn-soft-warning:hover { background: var(--amber); color: #fff; }
.btn-link { color: var(--brand-600); }
.btn:focus-visible { box-shadow: 0 0 0 4px var(--brand-100); }
a.btn:hover { text-decoration: none; }

.form-label { font-weight: 600; font-size: .84rem; color: var(--text-2); margin-bottom: .35rem; }
.form-label .req { color: var(--accent); }
.form-control, .form-select {
  background-color: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 10px; padding: .52rem .8rem; font-size: .92rem;
}
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); background-color: var(--surface); color: var(--text); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background: var(--surface-2); color: var(--muted); }
.form-control-lg { border-radius: 12px; padding: .75rem 1rem; font-size: 1.05rem; }
.form-text { color: var(--muted); font-size: .78rem; }
.form-check-input { border-color: var(--border-strong); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--brand-50); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); border-radius: 10px; }
[data-tema="oscuro"] .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23aab8b0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
[data-tema="oscuro"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-tema="oscuro"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.8); }

.table { color: var(--text); --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * { border-bottom-color: var(--border); padding: .7rem .9rem; vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover tbody tr[data-href] { cursor: pointer; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: .78rem; color: var(--muted); }
tr.resaltado > * { background: var(--accent-50) !important; }

.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--border); padding: 16px 20px; }
.modal-footer { border-top-color: var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.modal-body { padding: 20px; }
.modal-title { font-weight: 650; font-size: 1.05rem; }
.dropdown-menu { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; color: var(--text); }
.dropdown-item { border-radius: 8px; color: var(--text-2); padding: .5rem .75rem; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-divider { border-color: var(--border); }
.list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }
.nav-tabs { border-bottom-color: var(--border); gap: 4px; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; padding: .7rem 1rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active { background: transparent; color: var(--brand); border-bottom-color: var(--brand); }
.nav-tabs .nav-link .count { background: var(--track); color: var(--text-2); border-radius: 999px; padding: 0 8px; font-size: .75rem; margin-left: 4px; }
.nav-tabs .nav-link.active .count { background: var(--brand-50); color: var(--brand); }
.pagination .page-link { background: var(--surface); border-color: var(--border); color: var(--text-2); border-radius: 8px !important; margin: 0 2px; min-width: 34px; text-align: center; }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page-item.disabled .page-link { background: var(--surface-2); color: var(--muted); }
.progress { background: var(--track); }

.alert { border-radius: 12px; border: 1px solid transparent; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; }
.alert-dismissible { padding-right: 3rem; }
.alert .alert-icon { margin-top: 3px; }
.alert-success { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.alert-danger { background: var(--red-50); color: #a5192c; border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-warning { background: var(--amber-50); color: #8a4b04; border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.alert-info { background: var(--blue-50); color: #1d4f9e; border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
[data-tema="oscuro"] .alert-success { color: #6fe0a2; }
[data-tema="oscuro"] .alert-danger { color: #ff8b9a; }
[data-tema="oscuro"] .alert-warning { color: #fbbf5c; }
[data-tema="oscuro"] .alert-info { color: #8fb6ff; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; text-decoration: none !important; color: var(--text) !important; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.kpi-num { font-size: 1.75rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.kpi-lbl { color: var(--muted); font-size: .82rem; font-weight: 550; }
.kpi-sub { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.ic-green { background: var(--brand-50); color: var(--brand); }
.ic-pink { background: var(--accent-50); color: var(--accent); }
.ic-blue { background: var(--blue-50); color: var(--blue); }
.ic-amber { background: var(--amber-50); color: var(--amber); }
.ic-red { background: var(--red-50); color: var(--red); }
.ic-violet { background: var(--violet-50); color: var(--violet); }

/* ---------- Insignias ---------- */
.badge-plan { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.plan-impulsate { background: var(--blue-50); color: var(--blue); }
.plan-pro { background: var(--brand-50); color: var(--brand-600); }
.plan-superpro { background: var(--accent-50); color: var(--accent); }
.plan-otro { background: var(--track); color: var(--muted); }
[data-tema="oscuro"] .plan-pro { color: #4fd18b; }
.badge-estado { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; white-space: nowrap; padding: 2px 9px 2px 8px; border-radius: 999px; }
.badge-estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.est-success { color: var(--brand-600); background: var(--brand-50); }
.est-warning { color: var(--amber); background: var(--amber-50); }
.est-danger { color: var(--red); background: var(--red-50); }
.est-secondary { color: var(--muted); background: var(--track); }
[data-tema="oscuro"] .est-success { color: #4fd18b; }
.badge-cob { display: inline-flex; gap: 6px; align-items: center; font-size: .76rem; font-weight: 600; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.cob-tele { background: var(--blue-50); color: var(--blue); }
.cob-urg { background: var(--red-50); color: var(--red); }
.badge-serv { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.badge-serv.on { color: var(--brand-600); }
.badge-serv.off { color: var(--muted); }
[data-tema="oscuro"] .badge-serv.on { color: #4fd18b; }
.badge-rol { font-size: .74rem; font-weight: 650; padding: 3px 9px; border-radius: 6px; }
.rol-admin { background: var(--accent-50); color: var(--accent); }
.rol-operador { background: var(--blue-50); color: var(--blue); }
.rol-consultor { background: var(--track); color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--text-2); }

/* ---------- Gráficos ---------- */
.chart-donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.chart-donut svg { width: 190px; height: 190px; flex: none; }
.donut-num { font-size: 26px; font-weight: 750; fill: var(--text); }
.donut-lbl { font-size: 11px; fill: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.chart-legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 200px; }
.chart-legend li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .86rem; }
.chart-legend li:last-child { border-bottom: 0; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-legend .lg-lbl { flex: 1; color: var(--text-2); }
.chart-legend .lg-val { font-weight: 700; }
.chart-legend small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chart-bars { width: 100%; height: auto; }
.chart-bars .grid { stroke: var(--border); stroke-dasharray: 3 4; }
.chart-bars .axis { fill: var(--muted); font-size: 12px; }
.chart-bars .val { fill: var(--text-2); font-size: 12px; font-weight: 650; }

/* ---------- Cupos ---------- */
.cupo { margin-bottom: 14px; }
.cupo-head { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: 6px; color: var(--text-2); }
.cupo-bar { height: 9px; background: var(--track); border-radius: 999px; overflow: hidden; }
.cupo-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.cupo-full .cupo-bar span { background: var(--amber); }
.cupo-over .cupo-bar span { background: var(--red); }
.cupo-na { opacity: .6; }

/* ---------- Ficha de titular ---------- */
.ficha-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ficha-avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 1.35rem; font-weight: 750; color: #fff; background: linear-gradient(135deg, var(--brand), #13b97a); box-shadow: 0 6px 16px rgba(2, 147, 72, .3); flex: none; }
.ficha-avatar.af { background: linear-gradient(135deg, var(--accent), #ff5aa8); box-shadow: 0 6px 16px rgba(228, 15, 131, .25); }
.ficha-nombre { font-size: 1.3rem; font-weight: 700; margin: 0; }
.ficha-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 24px; margin: 0; }
.dl-grid dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 3px; }
.dl-grid dd { margin: 0; font-weight: 550; color: var(--text); word-break: break-word; }

.servicio-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.servicio-row:last-child { border-bottom: 0; }
.servicio-row .s-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.servicio-row .s-txt { flex: 1; }
.servicio-row .s-txt strong { display: block; font-size: .9rem; }
.servicio-row .s-txt small { color: var(--muted); }

/* ---------- Línea de tiempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline .tl-title { font-weight: 600; font-size: .86rem; }
.timeline .tl-meta { font-size: .76rem; color: var(--muted); }
.timeline .tl-desc { font-size: .82rem; color: var(--text-2); margin-top: 2px; }

/* ---------- Búsqueda ---------- */
.search-hero { background: linear-gradient(135deg, var(--brand-700), var(--brand) 55%, #10b37a); border-radius: 20px; padding: 28px; color: #fff; position: relative; overflow: hidden; margin-bottom: 22px; box-shadow: var(--shadow); }
.search-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(228, 15, 131, .45), transparent 70%); }
.search-hero h2 { color: #fff; font-size: 1.25rem; margin-bottom: 4px; position: relative; z-index: 1; }
.search-hero p { opacity: .85; margin-bottom: 16px; position: relative; z-index: 1; }
.search-hero form { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.search-hero .form-control { flex: 1; min-width: 240px; border: 0; height: 52px; border-radius: 14px; font-size: 1.05rem; padding-left: 18px; background: #fff; color: #17211c; }
.search-hero .btn { height: 52px; border-radius: 14px; padding: 0 22px; background: #0b2a1a; border: 0; color: #fff; }
.search-hero .btn:hover { background: #000; }
.search-hero .hint { font-size: .78rem; opacity: .8; margin-top: 10px; position: relative; z-index: 1; }

.result-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text) !important; text-decoration: none !important; }
.result-item:last-child { border-bottom: 0; }
.result-item:hover { background: var(--surface-2); }
.result-item .ri-av { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; flex: none; }
.result-item .ri-main { flex: 1; min-width: 0; }
.result-item .ri-main strong { display: block; }
.result-item .ri-main small { color: var(--muted); }

/* ---------- Filtros ---------- */
.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(140px, 1fr)) auto; gap: 10px; align-items: end; }
@media (max-width: 1199.98px) { .filters { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) { .filters { grid-template-columns: 1fr; } }
.filters .form-label { font-size: .74rem; }

/* ---------- Opciones de importación ---------- */
.op-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.op-card { position: relative; display: block; cursor: pointer; margin: 0; }
.op-card input { position: absolute; opacity: 0; pointer-events: none; }
.op-card .op-box { display: block; height: 100%; border: 2px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.op-card .op-box i.op-ic { display: grid !important; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; }
.op-card .op-box strong { display: block; margin-bottom: 4px; color: var(--text); }
.op-card .op-box small { color: var(--muted); display: block; line-height: 1.4; }
.op-card:hover .op-box { border-color: var(--border-strong); }
.op-card input:checked + .op-box { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 4px var(--brand-50); }
.op-card input:focus-visible + .op-box { box-shadow: 0 0 0 4px var(--brand-100); }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; margin-right: 8px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 26px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-50); }
.dropzone i { font-size: 2rem; color: var(--brand); margin-bottom: 8px; }
.dropzone .dz-file { font-weight: 650; color: var(--text); }
.resumen-import { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.resumen-import div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.resumen-import strong { display: block; font-size: 1.4rem; }
.resumen-import span { font-size: .78rem; color: var(--muted); }
.log-box { max-height: 300px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: .82rem; }
.log-box div { padding: 3px 0; border-bottom: 1px dashed var(--border); }
.log-box div:last-child { border-bottom: 0; }

/* ---------- Permisos ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); cursor: pointer; margin: 0; }
.perm-item:hover { border-color: var(--border-strong); }
.perm-item .form-check-input { margin-top: 3px; flex: none; }
.perm-item strong { display: block; font-size: .9rem; }
.perm-item small { color: var(--muted); }
.perm-item.fijo { background: var(--surface-2); cursor: default; }
.user-list a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text) !important; text-decoration: none !important; }
.user-list a:hover { background: var(--surface-2); }
.user-list a.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.user-list small { color: var(--muted); display: block; }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--brand-50); color: var(--brand); }
.empty h3 { font-size: 1.05rem; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto 14px; }

/* ---------- Pantallas de acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--surface); }
.auth-visual { position: relative; overflow: hidden; background: #06140d; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; }
.auth-visual .slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.4s ease, transform 8s ease; transform: scale(1.06); }
.auth-visual .slide.on { opacity: 1; transform: scale(1); }
.auth-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 20, 12, .55) 0%, rgba(4, 20, 12, .2) 40%, rgba(4, 20, 12, .88) 100%), linear-gradient(90deg, rgba(2, 147, 72, .35), transparent 60%); }
.auth-visual > *:not(.slide) { position: relative; z-index: 2; }
.auth-logo { display: inline-flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .96); padding: 8px 16px 8px 8px; border-radius: 16px; color: #17211c; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.auth-logo img { height: 42px; }
.auth-claim h2 { color: #fff; font-size: 2.1rem; font-weight: 750; max-width: 520px; line-height: 1.15; }
.auth-claim p { color: rgba(255, 255, 255, .82); max-width: 500px; font-size: 1.02rem; }
.auth-dots { display: flex; gap: 6px; margin-top: 18px; }
.auth-dots span { width: 22px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); transition: background .3s, width .3s; }
.auth-dots span.on { background: #fff; width: 36px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h1 { font-size: 1.7rem; font-weight: 750; margin-bottom: 6px; }
.auth-card .lead-sm { color: var(--muted); margin-bottom: 26px; }
.auth-card .form-control { height: 48px; }
.auth-card .btn-lg { width: 100%; height: 50px; }
.pass-wrap { position: relative; }
.pass-wrap .form-control { padding-right: 46px; }
.pass-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; }
.pass-wrap button:hover { color: var(--brand); background: var(--surface-2); }
.auth-alianza { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: rgba(255, 255, 255, .75); }
.auth-alianza img { height: 40px; }
@media (max-width: 991.98px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { min-height: 260px; padding: 24px; }
  .auth-claim h2 { font-size: 1.5rem; }
}

/* ---------- Portada ---------- */
.landing { min-height: 100vh; position: relative; color: #fff; display: flex; flex-direction: column; background: #06140d url("../img/tele3.jpg") center/cover no-repeat; }
.landing::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(3, 22, 12, .94) 0%, rgba(3, 22, 12, .78) 42%, rgba(3, 22, 12, .25) 100%); }
.landing > * { position: relative; z-index: 1; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 22px 6vw; }
.landing-hero { flex: 1; display: flex; align-items: center; padding: 20px 6vw 60px; }
.landing-hero .inner { max-width: 640px; }
.landing-hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: .8rem; margin-bottom: 18px; }
.landing-hero h1 { color: #fff; font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.landing-hero h1 span { color: #4fd18b; }
.landing-hero p { font-size: 1.1rem; color: rgba(255, 255, 255, .82); max-width: 560px; margin: 18px 0 28px; }
.landing-feats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 36px; font-size: .88rem; color: rgba(255, 255, 255, .85); }
.landing-feats div { display: flex; align-items: center; gap: 10px; }
.landing-feats i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(2, 147, 72, .35); color: #7ff0b1; }
.landing-foot { padding: 16px 6vw; font-size: .8rem; color: rgba(255, 255, 255, .6); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .08); }
.btn-ghost-light { border: 1px solid rgba(255, 255, 255, .4); color: #fff; background: transparent; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Acerca de ---------- */
.about-hero { display: grid; grid-template-columns: 1.2fr 1fr; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); margin-bottom: 20px; }
.about-hero .txt { padding: 32px; }
.about-hero .img { background: #06140d url("../img/tele4.png") center/cover; min-height: 240px; }
.feature-img { border-radius: 14px; overflow: hidden; aspect-ratio: 16/9; background: var(--track); }
.feature-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.partner-tile { background: #0a0f0c; border-radius: 14px; padding: 18px; display: grid; place-items: center; height: 110px; }
.partner-tile.light { background: #fff; border: 1px solid var(--border); }
.partner-tile img { max-height: 76px; max-width: 100%; }

/* ---------- Error ---------- */
.error-page { background: var(--bg); }
.error-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { max-width: 520px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 36px 30px; box-shadow: var(--shadow); }
.error-ilus { width: 180px; opacity: .5; margin-bottom: 8px; }
[data-tema="oscuro"] .error-ilus { filter: invert(1); opacity: .35; }
.error-code { font-size: .8rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; }
.error-card h1 { font-size: 1.5rem; margin: 6px 0 10px; }
.error-card p { color: var(--muted); margin-bottom: 22px; }
.error-detalle { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: .75rem; white-space: pre-wrap; }

/* ---------- Utilidades ---------- */
.gap-grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2.2fr); gap: 20px; }
@media (max-width: 1199.98px) { .grid-2, .grid-3-1, .grid-1-2 { grid-template-columns: 1fr; } }
.sticky-col { position: sticky; top: 84px; }
.muted { color: var(--muted); }
.small-caps { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .78rem; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.reglas-list { margin: 0; padding-left: 18px; }
.reglas-list li { margin-bottom: 6px; }
.tabla-planes td, .tabla-planes th { text-align: center; }
.tabla-planes td:first-child, .tabla-planes th:first-child { text-align: left; }
.manual-card { display: flex; gap: 18px; align-items: flex-start; }
.manual-card .mc-ic { display: grid !important; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .app-footer, .no-print, .btn, form.d-inline { display: none !important; }
  .app-main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
.form-switch { padding-left: 3.1em; }
.form-switch .form-check-input { margin-left: -3.1em; }
.op-grid.planes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767.98px) { .op-grid.planes { grid-template-columns: 1fr; } }
/* Planes con color configurable */
.badge-plan[style*="--plan-color"] { color: color-mix(in srgb, var(--plan-color) 82%, #000); background: color-mix(in srgb, var(--plan-color) 13%, transparent); }
[data-tema="oscuro"] .badge-plan[style*="--plan-color"] { color: color-mix(in srgb, var(--plan-color) 55%, #fff); background: color-mix(in srgb, var(--plan-color) 22%, transparent); }
.badge-plan[title="Plan inactivo"] { opacity: .7; text-decoration: line-through; text-decoration-thickness: 1px; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatches label { margin: 0; cursor: pointer; }
.color-swatches input { position: absolute; opacity: 0; }
.color-swatches span { display: block; width: 34px; height: 34px; border-radius: 10px; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.color-swatches input:checked + span { border-color: var(--text); }
.color-swatches input:focus-visible + span { outline: 3px solid var(--brand-100); }
.chip-clave { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); margin: 0 4px 4px 0; font-family: ui-monospace, Consolas, monospace; }
.plan-card-sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; vertical-align: middle; margin-right: 6px; }
