:root {
  --navy: #081653;
  --navy-2: #101f67;
  --ink: #11131a;
  --muted: #68707f;
  --line: rgba(17, 31, 100, .10);
  --paper: #fffefa;
  --canvas: #f3f5f8;
  --soft: #fff4dc;
  --emerald: #d90011;
  --gold: #f2b233;
  --gold-soft: #fff4dc;
  --red: #d90011;
  --red-dark: #970710;
  --blue: #223bb2;
  --black: #050b28;
  --shadow: 0 24px 70px rgba(8, 22, 83, .14);
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(8,22,83,.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(8,22,83,.04) 1px, transparent 1px),
    radial-gradient(circle at 88% 0%, rgba(242,178,51,.16), transparent 30%),
    radial-gradient(circle at 8% 28%, rgba(217,0,17,.06), transparent 22%),
    var(--canvas);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 620px) minmax(280px, 1fr);
  background:
    radial-gradient(circle at 17% 18%, rgba(242,178,51,.34), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(217,0,17,.22), transparent 24%),
    linear-gradient(135deg, rgba(8,22,83,.98), rgba(16,31,103,.94) 48%, rgba(5,11,40,.97)),
    linear-gradient(45deg, #fff6e6, #fff);
}
.login-panel { padding: clamp(28px, 6vw, 72px); color: white; align-self: center; }
.login-panel h1 { max-width: 680px; font-size: clamp(34px, 5vw, 64px); line-height: 1.02; margin: 38px 0 18px; letter-spacing: 0; }
.login-panel p { color: #c9d7e8; font-size: 17px; margin-bottom: 30px; }
.login-card {
  max-width: 440px;
  display: grid;
  gap: 16px;
  padding: 24px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(242,178,51,.28);
  border-radius: 8px;
  backdrop-filter: blur(16px);
  box-shadow: 0 28px 90px rgba(0,0,0,.22);
}
.login-aside { display: grid; align-content: end; gap: 18px; padding: 44px; }
.login-aside div { background: white; border: 1px solid rgba(245,166,35,.2); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); max-width: 360px; }
.login-aside strong { display: block; font-size: 44px; color: var(--navy); }
.login-aside small { color: var(--muted); }
.metric-label { color: var(--red); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; line-height: 1.1; }
.brand-lockup small { display: block; color: #8da2bd; font-size: 12px; margin-top: 3px; }
.brand-lockup.large small { color: #c9d7e8; }
.brand-logo-frame {
  width: 72px; height: 46px; display: grid; place-items: center; flex: 0 0 auto;
  background: transparent;
  border: 0; border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.28));
}
.brand-logo-frame img {
  width: 100%; height: 100%; object-fit: contain; padding: 0;
}
.brand-logo-frame.large {
  width: 208px; height: 104px; border-radius: 0;
  border-color: transparent;
}
.brand-logo-frame.large img { padding: 0; }
.login-panel .brand-logo-frame.large {
  width: 218px; height: 112px; border-radius: 8px;
  background:
    radial-gradient(circle at 14% 12%, rgba(255,255,255,.96), rgba(255,246,230,.9) 58%, rgba(245,166,35,.2)),
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,246,230,.68));
  border: 1px solid rgba(242,178,51,.5);
  box-shadow: 0 22px 52px rgba(0,0,0,.24), inset 0 0 0 1px rgba(255,255,255,.55);
}
.login-panel .brand-logo-frame.large img { padding: 8px; }
.sidebar-brand {
  padding: 10px;
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(245,166,35,.08));
  border: 1px solid rgba(245,166,35,.22);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.app-shell { min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: hidden; display: block; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 10; width: 284px; height: 100vh; overflow: auto;
  background:
    radial-gradient(circle at 35% 0%, rgba(242,178,51,.22), transparent 34%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 54%, var(--black) 100%);
  color: white; padding: 22px 16px; border-right: 1px solid rgba(242,178,51,.32);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(245,166,35,.55) rgba(255,255,255,.08);
}
.nav-list { margin-top: 22px; display: grid; gap: 5px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 11px; border: 0; background: transparent;
  position: relative;
  color: #d9def7; padding: 11px 12px; border-radius: 8px; text-align: left; font-weight: 750;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}
.nav-item span:first-child { width: 22px; text-align: center; }
.nav-item:hover { color: white; background: rgba(255,255,255,.1); box-shadow: inset 3px 0 0 rgba(245,166,35,.7), 0 10px 24px rgba(0,0,0,.12); }
.nav-item.active {
  color: white; background: linear-gradient(90deg, var(--red), var(--red-dark));
  box-shadow: inset 3px 0 0 var(--gold), 0 14px 30px rgba(227,6,19,.24);
}
.nav-item.active::after {
  content: ""; position: absolute; inset: 7px 8px 7px auto; width: 2px; border-radius: 999px;
  background: var(--gold); opacity: .82; animation: stitchPulse 2.8s ease-in-out infinite;
}
.nav-item:active { transform: translateY(1px); }
.sidebar-card {
  margin-top: 28px; padding: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(245,166,35,.42); border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.sidebar-card small, .sidebar-card span { display: block; color: #b8cadf; }
.sidebar-card strong { display: block; margin: 7px 0; }

.workspace { min-width: 0; max-width: calc(100vw - 284px); margin-left: 284px; overflow-x: hidden; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 22px; padding: 18px 28px; background: rgba(255,254,250,.94); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(242,178,51,.34);
  box-shadow: 0 18px 48px rgba(8,22,83,.08);
}
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: 0; color: var(--navy); position: relative; padding-left: 14px; }
.topbar h2::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 3px; width: 4px; border-radius: 999px; background: linear-gradient(180deg, var(--red), var(--gold)); }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search-box { position: relative; }
.search-box span { position: absolute; left: 12px; top: 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.search-box input { width: min(330px, 32vw); padding: 24px 12px 8px; }
.role-badge {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 13px; border-radius: 8px; color: var(--navy); background: var(--gold-soft);
  border: 1px solid rgba(245,166,35,.46); font-weight: 900; white-space: nowrap;
}

input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink);
  padding: 11px 12px; outline: none;
}
textarea { resize: vertical; min-height: 112px; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,27,34,.14), 0 0 0 5px rgba(242,165,26,.08); }
label { color: var(--muted); font-size: 13px; font-weight: 800; display: grid; gap: 7px; }
.primary-btn, .ghost-btn, .danger-btn, .icon-btn {
  border: 0; border-radius: 8px; min-height: 42px; padding: 0 14px; font-weight: 800;
}
.primary-btn { color: white; background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 10px 24px rgba(227,6,19,.2); }
.ghost-btn { color: var(--navy); background: white; border: 1px solid var(--line); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px rgba(17,31,100,.04); }
.danger-btn { color: #fff; background: var(--red); }
.icon-btn { min-width: 42px; background: white; border: 1px solid var(--line); color: var(--navy); }
.primary-btn:hover, .ghost-btn:hover, .danger-btn:hover, .icon-btn:hover { transform: translateY(-1px); }

.view { width: 100%; max-width: 100%; padding: 28px; display: grid; gap: 24px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 16px; }
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fffefa, #fffaf0); border: 1px solid rgba(8,22,83,.09); border-radius: 8px; padding: 18px; box-shadow: 0 16px 38px rgba(8,22,83,.08);
  animation: stitchRise .46s ease both;
}
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--red), var(--gold)); }
.kpi:nth-child(1) { grid-column: span 2; }
.kpi:nth-child(1) strong { font-size: 42px; }
.kpi:nth-child(2) { animation-delay: .03s; }
.kpi:nth-child(3) { animation-delay: .06s; }
.kpi:nth-child(4) { animation-delay: .09s; }
.kpi:nth-child(n+5) { animation-delay: .12s; }
.kpi small { color: var(--muted); font-weight: 800; }
.kpi strong { display: block; margin-top: 10px; font-size: 30px; color: var(--navy); }
.kpi span { color: var(--red); font-size: 13px; font-weight: 800; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr); gap: 18px; }
.panel {
  min-width: 0;
  background: rgba(255,254,250,.96); border: 1px solid rgba(8,22,83,.09); border-radius: 8px; padding: 18px; box-shadow: 0 18px 44px rgba(8,22,83,.065);
  animation: stitchRise .5s ease both;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(231,228,222,.78); }
.panel-header h3 { margin: 0; font-size: 17px; color: var(--navy); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar label { min-width: 180px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.text-link {
  border: 0; background: transparent; color: var(--blue); font-weight: 900; padding: 0;
  text-align: left; text-decoration: underline; text-underline-offset: 3px;
}

.table-wrap { width: 100%; max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; min-width: 860px; background: var(--paper); }
.grid-2 .table-wrap table, .profile-card .table-wrap table { min-width: 560px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--navy); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: linear-gradient(180deg, #fbfcff, #f4f7fb); }
td { font-size: 14px; }
td:nth-child(n+3):not(:last-child) { font-variant-numeric: tabular-nums; }
tr:hover td { background: #fffaf0; }
.status {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; text-transform: capitalize;
}
.status.active, .status.paid, .status.present, .status.approved, .status.enrolled, .status.admitted, .status.connected, .status.sent { color: #17318d; background: #e7ecff; }
.status.pending, .status.partial, .status.late { color: #875800; background: #fff2cf; }
.status.overdue, .status.unpaid, .status.absent, .status.dropped, .status.not-admitted, .status.inactive, .status.failed, .status.disabled { color: #a63232; background: #ffe3e3; }
.status.completed, .status.excused, .status.new, .status.queued { color: #245caa; background: #e3efff; }

.chart { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 86px minmax(120px, 1fr) 78px; align-items: center; gap: 10px; font-size: 13px; }
.bar { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold), var(--blue)); border-radius: inherit; }
.timeline { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 68px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.timeline-item time { font-weight: 900; color: var(--navy); }
.timeline-item strong { display: block; }
.timeline-item span { color: var(--muted); font-size: 13px; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 14px; }
.module-card { border: 1px solid rgba(8,22,83,.1); border-radius: 8px; background: linear-gradient(180deg, #fffefa, #fffdf8); padding: 16px; box-shadow: 0 12px 28px rgba(8,22,83,.05); animation: stitchRise .42s ease both; }
.module-card strong { display: block; color: var(--navy); }
.module-card span { display: block; color: var(--muted); margin-top: 6px; font-size: 13px; }
.module-card p { margin: 12px 0 0; color: var(--ink); font-size: 13px; line-height: 1.55; }
.module-card-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.sms-panel { background: linear-gradient(135deg, rgba(255,254,250,.98), rgba(255,250,240,.96)); }
.sms-status-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.sms-status-card {
  min-width: 0; border: 1px solid rgba(8,22,83,.1); border-radius: 8px; padding: 16px;
  background: linear-gradient(180deg, #fff, #fffaf0); box-shadow: 0 12px 28px rgba(8,22,83,.05);
}
.sms-status-card small { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.sms-status-card strong { display: block; margin-top: 8px; color: var(--navy); overflow-wrap: anywhere; }
.sms-status-card span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.sms-template-card { display: flex; flex-direction: column; }
.sms-template-card .module-card-actions { margin-top: auto; padding-top: 14px; }
.form-note {
  margin: 0; padding: 12px 14px; border: 1px solid rgba(245,166,35,.35); border-radius: 8px;
  background: var(--gold-soft); color: var(--ink); font-size: 13px; line-height: 1.5;
}
.portal-hero {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding: clamp(20px, 3vw, 30px); border-radius: 8px;
  background:
    radial-gradient(circle at 90% 10%, rgba(245,166,35,.22), transparent 28%),
    linear-gradient(135deg, var(--navy), var(--navy-2) 58%, var(--black));
  color: white; border: 1px solid rgba(242,178,51,.4); box-shadow: 0 28px 80px rgba(5,11,40,.22);
  animation: stitchRise .5s ease both;
}
.portal-hero h3 { margin: 7px 0 6px; font-size: clamp(24px, 3vw, 36px); line-height: 1.05; }
.portal-hero p { margin: 0; color: #c9d7e8; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.portal-actions .ghost-btn { border-color: rgba(245,166,35,.38); }
.portal-functions { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
.profile-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fbfdff; min-width: 0; }
.profile-card small { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.profile-card h4 { margin: 8px 0 12px; color: var(--navy); font-size: 18px; }
.profile-card .table-wrap table { min-width: 560px; }
.detail-list { display: grid; gap: 9px; margin: 0; }
.detail-list div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.detail-list dt { color: var(--muted); font-weight: 900; }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { padding: 7px 10px; border-radius: 999px; background: var(--soft); color: var(--navy); font-size: 12px; font-weight: 900; }
.fees-collection { padding: 18px; }
.fees-student-header {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; align-items: start;
  padding: 16px 8px 26px; border-bottom: 1px solid var(--line);
}
.student-avatar {
  width: 104px; height: 104px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #dcebf8, #ffffff); border: 1px solid var(--line);
  color: var(--navy); font-size: 30px; font-weight: 900; box-shadow: var(--shadow);
}
.fees-student-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 34px; margin: 0; }
.fees-student-meta div { display: grid; grid-template-columns: 180px minmax(0, 1fr); border-bottom: 1px solid var(--line); padding: 8px 0; }
.fees-student-meta dt { color: var(--ink); font-weight: 900; }
.fees-student-meta dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.danger-text { color: var(--red) !important; font-weight: 900; }
.fees-toolbar {
  display: grid; grid-template-columns: minmax(220px, 360px) 1fr auto; gap: 12px; align-items: end;
  padding: 18px 0;
}
.fees-date { justify-self: end; color: var(--ink); font-size: 13px; }
.fee-definition-panel { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 18px 0 4px; background: #fbfdff; }
.fee-definition-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 12px; }
.fee-definition-card { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 12px; min-width: 0; }
.fee-definition-card small { display: block; color: var(--red); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.fee-definition-row {
  display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(120px, 1fr) 86px 72px;
  gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px;
}
.fee-definition-row:first-of-type { border-top: 0; }
.fee-definition-row strong { color: var(--navy); }
.fee-definition-row span { color: var(--muted); }
.fee-definition-row b { color: var(--ink); text-align: right; }
.fee-definition-row em { color: var(--muted); font-style: normal; text-align: right; }
.fees-group-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fees-group-section h4 { margin: 0 0 12px; color: var(--navy); }
.fee-group-card > strong { display: block; color: var(--navy); margin-bottom: 6px; }
.fee-group-card > span { display: block; color: var(--muted); margin-bottom: 10px; font-size: 13px; }
.fee-group-card > b { display: inline-block; color: var(--ink); margin-right: 10px; }
.fee-group-card > em { color: var(--red); font-style: normal; font-weight: 900; text-transform: capitalize; }
.session-label { text-align: center; font-weight: 900; color: var(--ink); padding: 8px 0 22px; }
.fee-table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.fee-table { min-width: 1320px; font-size: 13px; }
.fee-table th, .fee-table td { padding: 10px 9px; }
.fee-table th { white-space: nowrap; }
.fee-main-row.fee-warning td { background: #f8dddd; }
.fee-main-row:hover td, .fee-payment-row:hover td { background: #eef6ff; }
.fee-payment-row td { color: #4f5f73; font-size: 12px; background: #fff; }
.fine-inline { color: red; font-weight: 800; white-space: nowrap; }
.muted { color: var(--muted); font-size: 12px; font-weight: 700; }
.mini-btn {
  min-width: 28px; height: 28px; border: 1px solid var(--line); background: white; color: var(--navy);
  border-radius: 6px; margin: 0 2px; font-weight: 900;
}
.mini-btn:hover { border-color: var(--red); color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(16,35,63,.56); }
.modal-card { width: min(920px, 100%); max-height: 92vh; overflow: auto; background: white; border-radius: 8px; box-shadow: var(--shadow); padding: 18px; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-card h3 { margin: 0; }
.cards-list { display: grid; gap: 12px; }
.notice { border-left: 4px solid var(--gold); padding: 13px 14px; border-radius: 8px; background: #fffaf0; }
.notice strong { display: block; }
.notice span { color: var(--muted); font-size: 13px; }
.mobile-only { display: none; }

@media (max-width: 1120px) {
  .app-shell { display: block; width: 100%; overflow-x: hidden; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(284px, 82vw); z-index: 10;
    transform: translateX(-110%); visibility: hidden; pointer-events: none; transition: transform .2s ease, visibility .2s ease;
  }
  .sidebar.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
  .workspace { width: 100%; max-width: 100%; margin-left: 0; overflow-x: hidden; }
  .mobile-only { display: inline-grid; place-items: center; }
  .kpi-grid, .module-grid, .sms-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(1) { grid-column: span 1; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 16px; }
  .topbar-actions, .search-box, .search-box input, .topbar-actions select, .role-badge { width: 100%; }
  .view { padding: 16px; }
  .kpi-grid, .module-grid, .form-grid, .sms-status-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .detail-list div { grid-template-columns: 1fr; gap: 2px; }
  .toolbar-actions { width: 100%; }
  .fees-student-header, .fees-student-meta, .fees-toolbar { grid-template-columns: 1fr; }
  .portal-hero { align-items: flex-start; flex-direction: column; }
  .portal-actions, .portal-actions .primary-btn, .portal-actions .ghost-btn { width: 100%; }
  .portal-functions { grid-template-columns: 1fr; }
  .fee-definition-grid { grid-template-columns: 1fr; }
  .fee-definition-row { grid-template-columns: 1fr 1fr; }
  .fee-definition-row b, .fee-definition-row em { text-align: left; }
  .fees-student-meta div { grid-template-columns: 1fr; gap: 2px; }
  .student-avatar { width: 82px; height: 82px; font-size: 24px; }
  .fees-date { justify-self: start; }
  .toolbar label { min-width: 100%; }
  .primary-btn, .ghost-btn, .danger-btn { width: 100%; }
}

@keyframes stitchRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stitchPulse {
  0%, 100% { opacity: .44; transform: scaleY(.7); }
  50% { opacity: .95; transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .sidebar, .topbar, .toolbar, .panel-header button, .icon-btn, .modal { display: none !important; }
  .app-shell { display: block; }
  .view { padding: 0; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
}
