:root {
  --bg: #F8FAFC;
  --surface: #ffffff;
  --surface-strong: #F5F9FF;
  --celeste: #F5F9FF;
  --primary: #2E6CF6;
  --primary-2: #163A70;
  --text: #16253b;
  --muted: #5f6d7a;
  --border: rgba(22, 37, 59, 0.12);
  --shadow: 0 16px 40px rgba(15, 33, 73, 0.12);
  --shadow-sm: 0 4px 14px rgba(15, 33, 73, 0.08);
  --shadow-md: 0 16px 40px rgba(15, 33, 73, 0.12);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.app-shell { margin: 0; font-family: "Inter", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); padding-left: var(--sidebar-w); padding-top: calc(var(--topbar-h) + 6px); }
body.app-shell .container, body.app-shell .container-fluid { max-width: 1400px; }
body.auth-shell { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--bg) 0%, var(--surface-strong) 100%); color: var(--text); font-family: "Inter", "Segoe UI", sans-serif; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 36px; }
.auth-card .auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-card .auth-brand .brand-mark { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex-shrink: 0; overflow: hidden; padding: 6px; }
.auth-card .auth-brand .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.auth-card .auth-brand h1 { margin: 0; font-size: 1.05rem; }
.auth-card .auth-brand p { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); }
.auth-card h2 { margin: 0 0 4px; font-size: 1.3rem; }
.auth-card .auth-subtitle { color: var(--muted); margin: 0 0 24px; font-size: 0.9rem; }
.auth-card .form-label { font-weight: 600; font-size: 0.85rem; }
.auth-card .form-control { border-radius: 12px; padding: 10px 14px; min-height: 48px; }
.auth-footer-link { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--muted); }
.auth-footer-link a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer-link a:hover { text-decoration: underline; }
.auth-page-footer { text-align: center; margin-top: 18px; font-size: 0.85rem; color: var(--muted); position: fixed; bottom: 14px; left: 0; right: 0; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: linear-gradient(180deg, var(--primary-2) 0%, #0f2c57 100%); color: white; display: flex; flex-direction: column; padding: 20px 16px; z-index: 1000; box-shadow: 20px 0 40px rgba(7, 20, 41, 0.16);
}
.app-sidebar .sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.app-sidebar .brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,0.16); font-weight: 800; font-size: 1.15rem; overflow: hidden; }
.app-sidebar .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.app-sidebar .sidebar-brand h1 { margin: 0; font-size: 1.08rem; }
.app-sidebar .sidebar-brand p { margin: 2px 0 0; font-size: 0.78rem; opacity: 0.8; }
.app-sidebar .sidebar-user { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.1); padding: 12px; border-radius: 16px; margin-bottom: 16px; }
.app-sidebar .sidebar-user .avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); display: grid; place-items: center; font-weight: 700; }
.app-sidebar .sidebar-user strong { display: block; font-size: 0.95rem; }
.app-sidebar .sidebar-user span { display: block; font-size: 0.78rem; opacity: 0.82; }
.app-sidebar .sidebar-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; overflow: visible; }
.app-sidebar .sidebar-nav a { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.88); text-decoration: none; padding: 11px 13px; border-radius: 12px; transition: background .18s ease, transform .18s ease, border-color .18s ease; border-left: 3px solid transparent; }
.app-sidebar .sidebar-nav a:hover { background: rgba(255,255,255,0.1); transform: translateX(2px); }
.app-sidebar .sidebar-nav a.active { background: rgba(255,255,255,0.16); border-left-color: #ffffff; font-weight: 600; color: #ffffff; }
.app-sidebar .sidebar-nav .nav-icon { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,0.12); flex-shrink: 0; }
.app-sidebar .sidebar-nav a.active .nav-icon { background: rgba(255,255,255,0.22); }
.app-sidebar .sidebar-group-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.5); font-weight: 700; padding: 14px 13px 4px; }
.app-sidebar .sidebar-group + .sidebar-group { margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 4px; }
.app-sidebar .sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.16); }
.app-sidebar .sidebar-footer a { display: flex; align-items: center; gap: 12px; color: #ffd6d6; text-decoration: none; padding: 12px 13px; border-radius: 14px; }
.app-topbar {
  position: fixed; inset: 0 0 auto var(--sidebar-w); height: var(--topbar-h); background: rgba(255,255,255,0.94); backdrop-filter: blur(18px); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; z-index: 999; border-bottom: 1px solid var(--border);
}
.app-topbar .sidebar-toggle { display: none; border: 0; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-strong); color: var(--primary); }
.app-topbar .topbar-title h2 { margin: 0; font-size: 1.05rem; }
.app-topbar .topbar-title p { margin: 2px 0 0; font-size: 0.84rem; color: var(--muted); }
.app-topbar .topbar-actions { display: flex; align-items: center; gap: 12px; }
.app-topbar .icon-btn, .app-topbar .install-btn { border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 600; background: var(--surface-strong); color: var(--primary); }
.app-topbar .install-btn { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.app-topbar .avatar-pill { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px; background: var(--surface-strong); }
.app-topbar .avatar-pill .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; display: grid; place-items: center; font-weight: 700; }
.user-menu { position: relative; }
.user-menu-toggle { border: 0; cursor: pointer; }
.user-menu-caret { font-size: 0.7rem; color: var(--muted); transition: transform .15s ease; }
.user-menu.open .user-menu-caret { transform: rotate(180deg); }
.user-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 1001;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
}
.user-menu.open .user-menu-dropdown { opacity: 1; pointer-events: auto; transform: translateY(0); }
.user-menu-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #b3261e; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.user-menu-dropdown a:hover { background: rgba(239,68,68,.08); }
.app-page { padding: 24px; }
.page-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.summary-card { background: linear-gradient(135deg, rgba(46,108,246,.08), rgba(22,58,112,.05)); border: 1px solid rgba(46,108,246,.12); border-radius: 22px; padding: 20px; min-height: 155px; transition: transform .2s ease, box-shadow .2s ease; }
.summary-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(20, 47, 97, 0.08); }
.summary-card .card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.summary-card .icon-box { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(46,108,246,.1); color: var(--primary); }
.summary-card h3 { margin: 0; font-size: 1rem; color: var(--muted); }
.summary-card .value { font-size: 1.45rem; font-weight: 800; margin-top: 6px; }
.summary-card .muted { color: var(--muted); font-size: 0.9rem; }
.alert-banner { background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(22,58,112,.10)); border: 1px solid rgba(245,158,11,.22); border-radius: 20px; padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.alert-banner .icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(245,158,11,.18); color: #875d00; font-size: 1.3rem; }
.kpi-list { display: grid; gap: 12px; }
.kpi-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.85); }
.chart-card { padding: 20px; }
.chart-card canvas { max-height: 280px; }
.table-card { padding: 20px; }
.table-card table { margin: 0; }
.table-card .table > :not(caption) > * > * { padding: 0.9rem 0.75rem; }
.badge-soft { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-soft.pending { background: rgba(245,158,11,.16); color: #8a5b00; }
.badge-soft.success { background: rgba(34,197,94,.14); color: #12833f; }
.badge-soft.danger { background: rgba(239,68,68,.14); color: #b3261e; }
.badge-soft.info { background: rgba(46,108,246,.12); color: var(--primary); }
.badge-soft.neutral { background: rgba(95,109,122,.14); color: var(--muted); }

/* Alertas / tarjetas de estado (info, advertencia, error, éxito) */
@keyframes alertFadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.alert-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  box-shadow: var(--shadow-sm); animation: alertFadeIn .28s ease;
}
.alert-card .alert-card-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 1.05rem; }
.alert-card strong { display: block; margin-bottom: 2px; }
.alert-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.alert-card--info { border-left-color: var(--primary); }
.alert-card--info .alert-card-icon { background: rgba(46,108,246,.12); color: var(--primary); }
.alert-card--warning { border-left-color: var(--warning); }
.alert-card--warning .alert-card-icon { background: rgba(245,158,11,.16); color: #8a5b00; }
.alert-card--error { border-left-color: var(--danger); }
.alert-card--error .alert-card-icon { background: rgba(239,68,68,.14); color: #b3261e; }
.alert-card--success { border-left-color: var(--success); }
.alert-card--success .alert-card-icon { background: rgba(34,197,94,.14); color: #12833f; }

/* Toasts modernos */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast-dentox {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
}
.toast-dentox .toast-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.toast-dentox .toast-body { flex: 1; font-size: 0.88rem; }
.toast-dentox .toast-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; line-height: 1; }
.toast-dentox--info { border-left-color: var(--primary); } .toast-dentox--info .toast-icon { background: rgba(46,108,246,.12); color: var(--primary); }
.toast-dentox--warning { border-left-color: var(--warning); } .toast-dentox--warning .toast-icon { background: rgba(245,158,11,.16); color: #8a5b00; }
.toast-dentox--error { border-left-color: var(--danger); } .toast-dentox--error .toast-icon { background: rgba(239,68,68,.14); color: #b3261e; }
.toast-dentox--success { border-left-color: var(--success); } .toast-dentox--success .toast-icon { background: rgba(34,197,94,.14); color: #12833f; }
.empty-state { text-align: center; padding: 36px 24px; border: 1px dashed var(--border); border-radius: 18px; background: rgba(255,255,255,.75); }
.empty-state .icon { font-size: 2rem; margin-bottom: 10px; }
.btn-dentox { border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 600; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; transition: transform .15s ease, box-shadow .15s ease; }
.btn-dentox:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: white; }

/* Botones semánticos unificados: icono + texto + hover + animación */
.btn-dentox-action {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px;
  padding: 9px 16px; font-weight: 600; font-size: 0.88rem; color: white; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-dentox-action:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: var(--shadow-sm); color: white; }
.btn-dentox-action:active { transform: translateY(0); }
.btn-dentox-action:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-save   { background: linear-gradient(135deg, var(--success), #16a34a); }
.btn-edit   { background: linear-gradient(135deg, var(--warning), #d97706); }
.btn-delete { background: linear-gradient(135deg, var(--danger), #dc2626); }
.btn-view   { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.btn-primary-dentox { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-dentox-action.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-dentox-action.btn-outline:hover { background: var(--surface-strong); }

/* Avatares */
.avatar-dentox { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar-dentox img { width: 100%; height: 100%; object-fit: cover; }
.avatar-dentox.avatar-sm { width: 30px; height: 30px; font-size: 0.75rem; }
.avatar-dentox.avatar-md { width: 42px; height: 42px; font-size: 0.95rem; }
.avatar-dentox.avatar-lg { width: 58px; height: 58px; font-size: 1.2rem; }

/* Barra de filtros unificada */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.filter-bar .filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.filter-bar .filter-field label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.filter-bar .filter-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* Barra de herramientas de tabla: buscador + cantidad de registros + acciones */
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.table-toolbar .table-toolbar-search { flex: 1; min-width: 220px; max-width: 360px; }
.table-toolbar .table-toolbar-meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.table-toolbar .table-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formularios */
.app-page label.form-label, .modal label.form-label, .page-card label.form-label { font-weight: 600; font-size: 0.85rem; color: var(--text); margin-bottom: 6px; }
.app-page .form-control, .app-page .form-select,
.modal .form-control, .modal .form-select,
.page-card .form-control, .page-card .form-select {
  border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid var(--border); min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.app-page .form-control:focus, .app-page .form-select:focus,
.modal .form-control:focus, .modal .form-select:focus,
.page-card .form-control:focus, .page-card .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 0.15rem rgba(46,108,246,.15); outline: none;
}
.app-page .is-invalid, .modal .is-invalid, .page-card .is-invalid { border-color: var(--danger) !important; }
.app-page .invalid-feedback, .modal .invalid-feedback, .page-card .invalid-feedback { display: flex; align-items: center; gap: 6px; color: var(--danger); font-size: 0.82rem; }

/* Modales */
.modal-dentox .modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.modal-dentox .modal-header { border-bottom: 1px solid var(--border); padding: 18px 22px; background: var(--surface-strong); }
.modal-dentox .modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-dentox .modal-body { padding: 22px; }
.modal-dentox .modal-footer { border-top: 1px solid var(--border); padding: 16px 22px; gap: 8px; }

/* Paginación */
.pagination .page-link { border: 1px solid var(--border); color: var(--text); border-radius: 10px; margin: 0 3px; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: white; }
.pagination .page-link:hover { background: var(--surface-strong); }

.search-box { position: relative; }
.search-box .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box .form-control { padding-left: 40px; padding-right: 36px; }
.search-box input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-box .search-clear-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.search-box .search-clear-btn:hover { background: var(--surface-strong); color: var(--text); }
.search-box .search-clear-btn[hidden] { display: none; }
.search-results:not(:empty) { margin-top: 6px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.search-results > div { padding: 10px 14px; background: var(--surface); cursor: pointer; font-size: 0.9rem; border-top: 1px solid var(--border); }
.search-results > div:first-child { border-top: 0; }
.search-results > div:hover { background: var(--surface-strong); }
.search-results .resultado-error { color: var(--danger); cursor: default; }
.search-results .resultado-error:hover { background: var(--surface); }
.sidebar-backdrop { display: none; }
@media (max-width: 991px) {
  body.app-shell { padding-left: 0; padding-top: calc(var(--topbar-h) + 10px); }
  .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 900; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .app-topbar { inset: 0 0 auto 0; }
  .app-topbar .sidebar-toggle { display: inline-grid; place-items: center; }
}
@media (max-width: 767px) {
  .app-page { padding: 16px; }
  .app-topbar { padding: 0 14px; }
  .app-topbar .topbar-title h2 { font-size: 0.95rem; }
  .topbar-actions .avatar-pill span { display: none; }
  .summary-card { min-height: auto; }
}

/* Mejoras de responsividad para tablas */
@media (max-width: 991px) {
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive .table { min-width: 640px; }
}
@media (max-width: 575px) {
  .table-responsive .table { min-width: 540px; font-size: 0.92rem; }
  .table-responsive td, .table-responsive th { white-space: nowrap; }
  .table-responsive .avatar { width:36px;height:36px;font-size:0.85rem }
}

/* Estilos para la versión cardify de tablas en móviles */
.table-cardified-list { display: grid; gap: 12px; margin-top: 12px; }
.table-cardified-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.table-cardified-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 4px 0; }
.table-cardified-label { color: var(--muted); font-size: 0.78rem; width: 40%; }
.table-cardified-value { font-weight: 600; text-align: right; width: 60%; }
.table-cardified-item .table-cardified-value a { color: var(--primary); text-decoration: none; }
.finance-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(22, 37, 59, 0.08);
  border-radius: 22px;
  min-height: 100%;
}
.finance-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: rgba(245, 247, 250, 0.95);
  border: 1px solid rgba(17, 34, 68, 0.08);
  margin-bottom: 0.85rem;
}
.finance-row:last-child {
  margin-bottom: 0;
}
.finance-row span {
  color: var(--muted);
  font-size: 0.95rem;
}
.finance-row strong {
  font-size: 1rem;
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Table visual enhancements: striped rows, hover elevation and subtle shadow */
.table-cardify {
  border-collapse: separate;
}
.table-cardify thead th {
  background: var(--surface-strong) !important;
  color: var(--primary) !important;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(46,108,246,.15) !important;
  position: sticky; top: 0; z-index: 2;
}
.table-cardify thead th:first-child { border-top-left-radius: 12px; }
.table-cardify thead th:last-child { border-top-right-radius: 12px; }
.table-cardify tbody tr {
  transition: transform .16s ease, box-shadow .16s ease, background .12s ease;
  will-change: transform, box-shadow, background;
}
.table-cardify tbody tr:nth-child(odd) {
  background: rgba(46,108,246,0.03);
}
@media (hover: hover) {
  .table-cardify tbody tr:hover {
    background: rgba(46,108,246,0.06);
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(15,33,73,0.08);
  }
}
.table-cardify td, .table-cardify th {
  border-top: 0;
  vertical-align: middle;
}
/* Make action icons clearer */
.table-cardify td a { color: var(--primary); margin-right: 8px; }
.table-cardify td a:hover { color: var(--primary-2); }

/* Compact footer subtotal */
.table-cardify tfoot td, .table-cardify tfoot th { font-weight: 700; }

/* Ocultar scrollbar del menú lateral pero permitir desplazamiento táctil */
.app-sidebar .sidebar-nav,
.app-sidebar,
.app-sidebar .sidebar-nav ul {
  overflow: hidden !important;
  -ms-overflow-style: none; /* IE 10+ */
  scrollbar-width: none; /* Firefox */
}
.app-sidebar .sidebar-nav::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar,
.app-sidebar .sidebar-nav ul::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.app-sidebar .sidebar-nav:hover { overflow: hidden !important; }

/* Alternativa: permitir scroll cuando se añade la clase allow-scroll */
.app-sidebar .sidebar-nav.allow-scroll {
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}
.app-sidebar .sidebar-nav.allow-scroll::-webkit-scrollbar { width: 8px; }
.app-sidebar .sidebar-nav.allow-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 6px; }

/* Botones de DataTables (exportar, copiar, etc.) alineados al lenguaje visual del sistema */
.dt-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dt-button,
div.dt-button,
a.dt-button {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--primary) !important;
  border-radius: 999px !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
.dt-button:hover,
.dt-button:focus,
div.dt-button:hover,
a.dt-button:hover {
  background: var(--surface-strong) !important;
  color: var(--primary) !important;
}
.dt-button.buttons-excel { color: #157a45 !important; border-color: rgba(21,122,69,.25) !important; }
.dt-button.buttons-pdf { color: #b3261e !important; border-color: rgba(179,38,30,.25) !important; }
.dt-button.buttons-print,
.dt-button.buttons-csv,
.dt-button.buttons-copy { color: var(--muted) !important; }

/* Las tablas de DataTables deben ocupar siempre el 100% del ancho disponible.
   Nota: si además queda un hueco en blanco a la derecha, la causa real suele ser
   columnas ocultas con el atributo HTML "hidden" en vez de columnDefs {visible:false} -
   el navegador les sigue reservando espacio en el cálculo de ancho aunque no se vean.
   Ver columnDefs en facturas_compras.php / facturas_ventas.php para el patrón correcto. */
.dataTables_wrapper { width: 100% !important; }
table.dataTable {
  width: 100% !important;
}

/* Acordeón "Ver más" del sidebar (grupo colapsable de módulos secundarios) */
.sidebar-more-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  background: rgba(255,255,255,0.08); border: 0; color: rgba(255,255,255,0.85);
  padding: 10px 13px; border-radius: 12px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.sidebar-more-toggle:hover { background: rgba(255,255,255,0.14); }
.sidebar-more-toggle .chevron { transition: transform .2s ease; }
.sidebar-more-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
/* Se maneja con JS propio (modern-app.js), sin depender del bundle JS de Bootstrap
   (no todas las páginas del sistema lo cargan todavía). */
.sidebar-more-panel { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sidebar-more-panel.open { max-height: 320px; }
.sidebar-more-panel .sidebar-nav { padding-top: 4px; }
