/* ============================================================
   نظام إدارة الطلاب — Apple-inspired RTL CRM
   Palette: Dark Navy (#0b1a2e / #12294a) + Orange (#ff7a00)
   Font: Cairo
   ============================================================ */

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-500: #64748b;
  --brand-500: #ff7a00;
  --brand-600: #ec6d00;
  --brand-400: #ff9a3d;
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-brand: 0 2px 6px rgba(255, 122, 0, 0.15);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* Human resources dashboard and records */
.hr-dashboard-view {
  --hr-blue: #24557e;
  --hr-blue-dark: #123b60;
  --hr-orange: #f58220;
  --hr-surface: #fff;
  --hr-soft: #f3f7fb;
}

.hr-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2rem;
  min-height: 230px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 8% 10%, rgba(245, 130, 32, .34), transparent 32%),
    linear-gradient(135deg, #102e4b 0%, #1c4e75 62%, #28709c 100%);
  box-shadow: 0 18px 45px rgba(18, 59, 96, .18);
}
.hr-hero::after {
  content: '';
  position: absolute;
  inset: auto -70px -130px auto;
  width: 300px;
  aspect-ratio: 1;
  border: 42px solid rgba(255, 255, 255, .055);
  border-radius: 50%;
  pointer-events: none;
}
.hr-hero-content { position: relative; z-index: 1; max-width: 670px; }
.hr-eyebrow,
.hr-section-heading > div > span,
.hr-attendance-summary > div:first-child > span {
  display: block;
  margin-bottom: .45rem;
  color: var(--hr-orange);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.hr-hero h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.5rem); font-weight: 900; }
.hr-hero p { max-width: 620px; margin: .65rem 0 0; color: rgba(255, 255, 255, .78); font-size: .9rem; line-height: 1.9; }
.hr-hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.35rem; }
.hr-hero-actions button,
.hr-attendance-actions button {
  min-height: 42px;
  padding: .65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 900;
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.hr-hero-actions button:hover,
.hr-attendance-actions button:hover { transform: translateY(-1px); }
.hr-hero-primary { color: #fff; background: var(--hr-orange); }
.hr-hero-secondary { color: #fff; border-color: rgba(255,255,255,.26) !important; background: rgba(255,255,255,.09); }
.hr-hero-attendance { position: relative; z-index: 1; display: flex; align-items: center; gap: 1rem; min-width: 220px; padding: 1rem; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; background: rgba(7, 30, 51, .38); }
.hr-attendance-ring { position: relative; display: grid; flex: 0 0 auto; width: 74px; aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(var(--hr-orange) var(--attendance-rate), rgba(255,255,255,.14) 0); }
.hr-attendance-ring::before { content: ''; position: absolute; width: 58px; aspect-ratio: 1; border-radius: 50%; background: #19496e; }
.hr-attendance-ring span { position: relative; z-index: 1; font-size: .83rem; font-weight: 900; }
.hr-hero-attendance strong,
.hr-hero-attendance span { display: block; }
.hr-hero-attendance strong { font-size: .95rem; }
.hr-hero-attendance > div:last-child span { margin-top: .25rem; color: rgba(255,255,255,.66); font-size: .7rem; }
.hr-hero-menu { position: absolute; z-index: 3; top: 1rem; left: 1rem; }

.hr-metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.hr-metric { position: relative; display: flex; min-width: 0; align-items: center; gap: .9rem; padding: 1.15rem; overflow: hidden; border: 1px solid #e6edf4; border-radius: 18px; background: var(--hr-surface); box-shadow: 0 8px 24px rgba(15, 39, 71, .055); }
.hr-metric::after { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--metric-color); }
.hr-metric-icon { display: grid; flex: 0 0 43px; width: 43px; aspect-ratio: 1; place-items: center; border-radius: 13px; color: var(--metric-color); background: var(--metric-soft); font-weight: 900; }
.hr-metric > div:last-child { min-width: 0; }
.hr-metric span,
.hr-metric small { display: block; overflow: hidden; color: #66758a; text-overflow: ellipsis; white-space: nowrap; }
.hr-metric span { font-size: .7rem; font-weight: 800; }
.hr-metric strong { display: block; margin: .15rem 0; color: #102e4b; font-size: 1.65rem; line-height: 1.25; }
.hr-metric strong em { margin-inline-start: .2rem; color: #8a98a9; font-size: .68rem; font-style: normal; }
.hr-metric small { font-size: .63rem; }
.hr-metric-employees { --metric-color: #24557e; --metric-soft: #edf5fb; }
.hr-metric-attendance { --metric-color: #15966f; --metric-soft: #e9f9f3; }
.hr-metric-leaves { --metric-color: #d97706; --metric-soft: #fff6df; }
.hr-metric-reviews { --metric-color: #7755c7; --metric-soft: #f3efff; }

.hr-dashboard-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border: 1px solid #e5edf4; border-radius: 16px; background: #fff; }
.hr-department-filter { width: min(320px, 100%); }
.hr-report-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.hr-report-actions button { min-height: 39px; padding: .55rem .85rem; border: 1px solid #dbe5ee; border-radius: 10px; color: #294a66; background: #f8fafc; font-size: .7rem; font-weight: 800; transition: .18s var(--ease); }
.hr-report-actions button:hover { border-color: #b8ccdc; background: #eef5fa; }

.hr-insights-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.hr-insight-card { min-width: 0; padding: 1.25rem; border: 1px solid #e4ebf2; border-radius: 19px; background: #fff; box-shadow: 0 8px 24px rgba(15, 39, 71, .05); }
.hr-insight-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.hr-insight-heading span { color: #7b8998; font-size: .65rem; font-weight: 800; }
.hr-insight-heading h3 { margin: .2rem 0 0; color: #163b5b; font-size: .96rem; font-weight: 900; }
.hr-insight-heading button { flex: 0 0 auto; padding: .42rem .62rem; border: 1px solid #e0e8ef; border-radius: 9px; color: #4d6275; background: #fafcfd; font-size: .63rem; font-weight: 800; }
.hr-insight-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: 1.25rem; }
.hr-insight-values div { padding: .7rem .35rem; border-radius: 11px; text-align: center; background: #f8fafc; }
.hr-insight-values strong,
.hr-insight-values span { display: block; }
.hr-insight-values strong { color: #173f63; font-size: 1.2rem; }
.hr-insight-values span { margin-top: .18rem; color: #788797; font-size: .58rem; }
.hr-progress { height: 5px; margin-top: .85rem; overflow: hidden; border-radius: 99px; background: #edf1f5; }
.hr-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #15966f, #4fc69d); }
.hr-insight-feature { display: flex; align-items: baseline; gap: .5rem; margin-top: 1.35rem; }
.hr-insight-feature strong { color: #c64f50; font-size: 2.2rem; line-height: 1; }
.hr-insight-feature span,
.hr-insight-card p { color: #778697; font-size: .68rem; }
.hr-insight-card p { margin: .85rem 0 0; padding-top: .75rem; border-top: 1px solid #edf1f4; }
.hr-insight-card p b { color: #273e55; }
.hr-score-row { display: flex; align-items: center; gap: .8rem; margin-top: 1.2rem; }
.hr-score-row > strong { color: #7451c2; font-size: 2.15rem; line-height: 1; }
.hr-score-row > div { flex: 1; }
.hr-score-row span { color: #778697; font-size: .64rem; }
.hr-score-track { height: 6px; margin-top: .45rem; overflow: hidden; border-radius: 99px; background: #eeeaf8; }
.hr-score-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7755c7, #a489e4); }

.hr-people-overview,
.hr-attendance-summary { border: 1px solid #e3ebf2; border-radius: 19px; background: #fff; box-shadow: 0 8px 24px rgba(15, 39, 71, .045); }
.hr-people-overview { padding: 1.25rem; overflow: hidden; }
.hr-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hr-section-heading h3 { margin: 0; color: #163b5b; font-size: 1rem; font-weight: 900; }
.hr-section-heading > strong { padding: .4rem .65rem; border-radius: 9px; color: #24557e; background: #eef6fb; font-size: .68rem; }
.hr-dashboard-view .table-wrapper { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.hr-dashboard-view .hr-overview-table { width: 100%; min-width: 720px; table-layout: auto; }
.hr-table-count { display: inline-grid; min-width: 27px; height: 27px; place-items: center; border-radius: 8px; color: #49708f; background: #edf5fa; font-weight: 900; }
.hr-table-count.has-alert { color: #b14444; background: #fff0f0; }
.hr-attendance-summary { display: grid; grid-template-columns: minmax(200px, 1fr) auto auto; align-items: center; gap: 1.5rem; padding: 1.4rem; }
.hr-attendance-summary h3 { margin: 0; color: #153b5b; font-size: 1rem; font-weight: 900; }
.hr-attendance-summary p { margin: .3rem 0 0; color: #7a8897; font-size: .68rem; }
.hr-attendance-numbers { display: flex; gap: .6rem; }
.hr-attendance-numbers div { min-width: 76px; padding: .6rem .75rem; border-radius: 11px; text-align: center; background: #f4f8fb; }
.hr-attendance-numbers strong,
.hr-attendance-numbers span { display: block; }
.hr-attendance-numbers strong { color: #173f63; font-size: 1.15rem; }
.hr-attendance-numbers span { color: #788797; font-size: .58rem; }
.hr-attendance-actions { display: flex; gap: .55rem; }
.hr-attendance-actions button:first-child { color: #fff; background: #24557e; }
.hr-attendance-actions button:last-child { color: #2f526f; border-color: #d8e4ec; background: #fff; }

.hr-records-view .table-wrapper { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.hr-records-view .hr-data-table { width: 100%; table-layout: auto; }
.hr-records-view .hr-leave-table { min-width: 980px; }
.hr-records-view .hr-disciplinary-table { min-width: 940px; }
.hr-records-view .hr-performance-table { min-width: 880px; }
.hr-record-table-card { overflow: hidden; }
.hr-table-scroll-hint { display: none; margin: .25rem 0 0; color: #8794a3; font-size: .62rem; }

.hr-page-hero {
  --page-accent: #f58220;
  --page-soft: #fff6ed;
  --page-line: #f2d7c0;
  --page-ring: rgba(245, 130, 32, .07);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  min-height: 150px;
  padding: 1.5rem 1.65rem;
  overflow: hidden;
  border: 1px solid #dce7ef;
  border-radius: 20px;
  background: linear-gradient(125deg, #fff 0%, #f8fbfd 70%, var(--page-soft) 100%);
  box-shadow: 0 10px 28px rgba(15, 39, 71, .065);
}
.hr-page-hero::before { content: ''; position: absolute; inset: 0 0 0 auto; width: 5px; background: var(--page-accent); }
.hr-page-hero::after { content: ''; position: absolute; top: -75px; left: -45px; width: 190px; aspect-ratio: 1; border: 30px solid var(--page-ring); border-radius: 50%; pointer-events: none; }
.hr-page-hero > div:first-child { position: relative; z-index: 1; max-width: 700px; }
.hr-page-hero > div:first-child > span { display: block; margin-bottom: .4rem; color: var(--page-accent); font-size: .68rem; font-weight: 900; }
.hr-page-hero h2 { margin: 0; color: #153b5b; font-size: clamp(1.25rem, 3vw, 1.7rem); font-weight: 900; }
.hr-page-hero p { margin: .5rem 0 0; color: #708091; font-size: .76rem; line-height: 1.8; }
.hr-page-hero-disciplinary { --page-accent: #d35d5d; --page-soft: #fff2f2; --page-line: #efd0d0; --page-ring: rgba(211, 93, 93, .07); }
.hr-page-hero-performance { --page-accent: #7451c2; --page-soft: #f6f1ff; --page-line: #ded3f2; --page-ring: rgba(116, 81, 194, .07); }
.hr-page-hero-leave { --page-accent: #178b6a; --page-soft: #edf9f5; --page-line: #cde8df; --page-ring: rgba(23, 139, 106, .07); }
.hr-page-hero-attendance-management { --page-accent: #2878a6; --page-soft: #eef7fc; --page-line: #cfe2ed; --page-ring: rgba(40, 120, 166, .07); }
.hr-page-stat { position: relative; z-index: 1; min-width: 108px; padding: .85rem 1rem; border: 1px solid var(--page-line); border-radius: 15px; text-align: center; background: rgba(255, 255, 255, .8); }
.hr-page-stat strong,
.hr-page-stat span { display: block; }
.hr-page-stat strong { color: var(--page-accent); font-size: 1.65rem; line-height: 1.2; }
.hr-page-stat span { margin-top: .2rem; color: #7d8b99; font-size: .61rem; font-weight: 700; }
.hr-page-menu { position: absolute; z-index: 3; top: .85rem; left: .85rem; }

.hr-entry-card { position: relative; overflow: hidden; border-color: #e0e8ef; box-shadow: 0 8px 24px rgba(15, 39, 71, .045); }
.hr-entry-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, #24557e, #f58220); }
.hr-entry-heading { margin-bottom: 1.15rem; padding-bottom: .85rem; border-bottom: 1px solid #edf1f4; }
.hr-entry-heading > span { display: block; margin-bottom: .25rem; color: #f58220; font-size: .64rem; font-weight: 900; }
.hr-entry-heading h3 { margin: 0; color: #153b5b; font-size: 1rem; font-weight: 900; }
.hr-entry-heading p { margin: .3rem 0 0; color: #7b8998; font-size: .67rem; }
.hr-entry-card .input,
.hr-entry-card .select { background-color: #fbfcfe; }
.hr-leave-balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.hr-leave-balances > div { position: relative; padding: 1.05rem 1.15rem; overflow: hidden; border: 1px solid #dce9e4; border-radius: 15px; background: linear-gradient(135deg, #fff, #eff9f5); }
.hr-leave-balances > div:last-child { border-color: #dce8f1; background: linear-gradient(135deg, #fff, #eff6fb); }
.hr-leave-balances > div::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 4px; background: #178b6a; }
.hr-leave-balances > div:last-child::after { background: #3679a7; }
.hr-leave-balances span,
.hr-leave-balances strong { display: block; }
.hr-leave-balances span { color: #708091; font-size: .68rem; font-weight: 700; }
.hr-leave-balances strong { margin-top: .3rem; color: #176b55; font-size: 1.25rem; }
.hr-leave-balances > div:last-child strong { color: #2c678f; }

.hr-records-stack { display: grid; gap: .7rem; }
.hr-record-filter { padding: 1rem 1.1rem; border: 1px solid #dce6ee; border-radius: 16px; background: linear-gradient(180deg, #fff, #f8fbfd); box-shadow: 0 7px 20px rgba(15, 39, 71, .04); }
.hr-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.hr-filter-heading span { display: block; color: #f58220; font-size: .61rem; font-weight: 900; }
.hr-filter-heading h3 { margin: .15rem 0 0; color: #183f60; font-size: .87rem; font-weight: 900; }
.hr-filter-heading small { padding: .35rem .55rem; border-radius: 8px; color: #52708a; background: #edf4f8; font-size: .6rem; font-weight: 800; }
.hr-filter-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(170px, 1fr) auto auto; align-items: end; gap: .7rem; }
.hr-filter-grid .btn { min-height: 42px; white-space: nowrap; }
.hr-records-stack .hr-record-table-card { border-color: #e1e9ef; box-shadow: 0 9px 25px rgba(15, 39, 71, .05); }
.attendance-overview-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; }
.attendance-overview-grid > div { position: relative; padding: 1rem 1.1rem; overflow: hidden; border: 1px solid #dfe8ef; border-radius: 15px; background: linear-gradient(135deg, #fff, #f3f8fb); }
.attendance-overview-grid > div::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 4px; background: #2878a6; }
.attendance-overview-grid > .attendance-overview-work::after { background: #178b6a; }
.attendance-overview-grid > .attendance-overview-permission::after { background: #9b6ab8; }
.attendance-overview-grid > .attendance-overview-employees::after { background: #2878a6; }
.attendance-overview-grid > .attendance-overview-open::after { background: #f58220; }
.attendance-overview-grid > .attendance-overview-period::after { background: #64748b; }
.attendance-overview-grid span,
.attendance-overview-grid strong { display: block; }
.attendance-overview-grid span { color: #748394; font-size: .67rem; font-weight: 700; }
.attendance-overview-grid strong { margin-top: .28rem; color: #183f60; font-size: 1.2rem; }
.attendance-overview-work strong { color: #176b55; }
.attendance-overview-permission strong { color: #7c4a98; }
.attendance-management-view .attendance-network-settings { border-color: #e0e8ef; }
.hr-record-filter .attendance-management-filter { grid-template-columns: minmax(200px, 1.35fr) minmax(120px, .7fr) minmax(110px, .65fr) auto auto; }
.hr-records-view .hr-attendance-table { min-width: 850px; }

@media (max-width: 1024px) {
  .attendance-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hr-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hr-insights-grid { grid-template-columns: 1fr; }
  .hr-attendance-summary { grid-template-columns: 1fr auto; }
  .hr-attendance-actions { grid-column: 1 / -1; }
  .hr-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hr-filter-grid .btn { width: 100%; }
  .hr-record-filter .attendance-management-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hr-record-filter .attendance-management-filter > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .hr-dashboard-view,
  .hr-records-view { padding-inline: .1rem; }
  .hr-hero { grid-template-columns: 1fr; min-height: 0; gap: 1.2rem; padding: 1.3rem; border-radius: 18px; }
  .hr-hero p { font-size: .78rem; }
  .hr-hero-attendance { width: 100%; min-width: 0; }
  .hr-hero-actions button { flex: 1 1 125px; }
  .hr-metrics-grid { gap: .65rem; }
  .hr-metric { align-items: flex-start; gap: .6rem; padding: .85rem .7rem; border-radius: 14px; }
  .hr-metric-icon { flex-basis: 34px; width: 34px; border-radius: 10px; }
  .hr-metric strong { font-size: 1.35rem; }
  .hr-metric small { white-space: normal; line-height: 1.5; }
  .hr-dashboard-toolbar { align-items: stretch; flex-direction: column; }
  .hr-department-filter { width: 100%; }
  .hr-report-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .hr-report-actions button { padding-inline: .35rem; }
  .hr-insight-card { padding: 1rem; border-radius: 15px; }
  .hr-people-overview { padding: 1rem .8rem; border-radius: 15px; }
  .hr-attendance-summary { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
  .hr-attendance-numbers { display: grid; grid-template-columns: repeat(3, 1fr); }
  .hr-attendance-numbers div { min-width: 0; }
  .hr-attendance-actions { grid-column: auto; }
  .hr-attendance-actions button { flex: 1; }
  .hr-dashboard-view .hr-overview-table { font-size: .68rem; }
  .hr-records-view .card { border-radius: 14px; padding: 1rem; }
  .hr-records-view .btn { min-height: 42px; }
  .hr-records-view input,
  .hr-records-view select,
  .hr-records-view textarea { font-size: 16px; }
  .hr-records-view .hr-record-table-card { padding-inline: .75rem; }
  .hr-records-view .table-wrapper { margin-inline: 0; overflow-x: auto; border: 1px solid #e8edf2; border-radius: 11px; }
  .hr-records-view .table-wrapper table.hr-data-table { display: table; width: max-content; max-width: none; }
  .hr-records-view .table-wrapper table.hr-data-table thead { display: table-header-group; }
  .hr-records-view .table-wrapper table.hr-data-table tbody { display: table-row-group; }
  .hr-records-view .table-wrapper table.hr-data-table tr { display: table-row; }
  .hr-records-view .table-wrapper table.hr-data-table th,
  .hr-records-view .table-wrapper table.hr-data-table td { display: table-cell; padding: .62rem .58rem; border-bottom: 1px solid #edf1f4; font-size: .68rem; white-space: nowrap; vertical-align: middle; }
  .hr-records-view .table-wrapper table.hr-data-table td.max-w-xs,
  .hr-records-view .table-wrapper table.hr-data-table td.max-w-md { min-width: 210px; max-width: 250px; white-space: normal; line-height: 1.65; }
  .hr-records-view .table-wrapper table.hr-data-table td::before { content: none; }
  .hr-records-view .table-wrapper table.hr-data-table .btn { width: auto; min-height: 32px; margin: 0; white-space: nowrap; }
  .hr-table-scroll-hint { display: block; }
  .hr-page-hero { grid-template-columns: minmax(0, 1fr) auto; min-height: 130px; gap: .75rem; padding: 1.1rem; border-radius: 16px; }
  .hr-page-hero p { font-size: .7rem; }
  .hr-page-stat { min-width: 82px; padding: .7rem .55rem; }
  .hr-page-stat strong { font-size: 1.35rem; }
  .hr-entry-card { padding: 1rem; }
  .hr-filter-grid { grid-template-columns: 1fr; }
  .hr-record-filter { padding: .9rem; border-radius: 13px; }
  .hr-filter-grid .btn { min-height: 40px; }
  .hr-leave-balances { gap: .6rem; }
  .hr-leave-balances > div { padding: .85rem .75rem; }
  .hr-leave-balances strong { font-size: 1.05rem; }
  .attendance-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .attendance-overview-grid > div { padding: .8rem .75rem; }
  .attendance-overview-period { grid-column: 1 / -1; }
  .attendance-overview-grid strong { font-size: 1rem; }
  .hr-record-filter .attendance-management-filter { grid-template-columns: 1fr; }
  .hr-record-filter .attendance-management-filter > div:first-child { grid-column: auto; }
}

/* Full-page employee create/edit workspace */
.employee-form-page {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding-bottom: 1.5rem;
}

.employee-form-toolbar,
.employee-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.employee-form-toolbar h2 {
  margin: .15rem 0 .25rem;
  color: var(--navy-900);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 800;
}

.employee-form-toolbar p { color: var(--muted); font-size: .75rem; }
.employee-form-eyebrow { color: var(--brand-500); font-size: .7rem; font-weight: 800; }
.employee-back-button,
.employee-add-button { min-height: 42px; padding-inline: 1rem; white-space: nowrap; }

.employee-data-form { display: grid; gap: 1rem; }

.employee-form-section {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.employee-section-heading {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding-bottom: .85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eef2f7;
}

.employee-section-heading > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--navy-900);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
}

.employee-section-heading h3 { color: var(--navy-900); font-size: .92rem; font-weight: 800; }
.employee-section-heading p { margin-top: .1rem; color: var(--muted); font-size: .67rem; }

.employee-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
}

.employee-form-grid > div { min-width: 0; }
.employee-form-grid .field-label b { color: #dc2626; }
.employee-form-grid .field-label span { color: #94a3b8; font-weight: 500; }
.employee-form-grid small { display: block; margin-top: .3rem; color: #94a3b8; font-size: .62rem; }
.employee-form-grid .input,
.employee-form-grid .select { min-height: 42px; }

.employee-permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.employee-permission-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: .8rem 1rem;
  border: 1px solid #e5eaf1;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
}

.employee-permission-option span { display: grid; gap: .2rem; min-width: 0; }
.employee-permission-option strong { color: var(--navy-800); font-size: .78rem; }
.employee-permission-option small { color: var(--muted); font-size: .65rem; }
.employee-permission-option input { width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--brand-500); }
.employee-notes-field { margin-top: .9rem; }
.employee-notes-field textarea { min-height: 96px; resize: vertical; }

.employee-form-actions {
  position: sticky;
  bottom: .5rem;
  z-index: 5;
  display: flex;
  justify-content: flex-start;
  gap: .75rem;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 30px rgba(15, 39, 71, .12);
  backdrop-filter: blur(8px);
}

.employee-form-actions .btn { min-width: 160px; min-height: 42px; }
.employee-form-actions .btn:disabled { opacity: .65; cursor: wait; }

@media (max-width: 1100px) {
  .employee-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .employee-form-toolbar,
  .employee-list-heading { align-items: stretch; flex-direction: column; }
  .employee-back-button,
  .employee-add-button { width: 100%; }
  .employee-form-section { padding: .9rem; border-radius: 10px; }
  .employee-form-grid,
  .employee-permissions-grid { grid-template-columns: minmax(0, 1fr); }
  .employee-data-form input,
  .employee-data-form select,
  .employee-data-form textarea { font-size: 16px; }
  .employee-form-actions { bottom: .25rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-form-actions .btn { min-width: 0; width: 100%; padding-inline: .5rem; }
}

@media (max-width: 390px) {
  .employee-form-actions { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .hr-statement .statement-table { table-layout: auto; font-size: 7.5px; }
  .hr-statement .statement-table th,
  .hr-statement .statement-table td { width: auto !important; padding: 4px 3px; }
  .hr-statement .statement-table th { white-space: nowrap; }
  .hr-statement .statement-bank-name { color: #f58220; }
}

/* Eshop Academy ERP — compact Slate-Navy interface ------------------ */
:root {
  --navy-900: #172554;
  --navy-800: #1e3a5f;
  --navy-700: #334e68;
  --navy-500: #627d98;
  --brand-500: #f97316;
  --brand-600: #ea580c;
  --brand-400: #fb923c;
  --bg: #f6f8fb;
  --line: #dbe4ee;
  --muted: #62748a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 2px 5px rgba(15, 23, 42, .06);
  --shadow-lg: 0 8px 18px rgba(15, 23, 42, .09);
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

html, body { 
  height: 100%;
  font-family: 'Cairo', sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--navy-900);
  letter-spacing: -0.1px;
}

/* Firefox / scrollbars ------------------------------------------------ */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in {
  from { opacity: 0; transform: scale(.98); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(255,122,0,.2); }
  70%  { box-shadow: 0 0 0 6px rgba(255,122,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,122,0,0); }
}

.view-enter { animation: fade-up .25s var(--ease) both; }
.stagger > * { animation: fade-up .25s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .01s; }
.stagger > *:nth-child(2) { animation-delay: .03s; }
.stagger > *:nth-child(3) { animation-delay: .05s; }
.stagger > *:nth-child(4) { animation-delay: .07s; }
.stagger > *:nth-child(5) { animation-delay: .09s; }

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

/* ============================================================
   Reusable component classes
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

/* The application uses these rules in addition to Tailwind utilities, so
   controls remain consistently flat even when a legacy class is present. */
.card { border-radius: 8px; box-shadow: var(--shadow-sm); }
.btn, .input, .select, textarea.input { border-radius: 6px; }
.btn { min-height: 34px; padding: .42rem .75rem; }
.input, .select, textarea.input { min-height: 34px; padding: .42rem .65rem; }
.nav-item { padding: .5rem .625rem; font-size: .78rem; gap: .6rem; border-radius: 6px; }
.nav-item svg { width: 16px; height: 16px; }
.table-wrapper { overflow-x: auto; overflow-y: auto; max-width: 100%; }
table.crm { min-width: 760px; }
table.crm thead th, table.crm tbody td { padding: .55rem .7rem; }
.support-scroll, .students-scroll, .cash-scroll { overflow-y: auto; min-height: 0; }

/* Legacy utility overrides: preserve the specified 8px/6px geometry. */
.rounded-xl, .rounded-2xl { border-radius: 8px !important; }
.rounded { border-radius: 6px !important; }
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: inherit; font-weight: 600; font-size: .85rem;
  border-radius: 6px; padding: .55rem 1rem; cursor: pointer;
  border: 1px solid transparent; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-brand { background: var(--brand-500); color: #fff; box-shadow: var(--shadow-brand); }
.btn-brand:hover { background: var(--brand-600); }
.btn-navy { background: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-900); }
.btn-ghost { background: #fff; color: var(--navy-700); border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-soft { background: #fff2e6; color: var(--brand-600); }
.btn-soft:hover { background: #ffe6d1; }

/* Check-management controls: compact segmented navigation with clear status cues. */
.check-status-tabs-card {
  padding: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.check-status-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.check-status-tab {
  --check-tab-color: var(--brand-600);
  --check-tab-soft: #fff7ed;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 12px;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease);
}
.check-status-tab--collected { --check-tab-color: #047857; --check-tab-soft: #ecfdf5; }
.check-status-tab--returned { --check-tab-color: #b91c1c; --check-tab-soft: #fef2f2; }
.check-status-tab:hover { color: var(--check-tab-color); background: rgba(255,255,255,.8); }
.check-status-tab:active { transform: scale(.985); }
.check-status-tab:focus-visible { outline: 3px solid rgba(245,130,32,.2); outline-offset: 2px; }
.check-status-tab.is-active {
  color: var(--check-tab-color);
  background: #fff;
  border-color: #dbe3ec;
  box-shadow: inset 0 -2px 0 var(--check-tab-color), 0 2px 8px rgba(15,39,71,.08);
}
.check-status-tab-icon {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 27px;
  color: var(--check-tab-color);
  background: var(--check-tab-soft);
  border-radius: 7px;
}
.check-status-tab-icon svg,
.check-print-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.check-status-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-status-tab-count {
  min-width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: inherit;
  background: var(--check-tab-soft);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 900;
}
.check-print-button { min-height: 38px; padding: .5rem .9rem; font-size: .75rem; white-space: nowrap; }
.check-action-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 6px; direction: rtl; }
.check-action-btn {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: .65rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.check-action-btn:active { transform: scale(.98); }
.check-action-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.check-action-btn:focus-visible { outline: 3px solid rgba(245,130,32,.18); outline-offset: 2px; }
.check-action-btn--collected { color: #fff; background: #059669; border-color: #059669; }
.check-action-btn--collected:hover { background: #047857; border-color: #047857; }
.check-action-btn--returned { color: #fff; background: #ef4444; border-color: #ef4444; }
.check-action-btn--returned:hover { background: #dc2626; border-color: #dc2626; }
.check-action-btn--cancelled { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.check-action-btn--cancelled:hover { color: #334155; background: #e2e8f0; }
.check-action-btn--returned-soft { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.check-action-btn--returned-soft:hover { background: #fee2e2; border-color: #fca5a5; }

@media (max-width: 639px) {
  .check-status-tabs { grid-template-columns: 1fr; }
  .check-status-tab { justify-content: flex-start; }
  .check-status-tab-count { margin-right: auto; }
}

/* Form controls ------------------------------------------------------ */
.field-label { display:block; font-size: .8rem; font-weight: 700; color: var(--navy-800); margin-bottom: .35rem; }
.input, .select, textarea.input {
  width: 100%; font-family: inherit; font-size: .88rem; color: var(--navy-900);
  background: #ffffff; border: 1px solid var(--line); border-radius: 6px;
  padding: .55rem .75rem; outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: #64748b; }

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

.financial-number,
.stat-kpi,
.hr-metric strong,
.cash-balance-grid .text-2xl {
  font-variant-numeric: tabular-nums;
}
.input:hover, .select:hover { border-color: #cbd5e1; }
.input:focus, .select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(255,122,0,.1);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 6 8 10 12 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.2rem;
}

/* Badges / pills ----------------------------------------------------- */
.badge { display:inline-flex; align-items:center; gap:.3rem; font-size:.78rem; font-weight:600; padding:.25rem .65rem; border-radius: 4px; }
.badge-green  { background:#ecfdf5; color:#059669; }
.badge-orange { background:#fff7ed; color:#ea580c; }
.badge-red    { background:#fef2f2; color:#dc2626; }
.badge-blue   { background:#eff6ff; color:#2563eb; }
.badge-gray   { background:#f1f5f9; color:#475569; }

.dot { width:6px; height:6px; border-radius:50%; display:inline-block; }

/* Sidebar nav item --------------------------------------------------- */
.sidebar-nav-group { display: flex; flex-direction: column; gap: .25rem; }
.sidebar-nav-group + .sidebar-nav-group {
  margin-top: .65rem;
  padding-top: .65rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-section-label {
  padding: .1rem .75rem .3rem;
  color: rgba(255,255,255,.46);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .01em;
  text-align: right;
}
.sidebar-nav-links { display: flex; flex-direction: column; gap: .2rem; }
.nav-item {
  display:flex; align-items:center; gap:.75rem;
  padding:.55rem .75rem; border-radius:6px; cursor:pointer;
  border:0; background:transparent; font-family:inherit; text-align:right;
  color:#94a3b8; font-weight:600; font-size:.88rem;
  transition: background .15s var(--ease), color .15s var(--ease);
  position: relative;
}
.nav-item svg { width:18px; height:18px; flex:0 0 auto; }
.nav-item:hover { background: rgba(255,255,255,.04); color:#fff; }
.nav-item.active { background: var(--brand-500); color:#fff; }
.nav-item.active::before {
  content:""; position:absolute; left: 6px; top:50%; transform:translateY(-50%);
  width:3px; height:50%; border-radius:2px; background: #fff;
}

/* Table -------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
table.crm {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  border-spacing: 0;
}
table.crm thead th {
  text-align:right; font-size:.8rem; font-weight:700; color:var(--muted);
  padding:.7rem .85rem; background:#f8fafc; border-bottom:1px solid var(--line);
  white-space:nowrap;
}
table.crm tbody td { padding:.7rem .85rem; border-bottom:1px solid #f1f5f9; font-size:.85rem; }
/* All application tables use the same RTL alignment so each value sits
   directly beneath its column heading on desktop and mobile. */
table.crm thead th,
table.crm tbody td { text-align:right !important; }
/* Numeric/date cells keep RTL column alignment even when their value uses
   LTR rendering for readable digits, times, IPs, or ISO dates. */
table.crm tbody td[dir="ltr"],
table.crm tbody td.font-mono { text-align:right !important; }
table.crm tbody tr { transition: background .15s var(--ease); }
table.crm tbody tr:hover { background:#f8fafc; }
table.crm tbody tr:last-child td { border-bottom:none; }

/* Compact, readable installment editor inside the student financial card. */
.edit-installments-table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed;
}
.edit-installments-table .edit-inst-col-number { width: 18%; }
.edit-installments-table .edit-inst-col-date { width: 36%; }
.edit-installments-table .edit-inst-col-amount { width: 26%; }
.edit-installments-table .edit-inst-col-status { width: 20%; }
.edit-installments-table th,
.edit-installments-table td { padding: .45rem .4rem !important; vertical-align: middle; }
.edit-installments-table input[type="date"],
.edit-installments-table input[type="number"] { width: 100%; min-width: 0; }
.payment-monitor-statement .statement-table { font-size: 10px; }
.payment-monitor-statement .statement-table td small { display: block; color: #64748b; font-size: 8px; margin-top: 2px; direction: ltr; }
.payment-monitor-statement .statement-table .statement-date { direction: ltr; white-space: nowrap; }
.report-status { display: inline-block; padding: 2px 6px; border-radius: 5px; font-weight: 700; white-space: nowrap; }
.report-status-paid { color: #15803d; background: #dcfce7; }
.report-status-pending { color: #c2410c; background: #ffedd5; }

@media print {
  .payment-monitor-statement .statement-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 7px !important;
  }
  .payment-monitor-statement .statement-table th,
  .payment-monitor-statement .statement-table td {
    min-width: 0 !important;
    padding: 3px 2px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .payment-monitor-statement .statement-table th:nth-child(1) { width: 5%; }
  .payment-monitor-statement .statement-table th:nth-child(2) { width: 27%; }
  .payment-monitor-statement .statement-table th:nth-child(3) { width: 16%; }
  .payment-monitor-statement .statement-table th:nth-child(4) { width: 14%; }
  .payment-monitor-statement .statement-table th:nth-child(5) { width: 13%; }
  .payment-monitor-statement .statement-table th:nth-child(6) { width: 12%; }
  .payment-monitor-statement .statement-table th:nth-child(7) { width: 13%; }
}

/* Modal -------------------------------------------------------------- */
.modal-backdrop {
  position:fixed; inset:0; background:rgba(15,23,42,.3); backdrop-filter: blur(4px);
  display:flex; align-items:center; justify-content:center; padding:1.5rem; z-index:60;
  animation: fade-in .2s var(--ease) both;
}
.modal-card { animation: scale-in .2s var(--ease) both; border-radius: 8px !important; }

/* Toast -------------------------------------------------------------- */
#toast-wrap { position:fixed; bottom:24px; left:24px; z-index:80; display:flex; flex-direction:column; gap:8px; }
.toast {
  display:flex; align-items:center; gap:.5rem; background:var(--navy-900); color:#fff;
  padding:.75rem 1rem; border-radius:6px; box-shadow:var(--shadow-lg); font-weight:600;
  font-size: .85rem;
  animation: slide-in-right .3s var(--ease) both;
}

/* Utility ------------------------------------------------------------ */
.icon-tile {
  width:40px; height:40px; border-radius:6px; display:flex; align-items:center; justify-content:center; flex:0 0 auto;
}
.stat-kpi { font-size: clamp(1.5rem, 3vw, 2rem); font-weight:800; line-height:1; letter-spacing:-0.5px; }

.divider { height:1px; background:var(--line); border:0; }

.alert-row { animation: pulse-ring 2.6s var(--ease) infinite; }

/* ============================================================
   Responsive Design & Mobile Sidebar Layout
   ============================================================ */

/* Mobile hamburger menu button */
.menu-toggle {
  display: none;
}

@media (max-width: 1023px) {
  body {
    overflow-x: hidden;
  }
  
  /* Sidebar responsive sliding drawer (from right in RTL) */
  aside {
    position: fixed !important;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(84vw, 280px) !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    z-index: 50;
    box-shadow: -4px 0 20px rgba(11, 26, 46, 0.15);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  aside.open {
    transform: translateX(0);
  }
  
  /* Sidebar backdrop overlay overlay */
  .sidebar-backdrop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 26, 46, 0.4);
    backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-backdrop-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--line);
    cursor: pointer;
    color: var(--navy-700);
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease);
  }

  .menu-toggle:not(.topbar-menu-toggle) {
    display: none;
  }
  
  .menu-toggle:hover {
    border-color: var(--brand-500);
    color: var(--brand-500);
  }
  
  main {
    width: 100% !important;
  }
  
  header {
    padding-left: 14px !important;
    padding-right: 14px !important;
    height: 64px !important;
  }
  
  header h2 {
    font-size: 1.25rem !important;
  }
  
  header .flex {
    gap: 0.5rem !important;
  }
  
  main > .flex-1.overflow-y-auto {
    padding: 14px !important;
  }
  
  /* KPIs stack vertically on small devices */
  .grid.grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  .stat-kpi {
    font-size: 2.2rem;
  }
  
  /* Tables horizontal scrolling wrapper */
  .table-wrapper {
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
    padding-left: 0;
    padding-right: 0;
  }
}

/* ============================================================
   Support dashboard glowing & contact styling
   ============================================================ */
.glow-orange {
  border-color: rgba(255, 122, 0, 0.4) !important;
  box-shadow: 0 0 15px rgba(255, 122, 0, 0.15) !important;
}

@keyframes pulse-orange {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.pulse-badge {
  background: var(--brand-500);
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  animation: pulse-orange 1.8s ease-in-out infinite;
}

/* Admin students database ------------------------------------------- */
.student-management-page { padding-left: 1px; padding-right: 1px; }

.admin-student-filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(160px, 1fr) minmax(145px, .9fr) minmax(260px, 1.35fr) auto;
  gap: .75rem;
  align-items: end;
}
.admin-student-filters-expanded {
  grid-template-columns: minmax(280px, 2fr) auto repeat(4, minmax(150px, 1fr));
}
.admin-student-filters-expanded .student-search-field { grid-column: span 1; }

@media (max-width: 900px) {
  .admin-student-filters,
  .admin-student-filters-expanded { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-student-filters .student-search-field,
  .admin-student-filters-expanded .student-search-field { grid-column: 1 / -1; }
}

@media (min-width: 901px) and (max-width: 1300px) {
  .admin-student-filters,
  .admin-student-filters-expanded { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-student-filters .student-search-field,
  .admin-student-filters-expanded .student-search-field { grid-column: span 2; }
  .admin-student-filters-expanded .student-date-filter { grid-column: span 2; }
}

.registration-date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.student-filter-reset { min-height: 38px; white-space: nowrap; }
.active-students-table table.crm { min-width: 720px; }
.pending-activation-table table.crm { min-width: 760px; }
.recent-students-table table.crm { min-width: 920px; }
.employee-settings-table table.crm { min-width: 850px; }
.sales-students-table table.crm { min-width: 900px; }
.sales-report-table table.crm { min-width: 900px; }
.sales-report-table .report-amount-cell { text-align: right !important; }
.sales-report-view,
.sales-report-toolbar,
.sales-report-table-card { min-width: 0; }
.sales-report-filters > div { min-width: 0; }
.sales-report-table-card { overflow: hidden; }
.student-name-link { display: inline-flex; max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; line-height: 1.6; text-align: right; cursor: pointer; transition: color .15s var(--ease); }
.student-name-link:hover { color: var(--brand-600); }
.student-name-link:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; border-radius: 3px; }
.sales-report-summary-card { min-width: 0; }
.sales-report-summary-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-bottom: .7rem; border-bottom: 1px solid #eef2f7; }
.sales-report-currency-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 .45rem; border-radius: 9px; color: #24557e; background: #edf5fa; font-family: Arial, sans-serif; font-weight: 800; }
.sales-report-summary-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.sales-report-summary-metric { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .6rem; border: 1px solid #f0f3f7; border-radius: 8px; background: #fbfcfe; }
.sales-report-summary-metric span { color: #64748b; font-size: .65rem; font-weight: 700; white-space: nowrap; }
.sales-report-summary-metric strong { min-width: 0; font-size: .78rem; text-align: left; }
.sales-report-scroll-hint { display: none; }
.report-money {
  display: inline-flex;
  align-items: baseline;
  gap: .24em;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  font-family: Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.report-money-symbol { display: inline-block; }
#installments-preview table.crm { min-width: 620px; }
.payment-monitor-view { font-size: .9rem; }
.payment-monitor-view table.crm { min-width: 860px; font-size: .74rem; }
.payment-monitor-view .crm th,
.payment-monitor-view .crm td { padding: .48rem .55rem; }
.payment-monitor-view .field-label { font-size: .7rem; }
.payment-monitor-view .btn { font-size: .74rem; }
.sales-entry-card { overflow: hidden; }
.sales-workspace .field-label { color: var(--navy-700); }
.sales-workspace .input,
.sales-workspace .select { min-height: 40px; }

.student-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  margin-top: .75rem;
  border-top: 1px solid #f1f5f9;
}

.student-pagination-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
}

@media (max-width: 1199px) {
  .admin-student-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-search-field { grid-column: 1 / -1; }
  .student-date-filter { min-width: 0; }
  .student-filter-reset { width: 100%; }
}

@media (max-width: 767px) {
  .student-management-page { padding: 0 !important; }
  .admin-student-filters { grid-template-columns: minmax(0, 1fr); }
  .student-search-field { grid-column: auto; }
  .registration-date-range { grid-template-columns: minmax(0, 1fr); }

  .responsive-student-table {
    overflow: visible;
    border: 0;
    border-radius: 0;
    margin: 0 !important;
    padding: 0 !important;
    max-height: none !important;
  }

  .responsive-student-table table.crm,
  .responsive-student-table table.crm tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .sales-report-table table.crm { min-width: 0 !important; table-layout: auto; }

  .responsive-student-table table.crm thead { display: none; }

  .responsive-student-table table.crm tbody {
    display: grid;
    gap: .75rem;
  }

  .responsive-student-table table.crm tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .responsive-student-table table.crm tbody td {
    display: block;
    min-width: 0;
    padding: .65rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    text-align: right !important;
    overflow-wrap: anywhere;
  }

  .responsive-student-table table.crm tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .2rem;
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
  }

  .responsive-student-table table.crm tbody td.student-primary,
  .responsive-student-table table.crm tbody td.student-actions {
    grid-column: 1 / -1;
  }

  .responsive-student-table table.crm tbody td.student-primary { background: #f8fafc; }
  .responsive-student-table table.crm tbody td.student-actions { border-bottom: 0; }
  .responsive-student-table table.crm tbody td.student-actions .btn { width: 100%; }

  .responsive-student-table table.crm tbody tr.empty-state-row { display: block; }
  .responsive-student-table table.crm tbody tr.empty-state-row td { border: 0; }
  .responsive-student-table table.crm tbody tr.empty-state-row td::before { display: none; }

  /* Keep the sales report as a real data table on phones; the wrapper provides
     horizontal scrolling for its nine financial columns. */
  .sales-report-table { overflow-x: auto; overflow-y: hidden; border: 1px solid #e8edf2; border-radius: 10px; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
  .sales-report-table table.crm { display: table !important; width: max-content !important; min-width: 900px !important; table-layout: auto; }
  .sales-report-table table.crm thead { display: table-header-group !important; }
  .sales-report-table table.crm tbody { display: table-row-group !important; }
  .sales-report-table table.crm tbody tr { display: table-row !important; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
  .sales-report-table table.crm th,
  .sales-report-table table.crm td { display: table-cell !important; min-width: 0; padding: .62rem .65rem; border-bottom: 1px solid #edf1f4; vertical-align: middle; white-space: nowrap; }
  .sales-report-table table.crm tbody td::before { display: none !important; content: none !important; }
  .sales-report-table table.crm tbody td:nth-child(3) { min-width: 190px; max-width: 250px; white-space: normal; line-height: 1.6; }
  .sales-report-scroll-hint { display: block; margin-bottom: .55rem; color: #64748b; font-size: .68rem; font-weight: 700; text-align: right; }

  /* Keep the admin student tables as tables on phones; each wrapper scrolls
     horizontally so all columns remain available without changing the data. */
  .mobile-table-scroll { overflow-x: auto; overflow-y: auto; border: 1px solid #e8edf2; border-radius: 10px; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
  .mobile-table-scroll table.crm { display: table !important; width: max-content !important; table-layout: auto; }
  .active-students-table.mobile-table-scroll table.crm { min-width: 760px !important; }
  .pending-activation-table.mobile-table-scroll table.crm { min-width: 760px !important; }
  .recent-students-table.mobile-table-scroll table.crm { min-width: 900px !important; }
  .mobile-table-scroll table.crm thead { display: table-header-group !important; }
  .mobile-table-scroll table.crm tbody { display: table-row-group !important; }
  .mobile-table-scroll table.crm tbody tr { display: table-row !important; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
  .mobile-table-scroll table.crm th,
  .mobile-table-scroll table.crm td { display: table-cell !important; min-width: 0; padding: .62rem .65rem; border-bottom: 1px solid #edf1f4; vertical-align: middle; white-space: nowrap; }
  .mobile-table-scroll table.crm tbody td::before { display: none !important; content: none !important; }
  .mobile-table-scroll table.crm tbody td.student-primary { min-width: 190px; white-space: normal; }
  .mobile-table-scroll table.crm tbody td.student-primary .student-name-link { white-space: normal; }
  .recent-students-table.mobile-table-scroll .student-name-link { color: var(--color-gray-800) !important; }
  .recent-students-table.mobile-table-scroll table.crm tbody td.student-primary { background: #fff; }
  .active-students-table.mobile-table-scroll table.crm tbody td.student-primary { background: #fff; }

  .student-pagination { align-items: stretch; flex-direction: column; }
  .sales-report-toolbar { padding: .9rem !important; }
  .sales-report-filters { align-items: stretch !important; }
  .sales-report-filters > div,
  .sales-report-filters > button { width: 100%; min-width: 0; }
  .sales-report-filters > button { margin-inline: 0 !important; }
  .sales-report-summary-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .sales-report-table-card { padding: .75rem !important; }
  .sales-report-table .report-money { font-size: .95em; }
  .sales-report-summary-metric { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .sales-report-summary-metric strong { text-align: right; }
  .student-pagination-controls { justify-content: space-between; }
  .sales-workspace h2 { font-size: 1.35rem !important; }
  .sales-entry-card > div:first-child { align-items: flex-start; }
  .employee-settings-table .student-actions > div { flex-wrap: wrap; }
}

@media (max-width: 479px) {
  .responsive-student-table table.crm tbody tr { grid-template-columns: minmax(0, 1fr); }
  .responsive-student-table table.crm tbody td.student-primary,
  .responsive-student-table table.crm tbody td.student-actions { grid-column: auto; }
}

/* ============================================================
   Print Media Query Rules
   ============================================================ */
@media print {
  body.printing-payment-report > *:not(#invoice-print-area) { display: none !important; }
  body.printing-payment-report > #invoice-print-area { display: block !important; visibility: visible !important; }
  body.printing-payment-report > #invoice-print-area * { visibility: visible !important; }

  @page {
    size: A4 portrait;
    /* Keep browser-generated URL/date headers outside the printable page. */
    margin: 0;
  }

  /* Keep the browser's URL/date print footer outside the attendance report. */
  @page attendance-report {
    size: A4 portrait;
    margin: 0;
  }

  .attendance-statement {
    page: attendance-report;
  }

  body {
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Cairo', sans-serif !important;
  }
  
  /* Hide sidebar, toggles, filters, and forms on printable bills */
  aside, 
  button, 
  form, 
  .menu-toggle, 
  #toast-wrap, 
  .no-print,
  .quick-actions-bar,
  header { 
    display: none !important; 
  }
  
  main { 
    width: 100% !important; 
    padding: 0 !important; 
    margin: 0 !important; 
    overflow: visible !important; 
  }
  
  /* Full page layout for report sheets */
  .print-area { 
    display: block !important; 
    width: 100% !important; 
    direction: rtl !important; 
  }

  .bank-statement {
    display: block;
    width: 100%;
    color: #172033;
    font-size: 8.5px;
    line-height: 1.35;
    overflow: visible;
    break-inside: auto;
    page-break-inside: auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .statement-print-logo {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 0 6px;
    text-align: center;
    break-after: avoid-page;
    page-break-after: avoid;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .statement-print-logo img {
    display: block !important;
    width: 40mm;
    max-width: 38%;
    height: auto;
    max-height: 20mm;
    object-fit: contain;
  }

  .statement-brand-line {
    height: 3px;
    background: linear-gradient(90deg, #0f2747 0 74%, #f58220 74% 100%);
    margin-bottom: 7px;
  }

  .statement-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 7px;
    border-bottom: 1px solid #ccd5df;
  }

  .statement-bank-name {
    color: #f58220;
    font-size: 8px;
    font-weight: 800;
    margin-bottom: 1px;
  }

  .statement-header h1 {
    margin: 0;
    color: #0f2747;
    font-size: 16px;
    font-weight: 900;
  }

  .statement-header p {
    margin: 4px 0 0;
    color: #64748b;
  }

  .statement-header-compact { align-items: center; }
  .statement-title-block { flex: 0 0 auto; }
  .statement-meta-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 3px 14px;
    color: #64748b;
  }

  .statement-meta-inline div { white-space: nowrap; }
  .statement-meta-inline span { margin-left: 3px; }
  .statement-meta-inline strong { color: #0f2747; }

  .statement-balance-bar,
  .statement-totals {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    page-break-inside: avoid;
  }

  .statement-balance-bar { margin: 7px 0; }
  .statement-balance-bar th,
  .statement-balance-bar td {
    padding: 5px 7px;
    border: 1px solid #d7e0e8;
  }

  .statement-balance-bar th {
    width: 27%;
    color: #536276;
    background: #eef3f7;
    text-align: right;
  }

  .statement-balance-bar td {
    width: 23%;
    color: #0f2747;
    font-family: Arial, sans-serif;
    font-size: 10px;
    font-weight: 700;
    direction: ltr;
    text-align: right;
  }

  .statement-balance-bar .attendance-total-duration {
    direction: rtl;
    text-align: right;
  }

  .statement-meta {
    min-width: 235px;
    border: 1px solid #d9e0e8;
    border-radius: 6px;
    overflow: hidden;
  }

  .statement-meta div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 9px;
    border-bottom: 1px solid #e8edf2;
  }

  .statement-meta div:last-child { border-bottom: 0; }
  .statement-meta span { color: #64748b; }
  .statement-meta strong { color: #0f2747; }

  .statement-opening {
    margin: 16px 0;
    padding: 12px 15px;
    background: #eef4f9;
    border-right: 4px solid #0f2747;
    border-radius: 5px;
  }

  .statement-opening div {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .statement-opening span { color: #536276; font-weight: 700; }
  .statement-opening strong { color: #0f2747; font-size: 18px; }
  .statement-opening p { margin: 3px 0 0; color: #738095; font-size: 8px; }

  .statement-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 9px;
    overflow: visible;
    break-before: auto;
    break-after: auto;
    break-inside: auto;
    page-break-before: auto;
    page-break-after: auto;
    page-break-inside: auto;
  }

  .statement-table thead { display: table-header-group; }
  .statement-table tbody { display: table-row-group; }
  .statement-table tfoot { display: table-footer-group; }
  .statement-table tr,
  .statement-table th,
  .statement-table td {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }
  .statement-table th {
    padding: 5px 4px;
    background: #0f2747;
    color: #fff;
    border: 1px solid #0f2747;
    font-size: 9px;
    text-align: right;
  }

  /* Give repeated table headers breathing room at the top of every new
     printed sheet, while keeping the report itself on A4. */
  .statement-table thead th {
    border-top: 5mm solid #ffffff;
  }

  .statement-table td {
    padding: 4px 4px;
    border: 1px solid #dde3ea;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .statement-table tbody tr:nth-child(even) td { background: #f7f9fb; }
  .statement-table th:nth-child(1) { width: 6%; }
  .statement-table th:nth-child(2) { width: 17%; }
  .statement-table th:nth-child(3) { width: 32%; }
  .statement-table th:nth-child(4),
  .statement-table th:nth-child(5),
  .statement-table th:nth-child(6) { width: 15%; }
  .check-statement .statement-table th:nth-child(1) { width: 5%; }
  .check-statement .statement-table th:nth-child(2) { width: 14%; }
  .check-statement .statement-table th:nth-child(3) { width: 20%; }
  .check-statement .statement-table th:nth-child(4) { width: 13%; }
  .check-statement .statement-table th:nth-child(5) { width: 13%; }
  .check-statement .statement-table th:nth-child(6) { width: 20%; }
  .check-statement .statement-table th:nth-child(7) { width: 15%; }
  .statement-table .money { direction: ltr; text-align: left; white-space: nowrap; font-family: Arial, sans-serif; font-weight: 700; }
  .cash-box-statement .statement-table .money,
  .cash-box-checks-statement .statement-table .money { direction: rtl; text-align: right; }
  .cash-box-statement .statement-table .money .report-money,
  .cash-box-checks-statement .statement-table .money .report-money { direction: ltr; text-align: right; }
  .sales-report-statement .statement-table .money { direction: rtl; text-align: right; }
  .statement-table .deposit { color: #15803d; }
  .statement-table .withdrawal { color: #b91c1c; }
  .statement-table .balance { color: #0f2747; }
  .statement-description small { display: block; margin-top: 2px; color: #64748b; }
  .statement-date { direction: ltr; text-align: right; font-family: Arial, sans-serif; font-size: 9px; }
  .statement-empty { padding: 24px !important; color: #64748b; text-align: center; }

  .statement-totals { margin-top: 7px; }
  .statement-totals th,
  .statement-totals td {
    padding: 5px 7px;
    border: 1px solid #d7e0e8;
  }

  .statement-totals th {
    color: #526174;
    background: #f1f5f8;
    text-align: right;
  }

  .statement-totals td {
    direction: ltr;
    text-align: right;
    color: #0f2747;
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: 700;
  }

  .statement-totals .summary-credit { color: #15803d; }
  .statement-totals .summary-debit { color: #b91c1c; }
  .statement-totals .closing-label,
  .statement-totals .summary-closing {
    color: #fff;
    background: #0f2747;
    border-color: #0f2747;
  }

  .statement-summary {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    margin-top: 16px;
    page-break-inside: avoid;
  }

  .statement-summary > div {
    padding: 10px;
    border: 1px solid #dbe2e9;
    border-radius: 5px;
    background: #f8fafc;
  }

  .statement-summary span { display: block; color: #64748b; font-size: 8px; margin-bottom: 3px; }
  .statement-summary strong { display: block; direction: ltr; text-align: right; color: #0f2747; font-family: Arial, sans-serif; font-size: 12px; }
  .statement-summary .summary-credit strong { color: #15803d; }
  .statement-summary .summary-debit strong { color: #b91c1c; }
  .statement-summary .summary-closing { color: #fff; background: #0f2747; border-color: #0f2747; }
  .statement-summary .summary-closing span,
  .statement-summary .summary-closing strong { color: #fff; }

  .statement-rollover {
    margin-top: 12px;
    padding: 9px 12px;
    color: #38475b;
    background: #fff8ed;
    border: 1px solid #fed7aa;
    border-radius: 5px;
    page-break-inside: avoid;
  }

  .statement-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 4px;
    color: #7b8798;
    border-top: 1px solid #d7dee7;
    font-size: 7px;
  }

  .statement-footer span {
    min-width: 0;
    max-width: 48%;
    overflow-wrap: anywhere;
  }
  
  .card { 
    border: none !important; 
    box-shadow: none !important; 
    padding: 0 !important; 
  }
}

.card-dark {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-900)) !important;
  color: white !important;
  border: none !important;
}

/* ============================================================
   Unified Viewport Constraints (No Page Scrolling)
   ============================================================ */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.app-shell {
  width: 100%;
  height: 100vh;
  min-height: 0;
}

@supports (height: 100dvh) {
  html,
  body,
  #app,
  .app-shell {
    height: 100dvh;
  }
}

/* Keep screen-only fixed viewport rules from clipping the monthly statement. */
@media print {
  html,
  body,
  #app,
  .app-shell,
  .app-shell main,
  #app-view-content,
  #app-view-content > *,
  .view-container,
  .view-container > .overflow-y-auto,
  main > .overflow-y-auto,
  main > .flex-1.overflow-y-auto {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  /* Convert the screen's flex/scroll shell back to normal document flow so
     paged media can create additional A4 sheets instead of clipping at 100vh. */
  .app-shell,
  .app-shell main,
  #app-view-content,
  .view-container {
    display: block !important;
  }

  #invoice-print-area {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 6mm !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .print-area,
  .bank-statement {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .statement-table,
  .statement-balance-bar,
  .statement-totals {
    max-width: 100% !important;
  }

  .attendance-statement .statement-table th,
  .attendance-statement .statement-table td {
    text-align: center;
    vertical-align: middle;
  }

  /* Sales report print layout: nine columns, names and amounts share space. */
  .sales-report-statement .statement-table th:nth-child(1) { width: 4%; }
  .sales-report-statement .statement-table th:nth-child(2) { width: 13%; }
  .sales-report-statement .statement-table th:nth-child(3) { width: 17%; }
  .sales-report-statement .statement-table th:nth-child(4) { width: 13%; }
  .sales-report-statement .statement-table th:nth-child(5) { width: 10%; }
  .sales-report-statement .statement-table th:nth-child(6) { width: 9%; }
  .sales-report-statement .statement-table th:nth-child(7),
  .sales-report-statement .statement-table th:nth-child(8),
  .sales-report-statement .statement-table th:nth-child(9) { width: 11%; }

  /* Seven columns when all employees are selected: keep the two duration
     columns inside the A4 printable width instead of letting the last one
     overflow beyond the left edge. */
  .attendance-all-employees .statement-table th:nth-child(1) { width: 5%; }
  .attendance-all-employees .statement-table th:nth-child(2) { width: 23%; }
  .attendance-all-employees .statement-table th:nth-child(3) { width: 14%; }
  .attendance-all-employees .statement-table th:nth-child(4),
  .attendance-all-employees .statement-table th:nth-child(5) { width: 11%; }
  .attendance-all-employees .statement-table th:nth-child(6),
  .attendance-all-employees .statement-table th:nth-child(7) { width: 18%; }
  .attendance-single-employee .statement-table th:nth-child(1) { width: 8%; }
  .attendance-single-employee .statement-table th:nth-child(2) { width: 17%; }
  .attendance-single-employee .statement-table th:nth-child(3),
  .attendance-single-employee .statement-table th:nth-child(4) { width: 14%; }
  .attendance-single-employee .statement-table th:nth-child(5) { width: 23%; }
  .attendance-single-employee .statement-table th:nth-child(6) { width: 24%; }

  .attendance-statement .statement-table {
    font-size: 9.5px;
  }

  .attendance-statement .statement-table th {
    font-size: 9px;
  }

  .attendance-statement .statement-date {
    font-size: 9px;
  }

  /* A repeated table footer reserves visual breathing room without opening a
     page-margin area where browsers can place the website URL. */
  .attendance-statement .attendance-page-bottom-space {
    height: 3mm;
    padding: 0 !important;
    border: 0 !important;
    background: #ffffff !important;
  }
}

/* The application uses a fixed viewport; every view must therefore expose a
   dedicated scroll area instead of letting content disappear below the fold. */
main > .overflow-y-auto {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.view-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Isolated Scrolling Containers */
.scrollable-y {
  overflow-y: auto;
  min-height: 0;
}

/* ============================================================
   Support workspace
   ============================================================ */
.support-scroll { padding: 2px 4px 28px; }

.support-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  padding: 26px 28px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 15%, rgba(245, 130, 32, 0.22), transparent 28%),
    linear-gradient(135deg, #0f2747 0%, #173b67 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(15, 39, 71, 0.18);
}

.support-hero::after {
  content: '';
  position: absolute;
  width: 210px;
  height: 210px;
  left: -70px;
  bottom: -125px;
  border: 32px solid rgba(255, 255, 255, 0.035);
  border-radius: 50%;
}

.support-hero-copy { position: relative; z-index: 1; }
.support-eyebrow {
  display: inline-flex;
  padding: 5px 10px;
  color: #fed7aa;
  background: rgba(245, 130, 32, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.24);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.support-hero h2 { margin: 10px 0 4px; font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.support-hero p { max-width: 640px; margin: 0; color: #cbd8e7; font-size: 12px; line-height: 1.9; }
.support-menu-button { position: relative; z-index: 2; align-self: start; color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); }

.support-kpis {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.support-kpis > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
}
.support-kpis strong { font: 800 21px/1 Arial, sans-serif; }
.support-kpis span { color: #d7e0eb; font-size: 10px; font-weight: 700; }
.support-kpis .is-urgent strong { color: #fb923c; }
.support-kpis .is-complete strong { color: #4ade80; }

.support-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 185px 170px auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  background: rgba(255,255,255,.96);
}
.support-search-field { position: relative; }
.support-search-field svg { position: absolute; right: 13px; top: 50%; width: 17px; height: 17px; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.support-search-field input,
.support-toolbar select {
  width: 100%;
  height: 42px;
  color: #17304f;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  outline: none;
  font: 700 11px 'Cairo', sans-serif;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.support-search-field input { padding: 0 40px 0 13px; }
.support-toolbar select { padding: 0 12px; text-align: right; }
.support-search-field input:focus,
.support-toolbar select:focus { background: #fff; border-color: #f58220; box-shadow: 0 0 0 3px rgba(245,130,32,.1); }
.support-result-count { min-width: 72px; padding: 8px 12px; color: #64748b; text-align: center; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 11px; font-size: 10px; white-space: nowrap; }
.support-result-count strong { color: #ea580c; font: 800 17px/1 Arial, sans-serif; }

.support-section-heading { display: flex; align-items: end; justify-content: space-between; margin: 22px 2px 10px; }
.support-section-heading h3 { margin: 0; color: #0f2747; font-size: 16px; font-weight: 900; }
.support-section-heading p { margin: 3px 0 0; color: #8492a6; font-size: 10px; }
.support-students-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }

.support-table-shell {
  overflow: hidden;
  padding: 0;
  background: #fff;
}
.support-students-table table.crm {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.support-students-table .support-col-student { width: 22%; }
.support-students-table .support-col-course { width: 16%; }
.support-students-table .support-col-contact { width: 23%; }
.support-students-table .support-col-status { width: 13%; }
.support-students-table .support-col-date { width: 12%; }
.support-students-table .support-col-actions { width: 14%; }
.support-students-table th { white-space: nowrap; }
.support-students-table td {
  vertical-align: middle;
  padding-block: 12px;
}
.support-table-row {
  cursor: pointer;
  transition: background-color .18s ease, box-shadow .18s ease;
}
.support-table-row:hover { background: #f8fafc; }
.support-table-row.is-new { box-shadow: inset -4px 0 0 #f58220; }
.support-table-student { display: flex; align-items: center; gap: 9px; min-width: 0; }
.support-table-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #24466d;
  background: #eef4fa;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}
.support-table-avatar.is-new { color: #fff; background: #f58220; border-color: #f58220; }
.support-table-student-copy { display: block; min-width: 0; }
.support-table-student-copy > strong {
  display: block;
  overflow: hidden;
  color: #112b4b;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.support-table-student-copy small { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.support-table-student-copy small b { color: #64748b; font: 700 9px/1 Arial, sans-serif; }
.support-table-student-copy small em {
  padding: 2px 5px;
  color: #c2410c;
  background: #ffedd5;
  border-radius: 999px;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}
.support-table-primary,
.support-table-secondary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-table-primary { color: #334b68; font-size: 10px; font-weight: 900; }
.support-table-secondary { margin-top: 4px; color: #64748b; font-size: 9px; font-weight: 700; }
.support-table-contact { display: grid; gap: 5px; min-width: 0; }
.support-table-contact a {
  overflow: hidden;
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.support-table-contact a:hover { color: #f58220; }
.support-table-note {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.support-table-actions { display: grid; gap: 5px; }
.support-table-actions a,
.support-table-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 8px;
  font: 800 8px 'Cairo', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: .18s ease;
}
.support-table-actions a { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.support-table-actions a:hover { color: #fff; background: #16a34a; border-color: #16a34a; }
.support-table-actions button { color: #fff; background: #173b67; border: 1px solid #173b67; cursor: pointer; }
.support-table-actions button:hover { background: #f58220; border-color: #f58220; }

/* Medium laptop screens (including 13-inch layouts) have less horizontal
   room beside the permanent sidebar. Keep every support column inside the
   viewport and let long values truncate cleanly instead of widening the table. */
@media (max-width: 1200px) and (min-width: 681px) {
  .support-students-table th,
  .support-students-table td { padding-inline: 7px; }
  .support-students-table .support-table-actions { gap: 4px; }
  .support-students-table .support-table-actions a,
  .support-students-table .support-table-actions button { padding-inline: 5px; font-size: 7px; }
}

.support-student-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid #e6ebf1;
  border-radius: 17px;
  box-shadow: 0 7px 20px rgba(15,39,71,.055);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.support-student-card:hover { transform: translateY(-2px); border-color: #cbd7e5; box-shadow: 0 15px 32px rgba(15,39,71,.11); }
.support-student-card.is-new { border-color: #fed7aa; box-shadow: 0 8px 26px rgba(245,130,32,.09); }
.support-card-accent { position: absolute; top: 0; right: 0; width: 4px; height: 100%; background: #94a3b8; }
.support-card-accent.is-pending { background: #f58220; }
.support-card-accent.is-progress { background: #3b82f6; }
.support-card-accent.is-done { background: #22c55e; }
.support-card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.support-status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.support-status.is-pending { color: #c2410c; background: #fff7ed; border: 1px solid #fed7aa; }
.support-status.is-progress { color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; }
.support-status.is-done { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.support-student-id { color: #64748b; font: 700 10px/1.2 Arial, sans-serif; }
.support-profile-row { display: flex; align-items: center; gap: 12px; }
.support-avatar { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; color: #24466d; background: linear-gradient(145deg, #eff5fb, #e2ebf5); border: 1px solid #d7e2ee; border-radius: 14px; font-size: 17px; font-weight: 900; }
.support-avatar.is-new { color: #fff; background: linear-gradient(145deg, #fb923c, #ea580c); border-color: #fb923c; box-shadow: 0 7px 18px rgba(234,88,12,.2); }
.support-profile-copy { min-width: 0; }
.support-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.support-name-line h4 { overflow: hidden; margin: 0; color: #112b4b; font-size: 15px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.support-name-line span { flex: 0 0 auto; padding: 2px 6px; color: #c2410c; background: #ffedd5; border-radius: 999px; font-size: 8px; font-weight: 900; }
.support-profile-copy p { overflow: hidden; margin: 3px 0 0; color: #64748b; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.support-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 15px 0 10px; }
.support-meta-grid > div { padding: 9px 10px; background: #f8fafc; border: 1px solid #edf1f5; border-radius: 10px; }
.support-meta-grid span { display: block; margin-bottom: 3px; color: #64748b; font-size: 8px; font-weight: 800; }
.support-meta-grid strong { display: block; overflow: hidden; color: #334b68; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.support-sales-note {
  position: relative;
  margin: 10px 0 2px;
  padding: 10px 13px 10px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.support-sales-note::before {
  content: '';
  position: absolute;
  top: 9px;
  right: 0;
  bottom: 9px;
  width: 3px;
  background: #f58220;
  border-radius: 3px 0 0 3px;
}
.support-sales-note span { display: block; margin-bottom: 3px; color: #475569; font-size: 9px; font-weight: 900; }
.support-sales-note p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.support-contact-list { display: grid; gap: 6px; padding: 10px 0 12px; border-bottom: 1px solid #edf1f5; }
.support-contact-list a { display: flex; align-items: center; gap: 8px; min-width: 0; color: #65758b; font-size: 9px; text-decoration: none; }
.support-contact-list a:hover { color: #f58220; }
.support-contact-list span { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; color: #173b67; background: #eef4fa; border-radius: 7px; font-weight: 900; }
.support-contact-list b { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.support-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 12px; }
.support-card-actions a,
.support-card-actions button { display: flex; align-items: center; justify-content: center; min-height: 37px; padding: 7px 10px; border-radius: 10px; font: 900 9px 'Cairo', sans-serif; text-decoration: none; transition: .2s ease; }
.support-card-actions .support-whatsapp-action { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.support-card-actions .support-whatsapp-action:hover { color: #fff; background: #16a34a; border-color: #16a34a; }
.support-card-actions button { gap: 6px; color: #fff; background: #173b67; border: 1px solid #173b67; cursor: pointer; }
.support-card-actions button:hover { background: #f58220; border-color: #f58220; }
.support-empty-state { grid-column: 1 / -1; padding: 38px 20px; text-align: center; }
.support-empty-state > div { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 10px; color: #64748b; background: #f1f5f9; border-radius: 15px; font-size: 21px; }
.support-empty-state h3 { margin: 0; color: #233d5d; font-size: 14px; font-weight: 900; }
.support-empty-state p { margin: 5px 0 0; color: #64748b; font-size: 10px; }
.support-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.support-pagination span { color: #64748b; font-size: 10px; font-weight: 700; }
.support-pagination button { min-width: 76px; padding: 8px 14px; color: #173b67; background: #fff; border: 1px solid #dbe4ee; border-radius: 10px; font: 800 10px 'Cairo', sans-serif; cursor: pointer; transition: .2s ease; }
.support-pagination button:hover:not(:disabled) { color: #fff; background: #173b67; border-color: #173b67; }
.support-pagination button:disabled { opacity: .4; cursor: not-allowed; }

.sales-notes-field {
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #dfe7f0;
  border-radius: 14px;
}
.sales-notes-field textarea {
  min-height: 112px;
  line-height: 1.8;
  resize: vertical;
}
.student-sales-notes-panel {
  position: relative;
  padding: 14px 16px 14px 18px;
  text-align: right;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  border: 1px solid #dfe7f0;
  border-radius: 13px;
  box-shadow: 0 5px 15px rgba(15, 39, 71, .04);
}
.student-sales-notes-panel::before {
  content: '';
  position: absolute;
  top: 13px;
  right: 0;
  bottom: 13px;
  width: 4px;
  background: linear-gradient(#f58220, #fb923c);
  border-radius: 4px 0 0 4px;
}
.student-sales-notes-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.student-sales-notes-title { display: grid; gap: 2px; }
.student-sales-notes-heading span { color: #173b67; font-size: 13px; font-weight: 900; }
.student-sales-notes-heading small { color: #94a3b8; font-size: 9px; font-weight: 700; }
.student-sales-notes-edit {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font: 800 9px 'Cairo', sans-serif;
  cursor: pointer;
  transition: .2s ease;
}
.student-sales-notes-edit:hover { color: #fff; background: #f58220; border-color: #f58220; }
.student-sales-notes-copy {
  margin: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.85;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.student-notes-editor {
  padding: 15px;
  background: #f8fafc;
  border: 1px solid #dfe7f0;
  border-radius: 12px;
}
.student-notes-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.student-notes-editor-heading label { color: #173b67; font-size: 12px; font-weight: 900; }
.student-notes-editor-heading span { color: #94a3b8; font-size: 9px; font-weight: 700; }
.student-notes-editor textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 13px;
  color: #334155;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  font: 600 12px/1.8 'Cairo', sans-serif;
  resize: vertical;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.student-notes-editor textarea:focus { border-color: #f58220; box-shadow: 0 0 0 3px rgba(245, 130, 32, .1); }
.student-notes-editor p { margin: 7px 0 0; color: #94a3b8; font-size: 9px; font-weight: 600; }

@media (max-width: 900px) {
  .support-toolbar { grid-template-columns: 1fr 1fr; }
  .support-search-field { grid-column: 1 / -1; }
  .support-result-count { justify-self: stretch; }
}

@media (max-width: 680px) {
  .support-scroll { padding-inline: 1px; }
  .support-hero { padding: 21px 18px; border-radius: 17px; }
  .support-hero h2 { font-size: 21px; }
  .support-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-toolbar { grid-template-columns: 1fr; margin-top: 10px; }
  .support-search-field { grid-column: auto; }
  .support-students-grid { grid-template-columns: minmax(0, 1fr); }
  .support-student-card { padding: 16px; }
  .support-students-table table.crm { min-width: 0; table-layout: auto; }
  .support-students-table colgroup { display: none; }
  .support-table-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-sales-notes-heading { align-items: flex-start; }
  .student-sales-notes-panel { padding: 12px 13px; }
  .student-sales-notes-edit { padding: 6px 8px; }
  .student-notes-editor { padding: 12px; }
}

@media (max-width: 420px) {
  .support-table-actions { grid-template-columns: minmax(0, 1fr); }
  .student-sales-notes-heading { flex-direction: column; }
  .student-sales-notes-edit { width: 100%; }
  .student-notes-editor-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* Attendance module additions. These rules keep the module independent from
   runtime CSS generation and reuse the application's existing visual system. */
.attendance-dashboard-card:hover { border-color: #fdba74; }
.attendance-network-warning {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.attendance-status-in {
  color: #15803d;
  border-color: #dcfce7;
}
.attendance-status-out {
  color: #c2410c;
  border-color: #ffedd5;
}

.attendance-admin-table {
  width: 100%;
  table-layout: fixed;
}

.attendance-admin-table .attendance-col-employee { width: 20%; }
.attendance-admin-table .attendance-col-date { width: 13%; }
.attendance-admin-table .attendance-col-time { width: 11%; }
.attendance-admin-table .attendance-col-duration { width: 13%; }
.attendance-admin-table .attendance-col-ip { width: 16%; }

.attendance-admin-table th,
.attendance-admin-table td {
  vertical-align: middle;
}

@media (min-width: 1024px) {
  .attendance-filter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ============================================================
   Phone layout refinements
   ============================================================ */
@media (max-width: 767px) {
  .app-shell main > header {
    box-sizing: border-box;
    min-height: calc(58px + env(safe-area-inset-top)) !important;
    height: calc(58px + env(safe-area-inset-top)) !important;
    padding-top: env(safe-area-inset-top) !important;
    padding-right: max(10px, env(safe-area-inset-right)) !important;
    padding-left: max(10px, env(safe-area-inset-left)) !important;
  }

  .app-shell main > header h2 {
    overflow: hidden;
    max-width: min(52vw, 240px);
    font-size: .95rem !important;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-menu-toggle {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .topbar-user-avatar { display: none !important; }

  #notifications-panel {
    top: calc(62px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  main > .flex-1.overflow-y-auto {
    padding: 12px !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
  }

  .btn,
  .input,
  .select,
  textarea.input {
    min-height: 44px;
  }

  .input,
  .select,
  textarea.input {
    font-size: 16px;
  }

  .btn { padding-inline: .8rem; }
  .field-label { font-size: .76rem; }

  .card { max-width: 100%; }

  .table-wrapper {
    max-width: 100%;
    overscroll-behavior-x: contain;
  }

  table.crm { min-width: 680px; }
  table.crm thead th,
  table.crm tbody td { padding: .65rem .7rem; }
  .attendance-history-table { min-width: 0 !important; table-layout: fixed; }
  .attendance-history-table th,
  .attendance-history-table td {
    padding-inline: .35rem !important;
    font-size: .68rem !important;
    overflow-wrap: anywhere;
  }

  .mobile-tabs {
    gap: 7px !important;
    margin-bottom: 16px !important;
    padding-bottom: 9px !important;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .mobile-tabs::-webkit-scrollbar { display: none; }
  .mobile-tabs > button {
    min-height: 40px;
    flex: 0 0 auto;
    padding-inline: 12px !important;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
    padding: 1rem !important;
    border-radius: 14px 14px 8px 8px !important;
  }

  #toast-wrap {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
  }

  .toast {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .login-view { padding: 14px !important; }
  .login-card { padding: 24px !important; }
  .login-card h1 { font-size: 1.55rem !important; }

  .attendance-network-settings > div { align-items: stretch !important; }
  .attendance-network-settings .btn { width: 100%; }

  .student-pagination-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .student-pagination-controls .btn { width: 100%; }

  .support-pagination {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }
  .support-pagination span {
    order: -1;
    width: 100%;
    text-align: center;
  }
  .support-pagination button { flex: 1; min-height: 42px; }
}

.login-remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  cursor: pointer;
  color: var(--navy-900);
  text-align: right;
}

.login-remember-checkbox {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  margin: 0;
  accent-color: var(--brand-500);
  cursor: pointer;
}

.login-remember-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.login-remember-row strong {
  font-size: .82rem;
  font-weight: 700;
}

.login-remember-row small {
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.5;
}

@media (max-width: 479px) {
  .admin-kpi-grid,
  .cash-balance-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .support-hero { padding: 18px 14px; }
  .support-hero h2 { font-size: 19px; }
  .support-hero p { font-size: 11px; line-height: 1.7; }
  .support-kpis { gap: 7px; }
  .support-kpis > div { padding: 9px; }
  .support-kpis strong { font-size: 18px; }

  .support-card-actions { grid-template-columns: minmax(0, 1fr); }
  .support-meta-grid { grid-template-columns: minmax(0, 1fr); }
}
