/* =============================================
   نظام إدارة المركز التعليمي - الأنماط الرئيسية
   Educational Center CRM - Main Styles
   ============================================= */

/* --- Design Tokens --- */
:root {
    --primary: #00416A;
    --primary-light: #006BAE;
    --primary-lighter: #BCE5FF;
    --primary-rgb: 0, 65, 106;
    --secondary: #36454F;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;

    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;
    --bg-sidebar-active: #00416A;

    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --text-muted: #9ca3af;

    --border-color: #e2e8f0;
    --border-radius: 0.625rem;
    --border-radius-lg: 1rem;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 65px;

    --transition: all 0.3s ease;
  font-family: "IBM Plex Sans", sans-serif;
   --font-body: var(--font-family);
  font-optical-sizing: auto;
    font-weight: 400;
  font-style: normal;
  font-variation-settings:
    "wdth" 100;

}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    direction: rtl;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* =============================================
   PROFESSIONAL SIDEBAR - Premium Design 2025
   ============================================= */

/* Sidebar custom scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0d1117 0%, #10172a 50%, #0d1117 100%);
    color: var(--text-light);
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.05);
    box-shadow: -4px 0 30px rgba(0,0,0,0.4);
}

/* ── Brand Section ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-height: var(--header-height);
    position: relative;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 18px;
    left: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb),0.6), transparent);
}


.sidebar-brand-logo {
    height: 38px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    display: block;
}

@media (max-width: 991px) {
    .sidebar-brand-logo {
        height: 32px;
        max-width: 170px;
    }
}

@media (max-width: 575px) {
    .sidebar-brand-logo {
        height: 28px;
        max-width: 140px;
    }
}


/* ── Navigation ── */
.sidebar-nav {
    padding: 10px 0 6px;
    flex: 1;
}

.sidebar-nav-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 18px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.28);
    font-weight: 700;
    /* ── Sticky Headers ── */
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, #0d1117 60%, transparent 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 2px;
}

.sidebar-nav-label::before {
    content: '';
    width: 14px;
    height: 1px;
    background: rgba(255,255,255,0.18);
    flex-shrink: 0;
}

.sidebar-nav-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.06);
}

.sidebar-nav-item {
    list-style: none;
    padding: 0 10px;
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.55);
    transition: all 0.22s ease;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.sidebar-nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.92);
    transform: translateX(-2px);
}

.sidebar-nav-link:hover::before {
    opacity: 1;
}

.sidebar-nav-link.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb),0.35) 0%, rgba(var(--primary-rgb),0.15) 100%);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(var(--primary-rgb),0.25),
        0 4px 20px rgba(var(--primary-rgb),0.35),
        0 0 40px rgba(var(--primary-rgb),0.12),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.sidebar-nav-link.active::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
}

.sidebar-nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px rgba(var(--primary-rgb),0.7);
}

/* ── Icon Bubbles ── */
.sidebar-nav-link .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.22s ease;
    position: relative;
}

.sidebar-nav-link:hover .nav-icon,
.sidebar-nav-link.active .nav-icon {
    transform: scale(1.08);
}

/* Icon color themes — Outline white by default, Fill white on hover/active */
.nav-icon.ic-blue,
.nav-icon.ic-emerald,
.nav-icon.ic-violet,
.nav-icon.ic-orange,
.nav-icon.ic-amber,
.nav-icon.ic-teal,
.nav-icon.ic-rose,
.nav-icon.ic-pink,
.nav-icon.ic-red,
.nav-icon.ic-indigo,
.nav-icon.ic-cyan,
.nav-icon.ic-lime,
.nav-icon.ic-sky,
.nav-icon.ic-slate,
.nav-icon.ic-primary {
    background: transparent;
    color: rgba(255,255,255,0.75);
    border: 1.5px solid rgba(255,255,255,0.3);
}

.sidebar-nav-link:hover .nav-icon,
.sidebar-nav-link.active .nav-icon {
    background: #ffffff;
    color: #0d2d73 !important;
    border-color: #ffffff;
    box-shadow: 0 3px 12px rgba(255,255,255,0.2);
}

/* ══════════════════════════════════════
   FEATURE 2 — Sidebar Search Bar
   ══════════════════════════════════════ */
.sidebar-search {
    padding: 10px 12px 6px;
    flex-shrink: 0;
}

.sidebar-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-icon {
    position: absolute;
    right: 11px;
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    pointer-events: none;
    transition: color 0.2s;
}

.sidebar-search-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 34px 8px 34px;
    color: rgba(255,255,255,0.85);
    font-size: 12.5px;
    font-family: inherit;
    direction: rtl;
    transition: all 0.22s ease;
    outline: none;
}

.sidebar-search-input::placeholder {
    color: rgba(255,255,255,0.25);
}

.sidebar-search-input:focus {
    background: rgba(255,255,255,0.1);
    border-color: rgba(var(--primary-rgb),0.5);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}

.sidebar-search-input:focus + .sidebar-search-icon,
.sidebar-search-wrap:focus-within .sidebar-search-icon {
    color: rgba(var(--primary-rgb),0.8);
}

.sidebar-search-clear {
    position: absolute;
    left: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
    transition: color 0.2s;
}

.sidebar-search-clear:hover { color: rgba(255,255,255,0.7); }
.sidebar-search-clear.visible { display: flex; align-items: center; }

.sidebar-nav-item.search-hidden { display: none; }

.sidebar-no-results {
    text-align: center;
    padding: 20px 10px;
    color: rgba(255,255,255,0.25);
    font-size: 12px;
    display: none;
}
.sidebar-no-results.visible { display: block; }

/* ══════════════════════════════════════
   FEATURE 3 — Sidebar Collapse
   ══════════════════════════════════════ */
.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-right: auto;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

/* Collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 10px;
}

.sidebar.collapsed .sidebar-brand-logo { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { margin-right: 0; }
.sidebar.collapsed .sidebar-search { display: none; }
.sidebar.collapsed .sidebar-nav-label { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-logout-btn { margin-right: 0; margin-left: 0; }
.sidebar.collapsed .sidebar-user-card {
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 10px 6px;
}
.sidebar.collapsed .sidebar-nav-item { padding: 0 6px; }
.sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 9px 0;
    position: relative;
    overflow: visible;
}
.sidebar.collapsed .nav-icon { width: 38px; height: 38px; }
.sidebar.collapsed .badge { display: none; }

/* ── Tooltip on collapsed (RTL: tooltip appears to the LEFT = into content) ── */
.sidebar.collapsed .sidebar-nav-link::after {
    content: attr(data-label);
    position: fixed;
    right: var(--sidebar-collapsed);
    top: auto;
    transform: none;
    background: #1e293b;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    z-index: 9999;
    margin-right: 8px;
}

.sidebar.collapsed .sidebar-nav-link:hover::after {
    opacity: 1;
}

/* cancel active border-indicator when collapsed (conflicts with tooltip ::after) */
.sidebar.collapsed .sidebar-nav-link.active::after {
    content: attr(data-label);
    width: auto;
    height: auto;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    top: auto;
    transform: none;
}

/* Main content shift when collapsed */
.main-header.sidebar-collapsed-header { right: var(--sidebar-collapsed); }
.main-content.sidebar-collapsed-content { margin-right: var(--sidebar-collapsed); }

/* ══════════════════════════════════════
   FEATURE 5 — Skeleton Loading
   ══════════════════════════════════════ */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.sidebar-skeleton {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #0d1117;
    z-index: 1041;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.sidebar-skeleton.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar-skeleton .sk-brand {
    height: 44px;
    border-radius: 12px;
    margin-bottom: 6px;
}

.sidebar-skeleton .sk-search {
    height: 36px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.sidebar-skeleton .sk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.sidebar-skeleton .sk-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
}

.sidebar-skeleton .sk-text {
    height: 14px;
    border-radius: 6px;
    flex: 1;
}

.sk-brand, .sk-search, .sk-icon, .sk-text {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.05) 75%
    );
    background-size: 400px 100%;
    animation: shimmer 1.4s infinite linear;
}

/* ── User Footer ── */
.sidebar-user-footer {
    flex-shrink: 0;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.2);
    position: relative;
}

.sidebar-user-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 12px;
    left: 12px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb),0.4), transparent);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    transition: all 0.22s ease;
    cursor: default;
}

.sidebar-user-card:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(var(--primary-rgb),0.35);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.38);
    white-space: nowrap;
    line-height: 1.3;
}

.sidebar-logout-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(239,68,68,0.12);
    border: none;
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-logout-btn:hover {
    background: rgba(239,68,68,0.25);
    color: #fca5a5;
    transform: scale(1.08);
}

/* --- Header --- */
.main-header {
    position: fixed;
    top: 0;
    right: var(--sidebar-width);
    left: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.header-user:hover {
    background: var(--bg-body);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
}

/* --- Main Content --- */
.main-content {
    margin-right: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.breadcrumb-custom {
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-custom a {
    color: var(--primary);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* --- Stat Cards --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card-icon.primary {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.stat-card-icon.success {
    background: rgba(25,135,84,0.1);
    color: var(--success);
}

.stat-card-icon.warning {
    background: rgba(255,193,7,0.15);
    color: #b8860b;
}

.stat-card-icon.danger {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

.stat-card-icon.info {
    background: rgba(13,202,240,0.1);
    color: #0aa2c0;
}

.stat-card-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.stat-card-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* --- Tables --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-toolbar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.table {
    margin-bottom: 0;
    font-size: 13px;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.03);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Forms --- */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 14px;
    font-size: 14px;
    transition: var(--transition);
    font-family: var(--font-family);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    font-family: var(--font-family);
    font-weight: 600;
    border-radius: var(--border-radius);
    padding: 8px 18px;
    font-size: 14px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

/* --- Badges --- */
.badge-stage {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.badge-success-soft { background: rgba(25,135,84,0.1); color: var(--success); }
.badge-warning-soft { background: rgba(255,193,7,0.15); color: #b8860b; }
.badge-danger-soft { background: rgba(220,53,69,0.1); color: var(--danger); }
.badge-info-soft { background: rgba(13,202,240,0.1); color: #0aa2c0; }

/* --- Attendance Page --- */
.attendance-scanner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.scanner-icon {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 48px;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.3); }
    70% { box-shadow: 0 0 0 20px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.scanner-input {
    max-width: 400px;
    margin: 0 auto;
}

.scanner-input .form-control {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 14px;
    border-radius: var(--border-radius);
}

.scanner-input .form-control::placeholder {
    color: rgba(255,255,255,0.6);
}

.scanner-input .form-control:focus {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
}

.attendance-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 350px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.attendance-record {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.attendance-record:hover {
    box-shadow: var(--shadow-sm);
}

.attendance-record .record-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.attendance-record .record-icon.check-in {
    background: rgba(25,135,84,0.1);
    color: var(--success);
}

.attendance-record .record-icon.check-out {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: white;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Search Page --- */
.search-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    color: white;
    margin-bottom: 24px;
}

.search-hero h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.search-input-wrapper {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper .form-control {
    padding: 14px 20px 14px 50px;
    border-radius: 50px;
    border: none;
    font-size: 16px;
}

.search-input-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

/* --- Settings --- */
.settings-nav .nav-link {
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
}

.settings-nav .nav-link.active {
    background: var(--primary);
    color: white;
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(110%);
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    }
    .main-header {
        right: 0;
    }
    .main-content {
        margin-right: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 1035;
    }
    .sidebar-overlay.show {
        display: block;
    }
    /* Compact nav items on mobile */
    .sidebar-nav-item { padding: 0 8px; }
    .sidebar-brand { padding: 16px 14px; }
    .sidebar-user-footer { padding: 10px 10px 14px; }

    /* ── Disable collapse on mobile — sidebar is off-canvas ── */
    .sidebar-collapse-btn { display: none !important; }
    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
        transform: translateX(110%);
    }
    .sidebar.collapsed.show {
        transform: translateX(0) !important;
    }
    .sidebar.collapsed .sidebar-brand-logo { display: block !important; }
    .sidebar.collapsed .sidebar-search { display: block !important; }
    .sidebar.collapsed .sidebar-nav-label {
        opacity: 1 !important; height: auto !important;
        padding: 16px 18px 6px !important; margin: 0 !important;
        overflow: visible !important;
    }
    .sidebar.collapsed .nav-text { display: inline !important; }
    .sidebar.collapsed .sidebar-user-info { display: block !important; }
    .sidebar.collapsed .sidebar-user-card { justify-content: flex-start !important; padding: 10px 11px !important; }
    .sidebar.collapsed .sidebar-nav-item { padding: 0 8px !important; }
    .sidebar.collapsed .sidebar-nav-link { justify-content: flex-start !important; padding: 9px 12px !important; }
    .sidebar.collapsed .nav-icon { width: 34px !important; height: 34px !important; }
    .sidebar.collapsed .badge { display: inline-flex !important; }
    .main-header.sidebar-collapsed-header { right: 0 !important; }
    .main-content.sidebar-collapsed-content { margin-right: 0 !important; }
}

@media (max-width: 575px) {
    .main-content {
        padding: 16px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    .stat-card-info h3 {
        font-size: 20px;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* =============================================
   SMART DASHBOARD — Customizable Widgets
   ============================================= */

/* ── Toolbar ── */
.dash-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.dash-toolbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.dash-customize-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.dash-customize-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),0.35);
    transform: translateY(-1px);
}

/* ── Widget Grids ── */
.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dash-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

.dash-wide-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

.dash-wide  { grid-column: 1; }
.dash-narrow{ grid-column: 2; }

/* ── Widget base ── */
.dash-widget {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.dash-widget.widget-hidden {
    display: none !important;
}

/* ── Drag states ── */
.widget-ghost {
    opacity: 0.35;
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: var(--border-radius-lg);
}

.widget-chosen {
    box-shadow: 0 8px 30px rgba(var(--primary-rgb), 0.2) !important;
}

.widget-dragging {
    opacity: 0.9;
    transform: rotate(1deg) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,0.15) !important;
}

/* ── Hide button on cards ── */
.widget-hide-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.18s ease;
    line-height: 1;
    flex-shrink: 0;
}

.widget-hide-btn:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

/* ── Stat card drag handle ── */
.stat-card {
    position: relative;
    cursor: grab;
}

.stat-card:active { cursor: grabbing; }

.stat-card .widget-hide-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.stat-card:hover .widget-hide-btn { opacity: 1; }

/* ── Restore Bar ── */
.dash-restore-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Customize Panel ── */
.dash-customize-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1060;
    transition: opacity 0.25s ease;
}

.dash-customize-overlay.open { display: block; }

.dash-customize-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1061;
    box-shadow: 4px 0 40px rgba(0,0,0,0.18);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-customize-panel.open {
    transform: translateX(0);
}

.dash-customize-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.dash-customize-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.dash-customize-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-customize-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 14px;
}

.dash-customize-close:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.dash-customize-hint {
    padding: 12px 20px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--bg-body);
    margin: 0;
    flex-shrink: 0;
}

.dash-widget-toggles {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-widget-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.18s ease;
    gap: 10px;
}

.dash-widget-toggle-item:hover {
    border-color: rgba(var(--primary-rgb),0.3);
    background: rgba(var(--primary-rgb),0.04);
}

.dash-widget-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.dash-widget-toggle-info i {
    font-size: 16px;
    color: var(--primary);
    flex-shrink: 0;
}

/* ── Toggle Switch ── */
.dash-toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.dash-toggle-switch input { display: none; }

.dash-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: all 0.22s ease;
}

.dash-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    right: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.22s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.dash-toggle-switch input:checked + .dash-toggle-slider {
    background: var(--primary);
}

.dash-toggle-switch input:checked + .dash-toggle-slider::before {
    right: calc(100% - 21px);
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-wide-grid { grid-template-columns: 1fr; }
    .dash-narrow { grid-column: 1; }
}

@media (max-width: 768px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-cards-grid { grid-template-columns: 1fr; gap: 10px; }
    .dash-wide-grid { grid-template-columns: 1fr; gap: 10px; }
    .dash-toolbar-title { font-size: 15px; }
    .dash-customize-panel { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .dash-stat-grid { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gap-grid { gap: 20px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* --- Activity Timeline --- */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
}

/* --- Print --- */
@media print {
    .sidebar, .main-header, .btn, .table-toolbar { display: none !important; }
    .main-content { margin: 0; padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   PAYMENTS PAGE — Professional Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Hero ──────────────────────────────────────────────────────── */
.pay-hero {
    background: linear-gradient(135deg, #0d1b3e 0%, #0a2a6e 50%, #0d3b7a 100%);
    border-radius: 16px;
    padding: 28px 32px 22px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.pay-hero::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 250px; height: 250px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.pay-hero::after {
    content: '';
    position: absolute;
    bottom: -80px; right: -40px;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}
.pay-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}
.pay-hero-title {
    display: flex;
    align-items: center;
    gap: 16px;
}
.pay-hero-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    backdrop-filter: blur(10px);
}
.pay-hero h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}
.pay-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}
.pay-breadcrumb a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color .2s;
}
.pay-breadcrumb a:hover { color: #fff; }
.pay-breadcrumb i { font-size: 10px; }

.pay-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #0a2a6e;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.pay-add-btn:hover {
    background: #f0f4ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* ── Filter Bar ───────────────────────────────────────────────── */
.pay-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.pay-filter-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 160px;
}
.pay-filter-item label {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    font-weight: 600;
}
.pay-filter-input {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 9px;
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    font-family: 'Cairo', sans-serif;
    outline: none;
    transition: all .2s;
    width: 100%;
}
.pay-filter-input option { background: #0d1b3e; color: #fff; }
.pay-filter-input:focus {
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.18);
}
.pay-filter-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 9px;
    padding: 8px 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    white-space: nowrap;
}
.pay-filter-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.pay-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
@media (max-width: 991px) { .pay-stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .pay-stats-row { grid-template-columns: 1fr; } }

.pay-stat-card {
    border-radius: 16px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform .2s, box-shadow .2s;
}
.pay-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.pay-stat-green  { background: linear-gradient(135deg, #1a7a4a, #22a05a); color: #fff; }
.pay-stat-blue   { background: linear-gradient(135deg, #0a2a6e, #1a4bc4); color: #fff; }
.pay-stat-red    { background: linear-gradient(135deg, #8b1a2a, #c62535); color: #fff; }
.pay-stat-purple { background: linear-gradient(135deg, #4a1270, #7b2fbe); color: #fff; }

.pay-stat-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.pay-stat-body { flex: 1; }
.pay-stat-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
}
.pay-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 3px;
}
.pay-stat-wave {
    position: absolute;
    bottom: -18px; left: -10px;
    width: 120px; height: 80px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

/* ── Progress Ring ────────────────────────────────────────────── */
.pay-stat-ring-wrap {
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.pay-ring {
    width: 52px; height: 52px;
    transform: rotate(-90deg);
}
.pay-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 3;
}
.pay-ring-fill {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray .6s ease;
}
.pay-ring-pct {
    position: absolute;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.pay-tabs-wrap {
    margin-bottom: 20px;
}
.pay-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    width: fit-content;
}
.pay-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.pay-tab:hover { background: var(--bg-body); color: var(--text-primary); }
.pay-tab.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.12), rgba(var(--primary-rgb),.06));
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb),.15);
}
.pay-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(var(--primary-rgb),.12);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}
.pay-tab-badge-red {
    background: rgba(220,53,69,.12);
    color: #dc3545;
}
.pay-tab-content { display: none; }
.pay-tab-content.active { display: block; }

/* ── Table Card ───────────────────────────────────────────────── */
.pay-table-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}
.pay-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}
.pay-table-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.pay-table-search-wrap {
    position: relative;
}
.pay-table-search-icon {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    right: 12px;
    color: var(--text-muted);
    font-size: 14px;
}
.pay-table-search {
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    outline: none;
    width: 220px;
    transition: border-color .2s;
}
.pay-table-search:focus { border-color: var(--primary); }

/* ── Table ────────────────────────────────────────────────────── */
.pay-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.pay-table thead tr {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
}
.pay-table thead th {
    padding: 13px 16px;
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.pay-table tbody tr {
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background .15s;
}
.pay-table tbody tr:hover { background: rgba(var(--primary-rgb),.03); }
.pay-table tbody td { padding: 12px 16px; vertical-align: middle; }
.pay-table tfoot td { padding: 13px 16px; }
.pay-row-num { color: var(--text-muted); font-size: 12px; }
.pay-date { color: var(--text-secondary); font-size: 13px; }

.pay-student-cell { display: flex; align-items: center; gap: 10px; }
.pay-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.15), rgba(var(--primary-rgb),.25));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}
.pay-student-name { font-weight: 600; color: var(--text-primary); }
.pay-student-grade { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.pay-amount {
    font-weight: 800;
    color: #1a7a4a;
    font-size: 14px;
}
.pay-month-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(var(--primary-rgb),.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}
.pay-method {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
}
.pay-method-cash     { background: rgba(25,135,84,.12);  color: #198754; }
.pay-method-card     { background: rgba(10,42,110,.12);  color: #0a2a6e; }
.pay-method-transfer { background: rgba(13,202,240,.12); color: #0dcaf0; }
.pay-method-other    { background: rgba(108,117,125,.12);color: #6c757d; }

.pay-actions { display: flex; gap: 6px; align-items: center; }
.pay-action-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.pay-action-print  { background: rgba(13,202,240,.12); color: #0dcaf0; }
.pay-action-edit   { background: rgba(var(--primary-rgb),.1); color: var(--primary); }
.pay-action-delete { background: rgba(220,53,69,.1); color: #dc3545; }
.pay-action-btn:hover { filter: brightness(0.85); transform: scale(1.1); }

.pay-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.pay-empty i { font-size: 40px; }

/* ── Summary Table total row ──────────────────────────────────── */
.pay-summary-total td {
    background: rgba(var(--primary-rgb),.05);
    border-top: 2px solid rgba(var(--primary-rgb),.15);
}

/* ── Progress bars (summary tab) ──────────────────────────────── */
.pay-progress-wrap {
    display: flex; align-items: center; gap: 10px;
}
.pay-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-body);
    border-radius: 10px;
    overflow: hidden;
}
.pay-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    transition: width .5s ease;
}
.pay-progress-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 34px;
}

/* ── Unpaid grid ──────────────────────────────────────────────── */
.pay-unpaid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    padding: 20px;
}
.pay-unpaid-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-body);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    transition: all .2s;
}
.pay-unpaid-card:hover {
    border-color: rgba(220,53,69,.3);
    box-shadow: 0 4px 14px rgba(220,53,69,.08);
}
.pay-unpaid-avatar {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: rgba(220,53,69,.12);
    color: #dc3545;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
}
.pay-unpaid-info { flex: 1; min-width: 0; }
.pay-unpaid-name {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pay-unpaid-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    flex-wrap: wrap;
}
.pay-quick-btn {
    background: linear-gradient(135deg, #1a7a4a, #22a05a);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
    flex-shrink: 0;
}
.pay-quick-btn:hover { filter: brightness(1.1); transform: scale(1.04); }

.pay-all-paid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}
.pay-all-paid-icon {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(25,135,84,.12);
    color: #198754;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
}
.pay-all-paid h4 { margin: 0; font-weight: 700; color: #198754; }
.pay-all-paid p { margin: 0; font-size: 14px; }

/* ── Modal ────────────────────────────────────────────────────── */
.pay-modal { border: none; border-radius: 18px; overflow: hidden; }
.pay-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    background: linear-gradient(135deg, #0d1b3e 0%, #0a2a6e 100%);
    position: relative;
}
.pay-modal-header-edit {
    background: linear-gradient(135deg, #2d1b00 0%, #7a4400 100%);
}
.pay-modal-icon {
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}
.pay-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.pay-modal-sub { font-size: 12.5px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.pay-modal-close {
    margin-right: auto;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.pay-modal-close:hover { background: rgba(255,255,255,0.25); }

.pay-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.pay-input, .pay-select {
    width: 100%;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 13.5px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.pay-input:focus, .pay-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1);
    background: #fff;
}
.pay-input-group {
    display: flex;
    align-items: center;
}
.pay-input-group .pay-input { border-radius: 10px 0 0 10px; border-left: none; }
.pay-input-suffix {
    background: var(--bg-body);
    border: 1.5px solid var(--border-color);
    border-right: none;
    border-radius: 0 10px 10px 0;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pay-method-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pay-method-opt { cursor: pointer; }
.pay-method-opt input[type="radio"] { display: none; }
.pay-method-opt span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-body);
    transition: all .2s;
}
.pay-method-opt input:checked + span {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb),.08);
    color: var(--primary);
}
.pay-method-opt:hover span { border-color: var(--primary); }

/* ── Smart Student Search ─────────────────────────────────────── */
.pay-student-search-wrap {
    position: relative;
}
.pay-student-search-icon {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    right: 13px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}
.pay-student-search-input {
    padding-right: 38px !important;
    padding-left: 36px !important;
}
.pay-student-clear {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    left: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color .2s;
}
.pay-student-clear:hover { color: #dc3545; }

.pay-student-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0; left: 0;
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
}
.pay-student-dropdown.open { display: block; }
.pay-student-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .15s;
}
.pay-student-dd-item:hover { background: rgba(var(--primary-rgb),.06); }
.pay-student-dd-item:first-child { border-radius: 10px 10px 0 0; }
.pay-student-dd-item:last-child  { border-radius: 0 0 10px 10px; }
.pay-student-dd-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.15), rgba(var(--primary-rgb),.25));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800;
    flex-shrink: 0;
}
.pay-student-dd-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.pay-student-dd-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.pay-student-dd-empty {
    padding: 16px 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.pay-student-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(var(--primary-rgb),.06);
    border: 1.5px solid rgba(var(--primary-rgb),.2);
    border-radius: 12px;
    padding: 10px 14px;
}
.pay-student-selected-avatar {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.2), rgba(var(--primary-rgb),.35));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    flex-shrink: 0;
}
.pay-student-selected-info { flex: 1; }
.pay-student-selected-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.pay-student-selected-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pay-student-selected-clear {
    background: rgba(220,53,69,.1);
    border: none;
    border-radius: 8px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    color: #dc3545;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.pay-student-selected-clear:hover { background: rgba(220,53,69,.2); }

.pay-edit-alert {
    background: rgba(255,152,0,.1);
    border: 1px solid rgba(255,152,0,.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #e65100;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
}
.pay-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}
.pay-modal-cancel {
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 22px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.pay-modal-cancel:hover { border-color: #aaa; color: var(--text-primary); }
.pay-modal-submit {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 24px;
    font-size: 13.5px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),.3);
}
.pay-modal-submit:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pay-modal-submit:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.pay-modal-submit-edit {
    background: linear-gradient(135deg, #7a4400, #d97706);
    box-shadow: 0 4px 14px rgba(217,119,6,.3);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 767px) {
    .pay-hero { padding: 20px 18px 18px; }
    .pay-hero h1 { font-size: 18px; }
    .pay-tabs { flex-wrap: wrap; }
    .pay-table-search { width: 160px; }
    .pay-unpaid-grid { grid-template-columns: 1fr; }
    .pay-filter-bar { gap: 8px; }
    .pay-filter-item { min-width: 130px; }
}
