/* =========================================================
   MIT Portal — sleek product UI (standalone)
   ========================================================= */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Instrument+Sans:wght@500;600;700&display=swap");

:root {
  /* TREM brand — https://trem.org/ theme globals */
  --ink: #1c1c1b;
  --ink-2: #3b3b39;
  --muted: #777574;
  --muted-2: #9a9690;
  --line: rgba(28, 28, 27, 0.08);
  --line-strong: rgba(196, 188, 188, 0.9);
  --bg: #f7f5ed;
  --surface: #ffffff;
  --soft: #fffaf2;
  --sidebar: #1c1c1b;
  --sidebar-text: rgba(255, 255, 255, 0.62);
  --sidebar-text-strong: #ffffff;
  --accent: #bf6229;
  --accent-2: #d4733a;
  --accent-deep: #985e23;
  --accent-soft: rgba(191, 98, 41, 0.12);
  --accent-sky: #bbe2ff;
  --danger: #da394d;
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 12px;
  --shadow: 0 1px 0 rgba(28, 28, 27, 0.03), 0 12px 32px rgba(28, 28, 27, 0.06);
  --shadow-lg: 0 24px 64px rgba(28, 28, 27, 0.16);
  --sidebar-w: 272px;
  --topbar: 68px;
  --bottom: 78px;
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: "Instrument Sans", "Outfit", ui-sans-serif, system-ui, sans-serif;
  --PRIMARY_COLOUR: #bf6229;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
}

body.mit-auth {
  background:
    radial-gradient(1000px 520px at 15% -10%, rgba(191, 98, 41, 0.28), transparent 55%),
    radial-gradient(800px 420px at 90% 0%, rgba(187, 226, 255, 0.22), transparent 50%),
    linear-gradient(180deg, #1c1c1b 0%, #2a2927 42%, #f7f5ed 42%, #f7f5ed 100%);
}

img { max-width: 100%; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Grid */
.container-fluid { width: 100%; padding-left: 0; padding-right: 0; }
.row { display: flex; flex-wrap: wrap; margin-left: -10px; margin-right: -10px; }
.row > [class*="col-"] { padding-left: 10px; padding-right: 10px; width: 100%; }
@media (min-width: 576px) { .col-sm-6 { width: 50%; } }
@media (min-width: 768px) {
  .col-md-1 { width: 8.333%; } .col-md-2 { width: 16.666%; } .col-md-3 { width: 25%; }
  .col-md-4 { width: 33.333%; } .col-md-6 { width: 50%; } .col-md-8 { width: 66.666%; }
  .col-md-10 { width: 83.333%; } .col-md-11 { width: 91.666%; } .col-md-12 { width: 100%; }
}
@media (min-width: 992px) {
  .col-lg-3 { width: 25%; } .col-lg-4 { width: 33.333%; }
  .col-lg-6 { width: 50%; } .col-lg-8 { width: 66.666%; } .col-lg-12 { width: 100%; }
}
.clearfix::after { content: ""; display: table; clear: both; }
.pull-right { float: right; }

/* Shell */
.wrapper { position: relative; min-height: 100vh; }

.mit-nav-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(8, 12, 24, 0.48); backdrop-filter: blur(2px); z-index: 1040;
}
body.nav-open .mit-nav-backdrop { display: block; }

.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  background:
    radial-gradient(420px 240px at 0% 0%, rgba(191, 98, 41, 0.28), transparent 60%),
    linear-gradient(180deg, #2a2927 0%, #1c1c1b 100%);
  z-index: 1050; transform: translateX(-105%); transition: transform 0.24s cubic-bezier(.2,.8,.2,1);
  border-right: 1px solid rgba(255,255,255,0.06);
}
body.nav-open .sidebar, .sidebar.nav-open { transform: translateX(0); }

.sidebar .logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar .logo a {
  display: flex; align-items: center; gap: 12px; color: var(--sidebar-text-strong);
}
.sidebar .logo img {
  width: 38px; height: 38px; object-fit: cover; border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.12);
}
.sidebar .brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .brand-copy strong {
  font-family: var(--display); font-size: 1.02rem; font-weight: 700; letter-spacing: -0.03em;
}
.sidebar .brand-copy span {
  font-size: 0.68rem; color: rgba(255,255,255,0.45); font-weight: 500; letter-spacing: 0.02em;
}

.sidebar-wrapper {
  height: calc(100vh - 88px); overflow-y: auto; padding: 16px 12px 120px;
}
.sidebar .nav { list-style: none; margin: 0; padding: 0; }
.sidebar .nav > div { margin: 0; }
.sidebar .nav .nav-item { margin: 3px 0; }
.sidebar .nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  color: var(--sidebar-text);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar .nav .nav-link i,
.sidebar .nav .nav-link .fa {
  width: 22px; text-align: center; font-size: 1.1rem; opacity: 0.9;
}
.sidebar .nav .nav-link .material-icons { font-size: 1.2rem; }
.sidebar .nav .nav-link p {
  margin: 0; font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em;
}
.sidebar .nav .nav-link:hover {
  background: rgba(255,255,255,0.06); color: var(--sidebar-text-strong);
}
.sidebar .nav .nav-item.active > .nav-link {
  background: linear-gradient(135deg, rgba(47,107,255,0.95), rgba(37,99,235,0.9));
  color: #fff;
  box-shadow: 0 10px 24px rgba(191, 98, 41, 0.28);
}
.sidebar .nav ul { list-style: none; margin: 0; padding: 4px 0 8px 38px; }
.sidebar .nav ul .nav-link { padding: 9px 12px; font-size: 0.86rem; border-radius: 12px; }
.sidebar .nav ul .nav-item.active > .nav-link {
  background: rgba(255,255,255,0.08); box-shadow: none; color: #fff;
}

.main-panel {
  min-height: 100vh; width: 100%;
  padding-bottom: calc(var(--bottom) + 18px);
}

.navbar {
  position: sticky; top: 0; z-index: 1030; min-height: var(--topbar);
  padding: 12px 16px;
  background: rgba(238, 242, 247, 0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid transparent;
}
.navbar .container-fluid { padding: 0; }
.navbar-wrapper { display: flex; align-items: center; gap: 12px; width: 100%; }
.navbar-toggler {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: 13px; background: var(--surface); cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04); overflow: hidden;
}
.navbar-toggler-logo {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.navbar-toggler-icon.icon-bar {
  display: none;
}
.navbar-brand, .navbar-brand h4 {
  margin: 0; color: var(--ink);
  font-family: var(--display); font-size: 1.12rem; font-weight: 700;
  letter-spacing: -0.03em;
}
.navbar-collapse { display: none; }
.mit-logout {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2) !important; font-size: 0.84rem; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.mit-logout .material-icons { font-size: 1.05rem; }

.mit-bottom-nav {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1045;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 8px;
  background: rgba(255,255,255,0.92); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.mit-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 54px; border-radius: 16px;
  color: var(--muted) !important; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.01em;
}
.mit-bottom-nav a i { font-size: 1.18rem; }
.mit-bottom-nav a .material-icons { font-size: 1.25rem; }
.mit-bottom-nav a.active,
.mit-bottom-nav a:hover {
  background: var(--accent-soft); color: var(--accent-deep) !important;
}

.content { padding: 20px 16px 32px; }
.footer { display: none; }

.page-hero {
  margin-bottom: 22px;
  display: flex; flex-direction: column; gap: 6px;
}
.page-hero h1 {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.55rem, 2.4vw, 1.9rem); font-weight: 700;
  letter-spacing: -0.04em; line-height: 1.15;
}
.page-hero p {
  margin: 0; color: var(--muted); font-size: 0.95rem; font-weight: 500;
  max-width: 40rem;
}

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden;
}
.card-header {
  padding: 20px 20px 0; background: transparent; border: 0;
}
.card-header.row {
  margin: 0; display: flex; flex-wrap: wrap; align-items: center;
  padding: 20px 20px 0;
}
.card-title {
  margin: 0 0 4px; font-family: var(--display);
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.025em; color: var(--ink);
}
.card-category, .card-description, .text-gray {
  color: var(--muted); font-size: 0.86rem; font-weight: 500; margin: 0;
}
.card-body { padding: 18px 20px 20px; }

/* KPI metric strip (students / teachers / follow-up) */
.mit-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin-bottom: 20px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mit-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 108px;
  padding: 20px 22px;
  background: var(--surface);
  position: relative;
}
.mit-metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}
.mit-metric:first-child::before { background: var(--accent); }
.mit-metric:nth-child(2)::before { background: #22c55e; }
.mit-metric:nth-child(3)::before { background: #f59e0b; }
.mit-metric:nth-child(4)::before { background: #a855f7; }

.mit-metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.mit-metric-value {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--ink);
}
.mit-metric-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 108px;
  padding: 18px 20px;
  background:
    linear-gradient(135deg, rgba(47,107,255,0.08), rgba(47,107,255,0.02)),
    var(--surface);
  color: var(--ink) !important;
  text-decoration: none !important;
}
.mit-metric-action .mit-metric-label {
  color: var(--accent-deep);
  font-weight: 700;
}
.mit-metric-action .mit-metric-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(191, 98, 41, 0.25);
  white-space: nowrap;
}

/* Legacy card-stats → compact horizontal metrics */
.stats-row {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 1px;
  margin: 0 0 20px !important;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stats-row > [class*="col-"] {
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.stats-row .card.card-stats {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--surface);
}
.stats-row .card-stats .card-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  min-height: 108px;
  padding: 20px 22px 20px 26px !important;
  position: relative;
}
.stats-row .card-stats .card-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.stats-row > [class*="col-"]:nth-child(2) .card-stats .card-header::before { background: #22c55e; }
.stats-row > [class*="col-"]:nth-child(3) .card-stats .card-header::before { background: #f59e0b; }

.stats-row .card-stats .card-icon { display: none !important; }
.stats-row .card-stats .card-category {
  margin: 0 !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0.01em !important;
  color: var(--muted) !important;
}
.stats-row .card-stats .card-title {
  margin: 0 !important;
  font-family: var(--display) !important;
  font-size: clamp(1.8rem, 3vw, 2.15rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.05em !important;
  line-height: 1 !important;
  color: var(--ink) !important;
}
.stats-row .card-stats .mit-link-btn,
.stats-row .card-stats a.mit-link-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  margin: 0;
}

/* Detail-page stats (student/teacher) keep individual cards, but refined */
.card-stats:not(.stats-row .card-stats) {
  position: relative;
  overflow: hidden;
}
.card-stats:not(.stats-row .card-stats) .card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 18px 18px 22px !important;
}
.card-stats:not(.stats-row .card-stats) .card-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.card-stats:not(.stats-row .card-stats) .card-icon { display: none !important; }
.card-stats:not(.stats-row .card-stats) .card-category {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.card-stats:not(.stats-row .card-stats) .card-title {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.card-profile { text-align: center; padding-bottom: 10px; }
.card-profile .card-avatar { margin: 22px auto 0; max-width: 88px; }
.card-profile .card-avatar img,
.card-profile .img {
  width: 88px; height: 88px; object-fit: cover; border-radius: 28px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card-profile .card-body { padding-top: 14px; }
.card-profile .card-title {
  font-size: 1.2rem; margin-top: 6px;
}

@media (min-width: 768px) {
  .mit-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
  .mit-metrics.mit-metrics-2 {
    grid-template-columns: 1.1fr 1.4fr;
  }
  .stats-row {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .stats-row.stats-row-2 {
    grid-template-columns: 1.1fr 1.4fr !important;
  }
}

/* Forms / buttons */
.form-group { margin-bottom: 14px; }
label, .bmd-label-floating, .control-label {
  display: block; margin-bottom: 7px;
  color: var(--muted); font-size: 0.78rem; font-weight: 650; font-weight: 600;
  letter-spacing: 0.01em;
}
.form-control,
select.form-control,
textarea.form-control,
input[type="date"] {
  display: block; width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--soft); color: var(--ink); outline: none;
  appearance: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea.form-control { min-height: 120px; resize: vertical; }
.form-control:focus {
  border-color: rgba(191, 98, 41, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Input + action button (e.g. Add Student ID + Search) */
.mit-field-with-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.mit-field-with-action .form-control {
  flex: 1 1 auto;
  min-width: 0;
}
.mit-field-with-action .btn {
  flex: 0 0 auto;
  margin-top: 0;
  align-self: stretch;
  white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 13px;
  border: 1px solid transparent; background: var(--soft); color: var(--ink-2);
  font-weight: 650; font-weight: 600; letter-spacing: -0.015em; cursor: pointer;
  text-decoration: none !important; box-shadow: none;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%);
  border-color: transparent; color: #fff !important;
  box-shadow: 0 8px 20px rgba(191, 98, 41, 0.28);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: linear-gradient(180deg, #bf6229 0%, #985e23 100%);
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(191, 98, 41, 0.34);
}
.btn-default, .btn-secondary, .btn-white {
  background: var(--surface); border-color: var(--line-strong); color: var(--ink-2) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.btn-link {
  background: transparent; border-color: transparent; color: var(--accent-deep) !important;
  min-height: 38px; box-shadow: none;
}
.btn-sm { min-height: 36px; padding: 8px 12px; font-size: 0.84rem; border-radius: 11px; }
.btn-round { border-radius: 999px; }
.btn-just-icon { width: 42px; min-width: 42px; padding: 0; }

/* Tables */
.table-responsive {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.card-body.table-responsive { border: 0; }
.table {
  width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; margin: 0;
}
.table th, .table td {
  padding: 14px 16px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
.table thead th {
  background: rgba(246, 248, 251, 0.95); color: var(--muted-2);
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: rgba(191, 98, 41, 0.035); }
.table tbody tr:last-child td { border-bottom: 0; }
.td-actions { white-space: nowrap; }
.mit-view-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(191, 98, 41, 0.28) !important;
  background: rgba(191, 98, 41, 0.08) !important;
  color: var(--accent-deep) !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.01em;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.mit-view-btn i {
  font-size: 0.92rem;
}
.mit-view-btn:hover,
.mit-view-btn:focus {
  background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%) !important;
  border-color: transparent !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(191, 98, 41, 0.28) !important;
}
/* DataTables layout */
.dataTables_wrapper {
  padding: 0;
  font-size: 0.9rem;
  clear: both;
}
.dataTables_wrapper::before,
.dataTables_wrapper::after {
  display: none !important;
  content: none !important;
}
.mit-dt-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}
.mit-dt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mit-dt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mit-dt-length,
.mit-dt-search,
.mit-dt-info,
.mit-dt-pages,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  text-align: left !important;
  color: var(--muted);
}
.mit-dt-search,
.dataTables_wrapper .dataTables_filter {
  margin-left: auto !important;
}
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  margin: 0 !important;
  box-shadow: none;
}
.dataTables_wrapper .dataTables_filter input {
  width: min(100%, 260px);
  min-width: 180px;
}
.dataTables_wrapper .dataTables_length select {
  width: auto;
  min-width: 72px;
  padding-right: 28px;
}
.mit-dt-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.dataTables_wrapper .dataTables_info {
  padding: 0;
  font-size: 0.82rem;
  font-weight: 500;
}
.dataTables_wrapper .dataTables_paginate {
  white-space: normal !important;
  text-align: right !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .page-link,
.dataTables_wrapper .pagination > li > a,
.dataTables_wrapper .pagination > li > span {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  margin: 3px !important;
  padding: 0 12px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 12px !important;
  background: var(--surface) !important;
  color: var(--ink-2) !important;
  box-shadow: none !important;
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .page-link:hover,
.dataTables_wrapper .pagination > li > a:hover {
  background: #fff !important;
  border-color: rgba(191, 98, 41, 0.35) !important;
  color: var(--accent-deep) !important;
  transform: translateY(-1px);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .pagination > .active > a,
.dataTables_wrapper .pagination > .active > span,
.dataTables_wrapper .page-item.active .page-link {
  background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(191, 98, 41, 0.28) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active,
.dataTables_wrapper .pagination > .disabled > a,
.dataTables_wrapper .pagination > .disabled > span,
.dataTables_wrapper .page-item.disabled .page-link {
  opacity: 0.45;
  cursor: default;
  transform: none;
  background: var(--soft) !important;
  color: var(--muted) !important;
  border-color: var(--line) !important;
  box-shadow: none !important;
}
.dataTables_wrapper .dt-buttons,
.dataTables_wrapper .html5buttons,
.mit-dt-actions .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  float: none !important;
  margin: 0 !important;
}
.dataTables_wrapper .dt-button,
.dataTables_wrapper .html5buttons .dt-button,
.dataTables_wrapper a.dt-button,
.dataTables_wrapper button.dt-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 11px !important;
  background: var(--surface) !important;
  color: var(--ink-2) !important;
  font-weight: 600;
  font-size: 0.8rem;
  box-shadow: none !important;
}
.dataTables_wrapper .dt-button:hover {
  border-color: rgba(191, 98, 41, 0.35) !important;
  color: var(--accent-deep) !important;
  background: #fff !important;
}
@media (max-width: 767px) {
  .mit-dt-tools,
  .mit-dt-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .mit-dt-search,
  .dataTables_wrapper .dataTables_filter {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .dataTables_wrapper .dataTables_length label,
  .dataTables_wrapper .dataTables_filter label {
    width: 100%;
    justify-content: space-between;
  }
  .dataTables_wrapper .dataTables_filter input {
    flex: 1;
    width: 100%;
    min-width: 0;
  }
  .dataTables_wrapper .dataTables_paginate {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center !important;
  }
  .mit-dt-info,
  .dataTables_wrapper .dataTables_info {
    text-align: center !important;
  }
}

/* Dropdowns */
.dropdown, .mit-action-menu { position: relative; display: inline-block; }
.dropdown-menu, .mit-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 210px; padding: 8px; margin: 0; list-style: none;
  border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
}
.dropdown.open > .dropdown-menu,
.dropdown.show > .dropdown-menu,
.mit-action-menu.open .mit-menu,
.mit-action-menu.open .dropdown-menu { display: block; }
.dropdown-item, .dropdown-menu > li, .mit-menu a, .mit-menu button {
  display: block; width: 100%; border: 0; background: transparent; border-radius: 11px;
  padding: 0; text-align: left;
}
.dropdown-item > a, .dropdown-menu > li > a, .mit-menu a, .mit-menu button {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  color: var(--ink) !important; font-weight: 600; font-size: 0.9rem;
  text-decoration: none !important; cursor: pointer;
}
.dropdown-item:hover, .dropdown-menu > li:hover, .mit-menu a:hover, .mit-menu button:hover {
  background: var(--soft);
}

/* Modals */
.modal {
  display: none; position: fixed; inset: 0; z-index: 2000;
  overflow-x: hidden; overflow-y: auto; padding: 22px 14px;
}
.modal.is-open, .modal.show { display: block; }
.modal-backdrop, .modal-backdrop-preview {
  position: fixed; inset: 0; background: rgba(8, 12, 24, 0.52);
  backdrop-filter: blur(6px); z-index: 1990;
}
.modal-dialog {
  position: relative; z-index: 2001; width: 100%; max-width: 520px; margin: 7vh auto 28px;
}
.modal-dialog.modal-lg { max-width: 760px; }
.modal-dialog.modal-md { max-width: 560px; }
.modal-content {
  background: var(--surface); border: 1px solid rgba(255,255,255,0.5);
  border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: mit-pop .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes mit-pop {
  from { transform: translateY(12px) scale(0.98); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.modal-title {
  margin: 0; font-family: var(--display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: -0.03em; color: var(--ink);
}
.modal-header .close {
  width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--soft); color: var(--ink); font-size: 1.2rem; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.modal-body {
  padding: 20px; max-height: min(70vh, 640px); overflow-y: auto; background: var(--surface);
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--line); background: rgba(246,248,251,0.9);
}
body.modal-open,
body.mit-alert-open { overflow: hidden; }

/* MIT Alert (SweetAlert replacement) */
.mit-alert-root {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 28, 27, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.mit-alert-root.is-open {
  opacity: 1;
  pointer-events: auto;
}
.mit-alert {
  width: min(100%, 420px);
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 20px;
  text-align: center;
  transform: translateY(10px) scale(0.98);
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.mit-alert-root.is-open .mit-alert {
  transform: translateY(0) scale(1);
}
.mit-alert-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  color: #fff;
}
.mit-alert-icon.success { background: linear-gradient(180deg, #34d399 0%, #059669 100%); }
.mit-alert-icon.error { background: linear-gradient(180deg, #f87171 0%, #da394d 100%); }
.mit-alert-icon.warning { background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%); }
.mit-alert-icon.info { background: linear-gradient(180deg, #1c1c1b 0%, #3b3b39 100%); }
.mit-alert-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 750;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.mit-alert-text {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.mit-alert-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.mit-alert-actions .btn {
  min-width: 110px;
}

/* FAB */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--bottom) + 14px); z-index: 1048;
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; min-width: 58px; padding: 0; border: 0; border-radius: 18px;
  background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%);
  color: #fff !important; font-size: 1.7rem; font-weight: 600; line-height: 1;
  text-decoration: none !important;
  box-shadow: 0 14px 30px rgba(191, 98, 41, 0.36);
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover, .fab:focus {
  color: #fff !important; transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 36px rgba(191, 98, 41, 0.42);
}
.fab .fab-label { display: none; }

/* Auth */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
}
.auth-card {
  width: 100%; max-width: 420px; background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.7); border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28); padding: 32px 28px 26px; text-align: center;
  backdrop-filter: blur(10px);
}
.auth-card-wide { max-width: 700px; text-align: left; }
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 24px; color: inherit;
}
.auth-brand img {
  width: 68px; height: 68px; object-fit: cover; border-radius: 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth-brand h1 {
  margin: 0; font-family: var(--display); font-size: 1.45rem; font-weight: 700;
  letter-spacing: -0.04em;
}
.auth-brand p { margin: 0; color: var(--muted); font-size: 0.93rem; font-weight: 500; }
.auth-actions { margin-top: 10px; }
.auth-actions .btn { width: 100%; min-height: 48px; border-radius: 14px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--muted); font-size: 0.92rem; }

/* Utilities */
.mit-iframe-frame {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.mit-iframe-frame iframe, iframe { display: block; width: 100%; border: 0; background: #fff; }
.mit-iframe-frame iframe { min-height: 70vh; height: 1200px; }
.mit-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: min(56vh, 420px);
  padding: 48px 16px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  box-sizing: border-box;
}
.mit-loading-modal {
  min-height: 220px;
  padding: 56px 16px;
}
/* Keep page loaders full-bleed inside .row flex containers */
.row > div:has(> .mit-loading) {
  width: 100%;
  flex: 0 0 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.mit-loader {
  position: relative;
  width: 44px;
  height: 44px;
}
.mit-loader::before,
.mit-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.mit-loader::before {
  border: 3px solid rgba(191, 98, 41, 0.16);
}
.mit-loader::after {
  border: 3px solid transparent;
  border-top-color: #bf6229;
  border-right-color: #d4733a;
  animation: mit-spin 0.75s cubic-bezier(.45,.05,.55,.95) infinite;
}
.mit-loader-orbit {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: rgba(152, 94, 35, 0.55);
  animation: mit-spin 1.15s linear infinite reverse;
}
.mit-loader-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
@keyframes mit-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mit-loader::after,
  .mit-loader-orbit { animation-duration: 1.8s; }
}

/* Never show the legacy GIF spinner */
img[src*="spinner.gif"],
img[src*="spinner.GIF"] {
  display: none !important;
}
.mit-error, p[style*="color:red"], p[style*="color: red"] {
  color: var(--danger) !important; font-weight: 600;
}
.mit-chip {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 0.7rem; font-weight: 750; font-weight: 700; letter-spacing: 0.04em;
}
.mit-link-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border-radius: 13px; background: linear-gradient(180deg, #d4733a 0%, #bf6229 100%);
  color: #fff !important; font-weight: 650; font-weight: 600;
  box-shadow: 0 8px 20px rgba(191, 98, 41, 0.28);
}
.modal-field-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
[ng-cloak], .ng-cloak { display: none !important; }

@media (min-width: 992px) {
  .sidebar { transform: none; }
  .mit-nav-backdrop, .mit-bottom-nav { display: none !important; }
  .main-panel {
    width: calc(100% - var(--sidebar-w)); margin-left: var(--sidebar-w); padding-bottom: 36px;
  }
  .navbar { padding: 14px 32px; }
  .navbar-toggler { display: none; }
  .content { padding: 28px 32px 48px; }
  .fab { right: 30px; bottom: 30px; width: 60px; height: 60px; border-radius: 20px; }
  .modal-field-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 575.98px) {
  .page-hero h1 { font-size: 1.4rem; }
  .mit-logout span { display: none; }
  .mit-metric-value,
  .stats-row .card-stats .card-title { font-size: 1.65rem; }
  .mit-metrics,
  .stats-row { border-radius: 18px; }
}
