html {
  font-size: 15px;
}

:root {
  --shadow-soft: 0 8px 24px rgba(37, 99, 235, 0.14);
}

* {
  box-sizing: border-box;
}

body.app-body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page-bg);
  font-family: "Noto Sans Bengali", "Hind Siliguri", "Segoe UI", Arial, sans-serif;
}

a {
  text-decoration: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.app-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.app-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 1rem 1rem 6.5rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% -10%, #1e3a8a 0, #111c36 38%, #071120 100%);
}

.login-card {
  width: min(100%, 430px);
  padding: 2rem;
  color: white;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 1rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-soft);
  font-size: 2.2rem;
}

.brand-mark img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 1rem;
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(2, 6, 23, 0.76);
  border-radius: 1rem;
}

.role-tabs button {
  border: 0;
  border-radius: 0.8rem;
  padding: 0.85rem 0.5rem;
  color: #cbd5e1;
  background: transparent;
  font-weight: 800;
}

.role-tabs button.active {
  color: white;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.42);
}

.role-tabs.role-tabs-4 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 420px) {
  .role-tabs.role-tabs-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.person-search-picker {
  position: relative;
}

.person-search-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0.75rem;
}

.person-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: transparent;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
}

.person-search-item:hover,
.person-search-item:focus {
  background: rgba(37, 99, 235, 0.08);
}

.person-search-empty {
  padding: 0.75rem 0.85rem;
  color: #64748b;
  font-size: 0.875rem;
}

.login-input {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  outline: none;
}

.login-input::placeholder {
  color: #94a3b8;
}

.login-remember {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.login-app-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #7dd3fc;
  text-decoration: none;
}

.login-app-link:hover {
  color: #bae6fd;
  text-decoration: underline;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.page-heading h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 900;
}

.shadow-card,
.stat-card,
.form-card,
.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.55rem;
  box-shadow: var(--shadow);
}

.shadow-soft {
  box-shadow: var(--shadow-soft) !important;
}

.shadow-strong {
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 760px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.date-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 760px) {
  .date-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mini-info {
  padding: 1rem;
}

.mini-info strong,
.mini-info span {
  display: block;
}

.mini-info span {
  color: var(--muted);
  font-weight: 800;
}

.stat-card {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
}

.stat-card strong {
  display: block;
  color: #172554;
  font-size: 2rem;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-weight: 800;
}

.form-card,
.list-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.section-title {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.2rem;
  width: min(calc(100% - 1rem), 720px);
  padding: 0.55rem;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.bottom-nav.bottom-nav-8 {
  grid-template-columns: repeat(4, 1fr);
  width: min(calc(100% - 0.5rem), 760px);
}

.bottom-nav.bottom-nav-8 a {
  font-size: 0.68rem;
  padding: 0.45rem 0.15rem;
}

.bottom-nav a {
  padding: 0.6rem 0.2rem;
  color: #64748b;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.bottom-nav a.active {
  color: var(--blue, #2563eb);
  background: rgba(37, 99, 235, 0.1);
}

/* —— Admin: desktop left sidebar, mobile bottom nav —— */
.admin-layout {
  min-height: 100vh;
}

.admin-sidebar {
  display: none;
}

.admin-content {
  min-width: 0;
}

.admin-sidebar-brand {
  text-align: center;
  padding: 0 0.35rem 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-sidebar-logo,
.admin-sidebar-logo-placeholder {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin: 0 auto 0.5rem;
  display: block;
  border-radius: 1rem;
}

.admin-sidebar-logo-placeholder {
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  background: rgba(37, 99, 235, 0.08);
}

.admin-sidebar-school {
  font-weight: 900;
  font-size: 0.95rem;
  line-height: 1.25;
}

.admin-sidebar-portal {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.25rem;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.25rem 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.88rem;
}

.admin-nav-item:hover {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.04);
}

.admin-nav-item.active {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
}

.admin-nav-icon {
  width: 1.35rem;
  text-align: center;
  flex-shrink: 0;
}

@media (min-width: 992px) {
  body.admin-shell .admin-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
  }

  body.admin-shell .admin-sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 1.15rem 0.75rem;
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }

  body.admin-shell .admin-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
  }

  body.admin-shell .admin-main {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
  }

  body.admin-shell .bottom-nav-admin {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  body.admin-shell .admin-layout {
    display: block;
  }

  body.admin-shell .admin-main {
    padding-bottom: 6.5rem;
  }
}

.comm-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .comm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.comm-card {
  display: block;
  padding: 1.25rem;
  color: inherit;
  border-radius: 1.25rem;
}

.comm-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.comm-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.comm-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.comm-meta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--blue, #2563eb);
}

#accounting-panel {
  scroll-margin-top: 0.75rem;
}

.accounting-subtabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
}

.accounting-subtabs a {
  flex: 0 0 auto;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
}

.accounting-subtabs a.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.fee-settings-group {
  margin-bottom: 1rem;
}

.fee-settings-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.fee-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.fee-settings-amount {
  font-weight: 900;
  white-space: nowrap;
}

.txn-kind-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.txn-kind-toggle label {
  text-align: center;
  padding: 0.55rem;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.txn-kind-toggle label.active {
  border-color: #0f172a;
}

.txn-kind-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.payable-row,
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.due-report-card {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: #fff;
}

.class-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .class-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .class-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-main:has(.class-grid) {
    width: min(100%, 980px);
  }
}

.class-grid-card {
  background: #fff;
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.class-grid-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  color: inherit;
}

.class-grid-icon {
  font-size: 1.35rem;
}

.class-grid-body {
  flex: 1;
  min-width: 0;
}

.class-grid-body strong {
  display: block;
  font-size: 1.05rem;
}

.class-grid-body small {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.class-grid-chevron {
  color: #cbd5e1;
  font-size: 1.5rem;
  line-height: 1;
}

.class-grid-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0 1rem 0.85rem;
  justify-content: flex-end;
}

.class-hero {
  padding: 1rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #1e40af 100%);
  color: #fff;
}

.class-hero-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.class-hero-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.class-hero-meta {
  font-size: 0.85rem;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

.class-search .form-control {
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.class-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.student-row-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem;
  margin-top: 0.65rem;
  background: var(--card);
  color: var(--ink);
  border-radius: 1rem;
  border: 1px solid var(--border);
}

.roll-box {
  min-width: 3.1rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.35rem 0.25rem;
  font-size: 0.72rem;
}

.roll-box strong {
  display: block;
  font-size: 0.95rem;
}

.student-row-main {
  flex: 1;
  min-width: 0;
  color: inherit;
}

.student-row-main strong {
  color: var(--blue);
}

.student-row-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.reg-badge {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.68rem;
}

.student-row-actions {
  display: flex;
  gap: 0.35rem;
}

.bottom-nav a {
  color: var(--nav-link);
}

.bottom-nav a:hover,
.bottom-nav a:focus {
  color: var(--blue);
  background: var(--nav-link-hover-bg);
}

.btn-primary,
.btn-success {
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  font-weight: 800;
}

.btn-primary {
  background: var(--blue);
  color: #ffffff;
}

.form-control,
.form-select {
  border-radius: 0.9rem;
  border-color: var(--border);
  padding: 0.8rem 1rem;
  background: var(--input-bg);
  color: var(--input-text);
}

.form-control::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.text-muted {
  color: var(--muted) !important;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  color: var(--badge-text);
  background: var(--badge-bg);
  border-radius: 999px;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 760px) {
  .module-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.settings-card {
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 1rem;
  color: var(--ink);
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.settings-card small {
  color: var(--muted);
}

.settings-card strong {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 0.4rem;
  background: #eff6ff;
  border-radius: 1rem;
}

.settings-card span {
  font-weight: 900;
}

.settings-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.result-table th,
.result-marks-table th {
  font-size: 0.78rem;
  vertical-align: middle;
}

.result-subhead th {
  background: #f1f5f9;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-marks-table .mark-cell {
  min-width: 3.25rem;
  padding: 0.25rem;
}

.result-marks-table .mark-total-cell {
  background: #f8fafc;
  text-align: center;
  vertical-align: middle;
}

.result-marks-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.result-marks-table th:first-child,
.result-marks-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 7.5rem;
  box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}

.result-marks-table thead th:first-child {
  z-index: 3;
  background: #f8fafc;
}

.marks-entry-hint {
  margin: -0.35rem 0 0.75rem;
}

.result-table td.text-center {
  font-size: 0.85rem;
}

.result-student-cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.result-student-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.result-card-head {
  text-align: center;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 0.65rem;
}

.result-card-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 0.25rem;
}

.result-card-school {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.result-card-sub {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.result-card-banner {
  display: inline-block;
  margin: 0.45rem 0 0.25rem;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.result-card-exam {
  font-weight: 800;
  margin-top: 0.35rem;
}

.result-card-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.result-card-info .lbl {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.result-card-table {
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

.result-card-table .subject-name {
  font-weight: 800;
  min-width: 5.5rem;
}

.result-card-table th {
  background: #f1f5f9;
  font-size: 0.72rem;
}

.result-card-summary td {
  background: #f8fafc;
}

.result-card-remarks {
  border: 1px dashed #cbd5e1;
  border-radius: 0.65rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
}

.result-card-remarks .lbl {
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.result-card-remarks p {
  margin: 0.25rem 0 0;
}

.result-card-sigs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.result-card-sigs .sig-line {
  border-top: 1px solid #0f172a;
  margin: 2.25rem 0.35rem 0.35rem;
}

.result-card-foot {
  text-align: center;
  font-size: 0.75rem;
  margin-top: 0.65rem;
}

@media (min-width: 640px) {
  .result-card-info {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.exam-subtabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.exam-subtabs a,
.exam-subtabs .muted-tab {
  flex: 0 0 auto;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.exam-subtabs a.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.routine-workspace {
  display: grid;
  gap: 1rem;
}

@media (min-width: 992px) {
  .app-main:has(.routine-workspace) {
    width: min(100%, 1180px);
  }

  .routine-workspace {
    grid-template-columns: minmax(280px, 360px) 1fr;
    align-items: start;
  }
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.segmented label {
  text-align: center;
  padding: 0.55rem 0.35rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.segmented label.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.exam-pick-list {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.5rem;
  background: #fff;
}

.exam-pick-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.35rem 0;
  font-size: 0.85rem;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.a4-preview-scaler {
  overflow: auto;
  padding: 0.25rem;
}

.a4-preview {
  width: 210mm;
  min-height: 280mm;
  margin: 0 auto;
  padding: 14mm 12mm;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: scale(var(--preview-zoom, 1));
  transform-origin: top center;
}

.a4-preview.font-normal { font-size: 11px; }
.a4-preview.font-large { font-size: 12px; }
.a4-preview.font-extra { font-size: 14px; }

.a4-head {
  text-align: center;
  margin-bottom: 0.75rem;
}

.a4-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: 0.35rem;
}

.a4-head h2 {
  margin: 0;
  font-size: 1.35em;
  font-weight: 900;
}

.a4-banner {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-weight: 800;
}

.a4-preview.theme-emerald .a4-banner { background: #047857; }
.a4-preview.theme-blue .a4-banner { background: #1d4ed8; }
.a4-preview.theme-violet .a4-banner { background: #6d28d9; }

.a4-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.92em;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.routine-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.routine-table th,
.routine-table td {
  border: 1px solid #cbd5e1;
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.routine-table th {
  background: #f8fafc;
  font-size: 0.85em;
}

.routine-table .exam-mini {
  font-weight: 700;
  margin-top: 0.15rem;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(var(--seat-cols, 5), minmax(52px, 1fr));
  gap: 0.35rem;
}

.seat-cell {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.35rem;
  text-align: center;
  background: #fff;
  font-size: 0.75rem;
}

.seat-cell strong {
  display: block;
  font-size: 0.82rem;
}

.msg-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  margin-bottom: 1rem;
}

.msg-hero-title {
  font-size: 1.15rem;
  font-weight: 900;
}

.msg-hero-sub {
  opacity: 0.9;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.msg-badge {
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.msg-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.45rem;
  border-radius: 1rem;
  background: #fff;
  margin-bottom: 1rem;
}

.msg-tabs a {
  flex: 1 0 auto;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.msg-tabs a.active {
  background: #ecfdf5;
  color: #047857;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

@media print {
  @page {
    size: legal landscape;
    margin: 6mm;
  }

  .app-header,
  .bottom-nav,
  .no-print,
  .routine-config,
  .preview-toolbar {
    display: none !important;
  }

  .a4-preview {
    transform: none !important;
    box-shadow: none;
    border: 0;
  }

  body.app-body {
    background: white;
  }

  .app-main {
    width: 100%;
    padding: 0;
  }

  .result-print {
    box-shadow: none;
    border: 0;
  }

  body:not(.print-result-cards) .result-print-class .result-table {
    width: 100%;
    table-layout: fixed;
    font-size: 8pt;
  }

  body:not(.print-result-cards) .result-print-class .result-table th,
  body:not(.print-result-cards) .result-print-class .result-table td {
    padding: 0.15rem 0.2rem;
    word-wrap: break-word;
  }

  body:not(.print-result-cards) .result-print-class .table-responsive {
    overflow: visible !important;
  }

  body.print-result-cards .result-print-class,
  body.print-result-cards .no-print-screen-only {
    display: none !important;
  }

  body:not(.print-result-cards) .result-student-cards {
    display: none !important;
  }

  body.print-result-cards .result-student-cards {
    display: block !important;
  }

  body.print-result-cards .result-student-card {
    page-break-after: always;
    break-after: page;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
  }

  body.print-result-cards .result-student-card:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

.dash-kpi-grid .stat-card {
  min-height: 108px;
}

.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.finance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.finance-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.06);
}

.finance-tab.active {
  color: #fff;
  background: #2563eb;
}

.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 992px) {
  .finance-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.finance-kpi {
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.finance-kpi span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.finance-kpi strong {
  font-size: 1.15rem;
  color: #1e3a8a;
}

.finance-kpi-loss strong {
  color: #b91c1c;
}

.fee-progress-row {
  margin-bottom: 0.85rem;
}

.fee-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.fee-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.dash-two-col {
  display: grid;
  gap: 1rem;
}

@media (min-width: 992px) {
  .dash-two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.dash-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dash-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.45rem;
  border-radius: 0.35rem;
  white-space: nowrap;
}

.badge-ok {
  color: #166534;
  background: #dcfce7;
}

.badge-danger {
  color: #991b1b;
  background: #fee2e2;
}

.badge-warn {
  color: #92400e;
  background: #fef3c7;
}

.badge-muted {
  color: #475569;
  background: #e2e8f0;
}

.exam-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.exam-kpi {
  padding: 0.85rem;
  border-radius: 0.85rem;
  color: #fff;
  text-align: center;
}

.exam-kpi span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
}

.exam-kpi strong {
  font-size: 1.35rem;
}

.exam-kpi-blue {
  background: #1e3a8a;
}

.exam-kpi-green {
  background: #15803d;
}

.exam-kpi-red {
  background: #b91c1c;
}

.performer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 992px) {
  .performer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.performer-card {
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
}

.performer-pct {
  font-size: 1.1rem;
  font-weight: 900;
  color: #2563eb;
}

.att-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 140px;
  padding-top: 0.5rem;
}

.att-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 120px;
  font-size: 0.62rem;
  color: var(--muted);
}

.att-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 0.35rem 0.35rem 0 0;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  margin-bottom: 0.25rem;
}

.subject-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.85rem;
}

.subject-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.subject-bar-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 999px;
}