:root {
  --primary: #ad1d37; --primary-dark: #8a1629; --primary-light: #fbe9ec; --accent: #213467; --navy: #213467;
  --bg: #f4f5f7; --card: #fff; --border: #e3e6ea; --text: #23272b; --muted: #6c757d;
  --success: #28a745; --warning: #ffc107; --danger: #dc3545; --info: #17a2b8;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.04);
  --font: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}
html[dir=rtl] { --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 13.5px; color: var(--text); background: var(--bg); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85em; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: Consolas, monospace; }
[hidden] { display: none !important; }
.flex { display: flex; gap: .5rem; align-items: center; } .flex-wrap { flex-wrap: wrap; } .grow { flex: 1; } .space { justify-content: space-between; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .ml-auto { margin-inline-start: auto; }
.grid { display: grid; gap: 1rem; } .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .75rem; height: 56px; padding: 0 .9rem; background: #fff; border-bottom: 3px solid var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--primary); font-size: 1rem; white-space: nowrap; flex-shrink: 0; }
@media (max-width: 1250px) { .brand #brandName { display: none; } }
.brand:hover { text-decoration: none; }
.logo-badge { width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; margin: 0 auto .6rem; }
.brand-logo { height: 40px; width: auto; }
.login-logo { max-width: 280px; height: auto; margin: 0 auto .5rem; display: block; }
.brand .brand-ar { font-family: 'Cairo', sans-serif; font-size: .8rem; color: var(--navy); display: block; line-height: 1; }
.logo-badge.small { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; margin: 0; }
.modules { display: flex; gap: .1rem; flex: 1; min-width: 0; overflow: hidden; align-items: center; }
.modules a { padding: .45rem clamp(.35rem, .6vw, .7rem); border-radius: 6px; color: var(--text); font-weight: 500; white-space: nowrap; font-size: clamp(.8rem, .85vw, .95rem); }
.nav-more { position: relative; }
.nav-more > a { padding: .45rem .6rem; border-radius: 6px; color: var(--primary); font-weight: 700; }
.nav-more-list { display: none; position: absolute; top: 110%; inset-inline-start: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 170px; padding: .3rem; z-index: 60; }
.nav-more.open .nav-more-list { display: block; }
.nav-more-list a { display: block; padding: .5rem .7rem; }
.nav-more-list a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.modules a:hover, .modules a.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); }
.stat i { color: var(--primary); }
.megamenu .group h4 i { background: var(--navy); }
.section-title, .page-head h1 { color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; }
.global-search { display: flex; align-items: center; gap: .4rem; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: .3rem .7rem; color: var(--muted); }
.global-search input { border: 0; background: transparent; outline: 0; width: clamp(90px, 11vw, 190px); font: inherit; }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: .35rem .6rem; cursor: pointer; font: inherit; font-weight: 600; color: var(--primary); }
.icon-btn:hover { background: var(--primary-light); }
.nav-toggle { display: none; border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; }
.user-menu { position: relative; display: flex; align-items: center; gap: .4rem; cursor: pointer; padding: .3rem .5rem; border-radius: 6px; font-weight: 500; }
.user-menu:hover { background: var(--bg); }
.user-menu .fa-circle-user { font-size: 1.4rem; color: var(--muted); }
.dropdown { display: none; position: absolute; top: 110%; inset-inline-end: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 190px; padding: .3rem; z-index: 60; }
.dropdown a { display: block; padding: .5rem .7rem; color: var(--text); border-radius: 6px; }
.dropdown a:hover { background: var(--bg); text-decoration: none; }
.user-menu.open .dropdown { display: block; }
@media (max-width: 1000px) { .global-search { display: none; } .nav-toggle { display: block; } .modules { display: none; position: absolute; top: 56px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: .5rem; box-shadow: var(--shadow); overflow: visible; } .modules.open { display: flex; } .modules a { font-size: .95rem; padding: .6rem .8rem; } .nav-more { display: none; } .brand #brandName { display: inline; } }

/* ---------- mega menu ---------- */
.megamenu { position: fixed; top: 55px; left: 50%; transform: translateX(-50%); width: min(1100px, 96vw); max-height: calc(100vh - 80px); overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 1rem 1.25rem; z-index: 55; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem 1.5rem; }
.megamenu .group h4 { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: .35rem; margin-bottom: .35rem; }
.megamenu .group h4 i { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; }
.megamenu .group a { display: block; padding: .22rem .3rem .22rem 2.1rem; color: var(--primary); font-size: .86rem; border-radius: 4px; }
html[dir=rtl] .megamenu .group a { padding: .22rem 2.1rem .22rem .3rem; }
.megamenu .group a:hover { background: var(--primary-light); text-decoration: none; }
.megamenu-backdrop { position: fixed; inset: 0; z-index: 54; }

.breadcrumb { padding: .55rem 1.2rem 0; color: var(--primary); font-size: .85rem; display: flex; gap: .4rem; align-items: center; }
.breadcrumb a { color: var(--primary); }
.breadcrumb .sep { color: var(--muted); }
.main { padding: .75rem 1.2rem 2rem; }

/* ---------- cards / panels ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-title h2, .card-title h3 { margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: .5rem; color: var(--navy); }
.page-head h1 i { font-size: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.actions-bar { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--border); background: #fff; color: var(--text); padding: .42rem .8rem; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: .25rem .5rem; font-size: .82rem; }
.btn-xs { padding: .12rem .4rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { border: 0; background: none; color: var(--primary); padding: .2rem .3rem; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-start-start-radius: 6px; border-end-start-radius: 6px; }
.btn-group .btn:last-child { border-start-end-radius: 6px; border-end-end-radius: 6px; }

/* ---------- forms ---------- */
.input, select.input, textarea.input { width: 100%; border: 1px solid #ccd1d6; border-radius: 6px; padding: .42rem .6rem; font: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid rgba(155,28,58,.25); border-color: var(--primary); }
.input[readonly] { background: #f7f8fa; color: var(--muted); }
textarea.input { min-height: 70px; resize: vertical; }
label { display: block; font-size: .82rem; font-weight: 600; color: #444; margin: .5rem 0 .25rem; }
label .req { color: var(--danger); margin-inline-start: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem .9rem; }
.form-grid .field-textarea, .form-grid .field-json, .form-grid .field-perms, .form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .field-textarea:not(.wide) { grid-column: span 2; }
@media (max-width: 700px) { .form-grid .field-textarea:not(.wide) { grid-column: 1 / -1; } }
/* QA-tester 2026-09-18: on a 390px phone the Circulation search rows pushed their buttons off screen and the page
   scrolled sideways. Rows of controls wrap and their inputs shrink instead of forcing the page wider. */
@media (max-width: 560px) {
  .flex { flex-wrap: wrap; }
  .flex > .input, .flex > select.input, .flex > .lookup { flex: 1 1 140px; min-width: 0; max-width: 100%; }
  .card, .card .input, .card .btn { max-width: 100%; box-sizing: border-box; }
  .card-title { flex-wrap: wrap; gap: .4rem; }
  .toolbar { flex-wrap: wrap; }
}
.check { display: flex; align-items: center; gap: .4rem; margin-top: 1.55rem; font-weight: 500; }
.check input { width: 16px; height: 16px; }
.form-footer { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: .6rem 0 0; margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.error-box { background: #fdecef; color: #8a1c1c; border: 1px solid #f5c2c7; padding: .5rem .7rem; border-radius: 6px; margin: .5rem 0; }
.hint { color: var(--muted); font-size: .78rem; }
.login-body { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #fff5f3 0%, #eef1f8 100%); }
.login-card { width: 380px; max-width: 94vw; background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.12); padding: 2rem; }
.login-brand { text-align: center; margin-bottom: 1rem; }
.login-brand h1 { color: var(--primary); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: .15rem; border-bottom: 2px solid var(--border); margin-bottom: .75rem; }
.tabs button { border: 0; background: transparent; padding: .5rem .8rem; font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button:hover { color: var(--primary); }
.tab-pane { display: none; } .tab-pane.active { display: block; }

/* lookup (searchable select) */
.lookup { position: relative; }
.lookup .lookup-input { padding-inline-end: 3.2rem; }
.lookup .lookup-tools { position: absolute; top: 0; bottom: 0; inset-inline-end: .4rem; display: flex; align-items: center; gap: .2rem; color: var(--muted); }
.lookup .lookup-tools span { cursor: pointer; padding: 0 .2rem; }
.lookup .lookup-list { position: absolute; z-index: 40; top: 100%; left: 0; right: 0; max-height: 240px; overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); display: none; }
.lookup .lookup-list.open { display: block; }
.lookup .lookup-list div { padding: .4rem .6rem; cursor: pointer; }
.lookup .lookup-list div:hover, .lookup .lookup-list div.hl { background: var(--primary-light); }
.lookup .lookup-list .empty { color: var(--muted); cursor: default; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid #eef0f2; text-align: start; vertical-align: middle; }
.table th { background: #fafbfc; font-weight: 600; color: #444; white-space: nowrap; position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--primary); }
.table tbody tr:hover { background: #fcf6f7; }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table tr.total td { font-weight: 700; background: #fafbfc; }
.table .row-actions { white-space: nowrap; text-align: end; }
.table .row-actions .btn { padding: .15rem .35rem; margin-inline-start: 2px; }
.table td a.rowlink { font-weight: 500; }
.table input.cell, .table select.cell { width: 100%; min-width: 60px; border: 1px solid #dde1e5; border-radius: 4px; padding: .25rem .4rem; font: inherit; }
.table-sm th, .table-sm td { padding: .3rem .45rem; }
.pager { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.pager .btn { padding: .25rem .55rem; }
.thumb { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #eee; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #eee; }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; color: #bbb; }

/* badges / chips */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 12px; font-size: .76rem; font-weight: 600; background: #eef0f2; color: #444; white-space: nowrap; }
.badge-success { background: #e6f5ea; color: #1e7b34; } .badge-danger { background: #fdecef; color: #a32036; } .badge-warning { background: #fff5d6; color: #8a6400; } .badge-info { background: #e2f4f7; color: #0f6674; } .badge-primary { background: var(--primary-light); color: var(--primary); } .badge-muted { background: #eef0f2; color: #6c757d; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: .28rem .55rem; font-size: .82rem; font-weight: 600; }
.chip b { color: var(--primary); }
.chip .x { cursor: pointer; color: var(--danger); }
.filter-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem .9rem; margin-bottom: .6rem; }
.search-box { display: flex; align-items: center; border: 1px solid #ccd1d6; border-radius: 6px; background: #fff; overflow: hidden; }
.search-box input { border: 0; padding: .42rem .6rem; font: inherit; width: 240px; outline: 0; }
.search-box button { border: 0; background: var(--primary); color: #fff; padding: .45rem .7rem; cursor: pointer; }

/* dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem; display: flex; align-items: center; gap: .8rem; box-shadow: var(--shadow); }
.stat i { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.stat .v { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .8rem; }
.stat > div { min-width: 0; flex: 1 1 auto; }
.stat .v { white-space: nowrap; overflow: hidden; }   /* value never spills out of the tile; app.js shrinks the font to fit */
.stat.c-green i { background: #e6f5ea; color: #1e7b34; } .stat.c-red i { background: #fdecef; color: #a32036; } .stat.c-blue i { background: #e2f4f7; color: #0f6674; } .stat.c-amber i { background: #fff5d6; color: #8a6400; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .9rem .5rem; text-align: center; color: var(--text); font-size: .82rem; font-weight: 500; }
.tile i { display: block; font-size: 1.5rem; color: var(--primary); margin-bottom: .45rem; }
.tile:hover { border-color: var(--primary); text-decoration: none; background: #fffafb; }
.section-title { color: var(--primary); font-weight: 600; margin: 1rem 0 .5rem; display: flex; align-items: center; gap: .4rem; }
.chart-box { position: relative; height: 240px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .4rem 0; border-bottom: 1px solid #f0f1f3; display: flex; gap: .5rem; align-items: center; }
.list-plain li:last-child { border: 0; }

/* timetable & sheets */
.tt-grid td { min-width: 130px; height: 62px; vertical-align: top; }
.tt-cell { font-size: .78rem; line-height: 1.25; }
.tt-cell b { display: block; color: var(--primary); }
.tt-cell select { width: 100%; font-size: .78rem; }
.status-btns { display: flex; gap: .2rem; flex-wrap: wrap; }
.status-btns button { border: 1px solid var(--border); background: #fff; border-radius: 4px; padding: .2rem .45rem; font: inherit; font-size: .78rem; cursor: pointer; font-weight: 600; }
.status-btns button.on { color: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.side-list { max-height: 70vh; overflow: auto; }
.side-list .item { padding: .5rem .6rem; border-bottom: 1px solid #f0f1f3; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
.side-list .item:hover, .side-list .item.active { background: var(--primary-light); }
.side-list .item .sub { color: var(--muted); font-size: .78rem; }
.profile-head { display: flex; gap: 1.2rem; align-items: center; }
.profile-head h1 { margin: 0; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.totals div { background: #fafbfc; border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem; }
.totals .l { color: var(--muted); font-size: .76rem; } .totals .v { font-weight: 700; font-size: 1.05rem; }
.print-only { display: none; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .3rem; }

/* toasts / modal */
.toasts { position: fixed; bottom: 1rem; inset-inline-end: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: #23272b; color: #fff; padding: .6rem .9rem; border-radius: 8px; box-shadow: var(--shadow); min-width: 220px; animation: fade .2s; }
.toast.ok { background: #1e7b34; } .toast.err { background: #a32036; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 3rem 1rem; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: min(900px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: fade .15s; }
.modal.sm { width: min(480px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1rem; max-height: 70vh; overflow: auto; }
.modal-foot { padding: .7rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid #eee; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 2rem; text-align: center; color: var(--muted); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.progress { height: 8px; background: #eef0f2; border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }

@media print {
  .topbar, .breadcrumb, .megamenu, .toasts, .no-print, .form-footer, .toolbar { display: none !important; }
  .main { padding: 0; } .card { box-shadow: none; border: 0; }
  .print-only { display: block; }
  body { background: #fff; }
}

/* ===== MoE registers (سجلات الوزارة) — official print layout ===== */
.moe-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 1rem; border-bottom: 2px solid #213467; padding-bottom: .5rem; margin-bottom: .75rem; font-size: .9rem; }
.moe-head .moe-side div { line-height: 1.5; } .moe-head .moe-side.end { text-align: end; }
.moe-head .moe-center { text-align: center; } .moe-head .moe-center img { height: 54px; } .moe-head .moe-center h2 { margin: .2rem 0; color: #ad1d37; font-size: 1.2rem; } .moe-head .moe-center .sub { color: var(--muted); font-size: .85rem; }
.moe-table { width: 100%; border-collapse: collapse; font-size: .8rem; } .moe-table th, .moe-table td { border: 1px solid #444; padding: .2rem .35rem; vertical-align: middle; } .moe-table th { background: #f1f3f6; font-weight: 600; text-align: center; } .moe-table td.num { text-align: center; }
.moe-table tfoot td { font-weight: 700; background: #fafafa; }
.moe-sign { display: flex; justify-content: space-between; margin-top: 2rem; font-size: .9rem; page-break-inside: avoid; } .moe-sign div { text-align: center; min-width: 160px; } .moe-sign div span { display: block; margin-top: 2.4rem; border-top: 1px solid #333; padding-top: .2rem; }
.moe-flag-under { background: #fde8ec !important; } .moe-flag-over { background: #fff4d6 !important; }
.moe-cert { max-width: 820px; margin: auto; padding: 2rem; border: 6px double #213467; font-size: 1.05rem; line-height: 2; page-break-after: always; }
.moe-cert h2 { text-align: center; color: #ad1d37; text-decoration: underline; margin: .5rem 0 1rem; } .moe-cert .serial { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); } .moe-cert b { color: #213467; }
.moe-cert .moe-sign { margin-top: 3rem; }
.doc-matrix td.ok { background: #e6f6ea; text-align: center; } .doc-matrix td.miss { background: #fde8ec; text-align: center; } .doc-matrix td.na { background: #f4f4f4; text-align: center; color: #bbb; } .doc-matrix input[type=checkbox] { transform: scale(1.1); cursor: pointer; }
.moe-kpis .stat .v { font-size: 1.5rem; }
@media print { .moe-table { font-size: .72rem; } .moe-head { margin-top: 0; } @page { size: A4 landscape; margin: 10mm; } .moe-cert-page { page: portrait; } }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .4rem; } .quick-links .quick { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border: 1px solid var(--border, #e3e6ea); border-radius: 8px; color: inherit; text-decoration: none; font-size: .88rem; } .quick-links .quick:hover { background: var(--primary-light, #fbeaed); border-color: var(--primary, #ad1d37); } .quick-links .quick i { color: #213467; width: 18px; text-align: center; }
/* QA20260913: invalid grade cells */
input.cell.invalid, .input.invalid { border-color: var(--danger, #a32036) !important; background: #fde8ec !important; }

/* =====================================================================================
   QuickBooks-style shell: dark left navigation, "+ New" quick-create, white top bar,
   green primary actions, blue links, calm gray canvas. Theme classes: body.theme-qb (default) / body.theme-rcs
   ===================================================================================== */
body.theme-qb { --primary: #2ca01c; --primary-dark: #248a17; --primary-light: #e6f4e4; --link: #0077c5; --accent: #393a3d; --navy: #393a3d; --nav-bg: #2b2c30; --nav-hover: #3a3b41; --nav-text: #d5d7dc; --nav-active: #ffffff; --bg: #f4f5f8; --border: #e3e5e8; --radius: 4px; --shadow: 0 1px 2px rgba(0,0,0,.06); }
body.theme-rcs { --primary: #ad1d37; --primary-dark: #8a1629; --primary-light: #fbe9ec; --link: #ad1d37; --accent: #213467; --navy: #213467; --nav-bg: #213467; --nav-hover: #2b437f; --nav-text: #d9def0; --nav-active: #ffffff; --radius: 6px; }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex-shrink: 0; background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; z-index: 60; transition: transform .2s ease; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: .85rem .9rem .6rem; color: #fff; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.sidebar .brand-logo { height: 38px; width: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.sidebar .brand:hover { text-decoration: none; }
.qb-new { padding: .4rem .9rem .8rem; position: relative; }
.btn-new { width: 100%; border: 0; border-radius: 22px; background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: .95rem; padding: .6rem 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btn-new:hover { background: var(--primary-dark); }
.qb-new-menu { position: fixed; top: 108px; inset-inline-start: 250px; z-index: 90; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: .9rem 1rem; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 1rem; min-width: 640px; }
.qb-new-menu h5 { margin: 0 0 .35rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.qb-new-menu a { display: block; padding: .32rem .35rem; border-radius: 4px; color: var(--text); font-size: .88rem; }
.qb-new-menu a:hover { background: var(--bg); color: var(--link); text-decoration: none; }
.sidebar .modules { display: flex; flex-direction: column; gap: 1px; padding: .2rem .5rem; flex: 1; overflow: visible; }
.sidebar .modules a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 6px; color: var(--nav-text); font-weight: 500; font-size: .92rem; border-inline-start: 3px solid transparent; }
.sidebar .modules a i { width: 18px; text-align: center; font-size: .95rem; opacity: .9; }
.sidebar .modules a:hover { background: var(--nav-hover); color: var(--nav-active); text-decoration: none; }
.sidebar .modules a.active { background: var(--nav-hover); color: var(--nav-active); border-inline-start-color: var(--primary); }
.sidebar .modules .nav-more { display: none !important; }
.sidebar-foot { padding: .6rem .9rem .9rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .icon-btn { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.sidebar-foot .icon-btn:hover { background: var(--nav-hover); }
.sidebar-foot .muted { color: rgba(255,255,255,.45); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .75rem; height: 56px; padding: 0 1.2rem; background: #fff; border-bottom: 1px solid var(--border); box-shadow: none; }
.topbar .breadcrumb { padding: 0; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: .9rem; }
.topbar .breadcrumb a { color: var(--link); } .topbar .breadcrumb span:last-child { color: var(--text); font-weight: 600; }
.global-search { border-radius: 4px; background: #fff; border: 1px solid #c8cbd0; }
.global-search:focus-within { border-color: var(--link); box-shadow: 0 0 0 2px rgba(0,119,197,.15); }
.icon-btn.help { color: var(--muted); border: 0; font-size: 1.15rem; }
.user-menu .avatar-initial { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.megamenu { position: fixed; top: 0; left: auto; transform: none; inset-inline-start: 236px; width: min(920px, calc(100vw - 236px)); max-height: 100vh; height: 100vh; overflow: auto; border-radius: 0; border: 0; border-inline-end: 1px solid var(--border); box-shadow: 12px 0 30px rgba(0,0,0,.12); padding: 1.2rem 1.4rem; z-index: 58; background: #fff; }
.megamenu .group h4 i { background: var(--primary); }
.megamenu .group a { color: var(--text); } .megamenu .group a:hover { color: var(--link); background: var(--bg); }
.megamenu-backdrop { background: rgba(0,0,0,.18); z-index: 55; }
.main { padding: 1.1rem 1.4rem 2.5rem; }
a { color: var(--link); }
.btn { border-radius: 4px; font-weight: 600; }
.btn-primary { background: var(--primary); border-color: var(--primary); } .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline, .btn-secondary { color: var(--primary); border-color: var(--primary); background: #fff; }
.card { border-radius: var(--radius); box-shadow: var(--shadow); }
.page-head { margin-bottom: 1rem; } .page-head h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); } .page-head h1 i { color: var(--muted); font-size: 1rem; }
.section-title { color: var(--text); font-size: 1.05rem; }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 700; }
.table th { background: #fff; color: #6b6c72; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; border-bottom: 2px solid var(--border); }
.table tbody tr:hover td { background: #f7f9fb; }
.table th.sortable:hover { color: var(--link); }
.badge { border-radius: 3px; font-weight: 600; }
.stat { border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.stat i { background: var(--primary-light); color: var(--primary); border-radius: 8px; }
.stat .v { font-size: 1.55rem; font-weight: 700; color: var(--text); } .stat .l { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tile { border-radius: var(--radius); } .tile i { color: var(--primary); } .tile:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); border-color: var(--primary); }
.search-box button { background: var(--primary); }
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--link) !important; box-shadow: 0 0 0 2px rgba(0,119,197,.15); outline: 0; }
.nav-toggle { display: none; }
/* drawer on narrow screens */
@media (max-width: 1000px) {
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; transform: translateX(-100%); height: 100vh; }
  html[dir=rtl] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 59; }
  .nav-toggle { display: inline-flex; border: 0; background: transparent; font-size: 1.25rem; cursor: pointer; color: var(--text); }
  .megamenu { inset-inline-start: 0; width: 100vw; }
  .qb-new-menu { position: fixed; inset-inline-start: .5rem; inset-inline-end: .5rem; top: 110px; min-width: 0; grid-template-columns: 1fr 1fr; }
  .sidebar .modules { display: flex; position: static; box-shadow: none; background: transparent; padding: .2rem .5rem; }
  .sidebar .modules a { font-size: .95rem; }
}
@media print { .sidebar, .sidebar-backdrop, .topbar, .qb-new-menu { display: none !important; } .shell { display: block; } }

/* ===== Finance overview (QuickBooks-style cards) ===== */
.qb-card .card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.qb-big { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: .2rem 0 .5rem; } .qb-big.pos { color: #1e7b34; } .qb-big.neg { color: #a32036; }
.qb-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #eef0f2; gap: 2px; } .qb-seg.ok { background: var(--primary); } .qb-seg.due { background: #e8a33d; }
.qb-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; color: var(--muted); margin-top: .4rem; } .qb-legend b { color: var(--text); margin-inline-end: .2rem; }
.pos { color: #1e7b34; } .neg { color: #a32036; }
.totals .v.neg { color: #a32036; }

/* ===== Classic (Winix-like) layout: top module bar + centred mega-menu, red RCS colours. Selected with setting ui_theme = classic ===== */
body.theme-classic { --primary: #ad1d37; --primary-dark: #8a1629; --primary-light: #fbe9ec; --link: #ad1d37; --accent: #213467; --navy: #213467; --bg: #f4f5f7; --border: #e3e6ea; --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.04); }
body.theme-classic .shell { display: block; }
body.theme-classic .sidebar { position: sticky; top: 0; width: auto; height: 56px; flex-direction: row; align-items: center; gap: .75rem; padding: 0 .9rem; background: #fff; color: var(--text); border-bottom: 3px solid var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); overflow: visible; z-index: 50; }
body.theme-classic .sidebar .brand { padding: 0; color: var(--primary); font-size: 1rem; } body.theme-classic .sidebar .brand-logo { height: 40px; background: transparent; padding: 0; border-radius: 0; }
@media (max-width: 1250px) { body.theme-classic .sidebar .brand #brandName { display: none; } }
body.theme-classic .qb-new { display: none; }
body.theme-classic .sidebar .modules { flex-direction: row; gap: .1rem; padding: 0; flex: 1; min-width: 0; overflow: hidden; align-items: center; }
body.theme-classic .sidebar .modules a { padding: .45rem clamp(.35rem, .6vw, .7rem); border: 0; border-radius: 6px; color: var(--text); font-weight: 500; white-space: nowrap; font-size: clamp(.8rem, .85vw, .95rem); gap: .35rem; }
body.theme-classic .sidebar .modules a i { display: none; } body.theme-classic .sidebar .modules a[data-mod=dashboard] i { display: inline-block; } body.theme-classic .sidebar .modules a[data-mod=dashboard] span { display: none; }
body.theme-classic .sidebar .modules a:hover, body.theme-classic .sidebar .modules a.active { background: var(--primary-light); color: var(--primary); }
body.theme-classic .sidebar .modules .nav-more:not([hidden]) { display: block !important; }
body.theme-classic .sidebar-foot { border: 0; padding: 0; } body.theme-classic .sidebar-foot .muted { display: none; } body.theme-classic .sidebar-foot .icon-btn { color: var(--primary); border-color: var(--border); background: #fff; }
body.theme-classic .sidebar .topbar-right { margin-inline-start: 0; } body.theme-classic .sidebar .nav-toggle { color: var(--text); }
body.theme-classic .content .topbar { height: 56px; min-height: 56px; padding: 0 1.2rem; background: #fff; border: 0; border-bottom: 1px solid #d5dbe3; position: sticky; top: 56px; box-shadow: none; }   /* the second bar, under the modules bar (QuickBooks Desktop layout) */
body.theme-classic .content .topbar .breadcrumb { color: var(--primary); font-size: .85rem; } body.theme-classic .content .topbar .breadcrumb span:last-child { color: var(--muted); font-weight: 400; }
body.theme-classic .megamenu { position: fixed; top: 55px; left: 50% !important; right: auto !important; transform: translateX(-50%); width: min(1100px, 96vw); max-height: calc(100vh - 80px); height: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; overflow: auto; }
body.theme-classic .megamenu .group h4 i { background: var(--navy); } body.theme-classic .megamenu .group a { color: var(--primary); } body.theme-classic .megamenu .group a:hover { background: var(--primary-light); }
body.theme-classic .megamenu-backdrop { background: transparent; }
body.theme-classic .main { padding: .75rem 1.2rem 2rem; }
body.theme-classic .page-head h1 { color: var(--navy); font-size: 1.35rem; } body.theme-classic .page-head h1 i { color: var(--navy); }
body.theme-classic .table th { background: #fafbfc; color: #444; font-size: inherit; letter-spacing: 0; text-transform: none; border-bottom: 1px solid #eef0f2; }
body.theme-classic .stat i { color: var(--primary); background: var(--primary-light); } body.theme-classic .stat .l { text-transform: none; letter-spacing: 0; }
body.theme-classic .badge { border-radius: 12px; } body.theme-classic .btn { border-radius: 6px; }
body.theme-classic .user-menu .avatar-initial { background: var(--navy); }
@media (max-width: 1000px) {
  body.theme-classic .sidebar { position: sticky; transform: none !important; height: 56px; inset-inline-start: auto; }
  body.theme-classic .sidebar .modules { display: none; position: absolute; top: 56px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: .5rem; box-shadow: var(--shadow); overflow: visible; }
  body.theme-classic .sidebar .modules.open { display: flex; }
  body.theme-classic .sidebar .modules a i { display: inline-block; }
  body.theme-classic .sidebar .nav-toggle { display: inline-flex; }
  body.theme-classic .content .topbar .global-search { display: none; }
  body.theme-classic .sidebar-backdrop { display: none !important; }
}

/* ===== Login (QuickBooks-style in theme-qb; classic keeps the card) ===== */
body.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
body.login-body.theme-qb { background: #f4f5f8; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.08); width: 100%; max-width: 440px; padding: 2rem 2.2rem 1.6rem; }
.login-brand { text-align: center; margin-bottom: 1.2rem; } .login-brand h1 { font-size: 1.45rem; color: var(--text); margin: .5rem 0 .1rem; } .login-brand .sub { color: var(--muted); font-size: .88rem; }
.login-card label { display: block; font-size: .85rem; font-weight: 600; color: #4a4b50; margin: .8rem 0 .3rem; }
.login-card .input { width: 100%; padding: .7rem .8rem; font-size: 1rem; border-radius: 4px; }
.login-card .btn-block { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; margin-top: 1.1rem; border-radius: 4px; }
/* QA-tester 2026-09-18: on a 390px phone the Google button's long label pushed the card past the viewport */
.login-card { box-sizing: border-box; width: 100%; max-width: 440px; }   /* keep the card at its designed width — max-width:100% here stretched it across the whole screen */
.login-card .input, .login-card .btn-block { box-sizing: border-box; max-width: 100%; }
.login-card .btn-block { white-space: normal; text-align: center; line-height: 1.35; }
@media (max-width: 420px) { body.login-body { padding: .6rem; } .login-card { padding: 1.4rem 1.1rem 1.2rem; } .login-card .btn-block { font-size: .95rem; } }
.login-card .or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: 1rem 0 .4rem; } .login-card .or::before, .login-card .or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.login-card .links { display: flex; justify-content: space-between; font-size: .82rem; margin-top: 1rem; } .login-card .links a { color: var(--link); }
.login-card .error-box { background: #fdecef; color: #a32036; border: 1px solid #f5c2c7; border-radius: 4px; padding: .5rem .7rem; margin-top: .8rem; font-size: .88rem; }
.login-foot { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 1.2rem; }
body.login-body.theme-classic .login-card { border-top: 4px solid var(--primary); }
.tile { position: relative; } .tile .tile-badge { position: absolute; top: 6px; inset-inline-end: 6px; }
.ess-tiles .tile i { color: var(--primary); }

/* ---- Report builder (Winix-like) ---- */
.rh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem 2rem; }
.rh-col h3 { font-size: 1rem; margin: 0 0 .4rem; color: var(--text); font-weight: 700; }
.rh-col ul { list-style: none; margin: 0; padding: 0 .8rem; } .rh-col li { padding: .18rem 0; display: flex; align-items: center; gap: .4rem; } .rh-col li a { color: var(--primary); }
.rh-col li .btn-sm { padding: 0 .3rem; opacity: .5; } .rh-col li:hover .btn-sm { opacity: 1; }
.rb-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; } @media (max-width: 900px) { .rb-top { grid-template-columns: 1fr; } }
.rb-h { margin: 0 0 .6rem; font-size: .95rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.rb-pick { margin-top: 1rem; } .rb-row { display: grid; grid-template-columns: 140px 1fr 220px; gap: .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px dashed var(--border); }
.rb-row:last-child { border-bottom: 0; } .rb-row > label { font-weight: 700; color: var(--muted); } .rb-row .chips { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 1.6rem; }
.rb-row .chip { display: inline-flex; align-items: center; gap: .25rem; background: #eef1f6; border-radius: 4px; padding: .1rem .45rem; font-size: .82rem; }
.rb-row .chip .x { cursor: pointer; color: var(--muted); margin-inline-start: .2rem; } .rb-row .chip .x:hover { color: var(--danger, #c0392b); }
.rb-row .chip button { border: 0; background: transparent; cursor: pointer; padding: 0 .15rem; color: var(--muted); font-size: .9rem; } .rb-row .chip button:hover { color: var(--primary); }
@media (max-width: 900px) { .rb-row { grid-template-columns: 1fr; } }
.rb-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; justify-content: center; } .rb-actions .btn { min-width: 110px; }
.rb-out { min-height: 120px; } .rb-title { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .5rem; } .rb-title h2 { margin: 0; font-size: 1.1rem; }
.rb-table tr.rb-group td { background: #e9eef7; font-weight: 700; } .rb-table tr.rb-subtotal td, .rb-table tr.rb-total td { font-weight: 700; background: #f5f6f8; }
.rb-table.rb-style-striped tbody tr:nth-child(even) td { background: #fafbfc; } .rb-table.rb-style-compact td, .rb-table.rb-style-compact th { padding: .15rem .35rem; }
.rb-table.rb-style-bordered td, .rb-table.rb-style-bordered th { border: 1px solid #aab; } .rb-table.rb-nofit { width: auto; }
.rb-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; } .rb-page { border: 1px solid var(--border); border-radius: 6px; padding: .7rem; page-break-inside: avoid; }
.rb-page dl { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .8rem; margin: 0; } .rb-page dt { color: var(--muted); } .rb-page dd { margin: 0; }
.rb-chart { max-width: 900px; margin: 1rem auto 0; } .lock-banner { background: #fff7e6; border: 1px solid #f3d9a4; color: #8a5a00; padding: .5rem .8rem; border-radius: 4px; margin-bottom: .6rem; }
@media print { .rb-top, .rb-pick, .rb-actions, .page-head .actions-bar { display: none !important; } }

/* R9 */
.year-switch { max-width: 130px; font-weight: 600; }
.profile-switch { max-width: 160px; height: 30px; padding: 0 .3rem; font-size: .8rem; margin-inline-end: .5rem; }
.exam-row { padding: .3rem 0; border-bottom: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
body.theme-classic .sidebar .profile-switch { max-width: 100%; margin: .3rem 0; }

.rb-nomap td:first-child { border-inline-start: 3px solid var(--warning, #c77700); }

/* ---- QuickBooks Desktop mode ---- */
body.theme-qbdesktop { --qbd-blue: #2e6db4; --qbd-dark: #1f3b5c; --qbd-gray: #e9edf2; background: #f1f3f6; }
@media (min-width: 1001px) { body.theme-qbdesktop .sidebar, body.theme-qbdesktop .sidebar-backdrop, body.theme-qbdesktop #navToggle { display: none !important; } }
/* narrow screens: the ERP module drop-downs leave the menu bar and the full navigation is reached through the hamburger drawer (sidebar + mega-menu) */
@media (max-width: 1000px) {
  body.theme-qbdesktop .qbd-mods { display: none; }
  body.theme-qbdesktop .sidebar { z-index: 1300; } body.theme-qbdesktop .sidebar-backdrop { z-index: 1299; } body.theme-qbdesktop .megamenu { z-index: 1301; } body.theme-qbdesktop .megamenu-backdrop { z-index: 1298; }
}
body.theme-qbdesktop .shell { padding-top: 0; } body.theme-qbdesktop .content { margin-inline-start: 0 !important; width: 100%; }
body.theme-qbdesktop .topbar { background: #fff; border-bottom: 1px solid #d5dbe3; }
#qbdBar { position: sticky; top: 0; z-index: 1200; font-family: 'Segoe UI', Inter, Tahoma, sans-serif; }
.qbd-menubar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; background: #f7f8fa; border-bottom: 1px solid #c9d1db; padding: 0 .4rem; min-height: 30px; font-size: 13px; }
.qbd-brand { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--qbd-dark); margin-inline-end: 1rem; } .qbd-brand img { height: 20px; }
@media (max-width: 1500px) { .qbd-brand b { display: none; } .qbd-brand { margin-inline-end: .4rem; } }
.qbd-sep { width: 1px; height: 18px; background: #b9c2ce; margin: 0 .35rem; }
/* ERP module drop-downs (built from App.meta.nav): group headers + every item, balanced columns, scroll when taller than the screen.
   The module menus form one block that moves to a second menu-bar row as a whole when the screen is too narrow for a single row. */
.qbd-mods { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.qbd-mod > button { padding: .3rem .5rem; } .qbd-mod > button i { color: var(--qbd-blue); font-size: 11px; margin-inline-end: .15rem; } .qbd-mod > button:hover i, .qbd-mod.open > button i { color: #fff; }
.qbd-dd-mod { --cw: 225px; width: calc(var(--cols) * var(--cw) + (var(--cols) + 1) * .9rem); max-width: calc(100vw - 12px); max-height: calc(100vh - 70px); overflow: auto; column-count: var(--cols); column-gap: .9rem; padding: .5rem .9rem .6rem; }
.qbd-grp { break-inside: avoid; -webkit-column-break-inside: avoid; padding-bottom: .5rem; }
.qbd-grp h5 { margin: .25rem 0 .2rem; padding: 0 .3rem .2rem; font-size: 11.5px; font-weight: 700; color: var(--qbd-dark); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid #e3e7ee; display: flex; align-items: center; gap: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbd-grp h5 i { color: var(--qbd-blue); font-size: 10px; width: 12px; text-align: center; }
.qbd-dd-mod a { padding: .25rem .5rem; overflow: hidden; text-overflow: ellipsis; border-radius: 2px; }
.qbd-menu { position: relative; } .qbd-menu > button { border: 0; background: transparent; padding: .3rem .6rem; cursor: pointer; font: inherit; color: #222; border-radius: 3px; } .qbd-menu > button:hover, .qbd-menu.open > button { background: var(--qbd-blue); color: #fff; }
.qbd-dd { display: none; position: absolute; top: 100%; inset-inline-start: 0; background: #fff; border: 1px solid #b9c2ce; box-shadow: 0 8px 20px rgba(0,0,0,.15); min-width: 240px; padding: .25rem 0; z-index: 50; } .qbd-menu.open .qbd-dd { display: block; }
.qbd-dd a { display: block; padding: .35rem .9rem; color: #222; text-decoration: none; white-space: nowrap; } .qbd-dd a:hover { background: var(--qbd-blue); color: #fff; } .qbd-dd hr { border: 0; border-top: 1px solid #e3e7ee; margin: .25rem 0; }
.qbd-iconbar { display: flex; align-items: stretch; gap: 2px; background: linear-gradient(#ffffff, #e6eaf0); border-bottom: 1px solid #b9c2ce; padding: .2rem .5rem; overflow-x: auto; }
.qbd-iconbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: .25rem .4rem; color: #1f2d3d; text-decoration: none; font-size: 11px; border-radius: 4px; gap: 3px; } .qbd-iconbar a i { font-size: 18px; color: var(--qbd-blue); } .qbd-iconbar a:hover { background: #d9e4f3; }
.qbd-iconbar .sep { width: 1px; background: #c3ccd7; margin: .3rem .3rem; }
.qbd-home { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; } @media (max-width: 1000px) { .qbd-home { grid-template-columns: 1fr; } }
.qbd-panel { background: #fff; border: 1px solid #cfd6df; border-radius: 6px; margin-bottom: 1rem; overflow: hidden; } .qbd-panel h3 { margin: 0; padding: .45rem .8rem; background: var(--qbd-dark); color: #fff; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; }
.qbd-panel.customers h3 { background: #2e6db4; } .qbd-panel.vendors h3 { background: #7a5c2e; } .qbd-panel.employees h3 { background: #3d7a4f; } .qbd-panel.banking h3 { background: #4d5f7a; } .qbd-panel.company h3 { background: #6b4c8a; } .qbd-panel.side { padding-bottom: .5rem; } .qbd-panel.side h4 { margin: .6rem .8rem .2rem; } .qbd-panel.side ul, .qbd-panel.side table { margin: .3rem .8rem; }
.qbd-flow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .8rem; }
.qbd-ic { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 112px; height: 78px; border: 1px solid #d5dbe3; border-radius: 6px; background: linear-gradient(#fff, #f2f5f9); text-decoration: none; color: #1f2d3d; font-size: 12px; text-align: center; gap: 6px; } .qbd-ic i { font-size: 22px; color: var(--qbd-blue); } .qbd-ic:hover { border-color: var(--qbd-blue); background: #eaf1fb; }
.qbd-arrow { color: #8a97a8; font-size: 18px; }
.qbd-center { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; min-height: 70vh; } @media (max-width: 900px) { .qbd-center { grid-template-columns: 1fr; } }
.qbd-list { background: #fff; border: 1px solid #cfd6df; border-radius: 6px; display: flex; flex-direction: column; max-height: 82vh; } .qbd-list-head { padding: .6rem; border-bottom: 1px solid #e3e7ee; display: flex; flex-direction: column; gap: .4rem; } .qbd-list-head h3 { margin: 0; }
.qbd-names { overflow: auto; } .qbd-name { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem .7rem; text-decoration: none; color: #1f2d3d; border-bottom: 1px solid #f0f2f5; font-size: .85rem; } .qbd-name.job { padding-inline-start: 1.6rem; } .qbd-name:hover { background: #eaf1fb; } .qbd-name.active { background: var(--qbd-blue); color: #fff; } .qbd-name .due { color: #b8322f; font-weight: 600; } .qbd-name.active .due { color: #ffd9d7; }
.qbd-detail { background: #fff; border: 1px solid #cfd6df; border-radius: 6px; padding: 1rem; } .qbd-info { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; } .qbd-bal { text-align: end; } .qbd-bal .l { color: #6b7684; font-size: .75rem; } .qbd-bal .v { font-size: 1.5rem; font-weight: 700; } .qbd-bal .v.due { color: #b8322f; }
.qbd-form { max-width: 1100px; margin: auto; } .qbd-form-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 2px solid var(--qbd-blue); padding-bottom: .4rem; margin-bottom: .8rem; } .qbd-form-head h2 { margin: 0; color: var(--qbd-dark); }
.qbd-head { background: #f7f9fc; border: 1px solid #e3e7ee; border-radius: 6px; padding: .8rem; } .qbd-grid .cell { width: 100%; border: 1px solid #d5dbe3; border-radius: 3px; padding: .25rem .4rem; font: inherit; } .qbd-total { font-size: 1.05rem; } .qbd-total b { font-size: 1.25rem; }
.qbd-coa tr.grp td { background: #f5f7fa; } .print-only { display: none; } @media print { .print-only { display: block; } #qbdBar, .topbar, .no-print { display: none !important; } }

/* ---- global loading indicator + skeleton + table pager ---- */
#loadingOverlay { position: fixed; inset: 0; z-index: 9000; background: rgba(20, 30, 45, .28); backdrop-filter: blur(1.5px); display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease-out; }
#loadingOverlay[hidden] { display: none; }
.loader-card { background: #fff; border-radius: 12px; padding: 1.4rem 2.2rem; min-width: 280px; box-shadow: 0 18px 50px rgba(0,0,0,.28); text-align: center; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.loader-card img { height: 46px; } .loader-txt { color: var(--muted); font-size: .9rem; letter-spacing: .02em; }
.loader-bar { width: 220px; height: 6px; border-radius: 6px; background: #e6ebf2; overflow: hidden; position: relative; }
.loader-bar span { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #2e6db4); animation: loaderSlide 1.1s cubic-bezier(.4,0,.2,1) infinite; }
@keyframes loaderSlide { 0% { left: -40%; } 100% { left: 100%; } } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.skeleton { padding: 1.2rem; } .sk-line { height: 14px; border-radius: 6px; margin: .7rem 0; background: linear-gradient(90deg, #e9edf2 25%, #f5f7fa 37%, #e9edf2 63%); background-size: 400% 100%; animation: skShine 1.3s ease infinite; } .sk-line.w40 { width: 40%; height: 22px; } .sk-line.w70 { width: 70%; } .sk-line.w90 { width: 90%; }
@keyframes skShine { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.tpager { display: flex; align-items: center; gap: .35rem; padding: .45rem .3rem; font-size: .82rem; border-top: 1px solid var(--border); } .tpager .grow { flex: 1; } .tpager .tpsize { width: auto; padding: .1rem .3rem; height: 28px; } .tpager .btn-sm { padding: .15rem .45rem; }
.qbd-names .tpager { padding: .4rem .6rem; position: sticky; bottom: 0; background: #fff; }


.theme-switch { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: .3rem 0; padding: .3rem 0; } .theme-switch-title { padding: .2rem .9rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; } .theme-switch a.on { font-weight: 700; color: var(--primary); }

/* Codex QA: a report refreshing after "Show" — the previous figures are dimmed and marked busy until the new ones arrive */
#out.is-loading { opacity: .35; pointer-events: none; position: relative; transition: opacity .15s; }
#out.is-loading::after { content: ''; position: absolute; top: 40px; left: 50%; width: 28px; height: 28px; margin-left: -14px; border: 3px solid var(--border, #ddd); border-top-color: var(--primary, #ad1d37); border-radius: 50%; animation: out-spin .7s linear infinite; }
@keyframes out-spin { to { transform: rotate(360deg); } }

/* ===== Codex QA round 3 — U1: no horizontal page overflow on phones / tablets (360, 390, 768 px; English + Arabic; all three themes) =====
   The top bar was the source: .topbar-right / #userMenu with the full user name could not shrink, so the body grew to ~450px on a 390px phone.
   Now the bar's right side may shrink, the user name is ellipsised on tablets and hidden on phones (the avatar initial + caret still open the
   drop-down with My Info / theme / logout), and the year switch keeps a usable width. A few page widgets that refused to wrap are relaxed too. */
.topbar-right { min-width: 0; } .dropdown a.only-narrow { display: none; }
.user-menu { min-width: 0; } .user-menu #userName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 1000px) {
  .topbar { gap: .4rem; padding-inline: .6rem; }
  .topbar .breadcrumb { flex: 1 1 0; }
  .topbar-right { flex: 0 1 auto; gap: .3rem; }
  .user-menu { flex: 0 1 auto; } .user-menu #userName { max-width: 140px; } .user-menu .avatar-initial { flex: 0 0 30px; }
  .year-switch { flex: 0 0 auto; width: auto; min-width: 92px; max-width: 120px; margin-inline-end: .2rem; }
  .profile-switch:not(.year-switch) { flex: 0 1 auto; min-width: 70px; max-width: 110px; margin-inline-end: .2rem; }
  .dropdown { max-width: calc(100vw - 1rem); }
  body.theme-classic .sidebar { gap: .4rem; padding: 0 .6rem; max-width: 100vw; }
  body.theme-classic .sidebar .brand { flex: 0 0 auto; }
  body.theme-classic .sidebar .topbar-right { margin-inline-start: auto; flex: 0 1 auto; }
  body.theme-classic .sidebar .profile-switch { margin: 0; margin-inline-end: .2rem; }
  body.theme-classic .content .topbar .year-switch { max-width: 120px; }
}
@media (max-width: 600px) {
  .user-menu #userName { display: none; }
  .user-menu { padding: .3rem .25rem; gap: .25rem; }
  .topbar .icon-btn.help, body.theme-classic .content .topbar .icon-btn.help { padding: .35rem .3rem; }
  .year-switch { min-width: 84px; max-width: 104px; font-size: .78rem; }
  body.theme-classic .sidebar .brand-logo { height: 34px; }
  body.theme-classic .sidebar-foot .icon-btn { padding: .3rem .45rem; }
  .user-menu { flex: 0 0 auto; }
  body.theme-classic .content .topbar .year-switch { min-width: 78px; max-width: 96px; }
  body.theme-classic .sidebar, body.theme-classic .sidebar .topbar-right { gap: .25rem; }
  /* page widgets that would not wrap: long status badges / links, and the QuickBooks-Desktop home grid whose 1fr columns grew with their content */
  .main { min-width: 0; } .main .badge { white-space: normal; max-width: 100%; } .main a, .main .muted, .main .small { overflow-wrap: anywhere; }
}
@media (max-width: 1000px) { .qbd-home { grid-template-columns: minmax(0, 1fr); } .qbd-col { min-width: 0; } .qbd-panel.side table { display: block; max-width: calc(100% - 1.6rem); overflow-x: auto; } }
@media (max-width: 420px) { .topbar .icon-btn.help, body.theme-classic .content .topbar .icon-btn.help { display: none; } .dropdown a.only-narrow { display: block; } body.theme-classic .sidebar { padding: 0 .4rem; } body.theme-classic .sidebar .brand-logo { height: 30px; } /* the User Guide link moves into the user drop-down (a.only-narrow, added in app.js) */ }
/* Codex QA round 3 (U1, seen while checking the phone layout): in the classic theme the breadcrumb row (.content .topbar, a flex item with z-index 50) painted over the open user drop-down of the module bar */
body.theme-classic .content .topbar { z-index: 40; }
/* the year switch keeps "2026 - 2027" readable on phones */
@media (max-width: 600px) { .year-switch { min-width: 112px; max-width: 124px; font-size: .74rem; padding: 0 .1rem; } body.theme-classic .content .topbar .year-switch { min-width: 94px; max-width: 98px; font-size: .7rem; padding: 0; } }
@media (max-width: 600px) { .grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; } }   /* grid cards (charts) may shrink below their content width */
@media (max-width: 340px) { body.theme-classic .content .topbar .year-switch { min-width: 84px; max-width: 88px; } body.theme-classic .sidebar, body.theme-classic .sidebar .topbar-right { gap: .15rem; } }

/* Codex QA 0430 (P2): parent portal overflow at 390 / 1280 — the student header could not wrap (fee totals had a fixed 300px), a child button
   with a long name + level + remaining badge kept its content width, and a grid card with a wide table pushed the page wider than the screen. */
.profile-head { flex-wrap: wrap; min-width: 0; }
.profile-head > div { min-width: 0; }
.profile-head .portal-totals { flex: 1 1 260px; min-width: 0; margin-inline-start: auto; }
.profile-head .portal-totals > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#kids { min-width: 0; }
#kids .kid { max-width: 100%; white-space: normal; text-align: start; line-height: 1.3; }
#kids .kid .badge { white-space: nowrap; }
.grid > .card, .grid > div { min-width: 0; }
.card .table-wrap, .card > table { max-width: 100%; overflow-x: auto; }
@media (max-width: 480px) { .profile-head { gap: .8rem; } .profile-head h2 { font-size: 1.15rem; word-break: break-word; } .profile-head .portal-totals { flex-basis: 100%; margin-inline-start: 0; } }

/* X-ERP branding (owner 2026-09-22): the product mark is the square X icon; the school crest stays on the public / printed pages */
.sidebar .brand-logo, body.theme-classic .sidebar .brand-logo { height: 36px; width: 36px; border-radius: 9px; background: transparent; padding: 0; object-fit: cover; }
.brand-logo { border-radius: 9px; }
.loader-card img { height: 52px; width: 52px; border-radius: 12px; }
.login-logo.login-logo-x { width: 96px; height: 96px; max-width: none; border-radius: 22px; margin: 0 auto .35rem; box-shadow: 0 6px 18px rgba(200,16,46,.25); }
.login-product { text-align: center; font-weight: 800; font-size: 1.5rem; letter-spacing: .06em; color: #c8102e; margin-bottom: .35rem; }
/* the school crest is the page background of the sign-in screen: full-screen, faint, behind the card (owner 2026-09-22) */
.login-body { position: relative; isolation: isolate; }
/* owner 2026-09-22: the school crest sits above the X-ERP mark inside the sign-in card */
.login-school-logo { display: block; max-width: 230px; height: auto; margin: 0 auto .9rem; }
.login-logo.login-logo-x { width: 72px; height: 72px; border-radius: 17px; }
@media (max-width: 420px) { .login-school-logo { max-width: 190px; } }
.login-card { position: relative; z-index: 1; }

/* owner 2026-09-22: in the Classic theme the search box, the year switch and the user menu look exactly like QuickBooks Desktop's
   (light pill with a green initial, full name, quiet borders) instead of the Classic red-bordered controls; the phone sizing rules above stay */
body.theme-classic .content .topbar .global-search { background: #fff; border: 1px solid #c8cbd0; border-radius: 4px; color: #6b6c72; }
body.theme-classic .content .topbar .global-search:focus-within { border-color: #0077c5; box-shadow: 0 0 0 2px rgba(0,119,197,.15); }
body.theme-classic .content .topbar .year-switch { border: 1px solid #c8cbd0; border-radius: 4px; background: #fff; color: var(--text); font-weight: 600; }
body.theme-classic .content .topbar .icon-btn.help { color: #6b6c72; border: 0; background: transparent; }
body.theme-classic .sidebar-foot .icon-btn { border: 1px solid #c8cbd0; color: var(--text); background: #fff; border-radius: 4px; }
body.theme-classic .content .topbar .user-menu { background: #f3f5f8; border-radius: 8px; color: var(--text); }
body.theme-classic .content .topbar .user-menu:hover { background: #e9ecf1; }
body.theme-classic .content .topbar .user-menu .avatar-initial { background: #2ca01c; border-radius: 50%; flex: 0 0 auto; }
body.theme-classic .content .topbar .user-menu .fa-caret-down { color: #6b6c72; }
body.theme-classic .dropdown { border-radius: 8px; min-width: 210px; padding: .4rem; }
body.theme-classic .dropdown a { color: var(--text); font-weight: 500; }
body.theme-classic .dropdown a:hover { background: #f3f5f8; }
body.theme-classic .theme-switch a.on { color: #2ca01c; }
@media (min-width: 1001px) {
  body.theme-classic .content .topbar .global-search { padding: .3rem .7rem; } body.theme-classic .content .topbar .global-search input { width: clamp(110px, 12vw, 200px); }
  body.theme-classic .content .topbar .year-switch { max-width: 150px; padding: .35rem .5rem; }
  body.theme-classic .content .topbar .icon-btn.help { font-size: 1.15rem; }
  body.theme-classic .content .topbar .user-menu { padding: .3rem .6rem .3rem .35rem; gap: .5rem; flex: 0 0 auto; max-width: 240px; }
  body.theme-classic .content .topbar .user-menu .avatar-initial { width: 30px; height: 30px; }
  body.theme-classic .content .topbar .user-menu #userName { max-width: 150px; font-weight: 500; }
}
