/* ==========================================================================
   DESIGN SYSTEM — ALCALDÍA MAYOR DE BOGOTÁ · CARNETIZACIÓN VENDEDORES
   Paleta institucional: Amarillo #FFB600 · Rojo #E3000F · Blanco #FFFFFF
   ========================================================================== */

   :root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* === PALETA INSTITUCIONAL ALCALDÍA MAYOR DE BOGOTÁ === */
    --color-yellow:        #FFB600;
    --color-yellow-dark:   #D99A00;
    --color-yellow-light:  #FFF8E1;
    --color-red:           #E3000F;
    --color-red-dark:      #B80010;
    --color-red-light:     #FDECEA;
    --color-navy:          #1A2E5A;
    --color-navy-light:    #2A3F6F;
    
    /* === FONDOS Y SUPERFICIES === */
    --color-bg-deep:       #F0F2F7;
    --color-panel-glass:   #FFFFFF;
    --color-border-glass:  #DDE1EC;
    --color-border-focus:  #FFB600;
    
    /* === PRIMARIO Y ACENTO === */
    --color-primary:       #E3000F;
    --color-primary-hover: #B80010;
    --color-accent:        #FFB600;
    --color-accent-hover:  #D99A00;
    
    /* === TIPOGRAFÍA === */
    --color-text-main:     #1A1A2E;
    --color-text-muted:    #6B7280;
    --color-text-inverse:  #FFFFFF;
    
    /* === ESTADOS === */
    --color-active:        #16A34A;
    --color-active-glow:   rgba(22, 163, 74, 0.15);
    --color-inactive:      #D97706;
    --color-inactive-glow: rgba(217, 119, 6, 0.15);
    --color-revoked:       #DC2626;
    --color-revoked-glow:  rgba(220, 38, 38, 0.15);
    
    /* === SOMBRAS === */
    --shadow-premium:      0 4px 24px 0 rgba(26, 46, 90, 0.12);
    --shadow-card:         0 2px 8px 0 rgba(26, 46, 90, 0.07);
    --shadow-glow-blue:    0 0 18px rgba(255, 182, 0, 0.30);
    --shadow-glow-green:   0 0 18px rgba(22, 163, 74, 0.25);
    --shadow-glow-yellow:  0 0 18px rgba(255, 182, 0, 0.35);
    --shadow-glow-red:     0 0 18px rgba(227, 0, 15, 0.25);
  }

  
  /* ==================== BASE STYLES ==================== */
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-deep);
    color: var(--color-text-main);
    overflow-x: hidden;
    line-height: 1.5;
  }
  
  /* Background institucional — patrón geométrico sutil */
  .mesh-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    background:
      radial-gradient(circle at 0% 0%, rgba(255,182,0,0.12) 0%, transparent 35%),
      radial-gradient(circle at 100% 0%, rgba(227,0,15,0.07) 0%, transparent 35%),
      radial-gradient(circle at 50% 100%, rgba(26,46,90,0.06) 0%, transparent 50%),
      #F0F2F7;
  }

  /* Custom Scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: #E8EBF3; }
  ::-webkit-scrollbar-thumb { background: #C0C8DC; border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: #FFB600; }
  
  /* ==================== CARD COMPONENTS ==================== */
  .card-glass {
    background: var(--color-panel-glass);
    border: 1px solid var(--color-border-glass);
    box-shadow: var(--shadow-premium);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .card-glass-interactive:hover {
    border-color: var(--color-yellow);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px 0 rgba(26,46,90,0.14);
  }

  .glow-blue:hover   { box-shadow: var(--shadow-card), var(--shadow-glow-yellow); border-color: var(--color-yellow); }
  .glow-green:hover  { box-shadow: var(--shadow-card), var(--shadow-glow-green);  border-color: var(--color-active); }
  .glow-yellow:hover { box-shadow: var(--shadow-card), var(--shadow-glow-yellow); border-color: var(--color-yellow); }
  .glow-red:hover    { box-shadow: var(--shadow-card), var(--shadow-glow-red);    border-color: var(--color-red); }
  
  /* ==================== BUTTONS ==================== */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
  }
  
  .btn-primary {
    background: linear-gradient(135deg, var(--color-red), var(--color-red-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(227, 0, 15, 0.25);
  }
  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(227, 0, 15, 0.38);
    background: linear-gradient(135deg, var(--color-red-dark), #8B000B);
  }
  .btn-primary:active { transform: translateY(0); }

  .btn-secondary {
    background: #FFFFFF;
    color: var(--color-text-main);
    border-color: var(--color-border-glass);
  }
  .btn-secondary:hover {
    background: var(--color-yellow-light);
    border-color: var(--color-yellow);
    color: var(--color-navy);
  }

  .btn-success {
    background: linear-gradient(135deg, #16A34A, #15803D);
    color: #fff;
  }
  .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
  }

  /* Botón amarillo institucional */
  .btn-accent {
    background: linear-gradient(135deg, var(--color-yellow), var(--color-yellow-dark));
    color: var(--color-navy);
    font-weight: 700;
  }
  .btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 182, 0, 0.4);
  }

  .btn-danger {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #fff;
  }
  .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
  }
  
  .btn-block { width: 100%; }
  .btn-sm { padding: 6px 12px; font-size: 0.8rem; }
  
  .hidden { display: none !important; }
  .spacer { flex-grow: 1; }
  .text-center { text-align: center; }
  .py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .mt-4 { margin-top: 1rem; }
  .mt-2 { margin-top: 0.5rem; }
  
  /* Status Text colors */
  .text-green { color: var(--color-active); }
  .text-yellow { color: var(--color-inactive); }
  .text-red { color: var(--color-revoked); }
  
  /* ==================== LOGIN VIEW ==================== */
  .login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  
  .login-card {
    width: 100%;
    max-width: 420px;
    padding: 35px 30px;
  }
  
  .login-header {
    text-align: center;
    margin-bottom: 30px;
  }
  
  .logo-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }
  
  .logo-accent {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--color-red), var(--color-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .logo-divider {
    width: 2px;
    height: 24px;
    background: var(--color-border-glass);
  }

  .logo-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-navy);
  }
  
  .login-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 10px;
  }
  
  .form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px;
    background: #FAFBFC;
    border: 1.5px solid var(--color-border-glass);
    border-radius: 8px;
    color: var(--color-text-main);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
  }

  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    outline: none;
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 3px rgba(255, 182, 0, 0.18);
    background: #FFFEF7;
  }
  
  .form-alert {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
  }
  .form-alert.error {
    background: var(--color-red-light);
    border: 1px solid rgba(227, 0, 15, 0.25);
    color: var(--color-red-dark);
  }
  
  /* ==================== SPA APPLICATION LAYOUT ==================== */
  .admin-body {
    min-height: 100vh;
  }
  
  .app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
  }
  
  /* Sidebar */
  .sidebar {
    height: calc(100vh - 30px);
    margin: 15px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: sticky;
    top: 15px;
    z-index: 10;
  }
  
  .sidebar-header {
    margin-bottom: 35px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border-glass);
  }
  
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
  }
  
  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-muted);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .nav-item:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.03);
  }
  
  .nav-item.active {
    color: var(--color-navy);
    background: var(--color-yellow-light);
    border-left: 3px solid var(--color-yellow);
    padding-left: 13px;
    font-weight: 600;
  }
  
  .sidebar-footer {
    padding-top: 15px;
    border-top: 1px solid var(--color-border-glass);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-red), var(--color-yellow));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .user-info {
    display: flex;
    flex-direction: column;
  }
  
  .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .user-role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
  }
  
  .btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--color-red);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
  }
  .btn-logout:hover {
    background: var(--color-red-light);
    color: var(--color-red-dark);
  }
  
  /* Main Content Area */
  .main-content {
    padding: 30px;
    overflow-y: auto;
    height: 100vh;
  }
  
  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
  }
  
  .header-title {
    font-size: 1.8rem;
    font-weight: 700;
  }
  
  .system-time {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
  }
  
  /* Tab view visibility */
  .tab-view {
    animation: fadeIn 0.4s ease;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* ==================== DASHBOARD VIEW ==================== */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
  }
  
  .stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
  }
  
  .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--color-yellow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-yellow-dark);
    border: 1.5px solid rgba(255, 182, 0, 0.3);
  }
  
  .stat-details {
    display: flex;
    flex-direction: column;
  }
  
  .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
  }
  
  .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-navy);
    margin-top: 2px;
  }
  
  .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
  
  .panel-card {
    padding: 25px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
  }
  
  .panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border-glass);
    padding-bottom: 10px;
  }
  
  .chart-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  /* Horizontal Bar Chart Custom Styles */
  .chart-bar-row {
    margin-bottom: 15px;
  }
  .chart-bar-label-group {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 5px;
  }
  .chart-bar-name {
    font-weight: 500;
    color: var(--color-text-main);
  }
  .chart-bar-bg {
    height: 10px;
    background: #EEF0F7;
    border-radius: 5px;
    overflow: hidden;
  }
  .chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-yellow), var(--color-red));
    border-radius: 5px;
    transition: width 0.8s ease-in-out;
  }
  
  /* SVG Column Chart */
  .svg-chart-wrapper {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-top: 20px;
  }
  
  .chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
  }

  .chart-col-val {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-yellow);
    text-align: center;
    min-height: 14px;
    line-height: 1;
    margin-bottom: 2px;
  }

  .chart-col-bar {
    width: 24px;
    min-width: 14px;
    background: linear-gradient(0deg, var(--color-yellow), var(--color-red));
    border-radius: 6px 6px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 4px;
    position: relative;
  }
  .chart-col-bar:hover {
    background: linear-gradient(0deg, var(--color-red), #8B000B);
    filter: drop-shadow(0 0 8px rgba(227, 0, 15, 0.4));
  }
  
  .chart-col-bar::before {
    content: attr(data-val);
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .chart-col-bar:hover::before {
    opacity: 1;
  }
  
  .chart-col-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    max-width: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* ==================== BENEFICIARIES GRID ==================== */
  .control-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  
  .search-box {
    position: relative;
    width: 100%;
    max-width: 360px;
  }
  
  .search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
  }
  
  .search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: var(--color-panel-glass);
    border: 1.5px solid var(--color-border-glass);
    border-radius: 8px;
    color: var(--color-text-main);
    font-family: var(--font-primary);
    font-size: 0.9rem;
  }
  .search-box input:focus {
    outline: none;
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 3px rgba(255, 182, 0, 0.15);
  }
  
  /* Filters panel */
  .filters-panel {
    padding: 20px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .filters-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
  }
  
  .filters-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border-glass);
  }
  
  /* Tables */
  .table-container {
    overflow-x: auto;
    margin-bottom: 20px;
  }
  
  .data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-glass);
  }
  
  .data-table th {
    background: var(--color-navy);
    font-weight: 600;
    color: var(--color-yellow);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .data-table tbody tr {
    transition: background 0.15s ease;
  }
  .data-table tbody tr:hover {
    background: var(--color-yellow-light);
  }
  
  /* Avatars in tables */
  .table-avatar-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-yellow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 182, 0, 0.3);
  }
  
  .table-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .table-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Status Badges */
  .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
  }
  
  .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-active);
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.1);
  }
  .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-inactive);
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.1);
  }
  .badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-revoked);
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.1);
  }
  
  /* Row Action buttons */
  .table-actions {
    display: flex;
    gap: 6px;
  }
  
  .btn-icon-only {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--color-border-glass);
    background: #FAFBFC;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  .btn-icon-only:hover {
    color: var(--color-navy);
    background: var(--color-yellow-light);
    border-color: var(--color-yellow);
  }

  .btn-icon-only.action-view:hover  { color: var(--color-navy); border-color: var(--color-yellow); background: var(--color-yellow-light); }
  .btn-icon-only.action-edit:hover  { color: #B45309; border-color: rgba(180,83,9,0.3); background: #FEF3C7; }
  .btn-icon-only.action-qr:hover    { color: var(--color-navy); border-color: var(--color-navy); background: #EEF2FF; }
  .btn-icon-only.action-delete:hover { color: var(--color-red-dark); border-color: rgba(227,0,15,0.25); background: var(--color-red-light); }
  
  /* Pagination */
  .pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .pagination-info {
    font-size: 0.85rem;
    color: var(--color-text-muted);
  }
  
  .pagination-buttons {
    display: flex;
    gap: 8px;
  }
  
  /* ==================== AUDIT SUBNAV & DIFFS ==================== */
  .tabs-subnav {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--color-border-glass);
    padding-bottom: 10px;
  }
  
  .subnav-item {
    background: transparent;
    border: none;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
  }
  .subnav-item:hover {
    color: var(--color-text-main);
  }
  .subnav-item.active {
    color: var(--color-primary);
  }
  .subnav-item.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary);
  }
  
  .subtab-view {
    animation: fadeIn 0.4s ease;
  }
  
  /* Inline Diff render box */
  .audit-diff-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: monospace;
    font-size: 0.75rem;
  }
  
  .diff-line {
    background: rgba(255, 255, 255, 0.03);
    padding: 3px 6px;
    border-radius: 4px;
  }
  
  .diff-field {
    font-weight: 700;
    color: var(--color-accent);
  }
  
  .diff-old {
    color: #fca5a5;
    text-decoration: line-through;
    margin: 0 4px;
  }
  
  .diff-new {
    color: #86efac;
    font-weight: 600;
  }
  
  /* ==================== MODALS ==================== */
  .modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
  }
  
  .modal-card {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  
  .modal-form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    height: 100%;
  }
  
  .modal-card.max-w-md { max-width: 480px; }
  
  @keyframes modalScaleUp {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }
  
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border-glass);
  }
  
  .modal-title {
    font-size: 1.25rem;
    font-weight: 700;
  }
  
  .btn-close-modal {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s ease;
  }
  .btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
  }
  
  .form-scroll-container {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
  }
  
  .modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
  }
  
  .form-column {
    display: flex;
    flex-direction: column;
  }
  
  .form-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
  }
  
  .form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  .form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
  }
  
  /* Photo Uploader Widget */
  .photo-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px dashed var(--color-border-glass);
    border-radius: 12px;
    margin-bottom: 15px;
  }
  
  .photo-preview-box {
    width: 105px;
    height: 125px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .avatar-silhouette {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .photo-upload-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .upload-tip {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-align: center;
  }
  
  .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border-glass);
  }
  
  /* Drag and drop CSV/Excel Uploader */
  .modal-body {
    padding: 24px;
  }
  
  .modal-intro {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
  }
  
  .dropzone-container {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 35px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
  }
  .dropzone-container:hover {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.03);
  }
  
  .dropzone-icon {
    color: var(--color-text-muted);
    transition: color 0.2s ease;
  }
  .dropzone-container:hover .dropzone-icon {
    color: var(--color-primary);
  }
  
  .dropzone-text {
    font-size: 0.9rem;
    color: var(--color-text-main);
    text-align: center;
  }
  
  .file-name-display {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 500;
  }
  
  .import-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
  }
  
  .import-results {
    margin-top: 20px;
    padding: 15px;
    max-height: 180px;
    display: flex;
    flex-direction: column;
  }
  
  .results-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
  }
  
  .results-log {
    flex-grow: 1;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.75rem;
    color: #fda4af;
    background: rgba(0,0,0,0.2);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  /* Spinner Animations */
  .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  .spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2.5px;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
  /* ==========================================================================
     PUBLIC VALIDATION SCREEN STYLING (validate.html)
     ========================================================================== */
  .public-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
  }
  
  .public-container {
    width: 100%;
    max-width: 375px; /* Perfect smartphone viewport scaling */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  
  .public-header {
    text-align: center;
  }
  
  .public-header .logo-accent {
    font-size: 2.2rem;
  }
  
  .card-glass.public-card {
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
  }
  
  .state-container {
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .loading-text {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
  }
  
  /* Error Validation styling */
  .status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-revoked);
    margin-bottom: 20px;
    animation: popScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  
  @keyframes popScale {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  
  .status-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 10px;
  }
  
  .status-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    padding: 0 10px;
  }
  
  /* Card validation success */
  .validation-status-banner {
    width: calc(100% + 48px);
    margin: -30px -24px 20px -24px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
  }
  
  .banner-active { background-color: var(--color-active); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); }
  .banner-inactive { background-color: var(--color-inactive); box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3); }
  .banner-revoked { background-color: var(--color-revoked); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }
  
  .status-icon-small {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .badge-profile-layout {
    display: grid;
    grid-template-columns: 85px 1fr;
    gap: 15px;
    width: 100%;
    align-items: center;
    text-align: left;
  }
  
  .badge-photo-wrapper {
    width: 85px;
    height: 105px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1.5px solid var(--color-border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .badge-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .badge-photo-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .badge-info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .beneficiary-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
  }
  
  .info-field {
    display: flex;
    flex-direction: column;
  }
  
  .info-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .info-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-main);
  }
  
  .text-glow {
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(217, 70, 239, 0.4);
    font-weight: 600;
  }
  
  .card-divider {
    width: 100%;
    border: none;
    border-top: 1px solid var(--color-border-glass);
    margin: 20px 0;
  }
  
  .badge-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
    text-align: left;
  }
  
  .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
  }
  .detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  
  .detail-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
  }
  
  .detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
  }
  
  .badge-security-footer {
    width: 100%;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .security-seal {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted);
  }
  .security-seal svg {
    color: var(--color-active);
  }
  
  .seal-timestamp {
    font-size: 0.65rem;
    color: var(--color-text-muted);
  }
  
  .public-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  /* Responsive Breakpoints */
  @media (max-width: 1024px) {
    .app-layout {
      grid-template-columns: 1fr;
    }
    .sidebar {
      position: static;
      height: auto;
      margin: 15px;
    }
    .stats-grid {
      grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
      grid-template-columns: 1fr;
    }
  }
  
  @media (max-width: 768px) {
    .filters-grid {
      grid-template-columns: repeat(2, 1fr);
    }
    .modal-grid {
      grid-template-columns: 1fr;
    }
    .control-row {
      flex-direction: column;
      align-items: stretch;
    }
    .search-box {
      max-width: none;
    }
    .stats-grid {
      grid-template-columns: 1fr;
    }
  }
