/* ============================================================
   PRINT OPTIMIZATION
   ============================================================ */
@media print {
    body { background: white !important; }
    #app-container, .sidebar, .header, .modal-overlay, .stats-grid, .card, .premium-controls-row {
        display: none !important;
    }
    #print-area {
        display: block !important;
        visibility: visible !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto !important;
        overflow: visible !important;
    }
    #print-area * {
        visibility: visible !important;
    }
    @page { margin: 0.5cm; }
}

/* ============================================================
   PREMIUM FILTER TOOLS (Glassmorphism Control Panel)
   ============================================================ */
.compact-filter-card {
    background: var(--bg-surface) !important;
    backdrop-filter: var(--blur) !important;
    -webkit-backdrop-filter: var(--blur) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 28px !important;
    padding: 24px !important;
    box-shadow: var(--shadow-lg) !important;
    transition: all 0.3s ease;
}

.filter-toggle-group {
    background: transparent;
    padding: 0;
    border-radius: 16px;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.qf-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 5px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.qf-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
    border: 1px solid var(--border-subtle);
}

.filter-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-input-group label {
    font-size: 10px;
    font-weight: 900;
    color: var(--text-muted);
    margin-right: 5px;
    text-transform: uppercase;
}

.filter-input-group input[type="date"] {
    width: 100%;
    height: 48px;
    border-radius: 14px;
    border: 1.5px solid var(--border-medium);
    background: var(--bg-elevated);
    padding: 0 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.filter-input-group input[type="date"]:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.glass-btn {
    height: 52px;
    border-radius: 16px;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.glass-btn:active {
    transform: scale(0.96);
}

.compact-submit-btn {
    background: var(--remind-blue);
    color: white;
    box-shadow: 0 10px 20px rgba(8, 104, 163, 0.2);
}

.whatsapp-btn {
    background: #25D366;
    color: white;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.2);
    flex: 0 0 52px;
}

/* Premium Tool Rows Responsive Stacking */
.premium-tool-row {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

@media (max-width: 991px) {
    .premium-tool-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .premium-tool-row .input-group-premium,
    .premium-tool-row .btn-submit {
        width: 100% !important;
        flex: none !important;
        margin: 0 !important;
    }
    .premium-tool-row .select2-container {
        width: 100% !important;
    }
    /* Ensure cards in grid span full width on mobile */
    .dashboard-header-flex + .stats-grid .card {
        grid-column: 1 / -1 !important;
    }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7); /* Deep Slate Blue Backdrop */
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px;
    box-sizing: border-box;
}

/* Ensure SweetAlert2 is always on top of modals */
.swal2-container {
    z-index: 20000 !important;
}

@media (max-width: 600px) {
  .modal-overlay { 
    padding: 10px !important; 
    align-items: center !important; 
    justify-content: center !important; 
  }
  .modal-box {
    max-height: 85vh !important;
    max-width: 95% !important;
    width: 100% !important;
    border-radius: 20px !important;
    margin: 0 !important;
  }
  .modal-body { 
    padding: 16px 20px !important; 
  }
  .modal-header { 
    padding: 16px 20px !important; 
    font-size: 16px !important; 
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
  }
  .modal-footer {
    padding: 12px 20px !important;
  }
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--bg-surface);
    width: 100%;
    max-width: 550px;
    border-radius: 30px !important;
    box-shadow: var(--shadow-xl);
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    border: 1px solid var(--border-subtle);
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-overlay.show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    border-bottom: 1px solid var(--border-subtle);
    border-top-left-radius: 30px !important;
    border-top-right-radius: 30px !important;
}

.modal-header i {
    margin-left: 10px;
    font-size: 1.1em;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-surface);
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
    position: relative;
}

/* Force bottom rounding on whatever is at the bottom of the modal */
.modal-box > *:last-child {
    border-bottom-left-radius: 30px !important;
    border-bottom-right-radius: 30px !important;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-medium);
    border-radius: 10px;
}

/* Specific Close Icon */
.close-icon {
    width: 36px;
    height: 36px;
    background: var(--hover-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 14px;
    border: 1px solid var(--border-subtle);
}

.close-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.close-icon i {
    margin: 0 !important;
}

/* Helper for modal-footer/actions if needed */
.modal-footer {
    padding: 20px 30px;
    background: var(--hover-bg);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-subtle);
    border-bottom-left-radius: 30px !important;
    border-bottom-right-radius: 30px !important;
}

  .bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    /* Handle gesture bar */
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-top: 1px solid var(--border-subtle);
  }

  .nav-item {
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: 'Cairo';
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    transition: all 0.3s ease;
    padding: 5px;
  }

  .nav-item i {
    font-size: 20px;
  }

  .nav-item.active {
    color: var(--text-primary);
    font-weight: 900;
  }

  .nav-item:hover {
    color: var(--text-primary);
  }

    body.role-CS .hide-on-cs {
    display: none !important;
  }

  body.role-DATA_ENTRY .hide-on-data-entry {
    display: none !important;
  }

  .accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 18px 20px;
    border-radius: 14px;
    transition: all 0.3s ease;
    user-select: none;
  }

  .accordion-header:hover {
    background: rgba(0, 80, 130, 0.04);
  }

  .accordion-header h3 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .accordion-arrow {
    color: var(--text-light);
    font-size: 13px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .accordion-body.open {
    grid-template-rows: 1fr;
  }

  .accordion-inner {
    overflow: hidden;
    padding: 0 20px;
  }

  .accordion-inner-pad {
    padding-bottom: 20px;
  }

  .appt-card {
    padding: 10px;
    border-right: 4px solid var(--remind-teal);
    margin-bottom: 8px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
  }

  .appt-card:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateX(-2px);
  }

  .appt-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
  }

  .appt-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 2px;
  }

  .appt-delete-btn {
    border: none;
    background: none;
    color: #e53e3e;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s ease;
    border-radius: 4px;
  }

  .appt-delete-btn:hover {
    background: #fee;
    transform: scale(1.1);
  }

  #toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 360px;
  }

  .toast {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: all;
    cursor: pointer;
  }

  .toast.hiding {
    animation: toastOut 0.3s ease forwards;
  }

  .toast-success {
    background: linear-gradient(135deg, #00a884, #00897b);
  }

  .toast-error {
    background: linear-gradient(135deg, #e53e3e, #c53030);
  }

  .toast-warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
  }

  .toast-info {
    background: linear-gradient(135deg, #005082, #003d63);
  }

  /* AI ASSISTANT */
  .ai-fab {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--remind-blue), var(--remind-teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 10px 25px rgba(0, 80, 130, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .ai-fab:hover {
    transform: scale(1.1) rotate(15deg);
  }

  .ai-chat-container {
    position: fixed;
    bottom: 160px;
    left: 20px;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 450px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: slideInLeft 0.4s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .ai-chat-header {
    background: linear-gradient(135deg, var(--remind-blue), var(--remind-teal));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .ai-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .ai-msg.bot {
    align-self: flex-start;
    background: white;
    color: #334155;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }

  .ai-msg.user {
    align-self: flex-end;
    background: var(--remind-blue);
    color: white;
    border-bottom-right-radius: 2px;
  }

  .ai-chat-footer {
    padding: 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
  }

  .ai-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    padding: 8px 15px;
    outline: none;
    font-size: 0.9rem;
  }

  .ai-send-btn {
    width: 38px;
    height: 38px;
    background: var(--remind-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateX(-30px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .toast-icon {
    font-size: 16px;
    flex-shrink: 0;
  }

  .toast-msg {
    flex: 1;
    line-height: 1.4;
  }

  @keyframes toastIn {
    from {
      opacity: 0;
      transform: translateY(-20px) scale(0.9);
    }

    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes toastOut {
    from {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    to {
      opacity: 0;
      transform: translateY(-10px) scale(0.95);
    }
  }

  .cs-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    direction: rtl;
  }

  .cs-stat-card {
    position: relative;
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 1;
  }

  .cs-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
  }

  .cs-stat-card:active {
    transform: scale(0.97);
  }

  .cs-stat-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .cs-stat-lbl {
    font-size: 12px;
    color: #64748b;
    font-weight: 800;
  }

  .cs-stat-num {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    color: var(--text-primary);
  }

  .cs-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  }

  .cs-stat-card .watermark {
    position: absolute;
    left: -15px;
    bottom: -20px;
    font-size: 80px;
    opacity: 0.03;
    z-index: -1;
    transform: rotate(-15deg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .cs-stat-card:hover .watermark {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.06;
  }

  .cs-stat-card.blue {
    border-bottom: 4px solid #0284c7;
  }

  .cs-stat-card.blue .cs-stat-icon {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
  }

  .cs-stat-card.orange {
    border-bottom: 4px solid #ea580c;
  }

  .cs-stat-card.orange .cs-stat-icon {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
  }

  .cs-stat-card.red {
    border-bottom: 4px solid #dc2626;
  }

  .cs-stat-card.red .cs-stat-icon {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
  }

  .cs-stat-card.green {
    border-bottom: 4px solid #16a34a;
  }

  .cs-stat-card.green .cs-stat-icon {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
  }

  /* =====================================================
       PREMIUM FINANCIAL STATEMENT LIST
       ===================================================== */
  .fin-statement-card {
    background: var(--bg-surface);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 20px;
    border: 1px solid var(--border-subtle);
    display: none;
  }

  .fin-statement-header {
    padding: 20px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
  }

  .fin-statement-header .hdr-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 16px;
  }

  .fin-statement-header .hdr-badge {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
  }

  .fin-section-label {
    padding: 12px 20px;
    background: transparent;
    font-size: 10px;
    font-weight: 900;
    color: var(--text-muted);
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .fin-statement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
  }

  .fin-statement-row:hover {
    background: var(--hover-bg);
  }

  .fin-statement-row .val {
    font-family: 'Cairo';
    font-weight: 800;
    font-size: 18px;
    color: var(--text-primary);
    direction: ltr;
    display: flex;
    align-items: center;
  }

  .fin-statement-row .val::before {
    content: 'ج.م';
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    margin-right: 4px;
    margin-top: 4px;
  }

  .fin-statement-row .label-group {
    display: flex;
    align-items: center;
    gap: 15px;
  }

  .fin-statement-row .label-text {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
    text-align: right;
    line-height: 1.3;
  }

  .fin-statement-row .label-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
    text-align: right;
  }

  .fin-statement-row .icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .fin-statement-row.profit {
    background: rgba(34, 197, 94, 0.1);
    border-top: 2px solid #22c55e;
    border-bottom: none;
    padding: 18px 20px;
  }

  .fin-statement-row.profit .val,
  .fin-statement-row.profit .label-text {
    color: #16a34a;
  }

  .fin-statement-row.negative .val,
  .fin-statement-row.negative .val::before {
    color: #dc2626;
  }

  /* Dark Mode specific contrast adjustments for Fin Statement */
  body.dark-mode .fin-statement-row.profit {
    background: rgba(74, 222, 128, 0.1);
  }
  body.dark-mode .fin-statement-row.profit .val,
  body.dark-mode .fin-statement-row.profit .label-text {
    color: #4ade80 !important;
  }
  body.dark-mode .fin-statement-row.negative .val,
  body.dark-mode .fin-statement-row.negative .val::before {
    color: #f87171 !important;
  }

  .fin-divider {
    display: none;
  }

  /* TODAY'S STATS PREMIUM BAR */
  .today-stats-container {
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-subtle);
    direction: rtl;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 13px;
    color: #1e293b;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e2e8f0;
  }

  .today-details-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Cairo';
    box-shadow: var(--shadow-sm);
  }

  .today-details-btn:hover {
    background: var(--active-bg);
    border-color: var(--border-strong);
    transform: translateY(-1px);
  }

  .premium-badge {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
  }
  .today-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
  }

  .today-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
  }

  .today-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    background: var(--bg-surface);
  }

  .today-item .t-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
  }

  .today-item .t-icon.inc { background: #f0fdf4; color: #10b981; }
  .today-item .t-icon.exp { background: #fef2f2; color: #ef4444; }
  .today-item .t-icon.net { background: #fff7ed; color: #f59e0b; }
  .today-item .t-icon.ses { background: #eff6ff; color: #3b82f6; }

  .today-item .t-data {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .today-item .t-lbl {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .today-item .t-val {
    font-size: 18px;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.2;
  }

  @media (max-width: 992px) {
    .today-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 20px;
    }
    .today-item:not(:last-child)::after {
      display: none;
    }
  }

  @media (max-width: 576px) {
    .today-grid {
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 10px !important;
    }
    .today-item {
      padding: 12px 10px !important;
      gap: 8px !important;
      border-radius: 16px !important;
    }
    .today-item .t-icon {
      width: 38px !important;
      height: 38px !important;
      border-radius: 10px !important;
      font-size: 16px !important;
    }
    .today-item .t-data {
      gap: 0px !important;
    }
    .today-item .t-lbl {
      font-size: 9px !important;
      margin-bottom: 2px !important;
    }
    .today-item .t-val {
      font-size: 14px !important;
    }

    /* Premium Financial Statement list responsive fixes */
    .fin-statement-header {
      flex-direction: column !important;
      align-items: flex-start !important;
      gap: 12px !important;
      padding: 16px 20px !important;
    }
    .fin-statement-header .hdr-badge {
      font-size: 10px !important;
      padding: 4px 10px !important;
      white-space: nowrap !important;
      align-self: flex-start !important;
      margin-right: 0 !important;
      direction: rtl !important;
      unicode-bidi: embed !important;
    }
    .fin-statement-row {
      padding: 12px 15px !important;
    }
    .fin-statement-row .label-group {
      gap: 10px !important;
    }
    .fin-statement-row .icon-box {
      width: 32px !important;
      height: 32px !important;
      border-radius: 8px !important;
      font-size: 14px !important;
    }
    .fin-statement-row .label-text {
      font-size: 13px !important;
    }
    .fin-statement-row .label-sub {
      font-size: 10px !important;
    }
    .fin-statement-row .val {
      font-size: 15px !important;
    }
    .fin-statement-row .val::before {
      font-size: 10px !important;
      margin-right: 2px !important;
    }
  }

  /* TODAY'S DETAILS MODAL */
  .tdm-tab {
    flex: 1;
    text-align: center;
    padding: 15px 0;
    font-weight: 800;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
  }

  .tdm-tab.active {
    color: var(--remind-teal);
    border-bottom-color: var(--remind-teal);
    background: #f8fafc;
  }

  .tdm-list-item {
    background: white;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  }

  .tdm-list-item .t-title {
    font-weight: bold;
    color: #1e293b;
    font-size: 13px;
    margin-bottom: 4px;
  }

  .tdm-list-item .t-sub {
    font-size: 11px;
    color: #94a3b8;
  }

  .tdm-list-item .t-val {
    font-weight: 900;
    font-size: 14px;
  }

  .tdm-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-weight: bold;
  }

  .tdm-empty i {
    font-size: 40px;
    margin-bottom: 15px;
    opacity: 0.3;
  }

  /* ACTIVE CLIENT CARD ITEMS */
  .ac-item {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid #f1f5f9;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
  }

  .ac-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--remind-teal);
    border-radius: 4px 0 0 4px;
  }

  .ac-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
  }

  .ac-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
  }

  .ac-name {
    font-weight: 800;
    color: #1e293b;
    font-size: 14px;
  }

  .ac-code {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 3px;
    display: inline-block;
  }

  .ac-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .ac-badge.high {
    background: #dcfce7;
    color: #15803d;
  }

  .ac-badge.med {
    background: #fef9c3;
    color: #a16207;
  }

  .ac-badge.low {
    background: #fee2e2;
    color: #b91c1c;
  }

  .ac-service {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
  }

  .ac-progress-bg {
    background: #f1f5f9;
    height: 6px;
    border-radius: 10px;
    overflow: hidden;
  }

  .ac-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
  }

  /* THERAPIST REPORT MODAL */
  .t-ses-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
  }

  .t-ses-row:last-child {
    border-bottom: none;
  }

  .t-ses-client {
    font-weight: 700;
    color: var(--text-primary);
  }

  .t-ses-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
  }

  .t-ses-amount {
    font-weight: 800;
    color: var(--remind-blue);
    font-size: 13px;
    white-space: nowrap;
  }

  .t-summary-box {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
  }

  .t-sum-item {
    flex: 1;
    min-width: 100px;
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
    border: 1px solid var(--border-subtle);
  }

  .t-sum-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
  }

  .t-sum-value {
    font-size: 17px;
    font-weight: 900;
  }

  @media print {
    body>*:not(#print-area) {
      display: none !important;
    }

    #print-area {
      display: block !important;
      padding: 20px;
    }
  }

  #print-area {
    display: none;
  }

  /* SETTINGS TABLE */
  .dash-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
  }

  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    flex-shrink: 0;
  }

  .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }

  input:checked+.slider {
    background-color: var(--remind-teal);
  }

  input:checked+.slider:before {
    transform: translateX(22px);
  }

  .view-mode-btn {
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    border-radius: 12px;
    padding: 8px 16px;
    font-family: 'Cairo';
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
  }

  .view-mode-btn.active {
    border-color: var(--remind-blue);
    background: #eff6ff;
    color: var(--remind-blue);
  }

  .metric-settings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
  }

  .metric-settings-table th {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
    border-bottom: 2px solid var(--border-subtle);
  }

  .metric-settings-table th:first-child {
    text-align: right;
  }

  .metric-settings-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
  }

  .metric-settings-table td:first-child {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
  }

  .metric-settings-table td:not(:first-child) {
    text-align: center;
  }

  /* ===================== STATUS PILLS ===================== */
  .status-pills {
    display: flex;
    gap: 5px;
  }

  .status-pill {
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--hover-bg);
    color: var(--text-muted);
  }

  .status-pill.active-open {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
  }

  .status-pill.active-progress {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.2);
  }

  .status-pill.active-closed {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.2);
  }

  .status-pill:not([class*="active"]):hover {
    background: var(--active-bg);
    color: var(--remind-blue);
  }

  /* ===================== MENTION DROPDOWN ===================== */
  .mention-wrap {
    position: relative;
  }

  .mention-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 220px;
    background: var(--bg-elevated);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    display: none;
    z-index: 999;
    overflow: hidden;
    margin-bottom: 8px;
  }

  .mention-dropdown.open {
    display: block;
    animation: slideDown 0.15s ease;
  }

  .mention-dd-header {
    padding: 10px 14px;
    background: var(--hover-bg);
    font-size: 10px;
    font-weight: 900;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
  }

  .mention-dd-item {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s;
  }

  .mention-dd-item:hover {
    background: var(--active-bg);
  }

  .mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--remind-blue), var(--remind-teal));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
  }

  .mention-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mention-role {
    font-size: 10px;
    color: var(--text-muted);
  }

  /* =====================================================
       ADMIN HUB PREMIUM UTILITIES
       ===================================================== */
  .glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  }

  .premium-gradient-text {
    background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
  }

  .admin-badge-glow {
    position: relative;
    overflow: hidden;
  }

  .admin-badge-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: rotate-glow 4s linear infinite;
    pointer-events: none;
  }

  @keyframes rotate-glow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .card-premium {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: var(--primary-glow);
  }

  /* Settings Grid Improvements */
  .settings-grid {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 15px;
  }

  .settings-item {
    flex: 0 1 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .settings-item label {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 5px;
    display: block;
  }

  .color-picker-wrapper {
    background: #f8fafc;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
  }

  .color-picker-wrapper:hover {
    border-color: var(--remind-blue);
    background: #fff;
  }

  .brand-color-input {
    width: 45px;
    height: 45px;
    padding: 0;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
  }

  .brand-color-input::-webkit-color-swatch-wrapper { padding: 0; }
  .brand-color-input::-webkit-color-swatch { border: none; border-radius: 10px; }

  @media (max-width: 600px) {
    .settings-item {
      flex: 1 1 100%;
    }
    .settings-grid {
      gap: 20px;
    }
  }

  /* Dashboard Header Layout */
  .dashboard-header-flex {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch;
  }

  .dashboard-header-flex > .glass-panel,
  .dashboard-header-flex > .today-stats-container,
  .dashboard-header-flex > .widget-stack-container {
    flex: 1;
    margin-bottom: 0 !important;
    height: auto;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle) !important;
  }

  /* Specific fix for widget slides to fill container */
  .widget-stack-container .swiper-slide {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  @media (max-width: 991px) {
    .dashboard-header-flex {
      flex-direction: column !important;
    }
    .dashboard-header-flex > .widget-stack-container {
      height: 220px !important;
    }
  }

  /* Make today grid adjust within half width */
  .dashboard-header-flex .today-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    flex: 1;
    align-content: center;
  }

  .dashboard-header-flex .today-item::after {
    display: none !important;
  }

  @media (max-width: 1200px) {
    .dashboard-header-flex {
      flex-direction: column;
    }
    .dashboard-header-flex .today-grid {
      grid-template-columns: repeat(4, 1fr) !important;
    }
  }

  @media (max-width: 768px) {
    .dashboard-header-flex .today-grid {
      grid-template-columns: repeat(2, 1fr) !important;
    }
  }

  /* Compact Filter Card */
  .compact-filter-card {
    padding: 12px 15px !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-sm) !important;
  }

  .compact-filter-card label {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    margin-bottom: 3px !important;
    display: block;
    letter-spacing: 0.2px;
  }

  .compact-filter-card input[type="date"] {
    height: 38px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
    background: var(--bg-elevated) !important;
    border: 1.5px solid var(--border-medium) !important;
    padding: 0 10px !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
  }

  .qf-btn {
    flex: 1;
    border: 1.5px solid var(--border-medium);
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 6px 0;
    font-family: 'Cairo';
    font-size: 11px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
  }

  .qf-btn.active {
    background: #475569;
    color: white;
    border-color: #475569;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  }

  .compact-submit-btn {
    height: 38px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
    margin: 0 !important;
  }

  /* Premium Transaction List Items */
  .txn-list-container {
    background: var(--bg-surface);
    border-radius: 18px;
    padding: 5px 20px;
    border: 1px solid var(--border-subtle);
  }

  .txn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s;
  }

  .txn-item:last-child {
    border-bottom: none;
  }

  .txn-info-side {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
  }

  .txn-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.2s;
  }

  .txn-item:hover .txn-icon-box {
    transform: scale(1.05);
  }

  .txn-text-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .txn-main-title {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 14px;
    display: block;
  }

  .txn-sub-title {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    display: block;
  }

  .txn-amount-side {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }

  .txn-status-label {
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
  }

  .txn-amount-val {
    font-weight: 900;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
  }

  /* Color Variations */
  .txn-inc { color: #10b981; }
  .txn-inc-bg { background: #f0fdf4; color: #10b981; }
  
  .txn-exp { color: #ef4444; }
  .txn-exp-bg { background: #fef2f2; color: #ef4444; }

  .txn-ses-bg { background: #eff6ff; color: #3b82f6; }
  .txn-ses-text { color: #3b82f6; }

  /* Dashboard Main Flex Layout */
  .dashboard-main-flex {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
  }

  .dashboard-left-col {
    flex: 1; /* Aligned with right column for 50/50 split */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Critical for flex items to shrink below content size */
  }

  .dashboard-right-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Critical for flex items to shrink below content size */
  }

  .dashboard-right-col .analytics-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
  }

  .dashboard-inner-flex {
    display: flex;
    gap: 20px;
    flex: 1;
  }

  /* expense-split-layout classes are styled and managed in admin-dashboard.css */


  /* ANALYTICS SLIDER */
  .analytics-slider-card {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 !important; /* Managed by slides */
  }

  .analytics-slides {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 200%; /* 2 slides */
  }

  .analytics-slide {
    width: 50%; 
    flex-shrink: 0;
    padding: 24px;
    box-sizing: border-box;
  }

  .slider-nav-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
  }

  .slider-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-medium);
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .slider-dot.active {
    background: var(--text-primary);
    width: 18px;
    border-radius: 4px;
  }

  .slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    color: var(--text-primary);
    transition: all 0.2s ease;
    opacity: 1;
    border: 1px solid var(--border-subtle);
  }

  .analytics-slider-card:hover .slider-arrow {
    opacity: 1;
  }

  .slider-arrow:hover { background: var(--bg-surface); transform: translateY(-50%) scale(1.1); }
  .slider-arrow.prev { right: 10px; }
  .slider-arrow.next { left: 10px; }

  @media (max-width: 1200px) {
    .dashboard-main-flex {
      flex-direction: column;
    }
    .dashboard-inner-flex {
      flex-direction: column;
    }
  }

  @media (max-width: 480px) {
    .dashboard-header-flex .today-grid {
      grid-template-columns: repeat(2, 1fr) !important;
    }
  }

  /* =====================================================
       TEAM GRID & CARDS (THERAPISTS & STAFF)
       ===================================================== */
  .team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
  }

  .team-card {
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 24px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
  }

  .team-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--remind-blue);
  }

  .team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(135deg, rgba(8, 104, 163, 0.05), rgba(13, 148, 136, 0.05));
    z-index: 0;
  }

  .team-card-avatar {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-surface);
    box-shadow: var(--shadow-md);
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    background: var(--bg-elevated);
  }

  .team-card-name {
    font-size: 17px;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0 0 4px;
    position: relative;
    z-index: 1;
  }

  .team-card-role {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .team-card-stats {
    display: flex;
    gap: 15px;
    background: var(--hover-bg);
    padding: 10px 15px;
    border-radius: 14px;
    margin-bottom: 20px;
    width: 100%;
    justify-content: center;
  }

  .team-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .team-stat-label {
    font-size: 9px;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 800;
  }

  .team-stat-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
  }

  .team-card-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: auto;
  }

  .btn-card-action {
    flex: 1;
    height: 40px;
    border-radius: 12px;
    border: none;
    font-family: 'Cairo';
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .btn-card-edit {
    background: #f0f9ff;
    color: var(--remind-blue);
  }

  .btn-card-edit:hover {
    background: var(--remind-blue);
    color: white;
  }

  .btn-card-delete {
    background: #fef2f2;
    color: #ef4444;
  }

  .btn-card-delete:hover {
    background: #ef4444;
    color: white;
  }

  .team-status-dot {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 2;
    border: 2px solid white;
  }

  .status-active { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1); }
  .status-inactive { background: #94a3b8; }

  /* Input Group Premium Updates for Settings */
  .settings-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
  }

  .avatar-selection-wrapper {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 15px;
    border: 1px solid var(--border-subtle);
  }

  .avatar-scroll-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px;
    scrollbar-width: thin;
  }

  .avatar-opt {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    background: var(--bg-surface);
    flex-shrink: 0;
  }

  .avatar-opt:hover {
    transform: scale(1.1);
  }

  .avatar-opt.selected {
    border-color: var(--remind-blue);
    box-shadow: 0 0 0 4px rgba(8, 104, 163, 0.1);
  }

  /* =====================================================
     MODAL & INPUT ENHANCEMENTS (Themed)
     ===================================================== */
  .confirm-box {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-lg) !important;
  }

  .confirm-msg {
    color: var(--text-secondary) !important;
  }

  /* Today Details Modal (TDM) Mini Stats */
  .tdm-stat-mini {
    padding: 15px;
    border-radius: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-subtle) !important;
    background: var(--hover-bg) !important;
  }

  .tdm-stat-mini:hover {
    transform: translateY(-2px);
    background: var(--active-bg) !important;
  }

  .tdm-stat-mini.active {
    border-color: var(--remind-blue) !important;
    box-shadow: 0 4px 12px var(--focus-ring) !important;
  }

  .tdm-stat-mini .lbl {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    margin-top: 5px;
  }

  .tdm-stat-mini .val {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
  }

  /* History Tabs */
  .history-tab {
    background: var(--hover-bg) !important;
    color: var(--text-muted) !important;
    border: 1px solid transparent !important;
  }

  .history-tab:hover {
    background: var(--active-bg) !important;
    color: var(--text-primary) !important;
  }

  .history-tab.active {
    background: var(--bg-elevated) !important;
    color: var(--remind-blue) !important;
    border-color: var(--border-subtle) !important;
    box-shadow: var(--shadow-sm) !important;
  }

  /* Futuristic Inputs */
  .futuristic-input {
    background: var(--bg-elevated) !important;
    border: 1.5px solid var(--border-medium) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    padding: 12px 15px !important;
    font-family: inherit !important;
    transition: all 0.2s ease !important;
  }

  .futuristic-input:focus {
    border-color: var(--remind-blue) !important;
    box-shadow: 0 0 0 4px var(--focus-ring) !important;
    outline: none !important;
  }

  /* Generic Labels in Modals */
  .modal-body label {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    text-align: right;
  }

.select2-container--open {
  z-index: 99999999 !important;
}

.modal-box .select2-container--open {
  z-index: 99999999 !important;
}

/* Fix: Select2 dropdown position after scroll */
.select2-container--open .select2-dropdown {
  z-index: 99999999 !important;
}

/* Fix: prevent dropdown from being clipped inside modal */
.modal-box {
  overflow: visible !important;
}

.modal-box .modal-body {
  overflow-y: auto !important;
  overflow-x: visible !important;
}

/* ===== Client Search Select2 ===== */
.select2-container--default .select2-search--dropdown .select2-search__field {
  font-family: 'Cairo', sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  padding: 10px 14px !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 10px !important;
  direction: rtl !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #f8fafc !important;
  color: #1e293b !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--remind-teal) !important;
  outline: none !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12) !important;
}
.select2-container--default .select2-results__message {
  font-family: 'Cairo', sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #94a3b8 !important;
  text-align: center !important;
  padding: 20px !important;
  direction: rtl !important;
}
.select2-dropdown {
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
  overflow: hidden !important;
  font-family: 'Cairo', sans-serif !important;
}
.select2-container--default .select2-results__option--highlighted {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   CUSTOM SEARCH DROPDOWN (cs-dropdown)
   ============================================================ */
.cs-dropdown-container {
  position: relative;
  width: 100%;
}

.cs-search-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  transition: all 0.2s;
}

.cs-search-input:focus {
  border-color: var(--remind-blue);
  box-shadow: 0 0 0 3px rgba(8, 104, 163, 0.1);
}

.cs-dropdown-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100000;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  animation: slideUp 0.2s ease;
}

.cs-dropdown-panel.open {
  display: block;
}

/* Elevate z-index of card or container when dropdown is open to prevent rendering behind subsequent containers */
.family-payer-box:has(.cs-dropdown-panel.open),
.card:has(.cs-dropdown-panel.open),
.report-card-mobile-stack:has(.cs-dropdown-panel.open),
.input-group-premium:has(.cs-dropdown-panel.open),
.cs-dropdown-container:has(.cs-dropdown-panel.open),
.premium-tool-row:has(.cs-dropdown-panel.open),
.stats-grid:has(.cs-dropdown-panel.open),
.swiper:has(.cs-dropdown-panel.open),
.swiper-wrapper:has(.cs-dropdown-panel.open),
.card:has(.select2-container--open),
.report-card-mobile-stack:has(.select2-container--open),
.input-group-premium:has(.select2-container--open),
.premium-tool-row:has(.select2-container--open),
.stats-grid:has(.select2-container--open),
.swiper:has(.select2-container--open),
.swiper-wrapper:has(.select2-container--open) {
  position: relative !important;
  z-index: 101000 !important;
}

.cs-dropdown-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.cs-dropdown-item:last-child {
  border-bottom: none;
}

.cs-dropdown-item:hover, .cs-dropdown-item.highlighted {
  background: var(--bg-elevated);
}

.cs-dropdown-item .client-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-primary);
}

.cs-dropdown-item .client-code {
  font-size: 11px;
  color: var(--text-muted);
}

.cs-dropdown-item .client-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.cs-badge-balance { background: #dcfce7; color: #16a34a; }
.cs-badge-debt { background: #fee2e2; color: #ef4444; }

.cs-loading, .cs-no-results {
  padding: 15px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Hide native select but keep it for value binding */
.cs-native-select {
  display: none !important;
}

.calendar-trigger-btn:hover {
  background: var(--hover-bg) !important;
  border-color: var(--remind-blue) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ===== Premium Client Registry UI ===== */
#client-search:focus {
  border-color: var(--remind-blue) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1) !important;
  background: white !important;
}

.select2-premium + .select2-container .select2-selection--single {
  height: 48px !important;
  border-radius: 14px !important;
  border: 1.5px solid var(--border-subtle) !important;
  background: white !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
}

.select2-premium + .select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--remind-blue) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1) !important;
}

.select2-premium + .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 48px !important;
}

#client-pagination-dots div {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#client-pagination-dots div:hover {
  transform: scale(1.4);
  background: var(--remind-blue) !important;
}

.admin-client-list-view::-webkit-scrollbar {
  width: 6px;
}

.admin-client-list-view::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}

.admin-client-list-view::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== Premium Filter Bar Redesign ===== */
.premium-filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border-radius: 22px;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 13px;
  margin-left: 10px;
  white-space: nowrap;
  height: 48px; /* Match height of inputs */
}

.filter-label i {
  color: var(--remind-blue);
  font-size: 14px;
}

.premium-refresh-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-refresh-btn:hover {
  background: var(--bg-elevated);
  color: var(--remind-blue);
  transform: rotate(45deg);
  box-shadow: var(--shadow-md);
  border-color: var(--remind-blue);
}

.premium-refresh-btn i {
  transition: transform 0.3s ease;
}

/* Dark Mode Refinements */
[data-theme="dark"] .premium-filter-bar {
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .select2-premium + .select2-container .select2-selection--single {
  background: rgba(15, 23, 42, 0.6) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .select2-premium + .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f8fafc !important;
}

[data-theme="dark"] .premium-refresh-btn {
  background: rgba(30, 41, 59, 0.8);
}

/* Extra Select2 Alignment Fixes */
.premium-filter-bar .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 46px !important; /* Center text vertically */
  padding-right: 8px !important;
}

.premium-filter-bar .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 46px !important;
  top: 1px !important;
}

/* Premium SweetAlert2 Styling */
.premium-swal-popup {
    border-radius: 30px !important;
    background: var(--bg-surface) !important;
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-subtle) !important;
    font-family: 'Cairo', sans-serif !important;
    box-shadow: var(--shadow-2xl) !important;
}

.premium-swal-popup .swal2-title {
    color: var(--text-primary) !important;
    font-weight: 900 !important;
}

.premium-swal-popup .swal2-html-container {
    color: var(--text-muted) !important;
    font-weight: 700 !important;
}

.premium-swal-popup .swal2-confirm {
    border-radius: 14px !important;
    font-weight: 800 !important;
    padding: 12px 25px !important;
}

.premium-swal-popup .swal2-cancel {
    border-radius: 14px !important;
    font-weight: 800 !important;
    padding: 12px 25px !important;
}

/* ============================================================
   APPOINTMENT SLOT PICKER
   ============================================================ */
.appt-slot {
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1.5px solid transparent;
    user-select: none;
    min-width: 58px;
    text-align: center;
}

.appt-slot.available {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.appt-slot.available:hover {
    background: var(--remind-blue);
    color: #fff;
    border-color: var(--remind-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.appt-slot.selected {
    background: var(--remind-blue) !important;
    color: #fff !important;
    border-color: var(--remind-blue) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transform: scale(1.05);
}

.appt-slot.booked {
    background: #fef2f2;
    color: #f87171;
    border-color: #fecaca;
    cursor: not-allowed;
    opacity: 0.7;
    text-decoration: line-through;
}

[data-theme="dark"] .appt-slot.available {
    background: var(--bg-elevated);
    border-color: var(--border-medium);
}

[data-theme="dark"] .appt-slot.booked {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

#appt-day-status {
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
}

/* ============================================================
   REPORT ACTION BUTTONS (View, Print, Share)
   ============================================================ */
.btn-report-action {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.btn-report-action.view-btn {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}
.btn-report-action.view-btn:hover {
    background: #16a34a;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.2);
}

.btn-report-action.print-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.btn-report-action.print-btn:hover {
    background: #1d4ed8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(29, 78, 216, 0.2);
}

.btn-report-action.share-btn {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}
.btn-report-action.share-btn:hover {
    background: #4f46e5;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

/* Small versions inside the history list */
.btn-report-action.view-btn-sm,
.btn-report-action.print-btn-sm,
.btn-report-action.share-btn-sm {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

/* Dark Mode styles for these buttons */
body.dark-mode .btn-report-action.view-btn {
    background: rgba(22, 163, 74, 0.15) !important;
    color: #4ade80 !important;
    border-color: rgba(74, 222, 128, 0.3) !important;
}
body.dark-mode .btn-report-action.view-btn:hover {
    background: #22c55e !important;
    color: white !important;
}

body.dark-mode .btn-report-action.print-btn {
    background: rgba(29, 78, 216, 0.15) !important;
    color: #60a5fa !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}
body.dark-mode .btn-report-action.print-btn:hover {
    background: #3b82f6 !important;
    color: white !important;
}

body.dark-mode .btn-report-action.share-btn {
    background: rgba(79, 70, 229, 0.15) !important;
    color: #818cf8 !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
}
body.dark-mode .btn-report-action.share-btn:hover {
    background: #6366f1 !important;
    color: white !important;
}