:root {
  --agora-primary: #1f4e79;
  --agora-primary-dark: #163a5a;
  --agora-accent: #e0a526;
  --agora-bg: #f4f6f9;
  --agora-sidebar-w: 240px;
}

body {
  background: var(--agora-bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
}

.btn-primary { --bs-btn-bg: var(--agora-primary); --bs-btn-border-color: var(--agora-primary);
  --bs-btn-hover-bg: var(--agora-primary-dark); --bs-btn-hover-border-color: var(--agora-primary-dark);
  --bs-btn-active-bg: var(--agora-primary-dark); }
.text-agora { color: var(--agora-primary); }
.btn-check:checked + .btn-outline-primary { background: var(--agora-primary); border-color: var(--agora-primary); color: #fff; }
.btn-check:checked + .btn-outline-success { background: #198754; border-color: #198754; color: #fff; }

/* ---------- Sidebar ---------- */
.agora-sidebar {
  /* !important: Bootstrap's .offcanvas-lg makes the background transparent on wide screens */
  background: var(--agora-primary) !important;
  width: var(--agora-sidebar-w);
}
.agora-sidebar .offcanvas-header, .agora-sidebar .offcanvas-body { color: #fff; }
.agora-brand { font-weight: 800; letter-spacing: .12em; color: #fff; text-decoration: none; font-size: 1.35rem; }
.agora-brand small { display: block; font-weight: 400; letter-spacing: normal; font-size: .72rem; opacity: .75; }
/* The module the user is in (AGORA = library), inside the VAULT portal */
.module-chip { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: .6rem;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff; }
.module-chip i { font-size: 1.15rem; color: var(--agora-accent); }
.module-chip span { font-weight: 700; letter-spacing: .1em; line-height: 1.1; }
.module-chip small { display: block; font-weight: 400; letter-spacing: normal; font-size: .7rem; opacity: .75; }
.module-badge { background: var(--agora-accent); color: #1f2937; letter-spacing: .08em; }

/* VAULT sidebar: modules as an accordion (only the current one open) */
.module-home { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; margin-bottom: .5rem;
  border-radius: .5rem; color: rgba(255,255,255,.8); text-decoration: none; font-size: .9rem; }
.module-home:hover { background: rgba(255,255,255,.1); color: #fff; }
.module-home.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.module-group { border-top: 1px solid rgba(255,255,255,.12); }
.module-group:last-child { border-bottom: 1px solid rgba(255,255,255,.12); }
.module-head { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .7rem .8rem;
  background: none; border: 0; color: rgba(255,255,255,.8); text-align: left; border-radius: .5rem; }
.module-head:hover { background: rgba(255,255,255,.08); color: #fff; }
.module-group.current .module-head { color: #fff; }
.module-group.current .module-icon { color: var(--agora-accent); }
.module-icon { font-size: 1.1rem; }
.module-name { flex-grow: 1; font-weight: 700; letter-spacing: .04em; line-height: 1.15; }
.module-name small { display: block; font-weight: 400; letter-spacing: normal; font-size: .7rem; opacity: .65; }
.module-chevron { font-size: .8rem; opacity: .7; transition: transform .2s ease; }
.module-head.collapsed .module-chevron { transform: rotate(-90deg); }
.module-group .agora-nav .nav-link { padding-left: 1.4rem; }

/* VAULT home tiles */
.module-tile { transition: transform .12s ease, box-shadow .12s ease; }
.module-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.12); }
.module-tile-icon { width: 52px; height: 52px; border-radius: .9rem; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.5rem; background: #e8f0f8; color: var(--agora-primary); }
.border-dashed { border: 2px dashed #d5dbe3 !important; box-shadow: none; }
.min-w-0 { min-width: 0; }
.check-chip { margin-bottom: .4rem; }
.agora-nav .nav-link {
  color: rgba(255,255,255,.82); border-radius: .5rem; padding: .6rem .8rem; margin-bottom: 2px;
  display: flex; align-items: center; gap: .65rem;
}
.agora-nav .nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.agora-nav .nav-link.active { background: #fff; color: var(--agora-primary); font-weight: 600; }
.agora-nav .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.5); margin: 1rem .8rem .35rem; }

@media (min-width: 992px) {
  .agora-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030; overflow-y: auto; }
  /* Bootstrap hides the offcanvas header on wide screens; it holds the VAULT name. */
  .agora-sidebar .offcanvas-header { display: flex !important; }
  .agora-main { margin-left: var(--agora-sidebar-w); }
}

.agora-topbar { background: #fff; border-bottom: 1px solid #e5e8ee; }

/* ---------- Cards & stats ---------- */
.card { border: 0; border-radius: .85rem; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f4; font-weight: 600;
  border-radius: .85rem .85rem 0 0 !important; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .78rem; color: #6c757d; text-transform: uppercase; letter-spacing: .04em; }
.stat-icon { width: 42px; height: 42px; border-radius: .7rem; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.25rem; }

.page-title { font-weight: 700; font-size: 1.35rem; margin: 0; }

.table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d;
  background: #fafbfc; white-space: nowrap; }

/* Mobile: list rows become stacked cards */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid #eef0f4; padding: .5rem 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important;
    padding: .25rem .9rem !important; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: #6c757d; text-align: left;
    font-size: .8rem; }
  .table-stack td[data-label=""]::before { content: none; }
  .table-stack td.td-actions { justify-content: flex-end; }
}

.form-label { font-weight: 600; font-size: .85rem; }
.login-wrap { min-height: 100vh; background: linear-gradient(135deg, var(--agora-primary), #2f6fa8); }

@media print {
  .agora-sidebar, .agora-topbar, .no-print, .messages { display: none !important; }
  .agora-main { margin: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}
