/* =========================================================================
   Eskan panel design ("the dorm office ledger", light blue edition).
   Loaded last in templates/base.html, after Bootstrap 3 and the legacy
   style.css / base.css, so it restyles every page without touching them.
   Sections: tokens, base, shell, components, legacy overrides, print.
   ========================================================================= */

/* ---------- tokens ---------- */
:root {
    --ink: #15294a; --ink-2: #3b4760; --muted: #66707f; --faint: #98a1ae;
    --paper: #eaf1fa; --surface: #fff; --sunk: #f5f8fc; --line: #d6e0ed; --line-2: #e6edf6;
    --primary: #1d4f91; --primary-soft: #e8eef7; --lip: #0f3366;
    --ok: #2f7d4f; --ok-soft: #e6f2ea; --bad: #a8432a; --bad-soft: #f8e9e4; --wait: #8a5a00; --wait-soft: #fbf1dc;
    --brass: #b0894a; --brass-2: #d9bd85;
    --r: 10px; --r-sm: 7px;
    --e1: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 1px rgba(21,41,74,.06), 0 2px 3px rgba(21,41,74,.05);
    --e2: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 1px rgba(21,41,74,.05), 0 4px 8px -2px rgba(21,41,74,.08), 0 14px 28px -10px rgba(21,41,74,.14);
    --side-w: 252px;
}

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; }
body.ui-body {
    margin: 0; direction: rtl; color: var(--ink);
    font-family: IRANSans, Tahoma, sans-serif; font-size: 14px; line-height: 1.7;
    background: radial-gradient(1200px 500px at 70% -10%, #f8fbff 0, rgba(248,251,255,0) 60%),
                radial-gradient(800px 400px at 0% 110%, #dce7f5 0, rgba(220,231,245,0) 70%), var(--paper);
    min-height: 100vh;
}
.ui-body a { color: var(--primary); }
.ui-body a:hover { color: #173f75; text-decoration: none; }
.ui-i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.ui-body *:focus-visible { outline: 2px solid #8fb0dc; outline-offset: 1px; }

/* ---------- shell ---------- */
.ui-app { display: flex; min-height: 100vh; }
.ui-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ui-page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px; }
.ui-staff .ui-page { max-width: none; padding: 16px 24px 40px; }

.ui-brand { display: flex; align-items: center; gap: 10px; color: #fff !important; font-weight: 700; font-size: 15px; white-space: nowrap; }
.ui-brand img { width: 34px; height: 34px; }
.ui-brand small { display: block; font-weight: 400; font-size: 11px; opacity: .7; line-height: 1.2; }

/* top bar */
.ui-top { background: linear-gradient(180deg, #1d3560 0, #15294a 100%); color: #fff; box-shadow: inset 0 -1px 0 rgba(255,255,255,.06), 0 1px 0 #0d1c35; position: relative; z-index: 20; }
.ui-top-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 20px; }
.ui-staff .ui-top-in { max-width: none; padding: 0 24px; }
.ui-staff .ui-top .ui-brand { display: none; }
.ui-sp { flex: 1; }
.ui-icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; color: #dfe6f2 !important; border: 0; background: transparent; padding: 0; }
.ui-icon-btn:hover { background: rgba(255,255,255,.08); }
.ui-icon-btn .ui-count { position: absolute; top: 2px; left: 0; box-shadow: 0 0 0 2px var(--ink); }
.ui-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: #fff;
    background: linear-gradient(#c6573a, #a03c24); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 2px rgba(0,0,0,.3); }
.ui-who { display: flex; align-items: center; gap: 8px; padding-inline-start: 12px; border-inline-start: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.ui-who-name { color: #fff !important; }
.ui-av { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff;
    background: linear-gradient(#3c64a3, #22427a); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 4px rgba(0,0,0,.25); flex: none; }
.ui-btn-top { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); color: #fff !important; background: rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.ui-only-narrow { display: none; }

/* student nav */
.ui-nav { background: linear-gradient(#fff, #f9fbfe); box-shadow: inset 0 1px 0 #fff, 0 8px 16px -12px rgba(21,41,74,.35); position: relative; z-index: 15; }
.ui-nav-in { max-width: 1180px; margin: 0 auto; padding: 0 12px; }
.ui-nav-list { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 0; }
.ui-nav-root { position: relative; }
.ui-nav-root > a, .ui-nav-root > button {
    display: flex; align-items: center; gap: 6px; padding: 12px 12px; color: var(--ink-2) !important; font: inherit; font-size: 13px; font-weight: 500;
    background: transparent; border: 0; white-space: nowrap; position: relative; cursor: pointer; }
.ui-nav-root .ui-chev { width: 12px; height: 12px; opacity: .6; }
.ui-nav-root.on > a, .ui-nav-root.on > button { color: var(--ink) !important; }
.ui-nav-root.on > a::after, .ui-nav-root.on > button::after { content: ""; position: absolute; inset: auto 10px 0 10px; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--brass), var(--brass-2), var(--brass)); }
.ui-nav-menu { display: none; position: absolute; top: 100%; right: 0; min-width: 240px; list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e2); z-index: 30; }
.ui-nav-root:hover > .ui-nav-menu, .ui-nav-root.open > .ui-nav-menu, .ui-nav-root:focus-within > .ui-nav-menu { display: block; }
.ui-nav-menu a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--ink) !important; font-size: 13px; }
.ui-nav-menu a:hover, .ui-nav-menu a.on { background: var(--primary-soft); }
/* legacy public menu (pages that override the top_menu block) */
.ui-nav .menu { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.ui-nav .menu-item { list-style: none; padding: 12px 12px; color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }

/* staff sidebar */
.ui-side { position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 10px 10px; color: #c9d3e4; z-index: 40;
    background: linear-gradient(180deg, #1b3259 0, #15294a 55%, #102140 100%); box-shadow: inset -1px 0 0 rgba(255,255,255,.06), -10px 0 30px -12px rgba(16,33,64,.6); }
.ui-side .ui-brand { padding: 4px 8px 14px; }
.ui-side .ui-brand small { color: #8494b0; opacity: 1; }
.ui-side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ui-side-grp { font-size: 11px; color: #8494b0; padding: 14px 10px 4px; }
.ui-side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: #c9d3e4 !important; font-size: 13px; transition: background .15s, transform .15s; }
.ui-side-link:hover { background: rgba(255,255,255,.07); color: #fff !important; }
.ui-side-link .ui-count { margin-inline-start: auto; }
.ui-side-link.on { background: linear-gradient(#fdfeff, #e6eef9); color: var(--ink) !important; font-weight: 500; transform: translateX(-4px);
    box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(0,0,0,.25), 0 8px 16px -6px rgba(0,0,0,.45); }
.ui-side-link.on .ui-i { color: var(--brass); }
.ui-side-foot { display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 12px; padding: 12px 6px 2px; font-size: 12px; }
.ui-side-who { flex: 1; min-width: 0; line-height: 1.4; }
.ui-side-who a { color: #fff !important; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-side-who small { color: #8494b0; }
.ui-scrim { display: none; }

/* breadcrumb, footer */
.ui-crumb, .ui-body .ui-crumb.navigation { position: static; font-size: 12px; color: var(--muted); margin: 0 0 12px; min-height: 18px; }
.ui-crumb:empty, .ui-crumb.is-empty { display: none; }
.ui-crumb a { color: var(--muted) !important; }
.ui-crumb a:hover { color: var(--primary) !important; }
.ui-crumb .fa { display: none; }
.ui-crumb a + a::before, .ui-crumb .fa + a::before { content: "›"; margin: 0 6px; color: var(--faint); }
.ui-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.ui-footer a { color: var(--muted) !important; }

/* student phone dock */
.ui-dock { display: none; }

/* ---------- components (used by reworked templates) ---------- */
.ui-page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.ui-page-h h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.ui-page-h .sub { font-size: 12.5px; color: var(--muted); }
.ui-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.ui-card { background: linear-gradient(#fff, #fdfeff); border: 1px solid #d9e2ee; border-radius: var(--r); box-shadow: var(--e2); margin-bottom: 16px; }
.ui-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line-2);
    background: linear-gradient(#fbfcfe, #f3f7fc); border-radius: var(--r) var(--r) 0 0; box-shadow: inset 0 -1px 0 #fff; }
.ui-card-h h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.ui-card-h .meta { font-size: 12px; color: var(--muted); }
.ui-card-b { padding: 16px 18px; }
.ui-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.ui-btn, .ui-body .button_link, .ui-body input[type=submit], .ui-body input[type=button], .ui-body button.btn, .ui-body a.btn, .ui-body .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; margin: 0; border-radius: var(--r-sm);
    font: inherit; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-shadow: none; text-decoration: none;
    color: var(--ink) !important; border: 1px solid #cfdbea; background: linear-gradient(#fff, #f1f5fb);
    box-shadow: inset 0 1px 0 #fff, 0 1px 0 #c6d3e4, 0 2px 4px -1px rgba(21,41,74,.12); transition: transform .08s, box-shadow .08s, background .15s; vertical-align: middle; }
.ui-btn:hover, .ui-body .button_link:hover, .ui-body input[type=submit]:hover, .ui-body input[type=button]:hover, .ui-body .btn:hover { background: linear-gradient(#fff, #edf2f9); border-color: #c3d1e3; }
.ui-btn:active, .ui-body .button_link:active, .ui-body input[type=submit]:active, .ui-body input[type=button]:active, .ui-body .btn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(21,41,74,.12); }
.ui-btn.primary, .ui-body input[type=submit], .ui-body .btn-primary, .ui-body .btn-success, .ui-body .btn-info {
    color: #fff !important; border-color: #1a4785; background: linear-gradient(#2a62ab, #1d4f91);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 0 var(--lip), 0 6px 12px -4px rgba(29,79,145,.5); }
.ui-btn.primary:hover, .ui-body input[type=submit]:hover, .ui-body .btn-primary:hover { background: linear-gradient(#2f6ab6, #1f5399); border-color: #1a4785; }
.ui-btn.primary:active, .ui-body input[type=submit]:active, .ui-body .btn-primary:active { transform: translateY(2px); box-shadow: inset 0 2px 3px rgba(0,0,0,.25); }
.ui-body .btn-danger, .ui-btn.danger { color: #fff !important; border-color: #8f3520; background: linear-gradient(#bb5236, #a8432a); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 2px 0 #7a2d1b; }
.ui-btn.sm, .ui-body .btn-sm, .ui-body .btn-xs { height: 30px; padding: 0 10px; font-size: 12px; }
.ui-btn[disabled], .ui-body .button_link[disabled], .ui-body input[disabled], .ui-body .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.ui-btn .ui-i { width: 16px; height: 16px; }

.ui-pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 1px 1px rgba(21,41,74,.08); }
.ui-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.ui-pill.ok { color: var(--ok); background: linear-gradient(#f0f8f2, #e1efe6); border-color: #cfe4d6; }
.ui-pill.bad { color: var(--bad); background: linear-gradient(#fbf0ec, #f4e1da); border-color: #ebcdc2; }
.ui-pill.wait { color: var(--wait); background: linear-gradient(#fdf7ea, #f7ecd2); border-color: #ecdcb4; }
.ui-pill.none { color: var(--muted); background: linear-gradient(#fff, #f1f5fb); border-color: var(--line); }

.ui-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r); margin: 0 0 16px; font-size: 13px; text-align: right;
    color: #6e2b1b; border: 1px solid #eac7ba; background: linear-gradient(#fbefea, #f7e4dd); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(168,67,42,.45); }
.ui-banner > .t { flex: 1; min-width: 200px; }
.ui-banner.ok { color: #1e5a37; border-color: #c6e0cf; background: linear-gradient(#eef7f1, #e2f0e7); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(47,125,79,.45); }
.ui-banner.wait { color: #5e3d00; border-color: #efd9a8; background: linear-gradient(#fdf6e6, #f9eed4); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(138,90,0,.4); }
.ui-banner.info { color: #173f75; border-color: #c9d8ee; background: linear-gradient(#f3f7fd, #e7eff9); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(29,79,145,.35); }
.ui-banner ul { margin: 4px 0 0; padding-inline-start: 18px; }

.ui-tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ui-tbl th { background: linear-gradient(#f6f9fd, #ecf2f9); color: var(--muted); font-weight: 500; font-size: 12px; text-align: right; padding: 9px 12px; white-space: nowrap;
    box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 var(--line); }
.ui-tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; text-align: right; }
.ui-tbl tbody tr:last-child td { border-bottom: 0; }
.ui-tbl tbody tr:hover td { background: #f8fbff; }
.ui-tbl tfoot td { background: linear-gradient(#f2f6fb, #e9f0f8); font-weight: 500; border-top: 1px solid var(--line); }
.ui-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-muted { color: var(--muted); }

.ui-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; flex: 1; }
.ui-kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; min-width: 0; }
.ui-kv dt { color: var(--muted); font-weight: 400; white-space: nowrap; }
.ui-kv dd { margin: 0; font-weight: 500; text-align: left; overflow-wrap: anywhere; }
.ui-kv .wide { grid-column: 1 / -1; }
.ui-person { display: flex; gap: 16px; align-items: flex-start; }
.ui-photo { width: 88px; height: 108px; object-fit: cover; border-radius: 8px; flex: none; background: #e3eaf4;
    box-shadow: inset 0 0 0 3px #fff, 0 1px 2px rgba(21,41,74,.15), 0 6px 12px -6px rgba(21,41,74,.25); border: 3px solid #fff;
    color: transparent; font-size: 0; overflow: hidden; }

.ui-grid-2 { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.ui-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ui-grid-2 > *, .ui-person > .ui-kv { min-width: 0; }
.ui-stack > .ui-card { margin-bottom: 0; }

/* room tag */
.ui-tag { position: relative; overflow: hidden; color: var(--ink); border: 1px solid #d3dfee; border-radius: 16px 16px 16px 46px; padding: 22px 22px 20px;
    background: linear-gradient(135deg, rgba(255,255,255,.9) 0, rgba(255,255,255,0) 40%),
                repeating-linear-gradient(90deg, rgba(29,79,145,.03) 0 2px, transparent 2px 5px),
                linear-gradient(160deg, #fdfeff 0, #e8f0fa 100%);
    box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(29,79,145,.08), 0 1px 1px rgba(21,41,74,.06), 0 12px 20px -8px rgba(21,41,74,.18), 0 34px 60px -24px rgba(21,41,74,.32);
    transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.ui-tag:hover { transform: translateY(-2px); }
.ui-tag::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 6px; background: linear-gradient(#2a4b82, #15294a); }
.ui-tag::after { content: ""; position: absolute; left: 20px; bottom: 22px; width: 22px; height: 22px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, var(--paper) 0 5px, transparent 5.5px), radial-gradient(circle at 35% 30%, #f5e3b8 0, var(--brass-2) 35%, var(--brass) 70%, #8a6a35 100%);
    box-shadow: inset 0 -1px 1px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.25); }
.ui-tag .lbl { font-size: 12px; color: var(--muted); }
.ui-tag .room { font-size: 52px; font-weight: 700; line-height: 1.05; letter-spacing: 2px; margin: 6px 0 2px; direction: ltr; text-align: right;
    text-shadow: 0 1px 0 #fff, 0 2px 0 rgba(29,79,145,.18), 0 6px 10px rgba(21,41,74,.12); }
.ui-tag .dorm { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.ui-tag .rule { border: 0; border-top: 1px dashed #c5d4e7; margin: 16px -22px 14px; }
.ui-tag dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.ui-tag dt { color: var(--muted); font-weight: 400; } .ui-tag dd { margin: 0; font-weight: 500; }
.ui-tag .mates { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0 40px; }
.ui-mate { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 12px; color: var(--ink);
    background: linear-gradient(#fff, #eef3fa); border: 1px solid #d6e1ee; box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(21,41,74,.08); }
.ui-mate i { order: -1; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 10px; font-weight: 700;
    color: #fff; background: linear-gradient(#3c64a3, #22427a); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.ui-tag.empty-room .room { font-size: 26px; letter-spacing: 0; }

.ui-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ui-actions.two { grid-template-columns: 1fr 1fr; }
.ui-act { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); color: var(--ink) !important; font-size: 13px; font-weight: 500;
    background: linear-gradient(#fff, #f7fafd); border: 1px solid #d9e2ee; box-shadow: var(--e1), 0 6px 12px -8px rgba(21,41,74,.2); transition: transform .15s, box-shadow .15s; }
.ui-act:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.ui-act .ic { width: 34px; height: 34px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--primary);
    background: radial-gradient(circle at 35% 25%, #fff 0, #e8eef7 45%, #d3def0 100%); box-shadow: inset 0 -2px 3px rgba(29,79,145,.15), inset 0 1px 0 #fff, 0 2px 4px -1px rgba(29,79,145,.3); }
.ui-sec-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 20px 0 10px; }

.ui-empty { text-align: center; padding: 44px 20px; }
.ui-empty .art { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--muted);
    background: radial-gradient(circle at 35% 25%, #fff, #e9f0f8); box-shadow: var(--e2); }
.ui-empty .art .ui-i { width: 28px; height: 28px; }
.ui-empty h3 { margin: 0 0 6px !important; font-size: 16px !important; color: var(--ink) !important; border: 0 !important; padding: 0 !important; }
.ui-empty p { margin: 0 auto 16px; max-width: 420px; color: var(--muted); font-size: 13px; }

.ui-filterbar { display: flex; gap: 10px 12px; align-items: flex-end; flex-wrap: wrap; }
.ui-field { flex: 1; min-width: 150px; }
.ui-field.wide { flex: 2; }
.ui-field label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; font-weight: 400; }
.ui-field input, .ui-field select { width: 100%; }

.ui-who-cell { display: flex; align-items: center; gap: 10px; }
.ui-who-cell img, .ui-who-cell .ph { width: 32px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; background: #e3eaf4; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(21,41,74,.2); }
.ui-who-cell b { display: block; font-weight: 500; }
.ui-who-cell span { font-size: 12px; color: var(--muted); }
tr.ui-sel td { background: #dde9f8 !important; }
.ui-bulk { position: sticky; bottom: 16px; z-index: 25; margin: 12px auto 0; max-width: 760px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #fff; border-radius: 12px; padding: 8px 10px 8px 14px;
    background: linear-gradient(#22406f, #15294a); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 0 #0d1c35, 0 18px 34px -10px rgba(16,33,64,.6); }
.ui-bulk .t { flex: 1; font-size: 13px; }
.ui-bulk .ui-btn, .ui-bulk .button_link { color: #fff !important; border-color: transparent; background: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.06)); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 0 rgba(0,0,0,.3); }
.ui-bulk[hidden] { display: none; }

/* ---------- legacy overrides: every existing page ---------- */
.ui-body .content { background: transparent; border: 0; padding: 0; margin: 0; min-height: 0; text-align: right; }
.ui-body .content h3, .ui-body .content > h2 { font-size: 16px; font-weight: 700; color: var(--ink); margin: 18px 0 10px; }
.ui-body .content h3:first-child { margin-top: 0; }
.ui-body h1, .ui-body h2, .ui-body h3, .ui-body h4, .ui-body h5 { font-family: IRANSans, Tahoma, sans-serif; }

/* containers */
.ui-body .bordered_div, .ui-body .block_bordered_div, .ui-body .medium_div, .ui-body .panel, .ui-body .well, .ui-body fieldset, .ui-body .seachContent, .ui-body .searchContent {
    background: linear-gradient(#fff, #fdfeff); border: 1px solid #d9e2ee; border-radius: var(--r); box-shadow: var(--e2); padding: 14px 16px; margin: 0 0 16px; max-width: 100%; }
.ui-body .bordered_div .bordered_div { box-shadow: none; background: var(--sunk); }
.ui-body .panel-heading { background: linear-gradient(#fbfcfe, #f3f7fc) !important; border-color: var(--line-2) !important; color: var(--ink) !important; margin: -14px -16px 12px; border-radius: var(--r) var(--r) 0 0; font-weight: 700; }
.ui-body legend { font-size: 15px; font-weight: 700; color: var(--ink); border: 0; width: auto; padding: 0 6px; margin: 0; }
.ui-body hr { border-color: var(--line); }

/* tables */
.ui-body .table_theme1, .ui-body .table_theme, .ui-body table.table {
    width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #d9e2ee; border-radius: var(--r); box-shadow: var(--e2); overflow: hidden; margin: 8px 0 16px; font-size: 13px; }
.ui-body .table_theme1 thead td, .ui-body .table_theme1 thead th, .ui-body .table_theme1 th, .ui-body .table_theme th, .ui-body .table_theme thead td, .ui-body table.table > thead > tr > th {
    background: linear-gradient(#f6f9fd, #ecf2f9) !important; color: var(--muted); font-weight: 500; font-size: 12px; padding: 9px 10px; border: 0 !important;
    box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 var(--line); white-space: nowrap; vertical-align: middle; }
.ui-body .table_theme1 thead { background: transparent !important; }
.ui-body .table_theme1 td, .ui-body .table_theme td, .ui-body table.table > tbody > tr > td {
    padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line-2) !important; border-top: 0 !important; vertical-align: middle; }
.ui-body .table_theme1 tr:last-child td, .ui-body .table_theme tr:last-child td { border-bottom: 0 !important; }
.ui-body .tr_even, .ui-body .tr_odd, .ui-body .tr_even2 { background: #fff !important; }
.ui-body .table_theme1 tbody tr:hover td, .ui-body .table_theme tbody tr:hover td, .ui-body table.table > tbody > tr:hover > td { background: #f8fbff; }
.ui-body .table_theme1 td.private_header_col, .ui-body .private_header_col { background: var(--sunk) !important; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.ui-body .hovered { background: #eef3fa !important; }
.ui-body .content > table:not([class]) { max-width: 100%; }

/* forms */
.ui-body input[type=text], .ui-body input[type=password], .ui-body input[type=email], .ui-body input[type=number], .ui-body input[type=tel], .ui-body input[type=search], .ui-body input[type=file],
.ui-body input:not([type]), .ui-body select, .ui-body textarea, .ui-body .form-control {
    font: inherit; font-size: 13px; color: var(--ink); min-height: 36px; padding: 5px 10px; border: 1px solid #cfdbea; border-radius: var(--r-sm); background-color: #fff; max-width: 100%;
    box-shadow: inset 0 1px 2px rgba(21,41,74,.08), 0 1px 0 #fff; transition: border-color .15s, box-shadow .15s; }
.ui-body textarea { min-height: 90px; line-height: 1.7; }
.ui-body input[type=file] { padding: 4px 6px; }
.ui-body select { padding-left: 30px; -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366707f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat 10px center / 14px; }
.ui-body select[multiple] { background-image: none; padding-left: 10px; }
.ui-body input:focus, .ui-body select:focus, .ui-body textarea:focus, .ui-body .form-control:focus { outline: 0; border-color: #7d9fd0; box-shadow: inset 0 1px 2px rgba(21,41,74,.08), 0 0 0 3px rgba(29,79,145,.15); }
.ui-body input[type=checkbox], .ui-body input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: middle; box-shadow: none; min-height: 0; }
.ui-body label { font-weight: 500; color: var(--ink-2); }
.ui-body .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--bad); font-size: 12px; }
.ui-body .form_error, .ui-body .error_message { color: var(--bad); font-style: normal; font-weight: 500; }
.ui-body .help-block, .ui-body .helptext { color: var(--muted); font-size: 12px; }

/* message boxes (Django messages and inline notices) */
.ui-body .hint_box, .ui-body .warning_box, .ui-body .error_message_box, .ui-body .alert {
    display: block; padding: 11px 16px; border-radius: var(--r); margin: 0 0 14px; font-size: 13px; text-align: right; }
.ui-body .hint_box, .ui-body .alert-success { color: #1e5a37; border: 1px solid #c6e0cf; background: linear-gradient(#eef7f1, #e2f0e7); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(47,125,79,.45); }
.ui-body .warning_box, .ui-body .alert-info { color: #173f75; border: 1px solid #c9d8ee; background: linear-gradient(#f3f7fd, #e7eff9); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(29,79,145,.35); }
.ui-body .alert-warning { color: #5e3d00; border: 1px solid #efd9a8; background: linear-gradient(#fdf6e6, #f9eed4); }
.ui-body .error_message_box, .ui-body .alert-danger { color: #6e2b1b; border: 1px solid #eac7ba; background: linear-gradient(#fbefea, #f7e4dd); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px -12px rgba(168,67,42,.45); }

/* legacy pagination (pagination_template.html) */
.ui-body .step-links { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.ui-body .step-links .current { color: var(--muted); font-size: 12.5px; padding: 0 6px; }
.ui-body .page_number_input { width: 52px !important; text-align: center; }
.ui-body .pagination > li > a, .ui-body .pagination > li > span { color: var(--ink-2); border-color: var(--line); }
.ui-body .pagination > .active > a { background: var(--primary); border-color: var(--primary); }

/* jQuery UI widgets */
.ui-body .ui-widget { font-family: IRANSans, Tahoma, sans-serif; font-size: 13px; }
.ui-body .ui-dialog { border: 1px solid #d9e2ee; border-radius: var(--r); box-shadow: var(--e2); padding: 0; }
.ui-body .ui-dialog .ui-widget-header { background: linear-gradient(#fbfcfe, #f3f7fc); border: 0; border-bottom: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r) var(--r) 0 0; }
.ui-body .ui-datepicker { box-shadow: var(--e2); border-radius: var(--r); }
#ajax_icon { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000; padding: 6px 16px; border-radius: 99px; font-size: 12.5px; color: #fff;
    background: linear-gradient(#22406f, #15294a); box-shadow: 0 8px 20px -6px rgba(16,33,64,.5); }

/* ---------- responsive ---------- */
@media (max-width: 991px) {
    .ui-side { position: fixed; top: 0; right: 0; bottom: 0; transform: translateX(105%); transition: transform .25s ease; }
    .ui-side-open .ui-side { transform: none; }
    .ui-side-open .ui-scrim { display: block; position: fixed; inset: 0; background: rgba(16,33,64,.45); z-index: 35; }
    .ui-only-narrow { display: inline-flex; }
    .ui-staff .ui-top .ui-brand { display: flex; }
    .ui-staff .ui-page { padding: 14px 14px 40px; }
    .ui-grid-2 { grid-template-columns: 1fr; }
    .ui-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
    .ui-top-in { height: 56px; padding: 0 12px; gap: 4px; }
    .ui-brand small, .ui-who-name { display: none; }
    .ui-who { border: 0; padding: 0; }
    .ui-student .ui-top .ui-icon-btn[title] { display: none; }
    .ui-student .ui-top .ui-who .ui-icon-btn { display: inline-flex; }
    .ui-page { padding: 14px 14px 100px; }
    .ui-student .ui-nav { display: none; }
    .ui-nav-open .ui-nav { display: block; position: fixed; inset: auto 10px 86px 10px; max-height: 70vh; overflow-y: auto; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 18px 40px -10px rgba(21,41,74,.45); z-index: 60; }
    .ui-nav-open .ui-nav-list { flex-direction: column; padding: 6px; }
    .ui-nav-open .ui-nav-menu { display: block; position: static; box-shadow: none; border: 0; padding: 0 18px 6px 0; min-width: 0; }
    .ui-nav-open .ui-nav-root > a::after, .ui-nav-open .ui-nav-root > button::after { display: none; }
    .ui-dock { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 10px; right: 10px; bottom: 10px; height: 64px; z-index: 50; border-radius: 18px;
        border: 1px solid var(--line); background: linear-gradient(#fff, #f4f7fc); box-shadow: inset 0 1px 0 #fff, 0 12px 24px -8px rgba(21,41,74,.3); }
    .ui-dock a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--muted) !important; }
    .ui-dock .ui-count { position: absolute; top: 6px; right: calc(50% - 22px); }
    .ui-kv { grid-template-columns: 1fr; }
    .ui-person { flex-direction: column; align-items: center; }
    .ui-page-h h1 { font-size: 19px; }
    .ui-tag .room { font-size: 46px; }
    .ui-footer { padding-bottom: 90px; justify-content: center; text-align: center; }
    .ui-staff .ui-footer { padding-bottom: 18px; }
    .ui-body .table_theme1, .ui-body .table_theme, .ui-body table.table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ui-body .bordered_div { display: block; }
    .ui-bulk { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { .ui-tag, .ui-act, .ui-side, .ui-side-link { transition: none; } .ui-tag:hover, .ui-act:hover { transform: none; } }

/* ---------- print: the shell never prints ---------- */
@media print {
    .ui-side, .ui-top, .ui-nav, .ui-dock, .ui-footer, .ui-crumb, .ui-bulk, .ui-tools { display: none !important; }
    body.ui-body { background: #fff; }
    .ui-card, .ui-tag, .ui-body .table_theme1 { box-shadow: none; }
}

/* dashboard.js and other legacy scripts force select widths inline; fields fill their slot instead. */
.ui-body .ui-field select, .ui-body .ui-field input, .ui-body .ui-page-h .ui-field select { width: 100% !important; }
/* pagination_template.html wraps itself in a bordered_div: center it as a slim bar. */
.ui-body .bordered_div:has(> .step-links) { display: flex; justify-content: center; width: fit-content; margin: 0 auto 16px; padding: 8px 12px; }
.ui-body .step-links .button_link { height: 32px; padding: 0 12px; }
/* jQuery UI dialog sources stay hidden until my_filters.js opens them. */
#payment_dialog_box:not(.ui-dialog-content), #message_dialog_box:not(.ui-dialog-content) { display: none; }
.ui-body .ui-dialog .ui-dialog-buttonpane { border-top: 1px solid var(--line-2); background: var(--sunk); border-radius: 0 0 var(--r) var(--r); }
.ui-body .ui-dialog .ui-dialog-buttonpane button { font: inherit; font-size: 13px; font-weight: 500; height: 34px; padding: 0 16px; border-radius: var(--r-sm); color: #fff;
    border: 1px solid #1a4785; background: linear-gradient(#2a62ab, #1d4f91); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 0 var(--lip); }
.ui-body .ui-dialog .ui-dialog-titlebar-close { border: 0; background: transparent; width: 28px; height: 28px; }
.ui-body .ui-widget-overlay { background: rgba(16,33,64,.45); opacity: 1; }

/* flexigrid tables (data_manager lists such as invoices, stuff, guests) */
.ui-body .flexigrid { font-family: IRANSans, Tahoma, sans-serif; border-radius: var(--r); overflow: hidden; box-shadow: var(--e2); border: 1px solid #d9e2ee; background: #fff; }
.ui-body .flexigrid div.mDiv { background: linear-gradient(#fbfcfe, #f3f7fc) !important; border: 0; border-bottom: 1px solid var(--line-2); color: var(--ink); font-size: 14px; }
.ui-body .flexigrid div.mDiv div { padding: 10px 14px; }
.ui-body .flexigrid div.tDiv, .ui-body .flexigrid div.tDiv2 { background: #fff !important; border: 0; border-bottom: 1px solid var(--line-2); }
.ui-body .flexigrid div.hDiv { background: linear-gradient(#f6f9fd, #ecf2f9) !important; border: 0; border-bottom: 1px solid var(--line); }
.ui-body .flexigrid div.hDiv th div, .ui-body .flexigrid div.hDiv th a { color: var(--muted) !important; font-weight: 500; }
.ui-body .flexigrid div.hDiv th, .ui-body .flexigrid div.bDiv td { border-color: var(--line-2) !important; }
.ui-body .flexigrid div.bDiv { border: 0; background: #fff; }
.ui-body .flexigrid tr.erow td { background: #fafcfe; }
.ui-body .flexigrid tr.trSelected td { background: #dde9f8 !important; border-color: #c9d8ee !important; }
.ui-body .flexigrid div.pDiv { background: var(--sunk) !important; border: 0; border-top: 1px solid var(--line-2); }
.ui-body .flexigrid div.fbutton span, .ui-body .flexigrid div.tDiv2 div.fbutton { color: var(--ink) !important; }
.ui-body .flexigrid div.fbutton { border-radius: 6px; }
.ui-body .flexigrid div.fbutton:hover { background: var(--primary-soft) !important; border-color: #c9d8ee !important; }

/* jqGrid tables (data_manager lists: invoices, stuff, guests, ...) on the cupertino jQuery UI theme */
.ui-body .ui-jqgrid { font-family: IRANSans, Tahoma, sans-serif; border: 1px solid #d9e2ee !important; border-radius: var(--r) !important; overflow: hidden; box-shadow: var(--e2); background: #fff; }
.ui-body .ui-jqgrid .ui-jqgrid-titlebar { background: linear-gradient(#fbfcfe, #f3f7fc) !important; border: 0 !important; border-bottom: 1px solid var(--line-2) !important; color: var(--ink) !important; padding: 10px 14px; font-size: 14px; border-radius: 0 !important; }
.ui-body .ui-jqgrid .ui-jqgrid-htable th, .ui-body .ui-jqgrid .ui-state-default.ui-th-column { background: linear-gradient(#f6f9fd, #ecf2f9) !important; color: var(--muted) !important; font-weight: 500; border-color: var(--line-2) !important; }
.ui-body .ui-jqgrid .ui-jqgrid-hdiv { background: #f6f9fd; border-color: var(--line) !important; }
.ui-body .ui-jqgrid tr.jqgrow td { border-color: var(--line-2) !important; padding: 5px 6px; color: var(--ink); }
.ui-body .ui-jqgrid tr.jqgrow:hover td, .ui-body .ui-jqgrid .ui-state-hover { background: #f3f7fc !important; }
.ui-body .ui-jqgrid .ui-state-highlight, .ui-body .ui-jqgrid tr.ui-state-highlight td { background: #dde9f8 !important; border-color: #c9d8ee !important; color: var(--ink) !important; }
.ui-body .ui-jqgrid .ui-jqgrid-pager, .ui-body .ui-jqgrid .ui-userdata, .ui-body .ui-jqgrid .ui-jqgrid-toppager { background: var(--sunk) !important; border-color: var(--line-2) !important; }
.ui-body .ui-jqgrid .ui-pg-button:hover, .ui-body .ui-jqgrid .ui-pg-div:hover { background: var(--primary-soft) !important; border-color: #c9d8ee !important; }
.ui-body .ui-jqgrid .ui-jqgrid-titlebar-close { display: none; }
.ui-body .ui-state-default, .ui-body .ui-widget-content .ui-state-default { border-color: #cfdbea; }
.ui-body .ui-widget-header { background: linear-gradient(#fbfcfe, #f3f7fc); border-color: var(--line); color: var(--ink); }

/* =====================================================================
   Parity with the approved preview (design-preview/index.html)
   ===================================================================== */

/* staff: no top bar on desktop, the sidebar carries brand, counts and the user */
@media (min-width: 992px) { .ui-staff .ui-top { display: none; } }
.ui-staff .ui-page { padding-top: 18px; }

/* default page header taken from the DB menu */
.ui-page-h-auto h1 { font-size: 20px; }
.ui-body .content > h3:first-child:not(.ui-keep) { font-size: 15px; color: var(--ink-2); }

/* phone-only / desktop-only content */
.ui-only-phone { display: none; }
@media (max-width: 767px) { .ui-only-phone { display: block; } .ui-hide-phone { display: none !important; } }

/* rows lift on hover */
.ui-tbl tbody tr { transition: transform .15s, box-shadow .15s; }
.ui-tbl tbody tr:hover { box-shadow: 0 6px 14px -8px rgba(21,41,74,.25); transform: translateY(-1px); position: relative; z-index: 1; }
.ui-tbl tbody tr:hover td { background: #f8fbff; }
.ui-tbl .ui-who-cell b a, .ui-tbl a.ui-who-cell b { color: var(--primary); }

/* pager: a bar inside the list card, or a slim card of its own on legacy pages */
.ui-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 12.5px; color: var(--muted);
    background: linear-gradient(#fff, #fdfeff); border: 1px solid #d9e2ee; border-radius: var(--r); box-shadow: var(--e2); margin: 0 0 16px; }
.ui-card .ui-pager { border: 0; border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r) var(--r); box-shadow: none; margin: 0; background: transparent; }
.ui-pager-pg { display: flex; align-items: center; gap: 4px; }
.ui-pager-pg a, .ui-pager-pg span { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-2) !important; border: 1px solid transparent; font-size: 13px; }
.ui-pager-pg a:hover { background: var(--primary-soft); }
.ui-pager-pg a.on { border-color: var(--line); background: linear-gradient(#fff, #eef3f9); box-shadow: var(--e1); color: var(--ink) !important; font-weight: 700; }
.ui-pager-pg .dis { color: var(--faint) !important; }
.ui-pager-pg .gap { min-width: 16px; }
.ui-body .ui-pager .page_number_input { width: 48px !important; min-height: 30px; height: 30px; padding: 0 4px; text-align: center; }

/* loading state while #search_form is submitting */
@keyframes ui-sk { to { background-position: -200% 0; } }
.ui-loading .ui-tbl tbody td, .ui-loading .table_theme1 tbody td, .ui-loading .table_theme1 tr:not(:first-child) td { color: transparent !important; position: relative; }
.ui-loading .ui-tbl tbody td > *, .ui-loading .table_theme1 td > * { visibility: hidden; }
.ui-loading .ui-tbl tbody td::after, .ui-loading .table_theme1 tr:not(:first-child) td::after {
    content: ""; position: absolute; inset: 50% 12px auto 12px; height: 10px; margin-top: -5px; border-radius: 5px;
    background: linear-gradient(90deg, #e6edf6, #f2f6fb, #e6edf6); background-size: 200% 100%; animation: ui-sk 1.2s infinite; }
.ui-loading .ui-tbl tbody td:first-child::after { inset: 50% 30% auto 30%; }
.ui-loading .ui-tbl-title::after { content: " · در حال جستجو…"; color: var(--muted); font-weight: 400; }

/* filter bar: primary fields, a "more filters" panel and removable chips */
.ui-more { display: none; width: 100%; }
.ui-filters-open .ui-more { display: flex; gap: 10px 12px; flex-wrap: wrap; }
.ui-more-btn .ui-chev { width: 14px; height: 14px; transition: transform .15s; }
.ui-filters-open .ui-more-btn .ui-chev { transform: rotate(180deg); }
.ui-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.ui-chips:empty, .ui-chips.is-empty { display: none; }
.ui-chips .lbl { font-size: 12px; color: var(--muted); }
.ui-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: 99px; font-size: 12px; font-weight: 500; color: var(--ink);
    background: linear-gradient(#fff, #edf2f9); border: 1px solid #d4dfed; box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(21,41,74,.08); }
.ui-chip::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--brass); }
.ui-chip button { border: 0; background: transparent; color: inherit; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.ui-chip button:hover { background: rgba(29,79,145,.12); }
.ui-chip button .ui-i { width: 12px; height: 12px; }
.ui-chips .clear { font-size: 12px; margin-inline-start: 6px; }

/* "new request" menu button */
.ui-menu-btn { position: relative; }
.ui-menu-btn .ui-pop { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; z-index: 30; list-style: none; margin: 0; padding: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e2); text-align: right; }
.ui-menu-btn.open .ui-pop { display: block; }
.ui-menu-btn .ui-pop a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 7px; color: var(--ink) !important; font-size: 13px; }
.ui-menu-btn .ui-pop a:hover { background: var(--primary-soft); }
.ui-empty .ui-menu-btn .ui-pop { left: 50%; transform: translateX(-50%); }

/* phone dock: current item and the request-only sheet */
.ui-dock a.on { color: var(--ink) !important; font-weight: 700; }
.ui-dock a.on .ui-i { color: var(--brass); }
@media (max-width: 767px) {
    .ui-nav-req .ui-nav-root:not(.is-req) { display: none; }
    .ui-nav-req .ui-nav-root.is-req > button { pointer-events: none; }
}

/* history as a list on phones */
.ui-list .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; margin: 0; }
.ui-list .row:last-child { border-bottom: 0; }

/* legacy dashed separators between search and results */
.ui-body hr.after_search_break { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* no card inside a card: fieldsets and nested boxes inside a container lose their own frame */
.ui-body .bordered_div fieldset, .ui-body .panel fieldset, .ui-body .seachContent fieldset, .ui-body .searchContent fieldset,
.ui-body .ui-card fieldset, .ui-body .bordered_div .block_bordered_div {
    border: 0; box-shadow: none; background: transparent; padding: 0; margin: 0; }
.ui-body .bordered_div fieldset > legend, .ui-body .ui-card fieldset > legend { padding: 0; margin: 0 0 10px; font-size: 15px; }

/* jqGrid toolbars have a fixed height: keep their inputs compact */
.ui-body .ui-jqgrid input, .ui-body .ui-jqgrid select, .ui-body .ui-jqgrid .ui-pg-input, .ui-body .ui-jqgrid .ui-pg-selbox {
    min-height: 0; height: 24px; padding: 0 6px; font-size: 12px; box-shadow: none; background-image: none; }
.ui-body .ui-jqgrid select { padding-left: 6px; }
.ui-body .ui-jqgrid input[type=checkbox] { height: 14px; width: 14px; }
.ui-body .ui-jqgrid .ui-pg-table td { font-size: 12px; color: var(--muted); }

/* "Search" is the primary action of every legacy search form, as in the preview */
.ui-body #btn_search, .ui-body .btn_search, .ui-body a.search_button {
    color: #fff !important; border-color: #1a4785; background: linear-gradient(#2a62ab, #1d4f91);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 0 var(--lip), 0 6px 12px -4px rgba(29,79,145,.5); }
.ui-body #btn_search:hover { background: linear-gradient(#2f6ab6, #1f5399); }

/* Staff sidebar is pinned with position: fixed. Sticky does not work here because the legacy style.css sets
   overflow-x: hidden on html and body, which makes the sidebar scroll away and end mid-page. */
@media (min-width: 992px) {
    .ui-staff .ui-side { position: fixed; top: 0; right: 0; bottom: 0; height: auto; }
    .ui-staff .ui-main { margin-right: var(--side-w); }
}
.ui-side { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; overscroll-behavior: contain; }
.ui-side::-webkit-scrollbar { width: 8px; }
.ui-side::-webkit-scrollbar-track { background: transparent; }
.ui-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.ui-side::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.3); }

/* =====================================================================
   Data-manager lists (templates/lib/arsh/data_manager/*): jqGrid inside the panel card
   ===================================================================== */
.ui-dm-filters .ui-field-check { flex: 0 0 auto; min-width: 0; display: flex; align-items: center; gap: 8px; align-self: flex-end; height: 36px; }
.ui-dm-filters .ui-field-check label { margin: 0; order: 2; }
.ui-dm .ui-card-h { flex-wrap: wrap; }
.ui-dm-title { display: flex; align-items: baseline; gap: 10px; }
.ui-dm-tools .ui-btn.danger-text { color: var(--bad) !important; }
.ui-dm-bulk .ui-btn.danger-text { color: #ffd9cf !important; }
.ui-dm-bulk .acts { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* jqGrid chrome replaced by the card: no caption, toolbar, pager, frame or loading box */
.ui-body .ui-dm .ui-jqgrid { border: 0 !important; border-radius: 0 !important; box-shadow: none; background: transparent; }
.ui-body .ui-dm .ui-jqgrid-titlebar, .ui-body .ui-dm .ui-userdata, .ui-body .ui-dm .pjqDM, .ui-body .ui-dm .ui-jqgrid-pager,
.ui-body .ui-dm .ui-jqgrid .loading, .ui-body .ui-dm .ui-jqgrid .ui-jqgrid-toppager { display: none !important; }
.ui-dm-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* header row */
.ui-body .ui-dm .ui-jqgrid-hdiv { background: linear-gradient(#f6f9fd, #ecf2f9) !important; border: 0 !important; box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 var(--line); }
.ui-body .ui-dm .ui-jqgrid .ui-jqgrid-htable th { background: transparent !important; border: 0 !important; height: 38px; padding: 0 10px; }
.ui-body .ui-dm .ui-jqgrid .ui-jqgrid-htable th div { color: var(--muted); font-weight: 500; font-size: 12px; height: auto; line-height: 38px; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.ui-body .ui-dm .ui-jqgrid .ui-th-column .s-ico { display: inline-block; margin-inline-start: 4px; }
.ui-body .ui-dm .ui-jqgrid .ui-jqgrid-sortable { cursor: pointer; }
.ui-body .ui-dm .ui-jqgrid .ui-state-hover { background: transparent !important; color: var(--ink) !important; }

/* body rows: same look as .ui-tbl */
.ui-body .ui-dm .ui-jqgrid-bdiv { background: #fff; }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow td { height: 46px; padding: 6px 10px; border: 0 !important; border-bottom: 1px solid var(--line-2) !important; font-size: 13px; color: var(--ink); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow { background: #fff; transition: transform .15s, box-shadow .15s; }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow.ui-state-hover td { background: #f8fbff !important; }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow:hover { box-shadow: 0 6px 14px -8px rgba(21,41,74,.25); transform: translateY(-1px); position: relative; z-index: 1; }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow.ui-state-highlight td { background: #dde9f8 !important; color: var(--ink) !important; border-color: var(--line-2) !important; }
.ui-body .ui-dm .ui-jqgrid tr.jqgfirstrow td { border: 0 !important; height: 0 !important; padding: 0 !important; }
.ui-body .ui-dm .ui-jqgrid .jqgrid-rownum { color: var(--muted); background: transparent !important; }
.ui-body .ui-dm .ui-jqgrid td .ui-pill { vertical-align: middle; }
.ui-body .ui-dm .ui-jqgrid .cbox { width: 16px; height: 16px; accent-color: var(--primary); }
.ui-body .ui-dm .ui-jqgrid tr.jqgrow td a { color: var(--primary); }

/* empty and loading states */
.ui-dm .ui-dm-empty { display: none; border-top: 1px solid var(--line-2); }
.ui-dm.is-empty .ui-dm-empty { display: block; }
.ui-dm.is-empty .ui-jqgrid-bdiv { display: none; }
.ui-dm.is-loading .ui-jqgrid tr.jqgrow td { color: transparent !important; position: relative; }
.ui-dm.is-loading .ui-jqgrid tr.jqgrow td > * { visibility: hidden; }
.ui-dm.is-loading .ui-jqgrid tr.jqgrow td::after { content: ""; position: absolute; inset: 50% 10px auto 10px; height: 10px; margin-top: -5px; border-radius: 5px;
    background: linear-gradient(90deg, #e6edf6, #f2f6fb, #e6edf6); background-size: 200% 100%; animation: ui-sk 1.2s infinite; }
.ui-dm.is-loading .ui-dm-count::after { content: " · در حال بارگذاری…"; }

/* pager extras */
.ui-body .ui-dm-pager .ui-dm-page { width: 48px !important; min-height: 30px; height: 30px; padding: 0 4px; text-align: center; }
.ui-body .ui-dm-pager .ui-dm-size { width: auto !important; min-height: 30px; height: 30px; padding: 0 28px 0 8px; margin-inline-start: 8px; font-size: 12px; }
.ui-dm.is-empty .ui-dm-pager { display: none; }

/* column chooser dialog */
.ui-body .ui-multiselect { border-radius: var(--r); border-color: var(--line) !important; }
.ui-body .ui-multiselect .ui-widget-header { background: var(--sunk); }

/* action popups (data_manager_actions.html, inside the fancybox iframe) */
body.ui-popup { background: #fff !important; padding: 16px 18px; }
body.ui-popup .ui-banner, body.ui-popup .hint_box, body.ui-popup .error_message_box { margin-bottom: 12px; }
body.ui-popup table { width: 100%; }
body.ui-popup td { padding: 6px 8px; vertical-align: middle; }
body.ui-popup .fancybox-title, body.ui-popup legend { font-size: 15px; font-weight: 700; color: var(--ink); }
/* moved legacy icon buttons (print / excel / xml) carry fixed sizes and sprites from data_manager.css */
.ui-body .ui-dm-tools .ui-btn, .ui-body .ui-dm-bulk .ui-btn { width: auto !important; min-width: 0; text-indent: 0 !important; float: none !important;
    background-position: 0 0 !important; background-repeat: no-repeat !important; margin: 0 !important; }
.ui-body .ui-dm-tools .ui-btn:not(.primary) { background-image: linear-gradient(#fff, #f1f5fb) !important; height: 36px !important; }
.ui-body .ui-dm-tools .ui-btn.primary { background-image: linear-gradient(#2a62ab, #1d4f91) !important; height: 36px !important; }
.ui-body .ui-dm-bulk .ui-btn { background-image: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.06)) !important; height: 30px !important; color: #fff !important; }
/* checkbox and row-number columns stay narrow and centred */
.ui-body .ui-dm .ui-jqgrid th[id$="_cb"], .ui-body .ui-dm .ui-jqgrid th[id$="_rn"],
.ui-body .ui-dm .ui-jqgrid td[aria-describedby$="_cb"], .ui-body .ui-dm .ui-jqgrid td[aria-describedby$="_rn"] {
    padding: 0 2px !important; text-align: center !important; text-overflow: clip !important; }
.ui-body .ui-dm .ui-jqgrid th[id$="_cb"] div, .ui-body .ui-dm .ui-jqgrid th[id$="_rn"] div { text-align: center !important; }
/* fancybox popups (data-manager actions, legacy dialogs) */
.ui-body .fancybox-overlay { background: rgba(16,33,64,.5) !important; }
.ui-body .fancybox-skin { background: #fff !important; border-radius: 14px !important; padding: 0 !important; box-shadow: 0 30px 60px -20px rgba(16,33,64,.55) !important; }
.ui-body .fancybox-outer, .ui-body .fancybox-inner, .ui-body .fancybox-iframe { border-radius: 14px; }
.ui-body .fancybox-title, .ui-body .fancybox-title-float-wrap .child { background: transparent !important; color: #fff !important; font-family: IRANSans, Tahoma, sans-serif;
    font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,.4); border: 0 !important; box-shadow: none !important; }
.ui-body .fancybox-close { filter: grayscale(1) brightness(.4); }

/* select2 / autocomplete-light widgets: the native select must stay hidden; the visible box matches .ui-field inputs */
.ui-body select.select2-hidden-accessible { width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
.ui-body .ui-field .select2-container { width: 100% !important; min-width: 0 !important; }
.ui-body .select2-container--default .select2-selection--single, .ui-body .select2-container--default .select2-selection--multiple {
    min-height: 36px; border: 1px solid #cfdbea; border-radius: var(--r-sm); background: #fff; box-shadow: inset 0 1px 2px rgba(21,41,74,.08), 0 1px 0 #fff; }
.ui-body .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 34px; color: var(--ink); font-size: 13px; padding-right: 10px; }
.ui-body .select2-container--default .select2-selection--single .select2-selection__arrow { height: 34px; }
.ui-body .select2-container--default.select2-container--focus .select2-selection--single,
.ui-body .select2-container--default.select2-container--open .select2-selection--single { border-color: #7d9fd0; box-shadow: 0 0 0 3px rgba(29,79,145,.15); }
.ui-body .select2-dropdown { border-color: var(--line); border-radius: var(--r-sm); box-shadow: var(--e2); font-family: IRANSans, Tahoma, sans-serif; font-size: 13px; }
.ui-body .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary); }

/* Data-manager columns fit their content: one table (header moved into the body table by
   data_manager_script.html), automatic layout, and jqGrid's inline pixel widths neutralised. */
.ui-body .ui-dm .ui-jqgrid, .ui-body .ui-dm .ui-jqgrid-view, .ui-body .ui-dm .ui-jqgrid-bdiv, .ui-body .ui-dm .ui-jqgrid-bdiv > div { width: 100% !important; }
.ui-body .ui-dm .ui-jqgrid-hdiv { display: none !important; }
.ui-body .ui-dm .ui-jqgrid-bdiv { overflow-x: auto !important; overflow-y: visible !important; height: auto !important; }
.ui-body .ui-dm table.ui-jqgrid-btable { width: 100% !important; min-width: 100%; table-layout: auto !important; border-collapse: separate; border-spacing: 0; }
.ui-body .ui-dm table.ui-jqgrid-btable th, .ui-body .ui-dm table.ui-jqgrid-btable td, .ui-body .ui-dm table.ui-jqgrid-btable th > div { width: auto !important; }
.ui-body .ui-dm table.ui-jqgrid-btable tr.jqgfirstrow { display: none; }
.ui-body .ui-dm table.ui-jqgrid-btable tr.jqgrow td { overflow: visible; text-overflow: clip; white-space: nowrap; }
.ui-body .ui-dm table.ui-jqgrid-btable thead th {
    background: linear-gradient(#f6f9fd, #ecf2f9) !important; border: 0 !important; height: 38px; padding: 0 12px; white-space: nowrap;
    box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 var(--line); font-weight: 500; text-align: right; }
.ui-body .ui-dm table.ui-jqgrid-btable thead th div { color: var(--muted); font-size: 12px; line-height: 38px; height: auto; text-align: right; white-space: nowrap; overflow: visible; }
.ui-body .ui-dm table.ui-jqgrid-btable thead th .ui-jqgrid-resize { display: none !important; }
.ui-body .ui-dm table.ui-jqgrid-btable tr.jqgrow td { padding: 6px 12px; }
.ui-body .ui-dm table.ui-jqgrid-btable th[id$="_cb"], .ui-body .ui-dm table.ui-jqgrid-btable th[id$="_rn"],
.ui-body .ui-dm table.ui-jqgrid-btable td[aria-describedby$="_cb"], .ui-body .ui-dm table.ui-jqgrid-btable td[aria-describedby$="_rn"] { width: 1% !important; padding: 0 8px !important; }
.ui-body .ui-dm.is-empty table.ui-jqgrid-btable tbody { display: none; }
.ui-body .ui-dm.is-empty .ui-jqgrid-bdiv { display: block !important; }
.ui-body .ui-dm table.ui-jqgrid-btable tr.jqgrow td.ui-wrap { white-space: normal !important; min-width: 220px; line-height: 1.6; }

/* Collapsible sidebar groups (accordion). The panel animates its height through grid rows 0fr -> 1fr. */
.ui-side-group { margin-top: 2px; }
.ui-side-grp { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
    color: #c9d3e4; font: inherit; font-size: 13px; text-align: right; transition: background .15s, color .15s; }
.ui-side-grp:hover { background: rgba(255,255,255,.07); color: #fff; }
.ui-side-grp:focus-visible { outline: 2px solid #8fb0dc; outline-offset: 1px; }
.ui-side-grp .nm { flex: 1; min-width: 0; }
.ui-side-grp .ui-chev { width: 14px; height: 14px; opacity: .6; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.ui-side-group.open > .ui-side-grp { color: #fff; background: rgba(255,255,255,.05); }
.ui-side-group.open > .ui-side-grp .ui-chev { transform: rotate(180deg); opacity: .9; }
/* the group that holds the current page keeps a brass marker while closed */
.ui-side-group.has-active > .ui-side-grp { color: #fff; }
.ui-side-group.has-active > .ui-side-grp::before { content: ""; width: 3px; height: 18px; border-radius: 3px; margin-inline-start: -10px; margin-inline-end: 4px;
    background: linear-gradient(var(--brass-2), var(--brass)); }
.ui-side-group.has-active > .ui-side-grp > .ui-i:first-of-type { color: var(--brass-2); }
.ui-side-panel { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .28s cubic-bezier(.2,.8,.2,1), opacity .2s ease; }
.ui-side-group.open > .ui-side-panel { grid-template-rows: 1fr; opacity: 1; }
.ui-side-panel-in { min-height: 0; overflow: hidden; padding-inline-start: 14px; margin-inline-start: 18px; border-inline-start: 1px solid rgba(255,255,255,.1); }
.ui-side-panel .ui-side-link { font-size: 12.5px; padding: 6px 10px; margin: 2px 0; }
.ui-side-panel .ui-side-link:first-child { margin-top: 4px; }
.ui-side-panel .ui-side-link:last-child { margin-bottom: 6px; }
.ui-side-panel .ui-side-link.on { transform: none; }
@media (prefers-reduced-motion: reduce) { .ui-side-panel, .ui-side-grp .ui-chev { transition: none; } }

/* Sidebar colour: #325d90 (the original eskan header blue). Text tints are lifted for contrast on it. */
:root { --side-bg: #325d90; }
.ui-side { background: var(--side-bg) !important; box-shadow: inset -1px 0 0 rgba(255,255,255,.08), -10px 0 30px -12px rgba(16,33,64,.45) !important; }
.ui-side .ui-brand small, .ui-side-who small { color: rgba(255,255,255,.7) !important; }
.ui-side-link, .ui-side-grp { color: #eef3fa !important; }
.ui-side-link:hover, .ui-side-grp:hover { background: rgba(255,255,255,.12) !important; color: #fff !important; }
.ui-side-group.open > .ui-side-grp { background: rgba(255,255,255,.1) !important; }
.ui-side-panel-in { border-inline-start-color: rgba(255,255,255,.22) !important; }
.ui-side-link.on { color: var(--ink) !important; }
.ui-side-foot { border-top-color: rgba(255,255,255,.18) !important; }
.ui-side .ui-count { box-shadow: 0 0 0 2px var(--side-bg), inset 0 1px 0 rgba(255,255,255,.3); }
.ui-side { scrollbar-color: rgba(255,255,255,.3) transparent; }
.ui-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); }

/* sidebar: restored group opens without animation; the active item keeps its look on hover */
.ui-side-noanim .ui-side-panel, .ui-side-noanim .ui-side-grp .ui-chev { transition: none !important; }
.ui-side .ui-side-link.on, .ui-side .ui-side-link.on:hover, .ui-side .ui-side-link.on:focus {
    background: linear-gradient(#fdfeff, #e6eef9) !important; color: var(--ink) !important; }
.ui-side .ui-side-link.on:hover { box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(0,0,0,.25), 0 10px 18px -6px rgba(0,0,0,.45); }

/* =====================================================================
   Filter bar, decluttered: an even grid of fields, one quiet action row at the bottom,
   and the extra filters in a tinted panel with optional sections.
   ===================================================================== */
.ui-body .ui-filterbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; align-items: end; padding: 18px 20px; }
.ui-body .ui-filterbar > .ui-field { min-width: 0; }
.ui-body .ui-filterbar .ui-field label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.ui-body .ui-filterbar > .ui-more { order: 1; grid-column: 1 / -1; }
.ui-body .ui-filterbar > .ui-tools { order: 2; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.ui-body .ui-filterbar > .ui-tools .primary,
.ui-body .ui-filterbar > .ui-tools [id="btn_search"],
.ui-body .ui-filterbar > .ui-tools [class*="btn_search_"],
.ui-body .ui-filterbar > .ui-tools #search_button { min-width: 120px; }
/* clear: a quiet text button */
.ui-body .ui-filterbar > .ui-tools #btn_clear, .ui-body .ui-filterbar > .ui-tools .btn_clear {
    background: transparent !important; border-color: transparent !important; box-shadow: none !important; color: var(--muted) !important; }
.ui-body .ui-filterbar > .ui-tools #btn_clear:hover, .ui-body .ui-filterbar > .ui-tools .btn_clear:hover { color: var(--primary) !important; background: var(--primary-soft) !important; }
/* "more filters" with a count of hidden filters in use */
.ui-more-btn .ui-more-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
    line-height: 18px; text-align: center; }
/* the extra filters: tinted panel, its own grid, optional sections */
.ui-body .ui-filters-open .ui-filterbar > .ui-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; align-items: end;
    margin: 4px -20px 0; padding: 16px 20px 18px; background: var(--sunk); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.ui-body .ui-more .ui-more-sec { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; align-items: end; }
.ui-body .ui-more .ui-more-sec + .ui-more-sec { padding-top: 14px; border-top: 1px dashed var(--line); }
.ui-body .ui-more .ui-more-sec > h4 { grid-column: 1 / -1; margin: 0 0 -4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ui-body .ui-filters-open .ui-filterbar > .ui-more { animation: ui-more-in .2s ease; }
@keyframes ui-more-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (max-width: 767px) {
    .ui-body .ui-filterbar { grid-template-columns: 1fr 1fr; padding: 14px; gap: 12px; }
    .ui-body .ui-filters-open .ui-filterbar > .ui-more { margin: 4px -14px 0; padding: 14px; grid-template-columns: 1fr 1fr; }
    .ui-body .ui-filterbar > .ui-tools { flex-wrap: wrap; }
    .ui-body .ui-filterbar > .ui-tools #search_button, .ui-body .ui-filterbar > .ui-tools [id="btn_search"],
    .ui-body .ui-filterbar > .ui-tools [class*="btn_search_"] { flex: 1 0 100%; order: 3; }
}
@media (prefers-reduced-motion: reduce) { .ui-body .ui-filters-open .ui-filterbar > .ui-more { animation: none; } }
/* filter bar: always right-aligned (some legacy pages wrap content in align="center"); the extra-filters panel is an inset box */
.ui-body .ui-filterbar, .ui-body .ui-filterbar .ui-more-sec > h4, .ui-body .ui-chips { text-align: right; }
.ui-body .ui-filters-open .ui-filterbar > .ui-more { margin: 2px 0 0 !important; padding: 16px 18px 18px !important; border: 1px solid var(--line-2) !important;
    border-radius: var(--r); box-shadow: inset 0 1px 2px rgba(21,41,74,.05); }
@media (max-width: 767px) { .ui-body .ui-filters-open .ui-filterbar > .ui-more { padding: 12px !important; } }
.ui-body .ui-btn, .ui-body .ui-btn:hover, .ui-body .ui-btn:focus, .ui-body .ui-btn:active { text-decoration: none !important; }
.ui-body .ui-field .ui-help { display: block; margin-top: 5px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
/* fields align at the top so help text under one field does not shift its neighbours */
.ui-body .ui-filterbar, .ui-body .ui-filters-open .ui-filterbar > .ui-more, .ui-body .ui-more .ui-more-sec { align-items: start; }
/* checkbox filters on every filter bar: box and label on one line, aligned with the inputs */
.ui-body .ui-filterbar .ui-field:has(> input[type=checkbox]), .ui-body .ui-filterbar .ui-field-check {
    display: flex; align-items: center; gap: 8px; min-height: 36px; margin-top: 22px; }
.ui-body .ui-filterbar .ui-field:has(> input[type=checkbox]) > label, .ui-body .ui-filterbar .ui-field-check > label { order: 2; margin: 0; color: var(--ink-2); }
.ui-body .ui-field input[type=checkbox], .ui-body .ui-field input[type=radio] { width: 16px !important; min-width: 16px; flex: none; margin: 0; }
.ui-body .ui-filterbar .ui-field:has(> input[type=checkbox]) { justify-content: flex-start; }
/* a bulk action that does not apply to the current selection stays clickable (its handler explains why) but dims */
.ui-bulk .ui-btn.is-off { opacity: .55; }

/* Selection bars are fixed to the bottom of the screen. Sticky positioning does not work here because the legacy
   style.css sets overflow-x: hidden on html and body. Centred over the content area (the staff sidebar is on the
   right), above the phone dock on small screens. */
.ui-bulk { position: fixed !important; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); max-width: none;
    margin: 0 !important; z-index: 60; }
@media (min-width: 992px) { .ui-staff .ui-bulk { left: calc((100% - var(--side-w)) / 2); width: min(760px, calc(100% - var(--side-w) - 48px)); } }
@media (max-width: 767px) { .ui-student .ui-bulk { bottom: 84px; } .ui-staff .ui-bulk { bottom: 12px; } }
/* room for the bar so it never covers the last rows or the pager */
.ui-page { padding-bottom: 96px; }

/* ---------- dialogs opened in fancybox (sign in, contact) ---------- */
.ui-dialog-form { width: 100%; max-width: 400px; margin: 0 auto; padding: 24px 24px 20px; text-align: right; }
.ui-dialog-form h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; color: var(--ink); }
.ui-dialog-form .form-group { margin: 0 0 14px; float: none; width: auto; padding: 0; }
.ui-dialog-form .form-group > div { float: none; width: auto; padding: 0; }
.ui-dialog-form label { display: block; float: none; width: auto; padding: 0; margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); text-align: right; }
.ui-dialog-form .form-control { width: 100%; height: 42px; }
.ui-dialog-form textarea.form-control { height: 120px; }
.ui-dialog-form .help-block { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ui-dialog-form .ui-btn.primary { width: 100%; height: 44px; justify-content: center; font-size: 14px; margin-top: 4px; }
.ui-dialog-form .ui-btn.is-busy { opacity: .6; pointer-events: none; }
.ui-dialog-alt { display: block; margin-top: 14px; text-align: center; font-size: 13px; }
.ui-dialog-note { margin: -6px 0 16px; font-size: 13px; color: var(--muted); }
.ui-dialog-form .ui-banner { margin-bottom: 14px; }

/* ---------- account page (accounts/personal_information.html) ---------- */
.ui-narrow { max-width: 760px; }
.ui-person-h { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ui-person-h .meta { display: block; }
.ui-av.lg { width: 44px; height: 44px; font-size: 15px; }
.ui-dlg-fields { display: grid; gap: 12px; min-width: min(320px, 78vw); padding: 4px 2px; text-align: right; }
.ui-dlg-fields .ui-field label { display: block; margin: 0 0 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.ui-dlg-fields .ui-field input:not([type=checkbox]) { width: 100%; }
.ui-dlg-fields .ui-field-check { display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; justify-content: flex-end; }
.ui-dlg-fields .ui-field-check label { margin: 0; }
.ui-field-err, .ui-field-err ul { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--bad); }
@media (max-width: 767px) { .ui-card-h:has(.ui-person-h) { flex-wrap: wrap; } }

/* ---------- toolbar with folder tabs (messages) ---------- */
.ui-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.ui-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #dbe5f2; box-shadow: inset 0 1px 2px rgba(21,41,74,.12); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ui-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2) !important; white-space: nowrap; }
.ui-tabs a:hover { color: var(--ink) !important; }
.ui-tabs a.on { color: var(--ink) !important; font-weight: 700; background: linear-gradient(#fff, #f7fafd); box-shadow: var(--e1); }
/* a table that fills its card */
.ui-list-card { overflow: hidden; }
.ui-body .ui-list-card > table.table_theme1 { margin: 0; border: 0; border-radius: 0; box-shadow: none; width: 100%; }
.ui-body td.ui-col-check { width: 44px; }
.ui-body .messages-table tbody tr:not(.ui-empty-row) { cursor: pointer; }
.ui-body .messages-table tr.hoverable td { font-weight: 700; color: var(--ink); background: #fff; }
.ui-body .messages-table tr.hoverable td:nth-child(2)::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 8px; border-radius: 50%; background: var(--primary); }
.ui-body .messages-table tr.tr_read td { color: var(--ink-2); }
.ui-body .messages-table td:last-child { white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.ui-body tr.ui-empty-row td, .ui-body tr.ui-empty-row:hover td { background: transparent !important; cursor: default; }
.ui-bulk .ui-btn.danger-text { color: #ffd9cf !important; }
@media (max-width: 767px) {
    .ui-toolbar .ui-sp { display: none; }
    .ui-toolbar > .ui-btn { flex: 1; justify-content: center; }
    .ui-body .messages-table thead td:nth-child(3), .ui-body .messages-table tbody td:nth-child(3) { display: none; }
}

/* ---------- filter bar, second pass ----------
   The buttons sit in the last cells of the row the fields end on (their own row only when that row is full),
   "clear" next to "search". On phones the whole bar folds behind one toggle. */
.ui-body .ui-filterbar > .ui-tools { grid-column: span 2 / -1; justify-content: flex-end; align-self: end; padding-top: 0; min-height: 36px; }
.ui-body .ui-filterbar > .ui-tools .ui-more-btn { margin-inline-end: auto; }
.ui-filter-toggle { display: none; }
@media (max-width: 767px) {
    .ui-filter-toggle { display: flex; align-items: center; gap: 8px; width: 100%; height: 46px; padding: 0 14px; border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); text-align: right; }
    .ui-filter-toggle > span:first-of-type { flex: 1; }
    .ui-filter-toggle .ui-i { color: var(--muted); }
    .ui-filter-toggle .ui-more-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
    .ui-filter-toggle .ui-chev { transition: transform .2s; }
    .ui-filters-shown > .ui-filter-toggle .ui-chev, .ui-filters-shown .ui-filter-toggle .ui-chev { transform: rotate(180deg); }
    .ui-body .ui-card:not(.ui-filters-shown) .ui-filter-toggle ~ [data-ui-filters],
    .ui-body .ui-card:not(.ui-filters-shown) .ui-filter-toggle + [data-ui-filters] { display: none; }
    .ui-body .ui-filters-shown [data-ui-filters] { border-top: 1px solid var(--line-2); }
    .ui-body .ui-filterbar > .ui-tools { grid-column: 1 / -1; }
    .ui-body .messages-table td { white-space: normal !important; overflow-wrap: anywhere; }
}
.ui-body .messages-table tr.tr_read td { background: var(--sunk) !important; }
.ui-body tr.ui-empty-row td { white-space: normal !important; }
/* a filter card keeps no padding of its own: the bar inside provides it */
.ui-body .ui-card.seachContent, .ui-body .ui-card.searchContent { padding: 0; }
/* unread dot sits in the cell's gutter so a long title or e-mail wraps cleanly */
.ui-body .messages-table tbody td:nth-child(2) { position: relative; padding-inline-start: 26px; }
.ui-body .messages-table tr.hoverable td:nth-child(2)::before { position: absolute; inset-inline-start: 8px; top: 50%; margin: -4px 0 0; }
@media (max-width: 767px) {
    .ui-body .messages-table td { overflow-wrap: break-word; word-break: normal; }
    .ui-body .messages-table td:last-child { font-size: 11.5px; font-weight: 400 !important; min-width: 96px; }
}

/* ---------- legacy row actions (.edit_button / .delete_button image links) as icon buttons ---------- */
.ui-body .edit_button, .ui-body .delete_button, .ui-body .delete_button_each {
    display: inline-flex; align-items: center; justify-content: center; position: relative; width: 30px; height: 30px; margin: 0 auto; padding: 0; overflow: hidden;
    border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1); color: var(--primary); cursor: pointer; text-indent: -9999px; vertical-align: middle; }
.ui-body .delete_button, .ui-body .delete_button_each { color: var(--bad); }
.ui-body .edit_button::before, .ui-body .delete_button::before, .ui-body .delete_button_each::before {
    content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; background: currentColor;
    -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ui-body .edit_button { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E"); }
.ui-body .delete_button, .ui-body .delete_button_each { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E"); }
.ui-body .edit_button:hover { border-color: #b9cbe3; background: var(--primary-soft); }
.ui-body .delete_button:hover, .ui-body .delete_button_each:hover { border-color: #ebcdc2; background: var(--bad-soft); }
.ui-body td:has(> .edit_button), .ui-body td:has(> .delete_button), .ui-body td:has(> .delete_button_each) { width: 46px; padding-inline: 6px; text-align: center; }
/* lists and nested layout tables inside data cells read as plain lines */
.ui-body .table_theme1 td ul { list-style: none; margin: 0; padding: 0; }
.ui-body .table_theme1 td table, .ui-body .table_theme1 td table td { border: 0; background: transparent !important; box-shadow: none; padding: 0; margin: 0; }
.ui-body .table_theme1 td[style*="Tahoma"] { font-family: inherit !important; font-size: 13px !important; }
/* bootstrap form error inside a dialog: the close mark sits at the end, not over the text */
.ui-dialog-form .alert { display: flex; flex-direction: row-reverse; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 10px 12px; font-size: 13px; }
.ui-dialog-form .alert .close { float: none; position: static; flex: none; line-height: 1.2; }

/* ---------- room residents list (/dormitory_view/, dormitory/view_dorms.html) ----------
   A row per room with a nested list of its residents (room_table / room_row, built and changed by
   room_assign.js, so the structure is kept). */
.ui-body .ui-toolbar .ui-list-title { margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: 16px !important; font-weight: 700; color: var(--ink) !important; line-height: 1.5; }
.ui-body .ui-dorm-table { table-layout: auto; }
.ui-body .ui-dorm-table > thead td, .ui-body .ui-dorm-table > tbody > tr > td { text-align: right; vertical-align: middle; }
.ui-body .ui-dorm-table > thead td:nth-child(1), .ui-body .ui-dorm-table > tbody > tr > td:nth-child(1),
.ui-body .ui-dorm-table > thead td:nth-child(n+3):nth-child(-n+6), .ui-body .ui-dorm-table > tbody > tr > td:nth-child(n+3):nth-child(-n+6) { text-align: center; white-space: nowrap; width: 1%; }
.ui-body .ui-dorm-table > tbody > tr > td:nth-child(1) { color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-body .ui-dorm-table > tbody > tr > td:nth-child(2) { white-space: nowrap; font-weight: 500; width: 1%; }
.ui-body .ui-dorm-table > tbody > tr > td:nth-child(4) { font-weight: 700; font-variant-numeric: tabular-nums; }
.ui-body .ui-dorm-table > tbody > tr > td:nth-child(4) p { margin: 0; }
.ui-body .ui-dorm-table > tbody > tr > td:nth-child(7) { color: var(--ink-2); font-size: 13px; min-width: 120px; }
.ui-body .ui-dorm-table > thead td:last-child, .ui-body .ui-dorm-table > tbody > tr > td:last-child { text-align: center; width: 1%; white-space: nowrap; }
.ui-body .ui-dorm-table .students_td { padding-block: 6px; min-width: 260px; }
.ui-body .ui-dorm-table .room_table { width: 100%; margin: 0; border: 0; background: transparent !important; box-shadow: none; }
.ui-body .ui-dorm-table .room_table td { padding: 4px 6px !important; border: 0; background: transparent !important; text-align: right; font-size: 13.5px; vertical-align: middle; }
.ui-body .ui-dorm-table .room_table tr + tr td { border-top: 1px dashed var(--line-2); }
.ui-body .ui-dorm-table .room_table td:first-child { width: 56px; white-space: nowrap; padding-inline: 0 !important; }
.ui-body .ui-dorm-table .room_table td:first-child:empty { width: 0; padding: 0 !important; }
.ui-body .ui-dorm-table .room_table td:last-child { width: 1%; text-align: left !important; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-body .ui-dorm-table .room_row.red td { color: var(--bad) !important; }
/* per-resident actions (remove, move): shown by the page script on row hover */
.ui-body .ui-dorm-table .student_delete_from_room, .ui-body .ui-dorm-table .student_transfer_to_room {
    display: inline-flex; align-items: center; justify-content: center; position: relative; width: 24px; height: 24px; border-radius: 6px; vertical-align: middle;
    color: var(--primary); border: 1px solid var(--line); background: linear-gradient(#fff, #f5f8fc); }
.ui-body .ui-dorm-table .student_delete_from_room { color: var(--bad); }
.ui-body .ui-dorm-table .student_delete_from_room:hover { background: var(--bad-soft); border-color: #ebcdc2; }
.ui-body .ui-dorm-table .student_transfer_to_room:hover { background: var(--primary-soft); border-color: #b9cbe3; }
.ui-body .ui-dorm-table .student_delete_from_room .ui-icon, .ui-body .ui-dorm-table .student_transfer_to_room .ui-icon { display: none; }
.ui-body .ui-dorm-table .student_delete_from_room::before, .ui-body .ui-dorm-table .student_transfer_to_room::before {
    content: ""; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ui-body .ui-dorm-table .student_delete_from_room { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
.ui-body .ui-dorm-table .student_transfer_to_room { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h14M14 4l4 4-4 4M20 16H6M10 12l-4 4 4 4'/%3E%3C/svg%3E"); }
.ui-body .ui-dorm-table .invisible_element { visibility: hidden; display: inline-flex; }
/* "add a student to this room": an icon button, live only for staff allowed to add */
.ui-body .ui-dorm-table > tbody > tr > td:last-child > a {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--primary) !important;
    border: 1px solid var(--line); background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1); }
.ui-body .ui-dorm-table > tbody > tr > td:last-child > a:hover { background: var(--primary-soft); border-color: #b9cbe3; }
.ui-body .ui-dorm-table > tbody > tr > td:last-child > a:not(.add_student_to_room) { opacity: .35; }
.ui-body .ui-dorm-table > tbody > tr > td:last-child > a .ui-i { width: 16px; height: 16px; }
@media (max-width: 767px) {
    .ui-body .ui-dorm-table .students_td { min-width: 220px; }
}
.ui-body .ui-list-card > .ui-scroll > table.table_theme1 { margin: 0; border: 0; border-radius: 0; box-shadow: none; width: 100%; }

/* =========================================================================
   Drawers. Every modal of the panel opens as a drawer: from the left edge on
   desktop, pulled up from the bottom on phones. Two kinds of modal exist:
   jQuery UI dialogs (.ui-dialog, about 70 of them) and fancybox popups
   (data-manager actions in an iframe, sign in). Both keep their own scripts;
   only where and how they are drawn changes. jQuery UI and fancybox write
   top / left / width / height inline, hence the !important on those.
   Behaviour (scrim click closes, page does not scroll behind) is in
   static/js/eskan-drawer.js.
   ========================================================================= */
@keyframes ui-drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes ui-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ui-scrim-in { from { opacity: 0; } to { opacity: 1; } }

/* the scrim behind a drawer: the legacy #overlay and jQuery UI's own modal overlay */
.ui-body #overlay, .ui-body .ui-widget-overlay {
    position: fixed; inset: 0; width: auto; height: auto; background: rgba(16,33,64,.45) !important; opacity: 1 !important; filter: none; z-index: 999; animation: ui-scrim-in .2s ease; cursor: pointer; }
body.ui-drawer-open { overflow: hidden; }

/* ---- jQuery UI dialogs ---- */
.ui-body .ui-dialog {
    position: fixed !important; top: 0 !important; bottom: 0; left: 0 !important; right: auto !important; height: auto !important;
    min-width: min(440px, 100vw); max-width: min(94vw, 1100px); margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain;
    border: 0; border-right: 1px solid #d9e2ee; border-radius: 0 16px 16px 0; background: #fff;
    box-shadow: 24px 0 60px -20px rgba(16,33,64,.45), 4px 0 12px -4px rgba(16,33,64,.18);
    animation: ui-drawer-in .28s cubic-bezier(.2,.8,.2,1); text-align: right; direction: rtl;
}
.ui-body .ui-dialog .ui-dialog-titlebar {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; min-height: 56px; margin: 0; padding: 10px 18px; cursor: default;
    border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0 16px 0 0; background: linear-gradient(#fbfcfe, #f3f7fc); color: var(--ink);
}
.ui-body .ui-dialog .ui-dialog-title { flex: 1; float: none; width: auto; margin: 0; font-size: 15.5px; font-weight: 700; line-height: 1.6; white-space: normal; overflow: visible; text-align: right; }
.ui-body .ui-dialog .ui-dialog-titlebar-close {
    position: static; flex: none; order: 2; width: 34px; height: 34px; margin: 0; padding: 0; top: auto; right: auto; left: auto; border: 1px solid var(--line); border-radius: 9px;
    background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1); color: var(--ink-2); cursor: pointer; text-indent: 0; font-size: 0;
    display: inline-flex; align-items: center; justify-content: center; }
.ui-body .ui-dialog .ui-dialog-titlebar-close:hover { background: #fff; border-color: #c3d1e3; color: var(--ink); }
.ui-body .ui-dialog .ui-dialog-titlebar-close > * { display: none; }
.ui-body .ui-dialog .ui-dialog-titlebar-close::before {
    content: ""; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
.ui-body .ui-dialog .ui-dialog-content {
    height: auto !important; min-height: 0 !important; max-height: none !important; width: auto !important; overflow: visible; margin: 0; padding: 18px; border: 0; background: transparent;
    font-size: 13.5px; line-height: 1.8; color: var(--ink); text-align: right; }
.ui-body .ui-dialog .ui-dialog-content table { max-width: 100%; }
.ui-body .ui-dialog .ui-dialog-content input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.ui-body .ui-dialog .ui-dialog-content select, .ui-body .ui-dialog .ui-dialog-content textarea { max-width: 100%; }
.ui-body .ui-dialog .ui-dialog-buttonpane {
    position: sticky; bottom: 0; z-index: 2; margin: 0; padding: 12px 18px; border: 0; border-top: 1px solid var(--line-2); border-radius: 0 0 16px 0; background: var(--sunk); }
.ui-body .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: none; display: flex; gap: 8px; flex-wrap: wrap; }
.ui-body .ui-dialog .ui-dialog-buttonpane button { margin: 0; min-width: 96px; height: 38px; }
.ui-body .ui-dialog .ui-resizable-handle { display: none !important; }

/* ---- fancybox popups ---- */
.ui-body .fancybox-overlay { background: rgba(16,33,64,.45) !important; overflow: hidden !important; }
.ui-body .fancybox-wrap {
    position: fixed !important; top: 0 !important; bottom: 0 !important; left: 0 !important; right: auto !important; width: min(760px, 94vw) !important; height: auto !important;
    margin: 0 !important; padding: 0 !important; animation: ui-drawer-in .28s cubic-bezier(.2,.8,.2,1); opacity: 1 !important; }
.ui-body .fancybox-skin {
    width: auto !important; height: 100% !important; padding: 0 !important; background: #fff !important; border-radius: 0 16px 16px 0 !important;
    box-shadow: 24px 0 60px -20px rgba(16,33,64,.45), 4px 0 12px -4px rgba(16,33,64,.18) !important; overflow: hidden; }
.ui-body .fancybox-outer { width: 100% !important; height: 100% !important; border-radius: 0; }
.ui-body .fancybox-inner { width: 100% !important; height: 100% !important; overflow: auto !important; border-radius: 0; }
.ui-body .fancybox-iframe { display: block; width: 100% !important; height: 100% !important; border-radius: 0; }
.ui-body .fancybox-close {
    top: 12px !important; left: 12px !important; right: auto !important; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; filter: none;
    background: linear-gradient(#fff, #f5f8fc) !important; box-shadow: var(--e1); color: var(--ink-2); display: flex; align-items: center; justify-content: center; z-index: 8050; }
.ui-body .fancybox-close::before {
    content: ""; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
.ui-body .fancybox-title { display: none; }
/* the page shown inside an action popup leaves room for the close button */
body.ui-popup { padding-top: 6px; }

/* ---- phones: pulled up from the bottom ---- */
@media (max-width: 767px) {
    .ui-body .ui-dialog {
        top: auto !important; bottom: 0; left: 0 !important; right: 0 !important; width: 100% !important; min-width: 0; max-width: none; max-height: 88vh;
        border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -24px 60px -20px rgba(16,33,64,.5); animation-name: ui-sheet-in; }
    .ui-body .ui-dialog .ui-dialog-titlebar { border-radius: 18px 18px 0 0; padding-top: 20px; }
    /* grab handle */
    .ui-body .ui-dialog .ui-dialog-titlebar::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #c5d1e2; }
    .ui-body .ui-dialog .ui-dialog-buttonpane { border-radius: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .ui-body .ui-dialog .ui-dialog-buttonpane button { flex: 1; }
    .ui-body .fancybox-wrap { top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; height: 90vh !important; animation-name: ui-sheet-in; }
    .ui-body .fancybox-skin { border-radius: 18px 18px 0 0 !important; box-shadow: 0 -24px 60px -20px rgba(16,33,64,.5) !important; }
}
@media (prefers-reduced-motion: reduce) {
    .ui-body .ui-dialog, .ui-body .fancybox-wrap, .ui-body #overlay, .ui-body .ui-widget-overlay { animation: none; }
}
@media print { .ui-body #overlay, .ui-body .ui-widget-overlay { display: none !important; } }
/* desktop: the button bar sits at the bottom of the drawer however short the content is */
@media (min-width: 768px) {
    .ui-body .ui-dialog .ui-dialog-content { min-height: calc(100vh - 56px - 63px) !important; box-sizing: border-box; }
    .ui-body .ui-dialog .ui-dialog-content:last-child { min-height: calc(100vh - 56px) !important; }
}
/* a popup with its own short content (sign in, contact) is a narrow drawer; iframe popups (forms, pickers) stay wide */
@media (min-width: 768px) {
    .ui-body .fancybox-wrap.fancybox-type-html, .ui-body .fancybox-wrap.fancybox-type-inline { width: min(460px, 94vw) !important; }
    .ui-body .fancybox-type-html .ui-dialog-form, .ui-body .fancybox-type-inline .ui-dialog-form { padding-top: 64px; }
}

/* =========================================================================
   Date and time pickers in the panel's design.
   Three widgets are in use: persianDatepicker (.pdp-default, most date
   fields), the jQuery UI date picker (.ui-datepicker, older forms) and the
   time picker add-on (.ui-timepicker-div). persianDatepicker writes cell
   sizes and font sizes inline, hence the !important on those.
   ========================================================================= */

/* ---- persianDatepicker ---- */
.ui-body .pdp-default {
    box-sizing: border-box; width: 284px !important; padding: 10px; margin-top: 6px; direction: rtl; color: var(--ink); font-family: IRANSans, Tahoma, sans-serif;
    border: 1px solid #d9e2ee; border-radius: 14px; background: #fff; z-index: 99999;
    box-shadow: 0 18px 40px -14px rgba(16,33,64,.45), 0 2px 6px rgba(16,33,64,.08); user-select: none; }
.ui-body .pdp-default *, .ui-body .pdp-default *::before, .ui-body .pdp-default *::after { box-sizing: border-box; }
.ui-body .pdp-default ::selection { color: inherit; background: transparent; }
/* header: month and year in the middle, an arrow at each end */
.ui-body .pdp-default .pdp-header {
    position: relative; display: flex; align-items: center; justify-content: center; height: 36px !important; line-height: 1.4 !important; margin: 0 0 8px; padding: 0 36px;
    border: 0; background: transparent; font-size: 14px !important; font-weight: 700; color: var(--ink); }
.ui-body .pdp-default .pdp-header > div:not(.nextArrow):not(.prevArrow) { flex: 1; }
.ui-body .pdp-default .monthYear { width: auto; margin: 0; padding: 4px 10px; border-radius: 8px; display: inline-block; cursor: pointer; }
.ui-body .pdp-default .monthYear:hover { background: var(--primary-soft); color: var(--primary); }
.ui-body .pdp-default .monthYear span { font-size: 14px; }
.ui-body .pdp-default .nextArrow, .ui-body .pdp-default .prevArrow {
    position: absolute; top: 2px; width: 32px; height: 32px; padding: 0; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1);
    color: var(--ink-2); font-size: 0 !important; line-height: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ui-body .pdp-default .nextArrow { right: 0; left: auto; }
.ui-body .pdp-default .prevArrow { left: 0; right: auto; }
.ui-body .pdp-default .nextArrow:hover, .ui-body .pdp-default .prevArrow:hover { color: var(--primary); border-color: #b9cbe3; background: #fff; }
.ui-body .pdp-default .nextArrow::before, .ui-body .pdp-default .prevArrow::before {
    content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 2px 2px 0 0; }
.ui-body .pdp-default .nextArrow::before { transform: translateX(-2px) rotate(45deg); }
.ui-body .pdp-default .prevArrow::before { transform: translateX(2px) rotate(-135deg); }
/* week days */
.ui-body .pdp-default .dows { display: flex; margin: 0 0 4px; background: transparent; color: var(--muted); border: 0; }
.ui-body .pdp-default .dow { flex: 1; width: auto !important; height: 26px !important; border: 0; font: 500 12px/26px IRANSans, Tahoma, sans-serif !important; color: var(--muted); }
.ui-body .pdp-default .dows .dow:last-child { color: var(--bad); }
/* days */
.ui-body .pdp-default .days { border: 0; background: transparent; font: inherit; }
.ui-body .pdp-default .days > div { display: flex; }
.ui-body .pdp-default .cell { flex: 1; text-align: center; }
.ui-body .pdp-default .dow.cell { display: block; }
.ui-body .pdp-default .day, .ui-body .pdp-default .nul {
    display: flex; align-items: center; justify-content: center; width: auto !important; height: 34px !important; margin: 1px; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent;
    /* line-height is part of the shorthand on purpose: a separate "font" declaration would reset it */
    font: 500 13px/1 IRANSans, Tahoma, sans-serif !important; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.ui-body .pdp-default .nul { cursor: default; }
.ui-body .pdp-default .day:hover { background: var(--primary-soft); border-color: #c9d8ee; border-radius: 9px; color: var(--primary); }
.ui-body .pdp-default .friday { color: var(--bad); }
.ui-body .pdp-default .today, .ui-body .pdp-default .today:hover { color: var(--primary); background: transparent; border-color: var(--primary); font-weight: 700 !important; }
.ui-body .pdp-default .selday, .ui-body .pdp-default .selday:hover {
    color: #fff; border-color: var(--lip); background: linear-gradient(#2a62ad, #1d4f91); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 0 var(--lip); font-weight: 700 !important; }
.ui-body .pdp-default .disday, .ui-body .pdp-default .disday:hover { color: var(--faint); background: transparent; border-color: transparent; cursor: not-allowed; text-decoration: line-through; }
/* footer: "today" */
.ui-body .pdp-default .pdp-footer { height: auto !important; line-height: 1.4 !important; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line-2); background: transparent; text-align: center; font: inherit; }
.ui-body .pdp-default .pdp-footer .goToday { display: inline-block; padding: 4px 14px; border-radius: 99px; font-size: 12.5px !important; font-weight: 500; color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.ui-body .pdp-default .pdp-footer .goToday:hover { color: #fff; background: var(--primary); text-decoration: none; }
/* month and year lists (opened from the header) */
.ui-body .pdp-default .monthSelect, .ui-body .pdp-default .yearSelect {
    position: absolute; top: 42px; right: 0; left: 0; width: auto; height: auto !important; max-height: 238px; margin: 0 !important; padding: 6px; z-index: 5;
    overflow-y: auto; direction: rtl; list-style: none; text-align: right; font-size: 0 !important;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 28px -12px rgba(16,33,64,.4); font: inherit; font-size: 13px !important; animation: none; }
/* the script shows these lists with an inline display:block, so the three columns come from the items */
.ui-body .pdp-default .monthSelect li, .ui-body .pdp-default .yearSelect li {
    display: inline-block; width: calc(33.333% - 4px) !important; height: 34px !important; line-height: 32px !important; margin: 2px; padding: 0; border: 1px solid transparent; border-radius: 8px; text-align: center; cursor: pointer; color: var(--ink); font-size: 13px; vertical-align: top; }
.ui-body .pdp-default .monthSelect li:hover, .ui-body .pdp-default .yearSelect li:hover { background: var(--primary-soft); border-color: #c9d8ee; color: var(--primary); }
.ui-body .pdp-default .monthSelect li.selected, .ui-body .pdp-default .yearSelect li.selected, .ui-body .pdp-default .selected { color: #fff; background: var(--primary); border-color: var(--lip); }
.ui-body .pdp-default .monthSelect li.disableMonth, .ui-body .pdp-default .monthSelect li.disableMonth:hover { color: var(--faint); background: var(--sunk); border-color: transparent; cursor: not-allowed; }
.ui-body .pdp-default ::-webkit-scrollbar { width: 8px; background: transparent; }
.ui-body .pdp-default ::-webkit-scrollbar-track { background: transparent; box-shadow: none; -webkit-box-shadow: none; }
.ui-body .pdp-default ::-webkit-scrollbar-thumb { background: #c5d1e2; border-radius: 8px; }

/* ---- jQuery UI date picker ---- */
.ui-body .ui-datepicker {
    width: 284px; padding: 10px; border: 1px solid #d9e2ee; border-radius: 14px; background: #fff; font-family: IRANSans, Tahoma, sans-serif; font-size: 13px; color: var(--ink);
    box-shadow: 0 18px 40px -14px rgba(16,33,64,.45), 0 2px 6px rgba(16,33,64,.08); z-index: 99999 !important; }
.ui-body .ui-datepicker .ui-datepicker-header { position: relative; padding: 4px 0 8px; margin: 0 0 4px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-weight: 700; }
.ui-body .ui-datepicker .ui-datepicker-title { margin: 0 38px; line-height: 32px; font-size: 14px; text-align: center; display: flex; gap: 6px; justify-content: center; }
.ui-body .ui-datepicker .ui-datepicker-title select { height: 30px !important; width: auto !important; min-width: 0; padding: 0 22px 0 8px; margin: 0; font-size: 12.5px; }
.ui-body .ui-datepicker .ui-datepicker-prev, .ui-body .ui-datepicker .ui-datepicker-next {
    top: 4px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1); cursor: pointer; }
.ui-body .ui-datepicker .ui-datepicker-prev { right: 0; left: auto; }
.ui-body .ui-datepicker .ui-datepicker-next { left: 0; right: auto; }
.ui-body .ui-datepicker .ui-datepicker-prev:hover, .ui-body .ui-datepicker .ui-datepicker-next:hover { border-color: #b9cbe3; background: #fff; top: 4px; }
.ui-body .ui-datepicker .ui-datepicker-prev-hover { right: 0; } .ui-body .ui-datepicker .ui-datepicker-next-hover { left: 0; }
.ui-body .ui-datepicker .ui-datepicker-prev span, .ui-body .ui-datepicker .ui-datepicker-next span {
    position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; background: none !important; text-indent: -9999px; overflow: hidden; border: solid var(--ink-2); border-width: 2px 2px 0 0; }
.ui-body .ui-datepicker .ui-datepicker-prev span { transform: translateX(-2px) rotate(45deg); }
.ui-body .ui-datepicker .ui-datepicker-next span { transform: translateX(2px) rotate(-135deg); }
.ui-body .ui-datepicker table { width: 100%; margin: 0; border: 0; border-collapse: separate; border-spacing: 2px; font-size: 13px; background: transparent; box-shadow: none; }
.ui-body .ui-datepicker th { padding: 4px 0; border: 0; background: transparent; font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; }
.ui-body .ui-datepicker td { padding: 0; border: 0; background: transparent !important; }
.ui-body .ui-datepicker td a, .ui-body .ui-datepicker td span {
    display: block; height: 32px; line-height: 30px; padding: 0; text-align: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 500; text-decoration: none; }
.ui-body .ui-datepicker td a:hover, .ui-body .ui-datepicker td a.ui-state-hover { background: var(--primary-soft); border-color: #c9d8ee; color: var(--primary); }
.ui-body .ui-datepicker td.ui-datepicker-today a { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.ui-body .ui-datepicker td a.ui-state-active, .ui-body .ui-datepicker td.ui-datepicker-current-day a {
    color: #fff; border-color: var(--lip); background: linear-gradient(#2a62ad, #1d4f91); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 0 var(--lip); font-weight: 700; }
.ui-body .ui-datepicker td.ui-datepicker-unselectable span { color: var(--faint); }
.ui-body .ui-datepicker .ui-datepicker-buttonpane { margin: 8px 0 0; padding: 8px 0 0; border: 0; border-top: 1px solid var(--line-2); background: transparent; display: flex; gap: 8px; justify-content: space-between; }
.ui-body .ui-datepicker .ui-datepicker-buttonpane button { float: none; margin: 0; height: 32px; padding: 0 14px; border-radius: var(--r-sm); font: inherit; font-size: 12.5px; font-weight: 500; opacity: 1;
    color: var(--ink); border: 1px solid var(--line); background: linear-gradient(#fff, #f5f8fc); box-shadow: var(--e1); cursor: pointer; }
.ui-body .ui-datepicker .ui-datepicker-buttonpane button.ui-priority-primary, .ui-body .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-close {
    color: #fff; border-color: var(--lip); background: linear-gradient(#2a62ad, #1d4f91); }

/* ---- time picker add-on (inside the jQuery UI picker box) ---- */
.ui-body .ui-timepicker-div { padding: 2px 4px; font-size: 13px; color: var(--ink); }
.ui-body .ui-timepicker-div .ui-widget-header { margin: 0 0 8px; padding: 4px 0 8px; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; background: transparent; color: var(--ink); font-weight: 700; text-align: center; }
.ui-body .ui-timepicker-div dl { margin: 0; text-align: right; }
.ui-body .ui-timepicker-div dl dt { float: right; clear: right; width: 64px; padding: 0; height: 30px; line-height: 30px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.ui-body .ui-timepicker-div dl dd { margin: 0 74px 10px 4px; min-height: 30px; line-height: 30px; font-variant-numeric: tabular-nums; font-weight: 700; }
/* the slider element is the <dd> itself: a thin track centred on the label's line, the handle centred on the track */
.ui-body .ui-timepicker-div dl dd.ui-slider, .ui-body .ui-timepicker-div .ui-slider.ui-slider-horizontal {
    position: relative; box-sizing: border-box; height: 6px !important; min-height: 0; line-height: 0; margin: 12px 84px 12px 14px; padding: 0;
    border: 0; border-radius: 6px; background: #d3deee; box-shadow: inset 0 1px 2px rgba(21,41,74,.18); }
.ui-body .ui-timepicker-div .ui-slider .ui-slider-handle {
    position: absolute; top: 50% !important; width: 20px; height: 20px; margin: -10px 0 0 -10px; border: 1px solid var(--lip); border-radius: 50%; background: linear-gradient(#2a62ad, #1d4f91);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 5px rgba(16,33,64,.35); cursor: grab; outline: 0; z-index: 2; }
.ui-body .ui-timepicker-div .ui-slider .ui-slider-handle:hover, .ui-body .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-focus { box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 0 0 4px rgba(29,79,145,.18), 0 2px 5px rgba(16,33,64,.35); }
.ui-body .ui-timepicker-div .ui-slider .ui-slider-handle.ui-state-active { cursor: grabbing; }
.ui-body .ui-timepicker-div .ui-slider .ui-slider-range { top: 0; height: 100%; background: var(--primary); border-radius: 6px; }
.ui-body .ui-timepicker-div td { background: transparent !important; }

/* phones: a picker never runs off the screen */
@media (max-width: 767px) {
    .ui-body .pdp-default, .ui-body .ui-datepicker { max-width: calc(100vw - 16px); }
    /* the widgets place themselves at the field's left edge, which can push them off a narrow screen: centre them */
    .ui-body .pdp-default { left: max(8px, calc((100vw - 284px) / 2)) !important; }
    .ui-body #ui-datepicker-div { left: max(8px, calc((100vw - 284px) / 2)) !important; }
}
/* time picker rows: label and control on one line (the add-on's floats let the labels drift from their sliders) */
.ui-body .ui-timepicker-div dl { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; row-gap: 4px; margin: 0; }
.ui-body .ui-timepicker-div dl dt { float: none; clear: none; width: auto; height: 32px; line-height: 32px; margin: 0; }
.ui-body .ui-timepicker-div dl dd { margin: 0; min-height: 32px; line-height: 32px; }
.ui-body .ui-timepicker-div dl dd.ui-slider, .ui-body .ui-timepicker-div .ui-slider.ui-slider-horizontal { margin: 0 12px; }

/* =========================================================================
   Typeface: IRANSansX (variable), for the whole staff and student panel and
   its popups. Not the public home page, which keeps its original design
   (it has no .ui-body class).
   - font-variation-settings "DOTS" 4: the dot style chosen for the panel.
   - font-feature-settings "ss02": Persian numerals for digits typed as 0-9,
     which the previous web font (IRANSansWeb FaNum) drew that way by itself.
   Both are set on every element with !important, because a "font" shorthand
   anywhere (and the browser's own form-control styles) resets them, and the
   legacy stylesheets name the old family on many selectors.
   Icon fonts are left alone.
   ========================================================================= */
@font-face {
    font-family: IRANSansX;
    src: url('../fonts/iransans-x/IRANSansXVF.woff2') format('woff2-variations'),
         url('../fonts/iransans-x/IRANSansXVF.woff2') format('woff2'),
         url('../fonts/iransans-x/IRANSansXVF.woff') format('woff');
    font-weight: 100 900; font-style: normal; font-display: swap;
}
.ui-body, .ui-body *:not(.fa):not(.glyphicon):not([class^="cke_"]):not([class*=" cke_"]) {
    font-family: IRANSansX, IRANSans, Tahoma, sans-serif !important;
}
.ui-body, .ui-body * {
    font-variation-settings: "DOTS" 4 !important;
    font-feature-settings: "ss02" !important;
}

/* =========================================================================
   Headings.
   1. A <legend> is the title of its box. Browsers draw a legend ON the top
      border of its fieldset, so on a card it sat half outside, cut by the
      card's edge. Floated at full width it becomes an ordinary first line
      inside the card, styled as the card's header.
   2. Plain h2 / h3 / h4 in page content get one scale and spacing.
   ========================================================================= */
.ui-body fieldset { min-width: 0; }
.ui-body fieldset > legend {
    float: right; box-sizing: border-box; width: calc(100% + 32px); max-width: none; margin: -14px -16px 14px; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line-2);
    border-radius: var(--r) var(--r) 0 0; background: linear-gradient(#fbfcfe, #f3f7fc); color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.6; text-align: right; }
.ui-body fieldset > legend + * { clear: both; }
.ui-body fieldset::after { content: ""; display: block; clear: both; }
.ui-body legend h1, .ui-body legend h2, .ui-body legend h3, .ui-body legend h4, .ui-body legend h5 {
    display: inline; margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: inherit !important; font-weight: inherit; line-height: inherit; color: inherit !important; }
/* a fieldset inside a card or box has no frame of its own: its legend is a section title, not a header bar */
.ui-body .bordered_div fieldset > legend, .ui-body .panel fieldset > legend, .ui-body .seachContent fieldset > legend, .ui-body .searchContent fieldset > legend,
.ui-body .ui-card fieldset > legend, .ui-body .ui-dialog fieldset > legend, body.ui-popup fieldset fieldset > legend {
    width: 100%; margin: 0 0 12px; padding: 0 0 8px; border-radius: 0; background: transparent; border-bottom: 1px solid var(--line-2); font-size: 14.5px; }
/* a fieldset that is itself the box (class bordered_div on the fieldset) keeps the header bar */
.ui-body fieldset.bordered_div > legend, .ui-body fieldset.ui-card > legend {
    width: calc(100% + 32px); margin: -14px -16px 14px; padding: 12px 18px; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(#fbfcfe, #f3f7fc); font-size: 15px; }

/* plain headings in page content: only headings that are not inside one of the panel's own components (.ui-card, .ui-tag, ...), which size their titles themselves */
.ui-body .ui-page .content h2:not(:where(.ui-card *, .ui-card-h *, .ui-page-h *, .ui-empty *, .ui-toolbar *, .ui-tag *, .ui-banner *, .ui-dialog *, .ui-bulk *, legend *)) { margin: 20px 0 12px; font-size: 18px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.ui-body .ui-page .content h3:not(:where(.ui-card *, .ui-card-h *, .ui-page-h *, .ui-empty *, .ui-toolbar *, .ui-tag *, .ui-banner *, .ui-dialog *, .ui-bulk *, legend *)) { margin: 18px 0 10px; font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.ui-body .ui-page .content h4:not(:where(.ui-card *, .ui-card-h *, .ui-page-h *, .ui-empty *, .ui-toolbar *, .ui-tag *, .ui-banner *, .ui-dialog *, .ui-bulk *, legend *)) { margin: 16px 0 8px; font-size: 14.5px; font-weight: 700; line-height: 1.5; color: var(--ink-2); }
.ui-body .ui-page .content h5:not(:where(.ui-card *, .ui-card-h *, .ui-page-h *, .ui-empty *, .ui-toolbar *, .ui-tag *, .ui-banner *, .ui-dialog *, .ui-bulk *, legend *)) { margin: 14px 0 6px; font-size: 13.5px; font-weight: 700; line-height: 1.5; color: var(--ink-2); }
.ui-body .ui-page .content > :first-child:is(h2, h3, h4), .ui-body .ui-page .content > div > :first-child:is(h2, h3, h4) { margin-top: 0; }
.ui-body .ui-card-h h2, .ui-body .ui-card-h h3, .ui-body .ui-empty h3, .ui-body .ui-page-h h1 { margin: 0; }
/* a <legend> used on its own as a section heading (no fieldset around it) */
.ui-body :not(fieldset) > legend {
    display: block; float: none; width: 100%; margin: 18px 0 12px; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent;
    font-size: 15.5px; font-weight: 700; line-height: 1.6; color: var(--ink); text-align: right; }
.ui-body :not(fieldset) > legend:first-child { margin-top: 0; }
.ui-body :not(fieldset) > legend ~ div > legend, .ui-body div > div > legend { font-size: 13.5px; color: var(--ink-2); border-bottom-style: dashed; margin: 12px 0 10px; }

/* =========================================================================
   A title above a table is the header bar of that table's card.
   Templates with buttons beside the title use the real card markup
   (.ui-card.ui-list-card > .ui-card-h). Everywhere else the heading sits
   directly before the table (or before the table's scroll wrapper), and is
   joined to it here: the heading becomes the top of the box, the table
   loses its top corners and its gap.
   ========================================================================= */
.ui-body .ui-list-card > .ui-card-h { flex-wrap: wrap; }
.ui-body .ui-list-card > .ui-card-h .ui-tools { margin-inline-start: auto; }
.ui-body .ui-list-card > .ui-card-h + .ui-scroll > table.table_theme1, .ui-body .ui-list-card > .ui-card-h ~ div table.table_theme1,
.ui-body .ui-list-card > .ui-card-h ~ table.table_theme1 { margin: 0; border: 0; border-radius: 0; box-shadow: none; width: 100%; }
.ui-body .ui-list-card > .ui-card-h ~ div { clear: both; }

.ui-body .ui-page .content :is(h2, h3, h4):is(
        :has(+ table.table_theme1), :has(+ .ui-scroll > table.table_theme1), :has(+ div > .ui-scroll > table.table_theme1),
        :has(+ div > table.table_theme1)):not(:where(.ui-card *, .ui-card-h *, .ui-page-h *, .ui-empty *, .ui-toolbar *, .ui-tag *, .ui-banner *, .ui-dialog *, .ui-bulk *, legend *)),
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child):is(
        :has(+ table.table_theme1), :has(+ .ui-scroll > table.table_theme1), :has(+ div > .ui-scroll > table.table_theme1),
        :has(+ div > table.table_theme1)) > :is(h2, h3, h4) {
    display: block !important; box-sizing: border-box; width: auto; margin: 16px 0 0 !important; padding: 12px 18px !important; text-align: right;
    font-size: 15px !important; font-weight: 700; line-height: 1.6; color: var(--ink) !important;
    border: 1px solid #d9e2ee !important; border-bottom-color: var(--line-2) !important; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(#fbfcfe, #f3f7fc); }
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child):is(
        :has(+ table.table_theme1), :has(+ .ui-scroll > table.table_theme1), :has(+ div > .ui-scroll > table.table_theme1), :has(+ div > table.table_theme1)) { margin: 0; padding: 0; }
/* the table (or its wrapper) right after such a heading */
.ui-body .ui-page .content :is(h2, h3, h4) + table.table_theme1,
.ui-body .ui-page .content :is(h2, h3, h4) + .ui-scroll > table.table_theme1,
.ui-body .ui-page .content :is(h2, h3, h4) + div > .ui-scroll > table.table_theme1,
.ui-body .ui-page .content :is(h2, h3, h4) + div > table.table_theme1,
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + table.table_theme1,
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + .ui-scroll > table.table_theme1,
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + div > .ui-scroll > table.table_theme1,
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + div > table.table_theme1 {
    margin-top: 0 !important; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* a plain wrapper between such a heading and its table (legacy float / padding / frame) steps out of the way */
.ui-body .ui-page .content :is(h2, h3, h4) + div:has(> table.table_theme1):not(.ui-card):not(.ui-list-card):not(.ui-scroll):not(.ui-toolbar),
.ui-body .ui-page .content :is(h2, h3, h4) + div:has(> .ui-scroll > table.table_theme1):not(.ui-card):not(.ui-list-card):not(.ui-scroll):not(.ui-toolbar),
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + div:has(> .ui-scroll > table.table_theme1):not(.ui-card):not(.ui-list-card):not(.ui-scroll):not(.ui-toolbar),
.ui-body .ui-page .content div:has(> :is(h2, h3, h4):only-child) + div:has(> table.table_theme1):not(.ui-card):not(.ui-list-card):not(.ui-scroll):not(.ui-toolbar) {
    display: block !important; float: none !important; clear: both; width: auto !important; margin: 0 0 16px !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.ui-body .ui-page .content :is(h2, h3, h4) + div > table.table_theme1,
.ui-body .ui-page .content :is(h2, h3, h4) + div > .ui-scroll > table.table_theme1 { width: 100% !important; margin-bottom: 0; }
.ui-body .ui-page .content :is(h2, h3, h4) + div > table.table_theme1,
.ui-body .ui-page .content :is(h2, h3, h4) + div > .ui-scroll > table.table_theme1 { margin: 0 !important; }

/* ---------- sign-in pages (templates/accounts/auth_base.html: sign-in, first sign-in, forgotten password, new password) ----------
   Pages of their own, without the top bar and menu: brand, the form in a card, the way back. The form fields
   use the dialog layout (.ui-dialog-form) above. */
.ui-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px 40px; }
.ui-auth-brand { display: flex; align-items: center; gap: 12px; color: var(--ink) !important; font-weight: 700; font-size: 17px; line-height: 1.5; }
.ui-auth-brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
/* the university mark is white, so it sits on the top bar's navy */
.ui-auth-mark { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
    background: linear-gradient(180deg, #1d3560 0, #15294a 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 6px 14px -6px rgba(21,41,74,.5); }
.ui-auth-mark img { width: 36px; height: 36px; }
.ui-auth-card { width: 100%; max-width: 400px; margin: 0; }
.ui-auth-card .ui-dialog-form { max-width: none; padding: 26px 26px 22px; }
.ui-auth-card h1 { margin: 0 0 18px; font-size: 18px; font-weight: 700; color: var(--ink); }
.ui-auth-lead { margin: -8px 0 16px; font-size: 13px; line-height: 1.9; color: var(--muted); }
/* security phrase: the picture and its field on one line */
.ui-auth-card .form-group > div:has(> img.captcha) { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ui-auth-card .form-group > div:has(> img.captcha) .help-block { flex: 0 0 100%; margin: 0; }
.ui-auth-card img.captcha { flex: none; height: 42px; width: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.ui-auth-card img.captcha ~ input[type=text] { flex: 1 1 120px; min-width: 0; width: auto; height: 42px; direction: ltr; text-align: center; letter-spacing: .12em; }
.ui-auth-back { font-size: 13px; color: var(--muted) !important; }
.ui-auth-back:hover { color: var(--primary) !important; }
@media (max-width: 480px) {
    .ui-auth { justify-content: flex-start; padding-top: 40px; gap: 18px; }
    .ui-auth-card .ui-dialog-form { padding: 22px 18px 18px; }
}
