/* =========================================================
   HAES AT A GLANCE — RESPONSIVE EXECUTIVE ANALYTICS & DIRECTORY
   ========================================================= */
.haes-glance-page {
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  color: #14213d;
  overflow-x: clip;
}

.haes-glance-page .aims-hero {
  position: relative;
  overflow: hidden;
  background-color: #0f1c33;
  min-height: clamp(240px, 34vw, 380px);
  display: flex;
  align-items: center;
}

.haes-glance-page .aims-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.haes-glance-page .aims-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(15, 28, 51, 0.92) 0%,
    rgba(20, 33, 61, 0.82) 58%,
    rgba(201, 100, 73, 0.36) 100%
  );
  z-index: 1;
}

.haes-glance-page .aims-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.25rem) clamp(1rem, 3vw, 1.5rem);
}

.glance-section {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.25rem) 0 clamp(2.75rem, 5vw, 4.5rem);
  background: linear-gradient(
    135deg,
    #fffaf0 0%,
    #f5f8ff 36%,
    #fdf3f0 70%,
    #f2fbf7 100%
  );
}

.glance-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 2.5vw, 1.5rem);
  position: relative;
  z-index: 2;
}

/* KPI Summary Cards */
.glance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.9rem, 1.8vw, 1.35rem);
  margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
}

.glance-kpi-card {
  background: #ffffff;
  border-radius: 16px;
  padding: clamp(1rem, 2vw, 1.3rem) clamp(1.05rem, 2vw, 1.4rem);
  border: 1px solid rgba(20, 33, 61, 0.08);
  border-top: 4px solid #c9a227;
  box-shadow: 0 10px 26px rgba(15, 28, 51, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.glance-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(15, 28, 51, 0.1);
}

.glance-kpi-card--terracotta { border-top-color: #c96449; }
.glance-kpi-card--navy { border-top-color: #14213d; }
.glance-kpi-card--teal { border-top-color: #2a7b76; }

.glance-kpi-label {
  font-size: clamp(0.68rem, 1vw, 0.74rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.glance-kpi-label i {
  color: #c96449;
  flex-shrink: 0;
}

.glance-kpi-value {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 800;
  color: #14213d;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.glance-kpi-sub {
  font-size: clamp(0.74rem, 1vw, 0.8rem);
  color: #475569;
  line-height: 1.45;
}

/* Tier Breakdown Cards */
.glance-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.9rem, 1.6vw, 1.25rem);
  margin-bottom: clamp(1.4rem, 2.8vw, 2rem);
}

.glance-tier-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  padding: clamp(1rem, 1.8vw, 1.25rem);
  border: 1px solid rgba(20, 33, 61, 0.09);
  box-shadow: 0 8px 20px rgba(15, 28, 51, 0.05);
  min-width: 0;
}

.glance-tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.glance-tier-title {
  font-size: clamp(0.9rem, 1.2vw, 0.98rem);
  font-weight: 700;
  color: #14213d;
  margin: 0;
}

.glance-tier-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: #14213d;
  color: #ffffff;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.glance-tier-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  font-size: clamp(0.75rem, 1vw, 0.82rem);
  color: #334155;
}

.glance-tier-stats strong {
  color: #14213d;
}

/* Charts Grid */
.glance-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 1.8vw, 1.45rem);
  margin-bottom: clamp(1.4rem, 2.8vw, 2rem);
}

.glance-chart-card {
  background: #ffffff;
  border-radius: 16px;
  padding: clamp(1rem, 1.8vw, 1.45rem);
  border: 1px solid rgba(20, 33, 61, 0.09);
  box-shadow: 0 10px 26px rgba(15, 28, 51, 0.06);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.glance-chart-card--wide {
  grid-column: 1 / -1;
}

.glance-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.glance-chart-title {
  font-size: clamp(0.95rem, 1.25vw, 1.05rem);
  font-weight: 700;
  color: #14213d;
  margin: 0 0 0.2rem;
}

.glance-chart-sub {
  font-size: clamp(0.72rem, 0.95vw, 0.78rem);
  color: #64748b;
  margin: 0;
}

.glance-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: clamp(230px, 32vw, 300px);
}

.glance-chart-canvas-wrap--tall {
  height: clamp(290px, 42vw, 380px);
}

/* Filter & Search Bar */
.glance-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(20, 33, 61, 0.08);
  border-radius: 14px;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.35rem;
  box-shadow: 0 8px 22px rgba(15, 28, 51, 0.05);
}

.glance-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1 1 auto;
}

.glance-filter-btn {
  font-family: inherit;
  font-size: clamp(0.74rem, 0.95vw, 0.8rem);
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(20, 33, 61, 0.14);
  background: #f8fafc;
  color: #14213d;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.glance-filter-btn:hover {
  border-color: #c9a227;
  background: #fffaf0;
}

.glance-filter-btn.is-active {
  background: #14213d;
  color: #ffffff;
  border-color: #14213d;
}

.glance-controls-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  flex: 0 1 auto;
}

.glance-search-wrap {
  position: relative;
  flex: 1 1 210px;
}

.glance-search-wrap i {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.82rem;
  pointer-events: none;
}

.glance-search-input {
  font-family: inherit;
  font-size: 0.82rem;
  width: 100%;
  min-width: 200px;
  min-height: 38px;
  padding: 0.45rem 0.85rem 0.45rem 2.15rem;
  border-radius: 8px;
  border: 1px solid rgba(20, 33, 61, 0.18);
  background: #ffffff;
  color: #14213d;
  box-sizing: border-box;
}

.glance-search-input:focus {
  outline: none;
  border-color: #c9a227;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

.glance-sort-select {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(20, 33, 61, 0.18);
  background: #ffffff;
  color: #14213d;
  cursor: pointer;
}

/* Directory Table */
.glance-table-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(20, 33, 61, 0.09);
  box-shadow: 0 12px 30px rgba(15, 28, 51, 0.07);
  overflow: hidden;
}

.glance-table-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #fcfaf4;
  border-bottom: 1px solid rgba(20, 33, 61, 0.08);
  font-size: clamp(0.76rem, 1vw, 0.82rem);
  color: #475569;
}

.glance-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.glance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.glance-table thead th {
  background: #14213d;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.78rem 0.7rem;
  white-space: nowrap;
  border-bottom: 3px solid #c9a227;
  position: sticky;
  top: 0;
  z-index: 1;
}

.glance-table tbody tr {
  border-bottom: 1px solid rgba(20, 33, 61, 0.08);
  transition: background 0.15s ease;
}

.glance-table tbody tr:hover {
  background: #fffaf0;
}

.glance-table td {
  padding: 0.72rem 0.7rem;
  color: #1e293b;
  vertical-align: top;
}

.glance-table td.num,
.glance-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.glance-table td.center,
.glance-table th.center {
  text-align: center;
  white-space: nowrap;
}

.glance-inst-name {
  font-weight: 700;
  color: #14213d;
  display: block;
}

.glance-inst-addr {
  font-size: 0.72rem;
  color: #64748b;
  display: block;
  margin-top: 0.15rem;
  line-height: 1.35;
}

.glance-cat-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.08);
  color: #14213d;
  margin-top: 0.25rem;
}

.glance-table tfoot td {
  background: #f1f5f9;
  font-weight: 700;
  color: #14213d;
  padding: 0.85rem 0.7rem;
  border-top: 2px solid #14213d;
  white-space: nowrap;
}

.glance-footnote {
  margin-top: 1.15rem;
  font-size: clamp(0.72rem, 0.95vw, 0.78rem);
  color: #64748b;
  line-height: 1.55;
}

/* Tablet Breakpoint */
@media (max-width: 1080px) {
  .glance-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glance-tier-grid,
  .glance-charts-grid {
    grid-template-columns: 1fr;
  }

  .glance-chart-card--wide {
    grid-column: auto;
  }
}

/* Mobile Breakpoint: Stacked Cards for Table Rows */
@media (max-width: 768px) {
  .glance-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .glance-filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glance-filter-btn {
    white-space: normal;
    text-align: center;
  }

  .glance-controls-right {
    flex-direction: column;
    align-items: stretch;
  }

  .glance-search-wrap,
  .glance-search-input,
  .glance-sort-select {
    width: 100%;
    min-width: 0;
  }

  .glance-table thead,
  .glance-table tfoot {
    display: none;
  }

  .glance-table tbody tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(20, 33, 61, 0.14);
  }

  .glance-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.3rem 0;
    border: none;
    text-align: right;
  }

  .glance-table td:first-child {
    display: none;
  }

  .glance-table td:nth-child(2) {
    display: block;
    text-align: left;
    padding-bottom: 0.55rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px dashed rgba(20, 33, 61, 0.12);
  }

  .glance-table td.num,
  .glance-table td.center {
    white-space: normal;
  }

  .glance-table td:nth-child(3)::before { content: "Est. Year"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(4)::before { content: "Head"; font-weight: 600; color: #64748b; text-align: left; flex-shrink: 0; }
  .glance-table td:nth-child(5)::before { content: "Boys"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(6)::before { content: "Girls"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(7)::before { content: "Total Strength"; font-weight: 700; color: #14213d; text-align: left; }
  .glance-table td:nth-child(8)::before { content: "Staff (G / L)"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(9)::before { content: "Total Staff"; font-weight: 700; color: #14213d; text-align: left; }
  .glance-table td:nth-child(10)::before { content: "Support (G / L)"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(11)::before { content: "Total Support"; font-weight: 700; color: #14213d; text-align: left; }
  .glance-table td:nth-child(12)::before { content: "Scholarships"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(13)::before { content: "Scholarship (Col. 14)"; font-weight: 600; color: #64748b; text-align: left; }
  .glance-table td:nth-child(14)::before { content: "Scholarship (Col. 15)"; font-weight: 600; color: #64748b; text-align: left; }
}

@media (max-width: 480px) {
  .glance-kpi-grid {
    grid-template-columns: 1fr;
  }

  .glance-filter-group {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glance-kpi-card,
  .glance-filter-btn,
  .glance-table tbody tr {
    transition: none;
  }
}