/**
 * Yaguarete Software — tema unificado
 * Sidebar oscura navy, acento verde hoja.
 */

/* ===== VARIABLES ===== */
:root {
  --primary:        #56ad38;
  --primary-hover:  #48972f;
  --primary-dark:   #3d8228;
  --primary-light:  rgba(86, 173, 56, 0.12);

  --sidebar-w:          248px;
  --sidebar-bg:         #0a1628;
  --sidebar-head-bg:    #000814;
  --sidebar-txt:        rgba(255,255,255,0.60);
  --sidebar-txt-hover:  rgba(255,255,255,0.90);
  --sidebar-txt-active: #ffffff;
  --sidebar-active-bg:  rgba(86, 173, 56, 0.14);
  --sidebar-active-bdr: #56ad38;
  --sidebar-divider:    rgba(255,255,255,0.07);

  --topbar-h:     52px;
  --topbar-bg:    #ffffff;
  --content-bg:   #f0f4f8;
  --content-padding: 1.5rem;
  --content-padding-x-mobile: 0.75rem;
  --card-bg:      #ffffff;
  --card-shadow:  0 2px 8px rgba(15,23,42,0.06);

  --text:           #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  --radius:    10px;
  --radius-sm: 6px;

  /* Alias para código legado */
  --app-accent:        var(--primary);
  --app-accent-hover:  var(--primary-hover);
  --app-radius:        var(--radius);
  --app-radius-sm:     var(--radius-sm);
  --app-glass:         var(--card-bg);
  --app-glass-border:  var(--border);
  --app-shadow:        var(--card-shadow);
  --app-text:          var(--text);
  --app-text-secondary:var(--text-secondary);
  --app-border:        var(--border);
  --app-border-strong: var(--border-strong);
  /* Alias Notion para post-its */
  --notion-text:          var(--text);
  --notion-text-secondary:var(--text-secondary);
  --notion-border:        var(--border);
  --notion-border-strong: var(--border-strong);
  --notion-accent:        var(--primary);
  --notion-hover:         rgba(15,23,42,0.04);
  --notion-radius:        var(--radius-sm);
}

/* ===== RESET ===== */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== DASHBOARD LAYOUT ===== */
body.app-dashboard {
  background: var(--content-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Sidebar --- */
.app-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  overflow: hidden;
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  background: var(--sidebar-head-bg);
  height: var(--topbar-h);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  min-width: 0;
}

.sidebar-brand .brand-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  letter-spacing: 0.06em;
}
.sidebar-brand .brand-sub {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.25;
  margin-top: 0.2rem;
  letter-spacing: 0.01em;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
}

.sidebar-group { margin-bottom: 0.35rem; }
.sidebar-group:last-child { margin-bottom: 0.25rem; }

.sidebar-group-label {
  padding: 0.75rem 1.15rem 0.35rem;
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.32);
}

.sidebar-section { padding: 0 0.35rem; }

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin: 3px 8px;
  padding: 6px 10px;
  border-radius: 12px;
  color: #dce4ef;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  border-left: none;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transform: translateX(2px);
}
.sidebar-link:focus-visible {
  outline: 2px solid rgba(50, 169, 255, 0.55);
  outline-offset: 2px;
}
.sidebar-link.active {
  background: rgba(10, 132, 255, 0.16);
  color: #ffffff;
  font-weight: 600;
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #32D74B;
}

.sidebar-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    0 4px 10px rgba(0, 0, 0, 0.22);
}
.sidebar-icon svg,
.sidebar-icon .sidebar-lucide,
.sidebar-icon .sidebar-bi {
  width: 18px;
  height: 18px;
  color: #ffffff;
  stroke: #ffffff;
  opacity: 1;
}
.sidebar-bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.sidebar-lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
  color: #ffffff;
  stroke: #ffffff;
  opacity: 1;
}
.sidebar-link.active .sidebar-lucide,
.sidebar-link.active .sidebar-bi {
  color: #ffffff;
  stroke: #ffffff;
  opacity: 1;
}

.sidebar-icon-green {
  background: linear-gradient(145deg, #34C759, #20A845);
}
.sidebar-icon-orange {
  background: linear-gradient(145deg, #FFB340, #FF9500);
}
.sidebar-icon-blue {
  background: linear-gradient(145deg, #32A9FF, #007AFF);
}
.sidebar-icon-cyan {
  background: linear-gradient(145deg, #5AC8FA, #009FDB);
}
.sidebar-icon-red {
  background: linear-gradient(145deg, #FF6961, #FF3B30);
}
.sidebar-icon-purple {
  background: linear-gradient(145deg, #BF5AF2, #8E44D7);
}
.sidebar-icon-teal {
  background: linear-gradient(145deg, #30D5C8, #00A99D);
}
.sidebar-icon-orange-dark {
  background: linear-gradient(145deg, #FF9F0A, #E67900);
}
.sidebar-icon-indigo {
  background: linear-gradient(145deg, #7D7AFF, #5856D6);
}

.sidebar-link-label {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.sidebar-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 3.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-badge--primary {
  background: var(--primary);
  color: #fff;
}
.sidebar-badge--danger {
  background: #FF3B30;
  color: #fff;
}

.sidebar-divider { height: 1px; background: var(--sidebar-divider); margin: 0.45rem 1.25rem; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-divider);
  flex-shrink: 0;
}
.sidebar-time { font-size: 1.35rem; font-weight: 700; color: var(--sidebar-footer-time, #fff); line-height: 1; font-variant-numeric: tabular-nums; }
.sidebar-date { font-size: 0.73rem; color: var(--sidebar-footer-sub, rgba(255,255,255,0.45)); margin-top: 0.15rem; text-transform: capitalize; }
.sidebar-status { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.sidebar-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 5px rgba(86, 173, 56, 0.45);
}
.sidebar-status span { font-size: 0.7rem; color: rgba(255,255,255,0.38); }

/* Mobile overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 1025;
}
.sidebar-overlay.show { display: block; }

/* --- Main wrapper --- */
.app-main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  display: flex; flex-direction: column;
  flex: 1; min-width: 0;
}

/* --- Topbar — estilo ERP administrativo --- */
.app-topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  width: 100%;
  background: var(--topbar-bg);
  border-bottom: 1px solid #D9DEE7;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  z-index: 900;
  box-shadow: none;
  flex-shrink: 0;
  overflow: visible;
}

.topbar-toggle {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 1px solid #D0D5DD;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475467;
  font-size: 1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.topbar-toggle:hover {
  background: #F9FAFB;
  border-color: #98A2B3;
  color: #172033;
}

.topbar-title {
  font-size: 0.9375rem;
  font-weight: 650;
  color: #172033;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar-title:empty {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  overflow: visible;
}

.topbar-actions-divider {
  width: 1px;
  height: 24px;
  background: #E8EBF0;
  margin: 0 4px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 1px solid #D0D5DD;
  background: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475467;
  font-size: 0.9375rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  position: relative;
  padding: 0;
  overflow: visible;
  flex-shrink: 0;
}

.topbar-icon-btn:has(.topbar-badge) {
  margin-right: 6px;
}

.topbar-icon-btn .bi {
  display: block;
  line-height: 1;
  pointer-events: none;
}

.topbar-icon-btn:hover {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
}

.topbar-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
  background: #F9FAFB;
}

.topbar-icon-btn:disabled:hover {
  background: #F9FAFB;
  border-color: #D0D5DD;
  color: #475467;
}

a.topbar-icon-btn {
  text-decoration: none;
  color: #475467;
}

.topbar-icon-btn--alert .bi {
  color: #B45309;
}

.topbar-icon-btn--alert:hover .bi {
  color: #92400E;
}

.topbar-badge {
  position: absolute;
  top: -7px;
  right: -9px;
  z-index: 2;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #DC2626;
  border: 2px solid #FFFFFF;
  border-radius: 10px;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
  white-space: nowrap;
  box-sizing: border-box;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 6px;
  border-radius: 6px;
  border: 1px solid #D0D5DD;
  background: #FFFFFF;
  cursor: pointer;
  color: #243044;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topbar-user:hover {
  background: #F9FAFB;
  border-color: #98A2B3;
  color: #172033;
}

.topbar-user.dropdown-toggle::after {
  display: none;
}

.topbar-user .avatar {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #EEF2F6;
  border: 1px solid #D9DEE7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1D4ED8;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.topbar-user .user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: #172033;
}

.topbar-user .user-role {
  font-size: 0.6875rem;
  color: #667085;
  line-height: 1.2;
}

.topbar-user .bi-chevron-down {
  font-size: 0.6875rem;
  color: #98A2B3;
}

.app-topbar .dropdown-menu {
  margin-top: 6px;
  padding: 4px;
  border: 1px solid #D9DEE7;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
}

.app-topbar .dropdown-item {
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  color: #344054;
}

.app-topbar .dropdown-item:hover {
  background: #F9FAFB;
  color: #172033;
}

.app-topbar .dropdown-item.text-danger {
  color: #DC2626 !important;
}

.app-topbar .dropdown-item.text-danger:hover {
  background: #FEF2F2;
}

/* --- Content area (márgenes unificados en todo el sistema) --- */
.app-content {
  flex: 1;
  padding: var(--content-padding);
  background: var(--content-bg);
}

@media (max-width: 575.98px) {
  .app-content {
    padding-left: var(--content-padding-x-mobile);
    padding-right: var(--content-padding-x-mobile);
  }
}

/* ===== CARDS & PANELS ===== */
.app-card, .app-panel, .card-glass {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.app-card .card-head {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.92rem;
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text);
}
.app-card .card-body, .app-panel .card-body { padding: 1.25rem; }

/* Stat cards */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.stat-card .stat-num { font-size: 1.55rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* Page header */
.page-header { margin-bottom: 1.25rem; }
.page-header h1, .page-header h2, .page-header .page-heading {
  font-weight: 700; color: var(--text); font-size: 1.25rem; margin-bottom: 0.15rem;
}
.page-header .page-lead { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }

/* ===== FILTERS ===== */
.filters-wrap, .filtros-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.filters-wrap .filters-title {
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 0.65rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.filters-wrap .filters-title i { color: var(--primary); }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.filters .btn { font-size: 0.82rem; padding: 0.3rem 0.75rem; }

/* ===== FORMS ===== */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem; color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(86, 173, 56, 0.18);
}
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.3rem; }

.form-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 1.75rem 2rem;
}

/* ===== BUTTONS ===== */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 0.88rem; }
.btn-primary, .btn-success {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-primary:hover,.btn-primary:focus,
.btn-success:hover,.btn-success:focus {
  background: var(--primary-hover); border-color: var(--primary-hover); color: #fff;
}
.btn-outline-success { color: var(--primary); border-color: var(--primary); }
.btn-outline-success:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== AUTH PAGES (login, bienvenida) ===== */
body.app-auth {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--content-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

.auth-split {
  display: flex;
  flex-wrap: nowrap;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* Panel izquierdo — marca / descripción comercial */
.auth-split-brand {
  flex: 1 1 50%;
  background: linear-gradient(165deg, #0a1628 0%, #000814 100%);
  color: #fff;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}
.auth-split-brand-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 28rem;
}
.auth-split-headline {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.auth-split-lead {
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 1.25rem;
}
.auth-split-features {
  font-size: 0.92rem;
  line-height: 1.55;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
}
.auth-split-brand-foot { min-height: 1.5rem; }
.auth-split-help {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.12s;
}
.auth-split-help:hover { color: var(--primary); }

/* Panel derecho — formulario */
.auth-split-form {
  flex: 1 1 50%;
  background: var(--content-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right))
           max(1.25rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  min-width: 0;
  box-sizing: border-box;
}
.auth-card {
  max-width: 400px;
  width: 100%;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem 2rem 1.75rem;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}
.auth-card .auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.auth-card .auth-brand-logo {
  display: block;
  width: 100%;
  max-width: 150px;
  height: auto;
  object-fit: contain;
}
.auth-card .auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  text-align: left;
  margin-bottom: 0.35rem;
}
.auth-card .auth-lead {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.35rem;
  line-height: 1.45;
}
.auth-card .auth-alert { font-size: 0.875rem; }
.auth-card .form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.auth-card .form-control {
  font-size: 0.92rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}
.auth-password-wrap { position: relative; }
.auth-password-input { padding-right: 2.5rem; }
.auth-password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.auth-password-toggle:hover { color: var(--text-secondary); background: #f1f5f9; }
.auth-submit {
  padding: 0.65rem 1rem;
  font-weight: 700;
  font-size: 0.92rem;
  margin-top: 0.25rem;
  border-radius: var(--radius-sm);
}
.auth-split-foot {
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 400px;
  width: 100%;
  line-height: 1.45;
  padding: 0 0.25rem;
  box-sizing: border-box;
}
.auth-card a { color: var(--primary); }

/* Tablet y móvil: columna, formulario primero */
@media (max-width: 991.98px) {
  .auth-split {
    flex-direction: column;
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .auth-split-form {
    order: 1;
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: 1rem;
    width: 100%;
  }
  .auth-split-brand {
    order: 2;
    flex: 0 0 auto;
    padding: 1.25rem 1.25rem 1.5rem;
    gap: 0.75rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .auth-split-brand-center {
    flex: none;
    max-width: none;
    justify-content: flex-start;
  }
  .auth-split-headline {
    font-size: clamp(1.35rem, 4.5vw, 1.65rem);
    margin-bottom: 0.5rem;
  }
  .auth-split-lead {
    font-size: 0.875rem;
    margin-bottom: 0.65rem;
  }
  .auth-split-features {
    font-size: 0.85rem;
  }
  .auth-split-brand-foot {
    display: block;
    min-height: 0;
    margin-top: 0.5rem;
  }
  .auth-card {
    max-width: 440px;
  }
}

/* Teléfonos */
@media (max-width: 575.98px) {
  .auth-split-form {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .auth-card {
    padding: 1.35rem 1.15rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.05);
  }
  .auth-card .auth-brand-logo {
    max-width: 128px;
  }
  .auth-card .auth-title {
    font-size: 1.2rem;
  }
  .auth-card .auth-lead {
    font-size: 0.8125rem;
    margin-bottom: 1.1rem;
  }
  .auth-card .form-control {
    font-size: 16px;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
  }
  .auth-password-input {
    padding-right: 2.75rem;
  }
  .auth-password-toggle {
    width: 2.75rem;
    height: 2.75rem;
  }
  .auth-submit {
    min-height: 44px;
    font-size: 1rem;
  }
  .auth-split-brand {
    padding: 1rem 1rem 1.25rem;
  }
  .auth-split-foot {
    font-size: 0.72rem;
    margin-top: 1rem;
  }
}

/* Pantallas muy bajas (landscape móvil) */
@media (max-height: 520px) and (max-width: 991.98px) {
  .auth-split-form {
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
  }
  .auth-card .auth-brand {
    margin-bottom: 0.65rem;
  }
  .auth-card .auth-brand-logo {
    max-width: 100px;
  }
  .auth-card .auth-lead {
    margin-bottom: 0.85rem;
  }
  .auth-split-brand {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .auth-split-headline {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
  }
  .auth-split-lead,
  .auth-split-features {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }
}

/* Escritorio ancho: mitades equilibradas */
@media (min-width: 992px) {
  .auth-split-brand,
  .auth-split-form {
    flex: 1 1 50%;
    max-width: 50%;
  }
}

.welcome-card {
  max-width: 420px; width: 100%;
  background: #fff; border-radius: var(--radius);
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.welcome-card .brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  background: transparent;
  width: auto;
  height: auto;
}
.welcome-card h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.welcome-card .sub { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1.75rem; }

/* Welcome buttons */
.btn-welcome-primary {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.7rem 1rem;
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 600;
  text-decoration: none; transition: background 0.12s;
  margin-bottom: 0.5rem;
}
.btn-welcome-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-welcome-secondary {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.7rem 1rem;
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 500;
  text-decoration: none; transition: background 0.12s;
  margin-bottom: 0.5rem;
}
.btn-welcome-secondary:hover { background: #f1f5f9; color: var(--text); }

/* WhatsApp button */
.whatsapp-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: rgba(37,211,102,0.08); border: 1px solid rgba(37,211,102,0.3);
  border-radius: var(--radius-sm); color: #16a34a; text-decoration: none;
  font-weight: 500; font-size: 0.9rem;
}
.whatsapp-link:hover { background: rgba(37,211,102,0.15); color: #15803d; }
.whatsapp-link svg { width: 18px; height: 18px; }

/* ===== TABLES ===== */
.app-table { font-size: 0.88rem; }
.app-table th { font-weight: 600; color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.app-table td { vertical-align: middle; }

/* ===== BADGES ===== */
.badge-status { border-radius: 20px; padding: 0.3em 0.7em; font-size: 0.75rem; font-weight: 600; }

/* ===== CARD-LIST (entregados) ===== */
.card-list {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--card-shadow); border: 1px solid var(--border); overflow: hidden;
}
.card-list .card-header { font-weight: 700; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); background: #f8fafc; }

/* ===== NAVBAR-APP (compatibilidad) ===== */
.navbar-app, .nav-admin-strip {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 0.5rem 1rem;
}
.navbar-app .navbar-brand,.nav-admin-strip .navbar-brand { font-weight: 700; color: var(--text); margin-right: 1rem; }
.navbar-app .nav-link,.nav-admin-strip .nav-link { color: var(--text-secondary); font-weight: 500; border-radius: var(--radius-sm); padding: 0.4rem 0.75rem; }
.navbar-app .nav-link:hover,.nav-admin-strip .nav-link:hover { background: #f1f5f9; color: var(--text); }
.navbar-app .nav-link.active,.nav-admin-strip .nav-link.active { color: var(--primary); background: var(--primary-light); }
.navbar-app .dropdown-menu,.nav-admin-strip .dropdown-menu { border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ===== MOBILE ===== */
@media (max-width: 991px) {
  .app-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); transition: transform 0.25s ease; }
  .app-sidebar.sidebar-open { transform: translateX(0); }
  .app-main { margin-left: 0; width: 100%; }
  .app-topbar { padding: 0 0.875rem; }
  .topbar-title { font-size: 0.875rem; }
}
@media (min-width: 992px) { .topbar-toggle { display: none; } }

@media (max-width: 575.98px) {
  .app-topbar {
    padding: 0 0.625rem;
    gap: 0.5rem;
  }

  .topbar-title {
    min-width: 0;
    font-size: 0.8125rem;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-icon-btn:has(.topbar-badge) {
    margin-right: 5px;
  }

  .topbar-badge {
    top: -6px;
    right: -8px;
  }

  .topbar-user {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .topbar-user .bi-chevron-down {
    display: none;
  }
}
