:root {
  --bg: #f7f3ea;
  --panel: rgba(255, 250, 241, 0.78);
  --text: #24180c;
  --muted: #786552;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --gold: #c28b2c;
  --gold-soft: rgba(194, 139, 44, 0.18);
  --danger-soft: rgba(190, 24, 93, 0.14);
  --shadow-lg: 0 28px 80px rgba(58, 42, 21, 0.12);
  --shadow-md: 0 18px 40px rgba(58, 42, 21, 0.1);
  --radius-xl: 30px;
  --sidebar-width: 290px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(194, 139, 44, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 32%),
    linear-gradient(180deg, #fcf8f0 0%, #f4efe4 100%);
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 24, 12, 0.28);
  opacity: 0;
  visibility: hidden;
  transition: 0.25s ease;
  z-index: 20;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 28px 22px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(36, 24, 12, 0.96) 0%, rgba(33, 26, 18, 0.96) 100%);
  color: #f9f4eb;
  box-shadow: 16px 0 50px rgba(20, 14, 7, 0.18);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  pointer-events: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #d7a957 0%, #8d651b 100%);
  color: #fff9ef;
}

.brand-copy {
  margin-top: 18px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: rgba(249, 244, 235, 0.6);
}

.brand-title {
  margin: 8px 0 4px;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.brand-subtitle {
  margin: 0;
  color: rgba(249, 244, 235, 0.72);
  line-height: 1.6;
  font-size: 0.95rem;
}

.sidebar-nav {
  margin-top: 34px;
  display: grid;
  gap: 10px;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  color: rgba(249, 244, 235, 0.8);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-link-item:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.08);
  color: #fffaf2;
}

.nav-link-item.is-active {
  color: #fff9ef;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.42), rgba(194, 139, 44, 0.24));
}

.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-text strong {
  font-size: 0.96rem;
  font-weight: 700;
}

.nav-text span {
  font-size: 0.78rem;
  color: rgba(249, 244, 235, 0.6);
}

.sidebar-panel {
  margin-top: 28px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-panel p {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: rgba(249, 244, 235, 0.72);
}

.sidebar-panel strong {
  display: block;
  font-size: 1rem;
  color: #fff8ed;
}

.main-panel {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 22px;
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.72);
  border: 1px solid rgba(92, 66, 31, 0.08);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.topbar-title h1 {
  margin: 0;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: 1.8rem;
}

.topbar-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-toggle {
  display: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: #fff6e7;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.meta-pill,
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: #fffaf1;
  border: 1px solid rgba(92, 66, 31, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
}

.user-pill strong {
  color: var(--text);
}

.page-grid {
  display: grid;
  gap: 22px;
}

.hero-card,
.surface-card,
.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(92, 66, 31, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.9fr);
  gap: 22px;
}

.hero-card h2 {
  margin: 12px 0;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.02;
  max-width: 12ch;
}

.hero-card p {
  margin: 0;
  max-width: 58ch;
  line-height: 1.75;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.btn-brand,
.btn-ghost,
.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 16px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

.btn-brand {
  background: linear-gradient(135deg, var(--accent) 0%, #15998f 100%);
  color: #f8fffe;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(92, 66, 31, 0.12);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.btn-danger-soft {
  background: rgba(220, 53, 69, 0.08);
  color: #b42318;
  box-shadow: inset 0 0 0 1px rgba(220, 53, 69, 0.18);
}

.portal-top-search {
  display: flex;
  flex: 1 1 420px;
  max-width: 760px;
  margin: 0 24px;
  position: relative;
}

.portal-top-search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(13, 72, 134, 0.22);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  padding: 0 18px;
  background: #fff;
  color: var(--text);
  outline: 0;
}

.portal-top-search button {
  width: 58px;
  min-height: 48px;
  border: 0;
  border-radius: 0 14px 14px 0;
  background: #0d4886;
  color: #fff;
  font-size: 1.05rem;
}

.portal-search-results {
  position: absolute;
  z-index: 1055;
  top: calc(100% + 6px);
  left: 0;
  right: 58px;
  overflow: hidden;
  border-radius: 14px;
  background: #0d4886;
  box-shadow: 0 18px 38px rgba(18, 28, 45, 0.22);
}

.portal-search-result {
  display: block;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.portal-search-result:hover,
.portal-search-result:focus {
  background: #0a3b70;
  color: #fff;
}

.portal-search-result:last-child {
  border-bottom: 0;
}

.portal-search-result i {
  margin-right: 8px;
}

.portal-search-result strong {
  color: #ff2c35;
}

.portal-search-result span {
  color: rgba(255, 255, 255, 0.92);
}

.portal-search-empty {
  padding: 13px 16px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .portal-top-search {
    flex-basis: 100%;
    order: 3;
    margin: 8px 0 0;
  }

  .portal-search-results {
    right: 58px;
  }
}

.hero-highlights {
  display: grid;
  gap: 14px;
}

.highlight-tile {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(36, 24, 12, 0.92);
  color: #fff8ef;
}

.highlight-tile small {
  color: rgba(255, 248, 239, 0.64);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.highlight-tile strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
}

.highlight-tile span {
  display: block;
  margin-top: 6px;
  color: rgba(255, 248, 239, 0.76);
}

.stats-grid,
.split-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
}

.stat-card {
  padding: 24px;
}

.span-4 {
  grid-column: span 4;
}

.span-3 {
  grid-column: span 3;
}

.span-2 {
  grid-column: span 2;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.stat-top p {
  margin: 0;
  color: var(--muted);
}

.stat-top h3 {
  margin: 10px 0 0;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: 2.4rem;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #8a621a;
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-strip {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.progress-strip span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: rgba(92, 66, 31, 0.08);
  flex: 1;
}

.progress-strip span.is-filled {
  background: linear-gradient(90deg, var(--accent), #19a095);
}

.surface-card {
  padding: 26px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h3 {
  margin: 0;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: 1.3rem;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.list-stack {
  display: grid;
  gap: 14px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(92, 66, 31, 0.08);
}

.list-row strong {
  display: block;
}

.list-row span,
.empty-state,
.helper-text {
  color: var(--muted);
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.84rem;
}

.mini-badge.warn {
  background: var(--gold-soft);
  color: #8a621a;
}

.mini-badge.danger {
  background: var(--danger-soft);
  color: #a31252;
}

.table-shell {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  border: 1px solid rgba(92, 66, 31, 0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: rgba(255, 255, 255, 0.48);
}

.data-table th,
.data-table td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(92, 66, 31, 0.08);
  vertical-align: middle;
}

.data-table th {
  background: rgba(255, 250, 241, 0.9);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table input,
.data-table select {
  width: 100%;
  min-width: 90px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(92, 66, 31, 0.12);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
}

.class-sheet-stack {
  display: grid;
  gap: 8px;
}

.class-sheet-points {
  min-height: 42px;
  font-weight: 700;
  color: var(--accent-strong);
  background: rgba(15, 118, 110, 0.08);
}

.hifz-sheet-shell {
  max-height: 72vh;
}

.hifz-sheet-table {
  min-width: 980px;
}

.hifz-sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.hifz-entry-stack {
  align-content: start;
}

.class-sheet-mini-label {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.class-sheet-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.hifz-last-summary {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.hifz-last-summary span {
  color: var(--accent-strong);
  font-weight: 800;
}

.hifz-row-warning {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--gold-soft);
  color: #8a621a;
  font-size: 0.78rem;
  font-weight: 700;
}

.hifz-row-save {
  white-space: nowrap;
}

.hifz-report-quicklinks {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
}

.attendance-register-card {
  max-width: 980px;
}

.attendance-table {
  min-width: 0;
}

.attendance-status-select.present {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

.attendance-status-select.late {
  background: rgba(194, 139, 44, 0.12);
  color: #8a621a;
}

.attendance-status-select.absent,
.attendance-status-select.authorised {
  background: rgba(190, 24, 93, 0.08);
  color: #a31252;
}

.attendance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attendance-report-filter {
  background: #e8eff7;
  border-radius: 18px;
  box-shadow: none;
}

.attendance-report-filter-grid {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.attendance-report-filter-grid .field {
  grid-column: auto;
}

.attendance-report-filter-grid .field input,
.attendance-report-filter-grid .field select {
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
}

.attendance-report-filter-actions {
  display: flex;
  align-items: end;
}

.attendance-sheet-card {
  background: #ffffff;
}

.attendance-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.attendance-sheet-heading {
  margin-bottom: 18px;
  text-align: center;
}

.attendance-sheet-heading h2 {
  margin: 8px 0 4px;
  color: var(--text);
}

.attendance-sheet-heading p {
  margin: 2px 0;
  color: var(--muted);
}

.attendance-sheet-logo,
.report-sheet-mark {
  align-items: center;
  background: var(--gold);
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.attendance-wide-shell {
  border-radius: 0;
}

.attendance-month-table {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 0.6rem;
  margin-left: auto;
  margin-right: auto;
  table-layout: fixed;
}

.attendance-col-roll {
  width: 42px;
}

.attendance-col-student {
  width: 305px;
}

.attendance-col-day {
  width: 24px;
}

.attendance-col-total {
  width: 30px;
}

.attendance-month-table th,
.attendance-month-table td {
  border: 1px solid #222;
  line-height: 1;
  padding: 0 1px;
  text-align: center;
  vertical-align: middle;
}

.attendance-month-table th:nth-child(2),
.attendance-month-table td:nth-child(2) {
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}

.attendance-month-table thead th {
  background: #f7f3ea;
  color: #111827;
  font-weight: 900;
}

.att-code {
  display: inline-flex;
  justify-content: center;
  min-width: 10px;
  font-weight: 900;
}

.att-code-present {
  color: #0f62fe;
}

.att-code-absent {
  color: #ff4040;
}

.att-code-late {
  color: #009b63;
}

.att-code-authorised {
  color: #6b7280;
}

.att-code-empty {
  color: #111827;
}

.attendance-status-legend {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 14px;
}

.attendance-status-legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.attendance-summary-table {
  min-width: 980px;
}

.attendance-summary-table th,
.attendance-summary-table td {
  white-space: nowrap;
}

.attendance-top-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.attendance-top-card {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(92, 66, 31, 0.1);
  border-radius: 22px;
  padding: 18px;
}

.attendance-top-card-head {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.attendance-top-card-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.attendance-top-card-head p {
  color: var(--muted);
  margin: 4px 0 0;
}

.attendance-top-table {
  min-width: 0;
  width: 100%;
}

.attendance-top-table th,
.attendance-top-table td {
  padding: 10px 12px;
  white-space: nowrap;
}

.attendance-top-table th:nth-child(2),
.attendance-top-table td:nth-child(2) {
  white-space: normal;
}

.link-strong {
  font-weight: 800;
  color: var(--accent-strong);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.field {
  grid-column: span 6;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(92, 66, 31, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
}

.field textarea {
  resize: vertical;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(15, 118, 110, 0.1);
  border: 1px solid rgba(15, 118, 110, 0.16);
  color: var(--accent-strong);
  font-weight: 700;
}

.metric-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(92, 66, 31, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-pill strong {
  color: var(--text);
}

.chart-shell {
  display: grid;
  gap: 18px;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.chart-meta p {
  margin: 0;
  color: var(--muted);
}

.chart-bars {
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 4px 0;
}

.chart-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.chart-stack {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.chart-bar {
  width: 100%;
  max-width: 24px;
  min-height: 0;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(180deg, #2ac2b7 0%, var(--accent) 100%);
}

.chart-bar.secondary {
  background: linear-gradient(180deg, #e9ba68 0%, #c28b2c 100%);
}

.chart-bar.tertiary {
  background: linear-gradient(180deg, #fb7185 0%, #be185d 100%);
}

.chart-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.chart-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.legend-swatch.secondary {
  background: var(--gold);
}

.legend-swatch.tertiary {
  background: #be185d;
}

.alert-stack {
  display: grid;
  gap: 14px;
}

.alert-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(92, 66, 31, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.alert-card strong {
  display: block;
  margin-bottom: 8px;
}

.alert-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.alert-card small {
  display: inline-block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.alert-card.danger {
  background: rgba(190, 24, 93, 0.08);
  border-color: rgba(190, 24, 93, 0.14);
}

.alert-card.danger small {
  color: #a31252;
}

.alert-card.warn {
  background: rgba(194, 139, 44, 0.1);
  border-color: rgba(194, 139, 44, 0.16);
}

.alert-card.warn small {
  color: #8a621a;
}

.alert-card.info small {
  color: var(--accent-strong);
}

.progress-ladder {
  display: grid;
  gap: 14px;
}

.ladder-row {
  display: grid;
  grid-template-columns: 76px 1fr 86px;
  gap: 12px;
  align-items: center;
}

.ladder-row strong {
  font-size: 0.95rem;
}

.ladder-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(92, 66, 31, 0.08);
  overflow: hidden;
}

.ladder-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #22b8ab);
}

.table-meta,
.student-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.student-cell {
  display: grid;
  gap: 6px;
}

.student-cell strong {
  font-size: 0.96rem;
}

.inline-note {
  color: var(--muted);
  font-size: 0.84rem;
}

.section-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-action-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.desktop-table-only {
  display: block;
}

.mobile-record-stack {
  display: none;
}

.mobile-record-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(92, 66, 31, 0.08);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-md);
}

.mobile-record-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mobile-record-grid small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
  font-weight: 700;
}

.mobile-record-grid strong {
  font-size: 0.95rem;
}

.mobile-record-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.mobile-inline-form {
  display: grid;
  gap: 10px;
}

.micro-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(92, 66, 31, 0.08);
  background: rgba(255, 255, 255, 0.56);
}

.micro-card p {
  margin: 0;
  color: var(--muted);
}

.micro-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
}

.application-grid {
  display: grid;
  gap: 18px;
}

.application-card {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(92, 66, 31, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.application-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.application-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.application-detail-grid div {
  display: grid;
  gap: 4px;
}

.application-detail-grid strong {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  overflow: hidden;
  border-radius: 34px;
  background: rgba(255, 250, 241, 0.78);
  border: 1px solid rgba(92, 66, 31, 0.08);
  box-shadow: var(--shadow-lg);
}

.login-story {
  padding: 42px;
  background: radial-gradient(circle at top right, rgba(194, 139, 44, 0.18), transparent 32%), linear-gradient(180deg, rgba(36, 24, 12, 0.95) 0%, rgba(27, 20, 12, 0.98) 100%);
  color: #fff8ef;
}

.login-story h1 {
  margin: 18px 0 14px;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 0.98;
  max-width: 10ch;
}

.login-story p {
  margin: 0;
  max-width: 46ch;
  line-height: 1.75;
  color: rgba(255, 248, 239, 0.78);
}

.story-grid {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.story-tile {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
}

.story-tile strong {
  display: block;
  margin-bottom: 8px;
}

.login-form {
  padding: 42px;
}

.login-form h2 {
  margin: 12px 0 8px;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  font-size: 2rem;
}

.login-form p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-form .field {
  grid-column: span 12;
}

.login-form button {
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 1100px) {
  .span-2,
  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8 {
    grid-column: span 12;
  }

  .hero-card,
  .login-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .mobile-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .main-panel {
    width: 100%;
    margin-left: 0;
    padding: 18px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 16px;
    border-radius: 24px;
  }

  .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

  .field {
    grid-column: span 12;
  }

  .ladder-row {
    grid-template-columns: 1fr;
  }

  .application-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-title h1 {
    font-size: 1.45rem;
  }

  .hero-card,
  .surface-card,
  .stat-card,
  .login-story,
  .login-form {
    padding: 22px;
  }

  .topbar-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-pill,
  .user-pill,
  .btn-brand,
  .btn-ghost,
  .btn-soft,
  .btn-danger-soft {
    width: 100%;
  }

  .section-head,
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .section-tools,
  .hero-actions,
  .inline-action-form,
  .inline-action-group {
    flex-direction: column;
    align-items: stretch;
  }

  .desktop-table-only {
    display: none;
  }

  .mobile-record-stack {
    display: grid;
    gap: 14px;
  }

  .table-shell {
    border-radius: 16px;
  }
}

@media (max-width: 991.98px) {
  .attendance-report-filter-grid,
  .attendance-annual-filter-grid {
    grid-template-columns: 1fr;
  }

  .attendance-report-filter-actions {
    align-items: stretch;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 3.5mm;
  }

  .no-print,
  .app-header,
  .app-sidebar,
  .app-content-header,
  .app-footer {
    display: none !important;
  }

  .app-main,
  .app-content,
  .container-fluid,
  .page-grid {
    margin: 0 !important;
    padding: 0 !important;
  }

  .surface-card {
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .attendance-sheet-card {
    width: 100% !important;
  }

  .attendance-sheet-heading {
    margin-bottom: 4px !important;
  }

  .attendance-sheet-heading h2 {
    font-size: 13px !important;
    margin: 2px 0 !important;
  }

  .attendance-sheet-heading p {
    font-size: 7px !important;
    line-height: 1.05 !important;
  }

  .attendance-sheet-logo,
  .report-sheet-mark {
    height: 18px !important;
    width: 18px !important;
    font-size: 7px !important;
  }

  .attendance-month-table {
    min-width: 0;
    width: auto !important;
    font-size: 5.7px;
    margin-left: auto !important;
    margin-right: auto !important;
    page-break-inside: auto;
    table-layout: fixed;
  }

  .attendance-col-roll {
    width: 8mm;
  }

  .attendance-col-student {
    width: 54mm;
  }

  .attendance-col-day {
    width: 6.2mm;
  }

  .attendance-col-total {
    width: 8mm;
  }

  .attendance-month-table th,
  .attendance-month-table td {
    padding: 0.25px 0;
    line-height: 1.05;
  }

  .attendance-month-table th:nth-child(2),
  .attendance-month-table td:nth-child(2) {
    min-width: 0;
    max-width: none;
    white-space: nowrap;
  }

  .attendance-month-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .att-code {
    min-width: 0;
  }

  .table-shell {
    border: 0 !important;
    overflow: visible !important;
  }

  .attendance-status-legend {
    gap: 6px !important;
    margin-top: 4px !important;
    font-size: 7px !important;
  }
}

body.attendance-pdf-mode .no-print,
body.attendance-pdf-mode .app-header,
body.attendance-pdf-mode .app-sidebar,
body.attendance-pdf-mode .app-content-header,
body.attendance-pdf-mode .app-footer {
  display: none !important;
}

body.attendance-pdf-mode .app-main,
body.attendance-pdf-mode .app-content,
body.attendance-pdf-mode .container-fluid,
body.attendance-pdf-mode .page-grid {
  margin: 0 !important;
  padding: 0 !important;
}

body.attendance-pdf-mode .attendance-sheet-card {
  box-shadow: none !important;
  border: 0 !important;
}
