/* ==========================================================
   Portal styles: sign in / sign up and the role dashboards.
   Loaded after style.css and reuses its tokens, .btn and .field.
   ========================================================== */

:root { --ok: #2E7D4F; --ok-bg: #E4F3EA; --warn: #9A6B00; --warn-bg: #FBF0D4; --bad: #A3261B; --bad-bg: #FBE6E3; --side-w: 264px; }

/* ---------- Auth ---------- */
.auth-body { background: var(--ivory); }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; }
.auth-panel {
  background: var(--pattern), var(--night); color: #C9D0EA; padding: clamp(2rem, 4vw, 3.5rem);
  display: flex; flex-direction: column; gap: 2.2rem; position: relative;
}
.auth-panel::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 4px; background: linear-gradient(var(--gold), var(--gold-2), var(--gold)); }
.auth-brand { display: flex; gap: 1rem; align-items: center; text-decoration: none; color: #fff; }
.auth-brand img { border-radius: 50%; background: #fff; padding: 3px; }
.auth-brand strong { font-family: var(--f-display); font-size: 1.5rem; line-height: 1.1; display: block; color: #fff; }
.auth-brand .ur { color: var(--gold-2); font-size: .85rem; display: block; text-align: left; }
.auth-ayah { margin-top: auto; }
.auth-ayah .ar { font-size: clamp(2.4rem, 4vw, 3.4rem); color: var(--gold-2); display: block; line-height: 1.5; text-align: left; }
.auth-ayah p { font-family: var(--f-display); font-size: 1.35rem; color: #fff; font-style: italic; }
.auth-ayah small { font-family: var(--f-body); font-style: normal; font-size: .85rem; color: #9AA4CC; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; font-size: .96rem; }
.auth-points li { padding-left: 1.6rem; position: relative; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 9px; height: 9px; background: var(--gold-2); transform: rotate(45deg); }
.auth-back { color: #9AA4CC; font-size: .9rem; text-decoration: none; }
.auth-back:hover { color: var(--gold-2); }
.auth-form { display: grid; place-items: center; padding: 2rem 1rem; background: var(--ivory) var(--pattern-light); }
.auth-card { width: min(470px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: clamp(1.6rem, 4vw, 2.6rem); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2.4rem; margin-bottom: .2rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.6rem; }
.auth-alt { text-align: center; margin: 1.4rem 0 0; }
.auth-help { text-align: center; font-size: .85rem; color: var(--muted); margin: .6rem 0 0; }
.auth-mobile-brand { display: none; }
.btn--block { width: 100%; justify-content: center; margin-top: .4rem; }
.pw { position: relative; }
.pw input { padding-right: 4.2rem; }
.pw-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--lapis); font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer; padding: .3rem .5rem; }
.opt { color: var(--muted); font-weight: 400; font-size: .82rem; }
.hint { font-size: .85rem; color: var(--muted); margin: -.4rem 0 1rem; }
.field .err:empty { display: none !important; }

.error-page { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 2rem 1rem; gap: .4rem; }
.error-page img { margin: 0 auto 1rem; border-radius: 50%; }

/* ---------- Flash ---------- */
.flash { padding: .85rem 1.1rem; border-radius: 10px; margin-bottom: 1.3rem; font-size: .95rem; border: 1px solid; word-break: break-word; }
.flash--ok { background: var(--ok-bg); color: #1D5535; border-color: #BFE0CB; }
.flash--err { background: var(--bad-bg); color: var(--bad); border-color: #F0C3BD; }

/* ---------- Shell ---------- */
.app-body { background: #F7F4EC; font-size: 1rem; }
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  background: var(--pattern), var(--night); color: #C9D0EA; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.3rem 1rem;
}
.side-brand { display: flex; gap: .75rem; align-items: center; text-decoration: none; padding: .2rem .4rem 1.2rem; border-bottom: 1px solid rgba(227,190,98,.2); }
.side-brand img { border-radius: 50%; background: #fff; padding: 2px; }
.side-brand strong { display: block; font-family: var(--f-display); color: #fff; font-size: 1.2rem; line-height: 1.1; }
.side-brand small { color: var(--gold-2); font-size: .8rem; }
.side-role { display: flex; align-items: center; gap: .5rem; margin: 1.1rem .4rem .8rem; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); }
.side-role svg { width: 15px; height: 15px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-foot a, .side-foot button {
  display: flex; align-items: center; gap: .8rem; padding: .68rem .8rem; border-radius: 10px; color: #C9D0EA; text-decoration: none;
  font: inherit; font-size: .95rem; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.side-nav svg, .side-foot svg { width: 19px; height: 19px; flex: none; }
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(227,190,98,.2), rgba(227,190,98,.05)); color: #fff; box-shadow: inset 3px 0 0 var(--gold-2); }
.side-nav a[aria-current="page"] svg { color: var(--gold-2); }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(227,190,98,.2); display: grid; gap: 2px; }
.side-foot form { margin: 0; }
.side-scrim { display: none; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topnav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .85rem clamp(1rem, 3vw, 2.2rem); background: rgba(252,250,244,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topnav-title { font-size: clamp(1.5rem, 2.4vw, 1.9rem); margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 42px; height: 42px; place-items: center; cursor: pointer; color: var(--night); }
.side-toggle svg { width: 22px; height: 22px; }
.me { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.me-text strong { display: block; font-size: .92rem; line-height: 1.2; }
.me-text small { color: var(--muted); font-size: .8rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lapis); color: var(--gold-2); display: grid; place-items: center; font-weight: 600; font-size: .9rem; flex: none; border: 2px solid var(--gold-soft); }
.avatar--sm { width: 34px; height: 34px; font-size: .78rem; }
.content { padding: clamp(1.2rem, 3vw, 2.2rem); width: 100%; max-width: 1320px; }

/* ---------- Building blocks ---------- */
.welcome {
  background: var(--pattern), var(--lapis); color: #D3D9EF; border-radius: 18px; padding: clamp(1.4rem, 3vw, 2rem) clamp(1.4rem, 3vw, 2.2rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.welcome .ar { color: var(--gold-2); font-size: 1.5rem; display: block; text-align: left; line-height: 1.6; }
.welcome h2 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 .3rem; }
.welcome p { margin: 0; max-width: 60ch; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stats--two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 640px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: .15rem; transition: border-color .2s, transform .2s;
}
a.stat:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.stat small { color: var(--muted); font-size: .84rem; }
.stat strong { font-family: var(--f-display); font-size: 2.1rem; line-height: 1.1; color: var(--night); font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat--gold { background: linear-gradient(160deg, #fff 40%, var(--gold-soft)); border-color: #E9D49B; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; align-items: start; }
.grid-2--wide { grid-template-columns: 1.5fr 1fr; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.1rem, 2.4vw, 1.6rem); margin-bottom: 1.5rem; min-width: 0; }
.grid-2 > .card { margin-bottom: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--form { max-width: 820px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-head h2 { font-size: 1.45rem; margin: 0; }
.card-head a { font-size: .9rem; white-space: nowrap; }
.card--accounts h2 { font-size: 1.45rem; }
.empty { color: var(--muted); margin: .5rem 0; padding: 1rem; }
.card--flush .empty { padding: 1.5rem; }
.lede { color: var(--muted); margin-bottom: 1.4rem; }
.crumb { margin: 0 0 1rem; font-size: .92rem; }
.crumb a { text-decoration: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: .86rem; margin-top: 1rem; }
.pre { white-space: pre-wrap; }
.sub { font-family: var(--f-body); font-size: .95rem; font-weight: 600; margin: 1.3rem 0 .4rem; color: var(--ink); }
.btn--sm { padding: .6rem 1.1rem; font-size: .92rem; }
.btn--sm svg { width: 16px; height: 16px; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input, .filters select, .role-form select {
  font: inherit; font-size: .92rem; padding: .55rem .8rem; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
.filters input[type="search"] { min-width: min(280px, 100%); flex: 1 1 220px; max-width: 360px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .8rem 1rem; background: #FBF8F0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid #F0EADB; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FDFBF6; }
.table td small { display: block; color: var(--muted); font-size: .82rem; }
.card:not(.card--flush) .table th:first-child, .card:not(.card--flush) .table td:first-child { padding-left: 0; }
.card:not(.card--flush) .table th { background: none; }
.t-right { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.row-muted td { opacity: .6; }
.inline { display: inline; margin: 0; }
.btn-sm {
  display: inline-block; font: inherit; font-size: .84rem; font-weight: 500; padding: .38rem .8rem; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--lapis); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-sm:hover { border-color: var(--lapis); color: var(--lapis); }
.btn-sm--ok { color: var(--ok); }
.btn-sm--ok:hover { border-color: var(--ok); color: var(--ok); }
.btn-sm--danger { color: var(--bad); }
.btn-sm--danger:hover { border-color: var(--bad); color: var(--bad); }
.link-danger { background: none; border: 0; padding: 0; color: var(--bad); font: inherit; font-size: .84rem; cursor: pointer; text-decoration: underline; }
.role-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.role-form select { padding: .35rem .5rem; font-size: .86rem; }
.person { display: flex; gap: .7rem; align-items: center; }
.person small { display: block; }

/* Badges */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; background: #EEF0F7; color: var(--muted); }
.badge--pending, .badge--new, .badge--waitlisted { background: var(--warn-bg); color: var(--warn); }
.badge--approved, .badge--verified { background: var(--ok-bg); color: var(--ok); }
.badge--rejected { background: var(--bad-bg); color: var(--bad); }
.badge--read { background: #E8ECF8; color: var(--lapis); }
.badge--staff { background: var(--night); color: var(--gold-2); }
.badge--role-admin { background: var(--night); color: var(--gold-2); }
.badge--role-manager { background: #E8ECF8; color: var(--lapis); }
.badge--role-user { background: #F2EEE2; color: #6B5A2C; }

/* Lists */
.rows { list-style: none; padding: 0; margin: 0; }
.rows li > a, .rows li > span:first-child { display: block; }
.rows li { border-top: 1px solid #F0EADB; }
.rows li:first-child { border-top: 0; }
.rows li, .rows li > a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 0; text-decoration: none; color: var(--ink); }
.rows li > a { padding: 0; flex: 1; }
.rows small { display: block; color: var(--muted); font-size: .84rem; }
.rows li > a:hover strong { color: var(--lapis); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .6rem 0; border-top: 1px solid #F0EADB; }
.people li:first-child { border-top: 0; }
.people small { display: block; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.people span { min-width: 0; }
.log { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.log li { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; padding: .55rem 0; border-top: 1px solid #F0EADB; }
.log li:first-child { border-top: 0; }
.log-time { color: var(--muted); font-size: .84rem; }
code { font-size: .82em; background: #F2EEE2; padding: .1rem .4rem; border-radius: 5px; color: #6B5A2C; }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 1rem 0; border-top: 1px solid #F0EADB; }
.notes li:first-child { border-top: 0; padding-top: 0; }
.notes h3 { font-size: 1.35rem; margin: .2rem 0 .3rem; }
.notes p { margin: 0 0 .4rem; white-space: pre-wrap; }
.notes-meta { font-size: .82rem; color: var(--muted); }

/* Charts */
.bars { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: 1rem; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: center; }
.bars-label { font-size: .9rem; }
.bars-val { font-weight: 600; font-variant-numeric: tabular-nums; grid-row: span 2; align-self: end; }
.bars-track { height: 10px; background: #F2EEE2; border-radius: 999px; overflow: hidden; }
.bars-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--lapis), var(--lapis-2)); border-radius: 999px; min-width: 4px; }
.quick { display: flex; gap: .6rem; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; height: 220px; align-items: end; }
.col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; gap: .35rem; }
.col-val { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-bar { align-self: end; width: 70%; max-width: 46px; margin: 0 auto; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-radius: 6px 6px 2px 2px; }
.col-label { font-size: .82rem; color: var(--muted); }

/* User home */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.action {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; display: flex; gap: 1rem; align-items: flex-start;
  text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s;
}
a.action:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.action strong { display: block; font-size: 1.05rem; }
.action small { color: var(--muted); font-size: .88rem; }
.action-icon { width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--lapis); color: var(--gold-2); display: grid; place-items: center; }
.action-icon--gold { background: var(--gold-soft); color: var(--night); }
.action-icon svg { width: 22px; height: 22px; }
.action--stat { flex-direction: column; gap: .1rem; background: var(--pattern), var(--night); border-color: var(--night); color: #C9D0EA; }
.action--stat small { color: #9AA4CC; }
.action--stat strong { font-family: var(--f-display); font-size: 2.1rem; color: var(--gold-2); }
.action--stat span { font-size: .85rem; }

/* Detail pages */
.details { margin: 0; display: grid; gap: 0; }
.details > div { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; padding: .6rem 0; border-top: 1px solid #F0EADB; }
.details > div:first-child { border-top: 0; }
.details dt { color: var(--muted); font-size: .9rem; }
.details dd { margin: 0; }
.choice { border: 0; padding: 0; margin: 0 0 1.1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.choice legend { font-size: .92rem; font-weight: 500; margin-bottom: .4rem; padding: 0; width: 100%; }
.choice label { display: flex; gap: .45rem; align-items: center; padding: .5rem .85rem; border: 1.5px solid var(--line); border-radius: 9px; cursor: pointer; font-size: .92rem; }
.choice label:has(input:checked) { border-color: var(--lapis); background: #F1F3FA; }
.check { display: flex; gap: .55rem; align-items: center; margin: 0 0 1.2rem; font-size: .94rem; }
.status-msg { padding: 1rem 1.1rem; border-radius: 12px; background: var(--warn-bg); color: #6E4D00; }
.status-msg--approved { background: var(--ok-bg); color: #1D5535; }
.status-msg--rejected { background: var(--bad-bg); color: var(--bad); }
.field-row--4 { grid-template-columns: repeat(4, 1fr); }

/* Messages */
.msgs { display: grid; gap: 1rem; }
.msgs .card { margin: 0; }
.msg--new { border-left: 4px solid var(--gold); }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .6rem; }
.msg-head small { display: block; color: var(--muted); font-size: .84rem; }
.msg-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-2--wide { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr 1fr; }
  .action--stat { grid-column: span 2; }
  .field-row--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(var(--side-w), 84vw); z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; }
  .side-scrim { position: fixed; inset: 0; background: rgba(15,24,66,.45); z-index: 40; }
  .side.open + .side-scrim { display: block; }
  .side-toggle { display: grid; }
  .me-text { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-mobile-brand { display: flex; gap: .8rem; align-items: center; text-decoration: none; color: var(--night); font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; line-height: 1.15; margin-bottom: 1.4rem; }
  .auth-mobile-brand img { border-radius: 50%; }
}
@media (max-width: 640px) {
  .actions { grid-template-columns: 1fr; }
  .action--stat { grid-column: auto; }
  .field-row, .field-row--4 { grid-template-columns: 1fr; gap: 0; }
  .details > div { grid-template-columns: 1fr; gap: .1rem; }
  .log li { grid-template-columns: 1fr; gap: .1rem; }
  .welcome .btn { width: 100%; justify-content: center; }
  .stat strong { font-size: 1.7rem; }
  .cols { gap: .35rem; }
  .col-val { display: none; }
}

/* ---------- Institution: dashboard, branches, Makatib, people ---------- */
.side-section { display: block; margin: 1rem .8rem .3rem; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #8F99C2; }
.group-title { font-family: var(--f-body); font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 1.6rem 0 .7rem; display: flex; align-items: center; gap: .8rem; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.stat-group .stats { margin-bottom: .4rem; }
.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat strong { font-size: 1.9rem; }

.quick-card { padding: 1rem; }
.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: .9rem .5rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 500; transition: border-color .2s, background .2s; }
.quick-action:hover { border-color: var(--gold); background: #FFFCF3; color: var(--night); }
.quick-action .action-icon { width: 42px; height: 42px; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.chart-grid .card { margin: 0; }
.chart-box { position: relative; height: 240px; }
.chart-empty { display: grid; place-items: center; min-height: 160px; text-align: center; background: #FBF8F0 var(--pattern-light); border-radius: 12px; }
.chart-table { margin-top: .6rem; font-size: .88rem; }
.chart-table summary { cursor: pointer; color: var(--lapis); }
.chart-table .table td { padding: .35rem 0; }
.log--compact li { grid-template-columns: 1fr; gap: 0; }

.card--wide { max-width: 1080px; }
.form-section { border: 0; padding: 0; margin: 0 0 1.4rem; }
.form-section > legend { font-family: var(--f-display); font-size: 1.35rem; font-weight: 600; color: var(--night); padding: 0; margin-bottom: .8rem; width: 100%; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.field-row--3 { grid-template-columns: repeat(3, 1fr); }
.ur-input { font-family: var(--f-urdu); line-height: 2; padding-top: .5rem !important; padding-bottom: .5rem !important; }
.ur-inline { font-family: var(--f-urdu); font-size: .95em; }
.result-count { color: var(--muted); font-size: .88rem; margin: -.3rem 0 .6rem; }
.row-link { text-decoration: none; color: var(--ink); }
.row-link:hover strong { color: var(--lapis); text-decoration: underline; }

.unit-head { display: grid; grid-template-columns: 120px 1fr auto; gap: 1.4rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem; margin-bottom: 1.5rem; }
.unit-cover { width: 120px; height: 120px; border-radius: 999px 999px 14px 14px; overflow: hidden; background: var(--pattern), var(--night); display: grid; place-items: center; color: var(--gold-2); border: 3px solid var(--gold-soft); }
.unit-cover img { width: 100%; height: 100%; object-fit: cover; }
.unit-cover svg { width: 44px; height: 44px; }
.unit-title h2 { margin: .2rem 0 0; font-size: clamp(1.7rem, 3vw, 2.3rem); }
.unit-ur { font-family: var(--f-urdu); color: var(--gold); font-size: 1.15rem; margin: 0; line-height: 2; text-align: left; }
.unit-meta { display: flex; gap: .5rem; align-items: center; }
.unit-place { display: flex; gap: .4rem; align-items: center; color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }
.unit-place svg { width: 16px; height: 16px; flex: none; color: var(--gold); }
.unit-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.unit-actions form { margin: 0; }
.code-chip { font-size: .78rem; font-weight: 600; letter-spacing: .06em; background: var(--night); color: var(--gold-2); padding: .15rem .55rem; border-radius: 6px; }
.btn--danger-line { border-color: #E9C2BC; color: var(--bad); }
.btn--danger-line:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.details--2col { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
.details--2col > div:nth-child(2) { border-top: 0; }

.tabs-inline { display: flex; gap: .3rem; flex-wrap: wrap; margin: 0 0 1.2rem; position: sticky; top: 70px; z-index: 5; background: #F7F4EC; padding: .4rem 0; }
.tabs-inline a { padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-size: .88rem; }
.tabs-inline a:hover { border-color: var(--lapis); color: var(--lapis); }
section[id] { scroll-margin-top: 130px; }

.assign { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.assign label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .4rem; }
.assign-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.assign-row select, .assign-row input, .transfer-form select { font: inherit; font-size: .9rem; padding: .5rem .7rem; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; min-width: 0; }
.assign-row select { flex: 2 1 240px; }
.assign-row input { flex: 1 1 160px; }
.transfer-form { display: flex; gap: .35rem; margin: 0; }
.transfer-form select { padding: .32rem .5rem; font-size: .84rem; max-width: 190px; }
.btn-sm svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: .2rem; }
.enrol { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

.grid-2--files { margin: 0; gap: 2rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.photo { margin: 0; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo figcaption { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.photo figcaption form { margin: 0; }
.docs { list-style: none; margin: 0 0 1rem; padding: 0; }
.docs li { display: grid; grid-template-columns: 20px 1fr auto; gap: .6rem; align-items: center; padding: .55rem 0; border-top: 1px solid #F0EADB; }
.docs li:first-child { border-top: 0; }
.docs svg { width: 18px; height: 18px; color: var(--lapis); }
.docs small { display: block; color: var(--muted); font-size: .8rem; }
.docs form { margin: 0; }
.upload { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 0; }
.upload small { color: var(--muted); font-size: .8rem; }
.upload-pick { position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border: 1.5px dashed var(--gold); border-radius: 10px; color: var(--night); font-weight: 500; font-size: .9rem; cursor: pointer; background: #FFFCF3; }
.upload-pick:hover, .upload-pick:focus-within { background: var(--gold-soft); }
.upload-pick svg { width: 17px; height: 17px; }
.upload-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-pick.is-busy { opacity: .6; pointer-events: none; }

.badge--active { background: var(--ok-bg); color: var(--ok); }
.badge--inactive { background: #EEF0F7; color: var(--muted); }
.badge--archived, .badge--left { background: #EFEAE0; color: #6B5A2C; }
.badge--graduated { background: #E8ECF8; color: var(--lapis); }

@media (max-width: 1100px) {
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .unit-head { grid-template-columns: 80px 1fr; }
  .unit-cover { width: 80px; height: 80px; }
  .unit-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .details--2col { grid-template-columns: 1fr; }
  .details--2col > div:nth-child(2) { border-top: 1px solid #F0EADB; }
  .tabs-inline { top: 64px; }
}
@media (max-width: 640px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row--3 { grid-template-columns: 1fr; }
  .transfer-form { flex-wrap: wrap; }
  .transfer-form select { max-width: none; flex: 1; }
}

/* ---------- Part 2: people, photos, attendance ---------- */
.legend-ur { font-family: var(--f-urdu); font-size: .95rem; color: var(--gold); font-weight: 500; margin-left: .6rem; direction: rtl; line-height: 2; }
.form-section > legend { display: flex; align-items: baseline; justify-content: space-between; }
.hint svg { width: 15px; height: 15px; vertical-align: -3px; color: var(--gold); }
.small-inline { font-size: .85rem; }
.stat-link { font-size: 1.4rem !important; color: var(--lapis) !important; }

.profile-head { display: grid; grid-template-columns: 180px 1fr minmax(220px, 280px); gap: 1.5rem; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; margin-bottom: 1.5rem; }
.profile-title h2 { margin: .2rem 0 0; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.profile-actions { margin-top: .9rem; gap: .5rem; }
.profile-actions form { margin: 0; }
.att-tiles { display: grid; gap: .8rem; }
.att-tiles .stat strong { font-size: 1.7rem; }

.photo-box { display: flex; flex-direction: column; align-items: center; gap: .55rem; text-align: center; }
.photo-box form { margin: 0; }
.photo-frame { width: 160px; height: 190px; border-radius: 999px 999px 14px 14px; overflow: hidden; border: 3px solid var(--gold-soft); background: var(--pattern), var(--night); display: grid; place-items: center; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-initials { font-family: var(--f-display); font-size: 3rem; color: var(--gold-2); }
.photo-form { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.upload-pick--sm { padding: .4rem .8rem; font-size: .84rem; }
.progress { width: 160px; height: 6px; background: #F2EEE2; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .15s; }
.photo-msg { font-size: .76rem; color: var(--muted); margin: 0; max-width: 170px; }
.photo-msg--err { color: var(--bad); font-weight: 500; }
.avatar--img { object-fit: cover; padding: 0; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; align-items: start; }
.grid-3 > .card { margin: 0; }
.details--tight > div { grid-template-columns: 130px 1fr; padding: .45rem 0; font-size: .93rem; }
.assign--flush { margin-top: 0; padding-top: 0; border-top: 0; }
.rows--cols { columns: 2; column-gap: 2rem; }
.rows--cols li { break-inside: avoid; }
.progress-form { display: grid; grid-template-columns: 150px 170px 1fr 1fr auto; gap: .7rem; align-items: end; margin-bottom: 1rem; }
.progress-form .field { margin: 0; }
.progress-form .field input { padding: .6rem .8rem; }
.doc-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem 1.5rem; }
.doc-cat { border: 1px solid #F0EADB; border-radius: 12px; padding: .8rem 1rem; }
.doc-cat .sub { margin-top: 0; }
.doc-cat .docs { margin-bottom: .6rem; }

.filter-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.card-head--pad { padding: 1rem 1.2rem 0; }
.att-counts { display: flex; gap: .4rem; flex-wrap: wrap; }
.att-dot { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: #F2EEE2; }
.att-dot--present { background: var(--ok-bg); color: var(--ok); }
.att-dot--absent { background: var(--bad-bg); color: var(--bad); }
.att-dot--leave { background: #E8ECF8; color: var(--lapis); }
.att-dot--late { background: var(--warn-bg); color: var(--warn); }
.register-tools { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.register-table td { padding: .55rem .6rem; }
.t-center { text-align: center; }
.att-radio { display: inline-grid; place-items: center; cursor: pointer; }
.att-radio input { position: absolute; opacity: 0; pointer-events: none; }
.att-radio span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); font-weight: 600; font-size: .85rem; color: var(--muted); background: #fff; transition: all .12s; }
.att-radio:hover span { border-color: var(--lapis); }
.att-radio input:focus-visible + span { outline: 3px solid var(--gold-2); outline-offset: 2px; }
.att-radio--present input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.att-radio--absent input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.att-radio--leave input:checked + span { background: var(--lapis); border-color: var(--lapis); color: #fff; }
.att-radio--late input:checked + span { background: var(--gold); border-color: var(--gold); color: var(--night); }
.att-radio input:disabled + span { opacity: .55; cursor: not-allowed; }
.note-input { font: inherit; font-size: .85rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; width: 100%; min-width: 120px; }
.register-save { margin-top: 1rem; position: sticky; bottom: 0; background: linear-gradient(transparent, #fff 35%); padding: .8rem 0 .3rem; }
.badge--present { background: var(--ok-bg); color: var(--ok); }
.badge--absent { background: var(--bad-bg); color: var(--bad); }
.badge--leave { background: #E8ECF8; color: var(--lapis); }
.badge--late, .badge--on_leave { background: var(--warn-bg); color: var(--warn); }

@media (max-width: 1100px) {
  .profile-head { grid-template-columns: 170px 1fr; }
  .att-tiles { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .progress-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .profile-head { grid-template-columns: 1fr; }
  .att-tiles { grid-template-columns: 1fr; }
  .rows--cols { columns: 1; }
  .progress-form { grid-template-columns: 1fr; }
  .att-radio span { width: 30px; height: 30px; }
}

.publish-form { display: flex; gap: .3rem; margin-top: .3rem; }
.publish-form input { flex: 1; min-width: 0; font: inherit; font-size: .78rem; padding: .3rem .45rem; border: 1px solid var(--line); border-radius: 6px; }
.publish-form .btn-sm { font-size: .74rem; padding: .3rem .5rem; }

/* Public site: account link in the main nav */
.nav .nav-account { font-weight: 500; }

/* ---------- Roles, schools, results, accounts, parents (Part 4) ---------- */
.badge--published { background: var(--ok-bg); color: var(--ok); }
.badge--draft { background: var(--warn-bg); color: var(--warn); }
.badge--role-nazim, .badge--role-principal { background: #E6F1EC; color: #1F6B4A; }
.badge--role-accountant { background: #FBF0D9; color: #7A5A12; }
.badge--role-teacher { background: #EEF0F7; color: var(--lapis); }
.badge--role-parent { background: #F6E9EE; color: #7A2E4A; }
.stat--warn { background: linear-gradient(160deg, #fff 40%, var(--bad-bg)); }
.stat-text { font-size: 1.15rem !important; line-height: 1.3; }
.btn--line-light { color: #fff; border-color: rgba(255,255,255,.5); }
.btn--line-light:hover { background: rgba(255,255,255,.1); color: #fff; }
.danger-zone { margin: 1.4rem 0 0; display: flex; justify-content: flex-end; }

/* Marks entry */
.marks-table th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }
.mark-input { width: 4.2rem; padding: .4rem .45rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; text-align: center; background: #fff; }
.mark-input:focus { outline: 2px solid var(--gold-2); border-color: var(--gold); }
.mark-input:disabled { background: #F6F4EE; color: var(--muted); }

/* Parent dashboard */
.child-card { padding-top: 1.2rem; }
.child-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.child-head > div:nth-child(2) { flex: 1; min-width: 200px; }
.child-head h2 { margin: 0; font-size: 1.5rem; }
.child-head h2 a { color: inherit; text-decoration: none; }
.child-head .muted { margin: .2rem 0 0; }
.child-photo { width: 72px; height: 84px; border-radius: 999px 999px 12px 12px; overflow: hidden; background: var(--pattern), var(--night); display: grid; place-items: center; color: var(--gold-2); font-family: var(--f-display); font-size: 1.6rem; flex: none; border: 2px solid var(--gold-soft); }
.child-photo img { width: 100%; height: 100%; object-fit: cover; }
.child-photo--lg { width: 150px; height: 178px; font-size: 2.6rem; }

/* Language switcher (portal header) */
.lang-switch { display: flex; align-items: center; gap: .15rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .3rem .2rem .55rem; }
.lang-switch svg { width: 16px; height: 16px; color: var(--gold); margin-inline-end: .2rem; }
.lang-switch a { text-decoration: none; color: var(--muted); font-size: .85rem; padding: .2rem .6rem; border-radius: 999px; }
.lang-switch a[lang="ur"] { font-family: var(--f-urdu); font-size: .85rem; line-height: 1.6; }
.lang-switch a[aria-current] { background: var(--night); color: var(--gold-2); }
@media (max-width: 640px) { .lang-switch svg { display: none; } .lang-switch { padding: .15rem; } }

/* Urdu interface: right-to-left, Nastaliq for the translated menus and titles */
[dir="rtl"] .side-nav span, [dir="rtl"] .side-section, [dir="rtl"] .side-role, [dir="rtl"] .side-foot span,
[dir="rtl"] .topnav-title, [dir="rtl"] .me-text small { font-family: var(--f-urdu); line-height: 1.9; letter-spacing: 0; text-transform: none; }
[dir="rtl"] .topnav-title { font-size: clamp(1.2rem, 2vw, 1.5rem); }
[dir="rtl"] .side-nav a, [dir="rtl"] .side-foot a, [dir="rtl"] .side-foot button, [dir="rtl"] .table th { text-align: right; }
[dir="rtl"] .side-nav a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--gold-2); background: linear-gradient(270deg, rgba(227,190,98,.2), rgba(227,190,98,.05)); }
[dir="rtl"] .t-right { text-align: left; }
[dir="rtl"] .card:not(.card--flush) .table th:first-child, [dir="rtl"] .card:not(.card--flush) .table td:first-child { padding-left: 1rem; padding-right: 0; }
[dir="rtl"] .btn-sm svg { margin-right: 0; margin-left: .2rem; }
[dir="rtl"] .legend-ur { margin-left: 0; margin-right: .6rem; }
[dir="rtl"] .pw input { padding-right: .9rem; padding-left: 4.2rem; }
[dir="rtl"] .pw-toggle { right: auto; left: .5rem; }
[dir="rtl"] .welcome .ar, [dir="rtl"] .unit-ur { text-align: right; }
@media (max-width: 900px) {
  [dir="rtl"] .side { inset: 0 0 0 auto; transform: translateX(100%); }
  [dir="rtl"] .side.open { transform: none; }
}

/* Offline / sync status (bottom of the screen) */
.net-status { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 90; max-width: min(560px, calc(100vw - 2rem));
  padding: .7rem 1.1rem; border-radius: 12px; font-size: .92rem; box-shadow: var(--shadow); background: var(--night); color: #fff; }
.net-status--off { background: #5A2A0E; color: #FFE7C2; }
.net-status--sync { background: var(--night); color: var(--gold-2); }
.net-status--ok { background: #1F6B4A; color: #fff; }
.net-status--warn { background: #8A1F1F; color: #fff; }
.section-switch a { font-weight: 500; }

/* School student registration (laid out like the Iqra Islamia Public School admission form) */
.school-reg-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: .6rem; border-bottom: 2px solid var(--ink); }
.school-reg-head img { border-radius: 50%; flex: none; }
.school-reg-head h2 { margin: 0; font-family: "Times New Roman", Georgia, serif; font-size: clamp(1.3rem, 2.6vw, 1.9rem); letter-spacing: .01em; color: var(--ink); }
.school-reg-head p { margin: .2rem 0 0; color: var(--muted); }

/* The two Jamias */
.jamia-card { display: block; text-decoration: none; color: inherit; border-top: 5px solid var(--lapis); transition: box-shadow .2s; }
.jamia-card--girls { border-top-color: #8A3B6B; }
.jamia-card:hover { box-shadow: var(--shadow); }
.jamia-card h2 { margin: .1rem 0 .2rem; font-size: clamp(1.35rem, 2.2vw, 1.75rem); line-height: 1.2; }
.jamia-card-ur { display: block; font-family: var(--f-urdu); color: var(--gold); font-size: 1.2rem; line-height: 2; }
.jamia-tabs { margin-bottom: 1rem; }
.darja-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.darja-opt { display: flex; gap: .55rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: .65rem .75rem; cursor: pointer; background: #fff; }
.darja-opt:has(input:checked) { border-color: var(--gold); background: #FBF5E4; box-shadow: inset 0 0 0 1px var(--gold); }
.darja-opt strong { display: block; font-size: .95rem; }
.darja-opt small { color: var(--muted); }
.promote-list .check { margin: 0; width: 100%; }
.promote-list .check small { display: block; color: var(--muted); }
.darja-opt input[type="radio"] { width: auto; flex: none; margin: .25rem 0 0; accent-color: var(--gold); }
.darja-opt span { min-width: 0; }
.jamia-darjat td:first-child strong { white-space: nowrap; }

/* Notifications */
.bell { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--night); flex: none; }
.bell svg { width: 20px; height: 20px; }
.bell:hover { border-color: var(--gold); }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #B42318; color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notes-list { list-style: none; margin: 0; padding: 0; }
.note a { display: grid; gap: .15rem; padding: .9rem 1.2rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.note a:hover { background: #FBF8F0; }
.note--unread a { background: #FFFBF0; border-left-color: var(--gold); }
.note--unread strong { color: var(--night); }
.note-kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); font-weight: 600; }
.note-body { color: var(--muted); font-size: .92rem; }
.note small { color: var(--muted); font-size: .78rem; }
.note--fee .note-kind { color: #7A5A12; } .note--salary .note-kind { color: #1F6B4A; } .note--result .note-kind { color: var(--lapis); }
.fresh-notes { border-left: 4px solid var(--gold); }
.fresh-notes .card-head h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.2rem; }
.fresh-notes .card-head svg { width: 20px; height: 20px; color: var(--gold); }
.notes-list--compact .note a { padding: .6rem .2rem; border-left: 0; background: none; }

/* Fees and salaries */
.fee-actions { margin: 0 0 1rem; align-items: center; flex-wrap: wrap; }
.fee-set { display: inline-flex; gap: .4rem; align-items: center; }
.fee-set input { width: 6rem; }
.fee-pay { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; margin: 0; }
.fee-pay input, .fee-pay select { padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .85rem; background: #fff; width: auto; }
.fee-pay input[name="amount"], .fee-pay input[name="basic"] { width: 5.5rem; }
.fee-pay input[name="allowance"], .fee-pay input[name="deduction"] { width: 4.8rem; }
.fee-table td { vertical-align: middle; }

/* ---------- Phones ---------- */
.att-radio { position: relative; }               /* keeps the hidden radio inside its own cell */
.bell-count[hidden] { display: none; }
.app-main { max-width: 100vw; }
.content { min-width: 0; }
@media (max-width: 640px) {
  .topnav { gap: .45rem; padding-left: .75rem; padding-right: .75rem; }
  .topnav-title { font-size: 1.15rem; }
  .side-toggle, .bell { width: 38px; height: 38px; }
  .me .avatar { width: 38px; height: 38px; font-size: .9rem; }
  .lang-switch { padding: .1rem; gap: 0; }
  .lang-switch a { padding: .2rem .45rem; font-size: .78rem; }
  .content { padding-left: .85rem; padding-right: .85rem; }
  .welcome { padding: 1.2rem; }
  .welcome h2 { font-size: 1.5rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .85rem; }
  .stat strong { font-size: 1.45rem; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 1rem; }
  .card-head { flex-wrap: wrap; gap: .4rem; }
  .filters { gap: .45rem; }
  .filters > * { flex: 1 1 140px; min-width: 0; }
  .filters .btn { flex: 0 0 auto; }
  .page-head { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .btn-row { flex-wrap: wrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row, .field-row--3, .field-row--4 { grid-template-columns: 1fr; }
  .fee-pay input[name="receipt_no"], .fee-pay input[name="allowance"], .fee-pay input[name="deduction"] { width: 4.6rem; }
  .jamia-tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .darja-pick { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .lang-switch a[lang="en"] { font-size: 0; padding: .2rem .5rem; }
  .lang-switch a[lang="en"]::after { content: "EN"; font-size: .75rem; }
}

/* Nothing may make the page wider than the screen sideways (either direction, English or Urdu) */
html, body { overflow-x: clip; }
/* An English page title in the Urdu interface is shortened at its end ("Jamia Arabia…"), not its start */
[dir="rtl"] .topnav-title { unicode-bidi: plaintext; text-align: right; }
