:root {
  --ums-primary: #4f46e5;
  --ums-primary-dark: #3730a3;
  --ums-sidebar: #111827;
  --ums-sidebar-2: #1f2937;
  --ums-bg: #f4f6fb;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { font-family: var(--bs-font-sans-serif); }
.app-body { background: var(--ums-bg); }

.btn-primary { --bs-btn-bg: var(--ums-primary); --bs-btn-border-color: var(--ums-primary);
  --bs-btn-hover-bg: var(--ums-primary-dark); --bs-btn-hover-border-color: var(--ums-primary-dark);
  --bs-btn-active-bg: var(--ums-primary-dark); --bs-btn-disabled-bg: #a5b4fc; --bs-btn-disabled-border-color: #a5b4fc; }
.btn-outline-primary { --bs-btn-color: var(--ums-primary); --bs-btn-border-color: var(--ums-primary);
  --bs-btn-hover-bg: var(--ums-primary); --bs-btn-hover-border-color: var(--ums-primary);
  --bs-btn-active-bg: var(--ums-primary); }
.page-link { color: var(--ums-primary); }
.active > .page-link, .page-link.active { background-color: var(--ums-primary); border-color: var(--ums-primary); }
.progress-bar { background-color: var(--ums-primary); }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); }
.form-check-input:checked { background-color: var(--ums-primary); border-color: var(--ums-primary); }

/* ------------------------------------------------------------------ layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0; background: linear-gradient(180deg, var(--ums-sidebar), var(--ums-sidebar-2));
  color: #cbd5e1; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { background: linear-gradient(180deg, var(--ums-sidebar), var(--ums-sidebar-2)); }
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-size: 1.3rem; box-shadow: 0 6px 18px rgba(99,102,241,.4);
}
.brand-logo-lg { width: 64px; height: 64px; font-size: 2rem; border-radius: 18px; }
.brand-title { color: #fff; font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #94a3b8; }
.sidebar-nav { padding: .5rem .75rem; flex-grow: 1; }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #64748b; margin: 1rem .75rem .35rem; font-weight: 600; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: .75rem; color: #cbd5e1; padding: .55rem .75rem; border-radius: .6rem;
  font-size: .92rem; margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, rgba(99,102,241,.95), rgba(139,92,246,.85)); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.sidebar-footer { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; padding: .75rem 1.5rem;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid #e5e7eb;
}
.topbar-title { font-weight: 600; color: #111827; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 1px solid #e5e7eb; background: #fff; border-radius: 2rem; padding: .25rem .75rem .25rem .25rem; }
.content { padding: 1.5rem; flex-grow: 1; }
@media (min-width: 1400px) { .content { padding: 2rem 2.5rem; } }
.app-footer { text-align: center; font-size: .8rem; color: #94a3b8; padding: 1rem; }

.page-header { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h1 { font-weight: 700; color: #111827; }

/* ------------------------------------------------------------------ components */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e0e7ff, #ede9fe); color: var(--ums-primary-dark); font-weight: 700; font-size: .8rem;
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; background: rgba(255,255,255,.2); color: #fff; border: 2px solid rgba(255,255,255,.35); }

.kpi-card {
  position: relative; background: #fff; border-radius: 1rem; padding: 1.1rem 1.1rem 1rem; height: 100%;
  box-shadow: 0 1px 3px rgba(16,24,40,.06); border: 1px solid #eef0f5; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
a .kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.08); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: .75rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: #111827; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { color: #6b7280; font-size: .82rem; font-weight: 500; }
.kpi-sub { color: #9ca3af; font-size: .75rem; }
.kpi-primary .kpi-icon { background: #eef2ff; color: #4f46e5; }
.kpi-info .kpi-icon { background: #e0f2fe; color: #0284c7; }
.kpi-success .kpi-icon { background: #dcfce7; color: #16a34a; }
.kpi-warning .kpi-icon { background: #fef3c7; color: #d97706; }
.kpi-danger .kpi-icon { background: #fee2e2; color: #dc2626; }
.kpi-purple .kpi-icon { background: #f3e8ff; color: #9333ea; }

.mini-stat { display: flex; align-items: center; gap: 1rem; background: #fff; border-radius: 1rem; padding: 1rem 1.25rem; border: 1px solid #eef0f5; color: inherit; }
.mini-stat > i:first-child { font-size: 1.5rem; color: var(--ums-primary); }
.mini-stat:hover { box-shadow: 0 6px 18px rgba(16,24,40,.07); }

.card { border-radius: 1rem; }
.card-header:first-child { border-radius: 1rem 1rem 0 0; }
.card-footer:last-child { border-radius: 0 0 1rem 1rem; }
.data-table thead th, .table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600;
  background: #f9fafb; border-bottom: 1px solid #eef0f5; white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }

.profile-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; padding: 1.5rem; border-radius: 1.25rem; color: #fff;
  background: linear-gradient(120deg, #4338ca 0%, #6d28d9 55%, #a21caf 100%); box-shadow: 0 12px 30px rgba(79,70,229,.25);
}

.empty-state { text-align: center; color: #9ca3af; padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; }

.flash-stack .alert { border: 0; border-radius: .8rem; }

/* ------------------------------------------------------------------ timetable */
.timetable { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; }
.tt-day { background: #f9fafb; border: 1px solid #eef0f5; border-radius: .9rem; padding: .75rem; min-height: 120px; }
.tt-day-name { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #4b5563; margin-bottom: .6rem; }
.tt-slot { background: #fff; border-left: 4px solid var(--ums-primary); border-radius: .6rem; padding: .55rem .7rem; margin-bottom: .5rem; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.tt-slot:nth-child(3n) { border-left-color: #0ea5e9; }
.tt-slot:nth-child(3n+1) { border-left-color: #a855f7; }
.tt-time { font-size: .75rem; color: #6b7280; font-weight: 600; }
.tt-course { font-weight: 600; font-size: .88rem; color: #111827; }
.tt-meta { font-size: .75rem; color: #6b7280; }
.tt-empty { font-size: .8rem; color: #9ca3af; font-style: italic; }

/* ------------------------------------------------------------------ login */
.login-body { background: #eef2ff; }
.login-wrap { min-height: 100vh; display: flex; }
.login-hero {
  flex: 1 1 50%; align-items: center; padding: 4rem; color: #fff;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.12), transparent 40%),
              linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #7c3aed 100%);
}
.login-panel { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.login-card { width: 100%; max-width: 430px; background: #fff; border-radius: 1.25rem; padding: 2.25rem; box-shadow: 0 20px 50px rgba(30,27,75,.12); }
.demo-box { border: 1px dashed #c7d2fe; border-radius: .9rem; padding: .5rem; background: #f8faff; }
.demo-item { display: flex; align-items: center; gap: .75rem; padding: .55rem; border-radius: .6rem; }
.demo-item + .demo-item { border-top: 1px solid #eef0f5; }
.demo-icon { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.bi-chevron-down { transition: transform .2s; }

