@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*,*::before,*::after{box-sizing:border-box}

:root{
  --primary:#10b981;
  --primary-dark:#059669;
  --primary-light:#d1fae5;
  --secondary:#1e3a5f;
  --secondary-dark:#0f2744;
  --danger:#ef4444;
  --warning:#f59e0b;
  --info:#3b82f6;
  --purple:#8b5cf6;
  --surface:#ffffff;
  --bg:#f3f4f6;
  --text:#111827;
  --text-muted:#6b7280;
  --border:#e5e7eb;
  --shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:0 10px 25px -5px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05);
  --radius:.75rem;
  --radius-lg:1.25rem;
  --sidebar-width:260px
}

body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);margin:0;padding:0;-webkit-font-smoothing:antialiased}

/* ── SIDEBAR ────────────────────────── */
.sidebar{width:var(--sidebar-width);min-height:100vh;background:linear-gradient(180deg,var(--secondary) 0%,var(--secondary-dark) 100%);display:flex;flex-direction:column;flex-shrink:0;transition:transform .3s cubic-bezier(.4,0,.2,1);z-index:50;overflow-y:auto}
.sidebar-header{padding:1.5rem;border-bottom:1px solid rgba(255,255,255,.08)}
.logo-container{display:flex;align-items:center;gap:.75rem}
.logo-container img{height:36px;width:auto;background:white;padding:3px;border-radius:8px}
.logo-text{font-size:1.3rem;font-weight:800;color:white;letter-spacing:-.02em}
.sidebar-user{margin:.5rem 1rem;padding:.5rem .75rem}
.sidebar-user-role{display:inline-block;font-size:.65rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;padding:2px 8px;border-radius:999px;background:rgba(16,185,129,.25);color:#6ee7b7;margin-top:3px}
.sidebar nav{flex:1;padding:.5rem .75rem}
.nav-section-title{font-size:.65rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:rgba(255,255,255,.35);padding:.75rem .75rem .35rem}
.nav-item{display:flex;align-items:center;gap:.75rem;padding:.65rem .875rem;border-radius:var(--radius);color:rgba(255,255,255,.7);font-size:.875rem;font-weight:500;transition:all .2s;cursor:pointer;margin-bottom:2px;background:none;border:none;width:100%;text-align:left}
.nav-item:hover{background:rgba(255,255,255,.1);color:white;transform:translateX(3px)}
.nav-item.active{background:rgba(16,185,129,.25);color:#6ee7b7;font-weight:600;border-left:3px solid #10b981}
.nav-item i{width:18px;text-align:center;flex-shrink:0}
.nav-item-logout{color:rgba(252,165,165,.8)!important}
.nav-item-logout:hover{background:rgba(239,68,68,.2)!important;color:#fca5a5!important}
.sidebar-footer{padding:.75rem;border-top:1px solid rgba(255,255,255,.08);display:flex;flex-direction:column;gap:.25rem;margin-top:auto}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:40;backdrop-filter:blur(2px)}

@media(max-width:768px){
  .sidebar{position:fixed;top:0;left:0;height:100vh;transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0);box-shadow:0 0 40px rgba(0,0,0,.4)}
  .sidebar-overlay.active{display:block}
}

/* ── LAYOUT ─────────────────────────── */
.app-layout{display:flex;min-height:100vh}
.main-content{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}

/* ── TOPBAR ─────────────────────────── */
.topbar{display:flex;align-items:center;justify-content:space-between;padding:.875rem 1.5rem;background:white;border-bottom:1px solid var(--border);box-shadow:0 1px 3px rgba(0,0,0,.05);position:sticky;top:0;z-index:30}
.topbar-logo{display:flex;align-items:center;gap:.5rem}
.topbar-logo img{height:28px}
.topbar-logo span{font-weight:800;font-size:1.1rem;color:var(--secondary)}
.menu-btn{background:none;border:none;padding:.5rem;border-radius:.5rem;cursor:pointer;color:var(--text);font-size:1.2rem;display:flex;align-items:center;justify-content:center;transition:background .2s}
.menu-btn:hover{background:var(--bg)}
.topbar-actions{display:flex;align-items:center;gap:.5rem}
.topbar-profile-btn{display:flex;align-items:center;gap:.5rem;background:none;border:1.5px solid var(--border);border-radius:var(--radius);padding:.35rem .625rem .35rem .35rem;cursor:pointer;transition:all .2s;color:var(--text);font-family:inherit}
.topbar-profile-btn:hover{background:var(--bg);border-color:var(--primary)}
.topbar-username{font-size:.8rem;font-weight:600;color:var(--text);max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

@media(max-width:640px){
  .topbar-username, .topbar-export-label { display:none!important }
  .topbar-actions .btn-ghost span { display:none!important }
  .topbar-logo span { font-size: 0.9rem; }
}

/* ── PAGE CONTENT ────────────────────── */
.page-content{flex:1;padding:1.5rem 2rem;overflow-y:auto}
@media(max-width:1024px){.page-content{padding:1.25rem 1.5rem}}
@media(max-width:768px){.page-content{padding:1rem}}

/* ── PAGE HEADER ────────────────────── */
.page-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:1.5rem;gap:1rem;flex-wrap:wrap}
.page-title{font-size:1.75rem;font-weight:800;color:var(--text);letter-spacing:-.02em;margin:0;line-height:1.2}
.page-subtitle{font-size:.85rem;color:var(--text-muted);margin-top:3px}
@media(max-width:768px){.page-header{flex-direction:column;align-items:flex-start}}

/* ── BUTTONS ────────────────────────── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.55rem 1.1rem;border-radius:var(--radius);font-weight:600;font-size:.875rem;cursor:pointer;border:none;transition:all .2s;text-decoration:none;line-height:1.4;white-space:nowrap;font-family:inherit}
.btn:disabled{opacity:.6;cursor:not-allowed;transform:none!important}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:white;box-shadow:0 4px 12px rgba(16,185,129,.3)}
.btn-primary:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 16px rgba(16,185,129,.4)}
.btn-secondary{background:white;color:var(--text);border:1.5px solid var(--border)}
.btn-secondary:hover:not(:disabled){background:var(--bg);border-color:#d1d5db}
.btn-ghost{background:transparent;border:none;color:var(--text-muted);padding:.25rem .5rem;border-radius:var(--radius);cursor:pointer;transition:all .2s}
.btn-ghost:hover{background:var(--bg);color:var(--text)}
.btn-danger{background:linear-gradient(135deg,#ef4444,#dc2626);color:white;box-shadow:0 4px 12px rgba(239,68,68,.25)}
.btn-danger:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 16px rgba(239,68,68,.35)}
.btn-warning{background:linear-gradient(135deg,#f59e0b,#d97706);color:white}
.btn-warning:hover:not(:disabled){transform:translateY(-1px)}
.btn-info{background:rgba(59,130,246,.1);color:#3b82f6;border:1px solid rgba(59,130,246,.3)}
.btn-info:hover:not(:disabled){background:rgba(59,130,246,.2);color:#1d4ed8}
.btn-sm{padding:.35rem .75rem;font-size:.8rem}
.btn-icon{width:32px;height:32px;padding:0;border-radius:.5rem}
.btn-icon-lg{width:38px;height:38px;padding:0;border-radius:.625rem}

/* ── CARDS ──────────────────────────── */
.card{background:white;border-radius:var(--radius-lg);box-shadow:0 1px 3px rgba(0,0,0,.07),0 1px 2px rgba(0,0,0,.04);border:1px solid var(--border)}
.card-header{padding:1.25rem 1.5rem;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.card-title{font-size:1rem;font-weight:700;color:var(--text);display:flex;align-items:center;gap:.625rem;margin:0}
.card-title-accent{width:3px;height:18px;background:var(--primary);border-radius:2px;display:inline-block}
.card-body{padding:1.5rem}

/* ── STAT CARDS ─────────────────────── */
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;margin-bottom:1.5rem}
.stat-card{border-radius:var(--radius-lg);padding:1.375rem;color:white;box-shadow:var(--shadow-lg);position:relative;overflow:hidden;transition:transform .2s}
.stat-card:hover{transform:translateY(-2px)}
.stat-card::after{content:'';position:absolute;top:-30px;right:-20px;width:80px;height:80px;border-radius:50%;background:rgba(255,255,255,.1)}
.stat-card-icon{width:44px;height:44px;border-radius:12px;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;font-size:1.25rem;margin-bottom:.875rem}
.stat-card-value{font-size:1.75rem;font-weight:800;line-height:1;margin-bottom:4px}
.stat-card-label{font-size:.75rem;opacity:.8;font-weight:500;text-transform:uppercase;letter-spacing:.05em}
.stat-card-trend{font-size:.7rem;opacity:.7;margin-top:.25rem}
.stat-card-green{background:linear-gradient(135deg,#10b981,#059669)}
.stat-card-blue{background:linear-gradient(135deg,#3b82f6,#2563eb)}
.stat-card-amber{background:linear-gradient(135deg,#f59e0b,#d97706)}
.stat-card-rose{background:linear-gradient(135deg,#f43f5e,#e11d48)}
.stat-card-purple{background:linear-gradient(135deg,#8b5cf6,#7c3aed)}
.stat-card-cyan{background:linear-gradient(135deg,#06b6d4,#0891b2)}

/* ── TABLE ──────────────────────────── */
.table-container{overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse}
thead tr{background:#f9fafb;border-bottom:2px solid var(--border)}
th{padding:.875rem 1.25rem;text-align:left;font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);white-space:nowrap}
tbody tr{border-bottom:1px solid #f3f4f6;transition:background .15s}
tbody tr:last-child{border-bottom:none}
tbody tr:hover{background:#f9fafb}
td{padding:.875rem 1.25rem;font-size:.875rem;vertical-align:middle}
.td-primary{font-weight:600;color:var(--text)}
.td-secondary{color:var(--text-muted);font-size:.8rem;margin-top:2px}

/* ── BADGES ─────────────────────────── */
.badge{display:inline-flex;align-items:center;gap:.3rem;padding:.25rem .6rem;border-radius:999px;font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.03em}
.badge-dot{width:6px;height:6px;border-radius:50%;background:currentColor}
.badge-success{background:#d1fae5;color:#065f46}
.badge-danger{background:#fee2e2;color:#991b1b}
.badge-warning{background:#fef3c7;color:#92400e}
.badge-info{background:#dbeafe;color:#1e40af}
.badge-purple{background:#ede9fe;color:#5b21b6}
.badge-gray{background:#f3f4f6;color:#374151}
.badge-cyan{background:#cffafe;color:#0e7490}

/* ── FORMS ──────────────────────────── */
.form-group{margin-bottom:1.125rem}
.form-label{display:block;font-size:.8rem;font-weight:600;color:#374151;margin-bottom:.4rem}
.form-label .required{color:var(--danger);margin-left:2px}
.form-input{width:100%;padding:.6rem .875rem;border:1.5px solid var(--border);border-radius:var(--radius);font-size:.875rem;font-family:inherit;background:white;color:var(--text);transition:all .2s;outline:none;-webkit-appearance:none}
.form-input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(16,185,129,.12)}
.form-input.error{border-color:var(--danger);box-shadow:0 0 0 3px rgba(239,68,68,.1)}
.form-input-icon{position:relative;display:flex;align-items:center}
.form-input-icon>i.fas{position:absolute;left:.875rem;color:var(--text-muted);z-index:1;pointer-events:none}
.form-input-icon .form-input{padding-left:2.5rem}
.form-input-toggle{position:absolute;right:.5rem;background:none;border:none;cursor:pointer;color:var(--text-muted);padding:.25rem;border-radius:4px}
.form-input-toggle:hover{color:var(--text)}
.toggle{position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0}
.toggle input{opacity:0;width:0;height:0}
.toggle-slider{position:absolute;cursor:pointer;inset:0;background:#d1d5db;border-radius:24px;transition:.3s}
.toggle-slider:before{content:'';position:absolute;height:18px;width:18px;left:3px;bottom:3px;background:white;border-radius:50%;transition:.3s}
.toggle input:checked+.toggle-slider{background:var(--primary)}
.toggle input:checked+.toggle-slider:before{transform:translateX(20px)}
select.form-input,.form-select{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .625rem center;background-size:1rem;padding-right:2.25rem}
.form-select{width:100%;padding:.6rem .875rem;border:1.5px solid var(--border);border-radius:var(--radius);font-size:.875rem;font-family:inherit;background-color:white;color:var(--text);transition:all .2s;outline:none;-webkit-appearance:none}
.form-select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(16,185,129,.12)}
.form-select-sm{padding:.35rem .625rem;font-size:.75rem;max-width:200px}
textarea.form-input{resize:vertical;min-height:80px}
.form-row{display:grid;gap:1rem}
.form-row-2{grid-template-columns:repeat(2,1fr)}
.form-row-3{grid-template-columns:repeat(3,1fr)}
@media(max-width:640px){.form-row-2,.form-row-3{grid-template-columns:1fr}}

/* ── MODAL ──────────────────────────── */
.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);backdrop-filter:blur(4px);z-index:100;align-items:center;justify-content:center;padding:1rem}
.modal-backdrop.active{display:flex}
.modal{background:white;border-radius:1.5rem;box-shadow:0 25px 50px rgba(0,0,0,.2);width:100%;max-width:560px;max-height:90vh;overflow-y:auto;animation:modalIn .25s cubic-bezier(.4,0,.2,1)}
.modal-lg{max-width:720px}
.modal-xl{max-width:900px}
.modal-sm{max-width:400px}
@keyframes modalIn{from{opacity:0;transform:scale(.95) translateY(10px)}to{opacity:1;transform:scale(1) translateY(0)}}
.modal-header{padding:1.25rem 1.5rem;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-title{font-size:1.1rem;font-weight:700;color:var(--text);display:flex;align-items:center;gap:.5rem;margin:0}
.modal-close{width:32px;height:32px;border-radius:8px;border:none;background:var(--bg);color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:1rem}
.modal-close:hover{background:#fee2e2;color:var(--danger)}
.modal-body{padding:1.5rem}
.modal-footer{padding:1.25rem 1.5rem;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:.75rem;flex-wrap:wrap}

/* ── TOAST ──────────────────────────── */
#toast-container{position:fixed;top:1rem;right:1rem;z-index:9999;display:flex;flex-direction:column;gap:.5rem;max-width:360px;width:calc(100% - 2rem)}
.toast{display:flex;align-items:flex-start;gap:.75rem;padding:.875rem 1.125rem;border-radius:var(--radius);background:white;box-shadow:0 10px 25px rgba(0,0,0,.12);border-left:4px solid;animation:slideIn .3s cubic-bezier(.4,0,.2,1)}
@keyframes slideIn{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}
.toast-success{border-color:var(--primary)}.toast-error{border-color:var(--danger)}.toast-warning{border-color:var(--warning)}.toast-info{border-color:var(--info)}
.toast-icon{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:.7rem;color:white}
.toast-success .toast-icon{background:var(--primary)}.toast-error .toast-icon{background:var(--danger)}.toast-warning .toast-icon{background:var(--warning)}.toast-info .toast-icon{background:var(--info)}
.toast-message{font-size:.85rem;font-weight:500;color:var(--text);flex:1;line-height:1.4}
.toast-close{background:none;border:none;color:currentColor;cursor:pointer;font-size:1.1rem;padding:0 0 0 .5rem;opacity:.6;flex-shrink:0}
.toast-close:hover{opacity:1}

/* ── SEARCH & FILTER ────────────────── */
.search-box{position:relative;flex:1;min-width:200px;max-width:320px}
.search-box i{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);color:var(--text-muted);font-size:.875rem;pointer-events:none}
.search-box input{width:100%;padding:.55rem .875rem .55rem 2.25rem;border:1.5px solid var(--border);border-radius:var(--radius);font-size:.875rem;font-family:inherit;background:white;outline:none;transition:all .2s}
.search-box input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(16,185,129,.1)}

/* ── LOADING ────────────────────────── */
.loading-overlay{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:1rem;min-height:200px;color:var(--text-muted);font-size:.875rem}
.spinner{width:36px;height:36px;border:3px solid #e5e7eb;border-top-color:var(--primary);border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2.5rem;color:var(--text-muted);gap:.75rem}
.empty-state i{font-size:2rem;opacity:.4}
.empty-state p{margin:0;font-size:.9rem}

/* ── PROGRESS BAR ───────────────────── */
.progress-bar{height:8px;background:#f3f4f6;border-radius:999px;overflow:hidden}
.progress-bar-fill{height:100%;background:linear-gradient(90deg,var(--primary),var(--primary-dark));border-radius:999px;transition:width .5s ease}
.progress-label{display:flex;justify-content:space-between;font-size:.75rem;color:var(--text-muted);margin-top:.25rem}

/* ── TABS ───────────────────────────── */
.tabs{display:flex;gap:.25rem;border-bottom:2px solid var(--border);margin-bottom:1.25rem;overflow-x:auto}
.tab-btn{padding:.625rem 1.25rem;font-size:.875rem;font-weight:600;color:var(--text-muted);border:none;background:none;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;white-space:nowrap;transition:all .2s;border-radius:var(--radius) var(--radius) 0 0;font-family:inherit}
.tab-btn:hover{color:var(--primary);background:rgba(16,185,129,.05)}
.tab-btn.active{color:var(--primary);border-bottom-color:var(--primary);background:rgba(16,185,129,.05)}

/* ── ALERTS ─────────────────────────── */
.alert{display:flex;align-items:center;gap:.75rem;padding:.875rem 1rem;border-radius:var(--radius);font-size:.875rem;font-weight:500;margin-bottom:1rem}
.alert-success{background:#f0fdf4;color:#16a34a;border:1px solid #bbf7d0}
.alert-error{background:#fef2f2;color:#dc2626;border:1px solid #fee2e2}
.alert-warning{background:#fffbeb;color:#d97706;border:1px solid #fde68a}
.alert-info{background:#eff6ff;color:#2563eb;border:1px solid #bfdbfe}

/* ── AVATAR ─────────────────────────── */
.avatar{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:.875rem;font-weight:700;flex-shrink:0}
.avatar-sm{width:28px;height:28px;font-size:.75rem}
.avatar-xl{width:72px;height:72px;font-size:2rem;border-radius:1.25rem}
.avatar-green{background:#d1fae5;color:#065f46}
.avatar-blue{background:#dbeafe;color:#1e40af}
.avatar-purple{background:#ede9fe;color:#5b21b6}
.avatar-amber{background:#fef3c7;color:#92400e}
.avatar-rose{background:#fee2e2;color:#991b1b}

/* ── LOGIN ──────────────────────────── */
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1.5rem;background:linear-gradient(135deg,#ecfdf5 0%,#d1fae5 50%,#a7f3d0 100%)}
.login-card{background:white;border-radius:1.5rem;box-shadow:0 25px 60px rgba(0,0,0,.12);width:100%;max-width:420px;padding:2.5rem}
.login-logo{display:flex;justify-content:center;margin-bottom:1.75rem}
.login-logo-inner{background:linear-gradient(135deg,#f0fdf4,#d1fae5);border:2px solid #a7f3d0;border-radius:1.25rem;padding:1rem 1.5rem}
.login-logo img{height:70px;width:auto;object-fit:contain}
.demo-accounts{margin-top:1rem;padding:1rem;background:#f9fafb;border-radius:var(--radius);border:1px solid var(--border)}
.demo-account-row{display:flex;justify-content:space-between;align-items:center;padding:.3rem 0;border-bottom:1px solid #f3f4f6;font-size:.75rem}
.demo-account-row:last-child{border-bottom:none}
.demo-account-badge{font-size:.65rem;padding:.2rem .5rem;border-radius:999px;font-weight:700;text-transform:uppercase}

/* ── QUICK ACTIONS ───────────────────── */
.quick-actions-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:.75rem}
.quick-action{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:1.25rem 1rem;border-radius:var(--radius-lg);cursor:pointer;border:2px solid transparent;transition:all .25s;text-align:center;background:none;font-family:inherit}
.quick-action:hover{transform:translateY(-3px);box-shadow:var(--shadow-lg)}
.quick-action-icon{width:48px;height:48px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.2rem;margin-bottom:.5rem;background:white;box-shadow:var(--shadow);transition:transform .25s}
.quick-action:hover .quick-action-icon{transform:scale(1.1)}
.quick-action-label{font-size:.78rem;font-weight:700}

/* ── DASHBOARD CARDS ────────────────── */
.dashboard-grid-2{display:grid;grid-template-columns:2fr 1fr;gap:1.5rem}
.dashboard-grid-equal{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem}
@media(max-width:1024px){.dashboard-grid-2,.dashboard-grid-equal{grid-template-columns:1fr}}

/* ── PERFORMANCE ────────────────────── */
.perf-rank{width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:.75rem;font-weight:800;flex-shrink:0}
.perf-rank-1{background:linear-gradient(135deg,#f59e0b,#d97706);color:white}
.perf-rank-2{background:linear-gradient(135deg,#6b7280,#4b5563);color:white}
.perf-rank-3{background:linear-gradient(135deg,#92400e,#78350f);color:white}
.perf-rank-other{background:#f3f4f6;color:#374151}

/* ── CHART ──────────────────────────── */
.chart-container{position:relative;height:200px}

/* ── DROPDOWN ───────────────────────── */
.dropdown-item{display:flex;align-items:center;gap:.625rem;padding:.5rem 1rem;font-size:.85rem;cursor:pointer;background:none;border:none;width:100%;text-align:left;color:var(--text);transition:background .15s;font-family:inherit}
.dropdown-item:hover{background:var(--bg);color:var(--primary)}
.dropdown-item i{width:16px;text-align:center;color:var(--text-muted)}

/* ── INFO BLOCK ─────────────────────── */
.info-block{background:#f9fafb;border-radius:var(--radius);padding:1rem;border:1px solid var(--border)}
.info-block-label{font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);margin-bottom:.25rem}
.info-block-value{font-size:.9rem;font-weight:600;color:var(--text)}

/* ── SCHOOL OVERVIEW CARD ────────────── */
.school-card{border-radius:var(--radius-lg);border:1px solid var(--border);background:white;overflow:hidden;transition:all .2s}
.school-card:hover{box-shadow:var(--shadow-lg);transform:translateY(-2px)}
.school-card-header{padding:1rem 1.25rem;background:linear-gradient(135deg,var(--secondary),var(--secondary-dark));color:white;display:flex;align-items:center;gap:.75rem}
.school-card-body{padding:1rem 1.25rem}
.school-stat{text-align:center}
.school-stat-value{font-size:1.4rem;font-weight:800}
.school-stat-label{font-size:.7rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em}

/* ── BULLETIN ───────────────────────── */
.bulletin-card{border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}
.bulletin-header{background:linear-gradient(135deg,var(--secondary),var(--secondary-dark));color:white;padding:1.5rem;display:flex;justify-content:space-between;align-items:center}
.bulletin-summary{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;padding:1.5rem;border-bottom:1px solid var(--border)}
.average-circle{display:flex;flex-direction:column;align-items:center;justify-content:center;width:120px;height:120px;border-radius:50%;background:linear-gradient(135deg,#10b981,#059669);color:white;margin:0 auto 1rem}
.average-value{font-size:2.5rem;font-weight:900;line-height:1}
.average-max{font-size:.8rem;opacity:.8}

/* ── MISC ───────────────────────────── */
.divider{height:1px;background:var(--border);margin:1.25rem 0}
.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.activation-code{font-family:'Courier New',monospace;font-size:2rem;font-weight:800;letter-spacing:.1em;color:#065f46;word-break:break-all}

/* ── SIDEBAR STATS ───────────────────── */
.sidebar-stat{display:flex;justify-content:space-between;align-items:center;padding:.4rem .75rem;background:rgba(255,255,255,.05);border-radius:.5rem;margin-bottom:.25rem}
.sidebar-stat-label{font-size:.7rem;color:rgba(255,255,255,.5)}
.sidebar-stat-value{font-size:.75rem;font-weight:700;color:#6ee7b7}

/* ── ROLE INDICATOR ─────────────────── */
.role-indicator{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:var(--radius);font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em}
.role-superadmin{background:linear-gradient(135deg,#10b981,#059669);color:white}
.role-admin{background:linear-gradient(135deg,#3b82f6,#2563eb);color:white}
.role-teacher{background:linear-gradient(135deg,#8b5cf6,#7c3aed);color:white}
.role-accountant{background:linear-gradient(135deg,#f59e0b,#d97706);color:white}
.role-student{background:linear-gradient(135deg,#06b6d4,#0891b2);color:white}
.role-parent{background:linear-gradient(135deg,#f43f5e,#e11d48);color:white}

/* ── PRINT ──────────────────────────── */
@media print{
  .sidebar,.topbar,.btn,.nav-item,.modal-backdrop,#toast-container,.page-header button,.export-dropdown{display:none!important}
  .page-content{padding:0!important}
  .card{box-shadow:none!important;border:1px solid #e5e7eb}
  body{background:white}
}

/* ── SCROLLBAR ──────────────────────── */
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:999px}
::-webkit-scrollbar-thumb:hover{background:#9ca3af}

/* ── RESPONSIVE UTILS ────────────────── */
@media(max-width:640px){
  .hide-sm{display:none!important}
  .stats-grid{grid-template-columns:1fr 1fr}
  .quick-actions-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:768px){.hide-md{display:none!important}}

/* ── CARD HOVER EFFECT ───────────────── */
.card-hoverable{transition:all .2s;cursor:pointer}
.card-hoverable:hover{box-shadow:var(--shadow-lg);transform:translateY(-2px)}

/* ── KPIS EXTRA ─────────────────────── */
.kpi-change{font-size:.7rem;padding:.15rem .4rem;border-radius:999px;font-weight:700}
.kpi-up{background:#d1fae5;color:#065f46}
.kpi-down{background:#fee2e2;color:#991b1b}

/* ── ATT BUTTONS ─────────────────────── */
.att-btn{transition:all .2s;font-size:.75rem!important}
.att-btn:hover{transform:scale(1.05)}

/* ── ONLINE INDICATOR ────────────────── */
.online-dot{width:8px;height:8px;border-radius:50%;background:#10b981;display:inline-block;margin-right:4px;animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}

/* ── PROFILE PAGE IMPROVEMENTS ──────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-header-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-radius: var(--radius);
  border: 1px solid #bbf7d0;
}

.profile-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.avatar-edit-btn:hover {
  transform: scale(1.1);
  background: var(--primary-dark);
}

@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .profile-header-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ── DESKTOP OPTIMIZATION (≥1400px) ──────────────────── */
@media (min-width: 1400px) {
  :root {
    --sidebar-width: 280px
  }
  .sidebar { font-size: .9rem }
  .sidebar-header { padding: 1.75rem 1.5rem }
  .logo-container img { height: 40px }
  .logo-text { font-size: 1.4rem }
  .nav-item { padding: .75rem 1rem }
  .page-content { padding: 2rem 2.5rem }
  .topbar { padding: 1rem 2rem }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) }
  .stat-card { padding: 1.5rem }
  .stat-card-value { font-size: 2rem }
  .card-body { padding: 1.75rem }
  .card-header { padding: 1.375rem 1.75rem }
  .page-title { font-size: 2rem }
}

/* ── SMOOTH SCROLLBAR (webkit) ────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent
}
::-webkit-scrollbar { width: 8px; height: 8px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; border: 2px solid transparent; background-clip: content-box }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; background-clip: content-box }
::-webkit-scrollbar-corner { background: transparent }

/* ── FOCUS STYLES (keyboard navigation) ──────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(16,185,129,.2) }
.nav-item:focus-visible { outline: 2px solid #6ee7b7; outline-offset: -2px; background: rgba(255,255,255,.15) }
.form-input:focus-visible { outline: none }
.tab-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius) var(--radius) 0 0 }
.modal-close:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px }

/* ── PRINT STYLES (enhanced) ─────────────────────────── */
@media print {
  .sidebar, .sidebar-overlay, .topbar, .btn, .nav-item, .modal-backdrop,
  #toast-container, .page-header button, .export-dropdown,
  .quick-actions-grid, .menu-btn, .topbar-actions { display: none !important }
  .app-layout { display: block !important }
  .main-content { margin: 0 !important; padding: 0 !important }
  .page-content { padding: 0 !important; overflow: visible !important }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; page-break-inside: avoid; margin-bottom: 1rem }
  .card-header { border-bottom: 1px solid #ddd !important; background: #f9f9f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact }
  .stat-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; page-break-inside: avoid }
  .stat-card::after { display: none }
  body { background: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact }
  .table-container { overflow: visible !important }
  .chart-container { page-break-inside: avoid }
  .badge { border: 1px solid #ddd !important }
  .badge-success, .badge-danger, .badge-warning, .badge-info { background: #f3f4f6 !important; color: #111 !important }
  @page { margin: 1.5cm; size: A4 }
}

/* ── PAGE TRANSITIONS ────────────────────────────────── */
.page-content { transition: opacity .15s ease }
.page-content--fading { opacity: 0 }
.page-content--visible { opacity: 1 }

/* ── REDUCED MOTION ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important
  }
  .page-content { transition: none }
  .stat-card:hover { transform: none }
  .btn-primary:hover:not(:disabled) { transform: none }
  .nav-item:hover { transform: none }
  .school-card:hover { transform: none }
  .card-hoverable:hover { transform: none }
  .toast { animation: none }
  .modal { animation: none }
  .quick-action:hover { transform: none }
  .quick-action:hover .quick-action-icon { transform: none }
}

/* ── KEYBOARD SHORTCUT TOOLTIP ───────────────────────── */
.nav-item .shortcut-hint {
  margin-left: auto;
  font-size: .6rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.08);
  padding: 1px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none
}
.nav-item:hover .shortcut-hint,
.nav-item:focus .shortcut-hint { opacity: 1 }

/* ── DOSSIER ÉTUDIANT TABS ────────────────────────────── */
.dossier-tab { background: transparent; border: 1px solid var(--border); border-bottom: none; color: var(--text-muted); font-weight: 600; transition: all .2s }
.dossier-tab:hover { background: #f9fafb; color: var(--text) }
.dossier-tab.active-tab { background: var(--primary); color: white; border-color: var(--primary) }
.dossier-tab-content { animation: fadeInTab .2s ease }
@keyframes fadeInTab { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: translateY(0) } }



/* ── MODERN STUDENT DOSSIER ────────────────────────── */
.dossier-header-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.dossier-header-bg {
  height: 120px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  position: relative;
}
.dossier-header-content {
  padding: 0 2rem 2rem;
  margin-top: -50px;
  display: flex;
  align-items: flex-end;
  gap: 2rem;
}
.dossier-avatar-container {
  position: relative;
  flex-shrink: 0;
}
.dossier-avatar {
  width: 140px;
  height: 140px;
  border-radius: 2rem;
  border: 6px solid white;
  box-shadow: var(--shadow);
  background: white;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
}
.dossier-main-info {
  padding-bottom: 0.5rem;
  flex: 1;
}
.dossier-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.dossier-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dossier-stat-pill {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.3s ease;
}
.dossier-stat-pill:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  background: white;
  box-shadow: var(--shadow);
}
.dossier-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.dossier-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.dossier-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.info-table-row {
  display: flex;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}
.info-table-row:last-child {
  border-bottom: none;
}
.info-table-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.info-table-value {
  font-weight: 600;
  color: var(--text);
  font-size: 0.875rem;
  text-align: right;
}

@media (max-width: 1024px) {
  .dossier-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .dossier-header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: -70px;
  }
  .dossier-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .dossier-badges {
    justify-content: center;
  }
}

/* ── TOGGLE SWITCH ─────────────────── */
.toggle { position:relative; display:inline-flex; align-items:center; cursor:pointer; }
.toggle input { opacity:0; width:0; height:0; position:absolute; }
.toggle-slider { width:44px; height:24px; background:var(--border); border-radius:999px; transition:background .2s; position:relative; display:inline-block; }
.toggle-slider::before { content:''; position:absolute; left:2px; top:2px; width:20px; height:20px; border-radius:50%; background:white; transition:transform .2s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-slider { background:var(--primary); }
.toggle input:checked + .toggle-slider::before { transform:translateX(20px); }

/* ── TABS ──────────────────────────── */
.tabs { display:flex; gap:.5rem; border-bottom:2px solid var(--border); padding-bottom:0; overflow-x:auto; }
.tab-btn { background:transparent; border:none; border-radius:var(--radius) var(--radius) 0 0; padding:.6rem 1.25rem; font-weight:600; font-size:.875rem; cursor:pointer; color:var(--text-muted); transition:all .2s; font-family:inherit; white-space:nowrap; }
.tab-btn:hover { background:var(--bg); color:var(--text); }
.tab-btn.active { background:var(--primary); color:white; box-shadow:0 -2px 8px rgba(16,185,129,.2); }

/* ── PROFILE GRID ──────────────────── */
.profile-grid { display:grid; grid-template-columns:1fr 380px; gap:1.5rem; }
.profile-header-card { display:flex; align-items:center; gap:1rem; margin-bottom:1.5rem; padding:1.25rem; background:linear-gradient(135deg,#f0fdf4,#ecfdf5); border-radius:var(--radius); border:1px solid #a7f3d0; }
.profile-avatar-container { position:relative; flex-shrink:0; }
.avatar-edit-btn { position:absolute; bottom:-4px; right:-4px; width:28px; height:28px; font-size:.7rem; border-radius:50%; background:var(--primary); color:white; border:2px solid white; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .2s; }
.avatar-edit-btn:hover { background:var(--primary-dark); transform:scale(1.1); }
@media(max-width:1024px) { .profile-grid { grid-template-columns:1fr; } }

/* ── KEYBOARD SHORTCUTS ─────────────── */
.shortcut-hint { font-size:.55rem; font-weight:700; color:rgba(255,255,255,.4); background:rgba(255,255,255,.08); border-radius:4px; padding:1px 4px; margin-left:auto; font-family:monospace; display:none; }
@media(min-width:1200px) { .shortcut-hint { display:inline-block; } }

/* ── PAGE TRANSITIONS ───────────────── */
.page-content--fading { opacity:0; transition:opacity .12s ease-out; }
.page-content--visible { opacity:1; transition:opacity .15s ease-in; }

/* ── SUCCESS/DANGER VARS ───────────── */
:root { --success: var(--primary); }

/* ── DROPDOWN ITEM ──────────────────── */
.dropdown-item { display:flex; align-items:center; gap:.75rem; padding:.6rem 1rem; width:100%; text-align:left; background:none; border:none; cursor:pointer; font-size:.875rem; font-weight:500; color:var(--text); transition:background .15s; font-family:inherit; }
.dropdown-item:hover { background:var(--bg); color:var(--secondary); }
.dropdown-item i { width:18px; text-align:center; color:var(--text-muted); }

/* ── ONLINE DOT ────────────────────── */
.online-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#10b981; margin-right:.35rem; animation:pulse-online 2s infinite; }
@keyframes pulse-online { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── FORM TEXTAREA ──────────────────── */
textarea.form-input { resize:vertical; min-height:80px; }

/* ── EMPTY STATE IMPROVEMENTS ───────── */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:3rem; color:var(--text-muted); gap:.75rem; }
.empty-state i { font-size:2.5rem; opacity:.3; }
.empty-state p { font-size:.9rem; margin:0; }
