/* BWT Finance — Fluent / Dynamics 365 inspired theme
   Navy app bar, light-gray site map with collapsible areas, page header with a flat command bar, dense grids, 2px radii, Segoe UI. */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

:root {
  --navy: #002050; --navy-2: #0b3a74; --accent: #0078d4; --accent-h: #106ebe; --accent-d: #005a9e; --accent-l: #deecf9; --accent-ll: #eff6fc;
  --green: #107c10; --green-l: #dff6dd; --green-d: #0b6a0b; --gold: #c19c00; --gold-l: #fff4ce; --gold-d: #8a6d00;
  --red: #a4262c; --red-l: #fde7e9; --orange: #ca5010;
  --bg: #faf9f8; --surface: #ffffff; --nav: #f3f2f1; --line: #edebe9; --line-2: #c8c6c4; --line-3: #8a8886;
  --text: #201f1e; --text-2: #323130; --muted: #605e5c; --muted-2: #a19f9d;
  --shadow-2: 0 1.6px 3.6px rgba(0,0,0,.13), 0 .3px .9px rgba(0,0,0,.11); --shadow-8: 0 3.2px 7.2px rgba(0,0,0,.13), 0 .6px 1.8px rgba(0,0,0,.11); --shadow-16: 0 6.4px 14.4px rgba(0,0,0,.13), 0 1.2px 3.6px rgba(0,0,0,.11); --shadow-64: 0 25.6px 57.6px rgba(0,0,0,.22), 0 4.8px 14.4px rgba(0,0,0,.18);
  --radius: 2px; --sidebar: 232px; --appbar: 48px;
  /* legacy aliases used by page scripts */
  --green-dd: #0b6a0b; --blue: #0078d4; --blue-l: #deecf9; --sand: #faf9f8; --card: #ffffff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Segoe UI', 'Cairo', Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; direction: rtl; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.num, td.num, th.num, .mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.ltr { direction: ltr; unicode-bidi: embed; }
::selection { background: var(--accent-l); }

/* ---------- app bar ---------- */
.appbar { position: fixed; top: 0; inset-inline: 0; height: var(--appbar); background: var(--navy); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 12px; z-index: 30; box-shadow: var(--shadow-8); }
.appbar .waffle { width: 40px; height: 40px; border: 0; background: transparent; color: #fff; font-size: 18px; cursor: pointer; border-radius: 2px; }
.appbar .waffle:hover { background: rgba(255,255,255,.12); }
.appbar .brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.appbar .brand img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.appbar .brand .sep { opacity: .5; margin: 0 4px; font-weight: 400; }
.appbar .brand small { font-weight: 400; font-size: 13px; opacity: .9; }
.appbar .spacer { flex: 1; }
.appbar .env { font-size: 11.5px; background: rgba(255,255,255,.14); padding: 3px 10px; border-radius: 2px; letter-spacing: .3px; }
.appbar .user { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.appbar .user .av { width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 700; }
.appbar .user .who { display: flex; flex-direction: column; line-height: 1.2; }
.appbar .user .who b { font-weight: 600; } .appbar .user .who span { opacity: .8; font-size: 11.5px; }
.appbar .user button { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 16px; width: 36px; height: 36px; border-radius: 2px; }
.appbar .user button:hover { background: rgba(255,255,255,.12); }

/* ---------- shell / site map ---------- */
.shell { display: flex; min-height: 100vh; padding-top: var(--appbar); }
.sidebar { width: var(--sidebar); background: var(--nav); border-inline-end: 1px solid var(--line); position: fixed; inset-inline-start: 0; top: var(--appbar); bottom: 0; display: flex; flex-direction: column; z-index: 20; overflow-y: auto; }
.nav { padding: 6px 0 24px; flex: 1; }
.nav .grp { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding: 14px 16px 4px; letter-spacing: .3px; font-weight: 600; text-transform: uppercase; cursor: pointer; user-select: none; }
.nav .grp::after { content: '⌃'; font-size: 11px; transform: rotate(180deg); opacity: .7; }
.nav .grp.collapsed::after { transform: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; color: var(--text-2); font-weight: 400; border-inline-start: 3px solid transparent; font-size: 13.5px; }
.nav a.hidden { display: none; }
.nav a svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.nav a:hover { background: #e1dfdd; text-decoration: none; }
.nav a.active { background: #fff; color: var(--text); font-weight: 600; border-inline-start-color: var(--accent); }
.nav a.active svg { color: var(--accent); }
.nav a .cnt { margin-inline-start: auto; background: var(--accent); color: #fff; font-size: 10.5px; padding: 0 6px; border-radius: 10px; font-weight: 600; min-width: 18px; text-align: center; line-height: 18px; }
.main { margin-inline-start: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- page header + command bar ---------- */
.pagehead { background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 24px 0; position: sticky; top: var(--appbar); z-index: 10; }
.crumbs { color: var(--muted); font-size: 12px; }
.crumbs span + span::before { content: '›'; margin: 0 6px; color: var(--muted-2); }
.pagehead h1 { font-size: 20px; font-weight: 600; margin: 2px 0 8px; color: var(--text); }
.cmdbar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; min-height: 40px; border-top: 1px solid var(--line); margin: 0 -24px; padding: 2px 16px; }
.cmdbar:empty { display: none; }
.cmdbar .btn { border: 0; background: transparent; color: var(--text-2); border-radius: 2px; min-height: 36px; padding: 0 12px; font-weight: 400; }
.cmdbar .btn:hover { background: var(--nav); color: var(--text); }
.cmdbar .btn.primary { color: var(--accent); font-weight: 600; background: transparent; }
.cmdbar .btn.primary:hover { background: var(--accent-ll); }
.cmdbar .btn.gold { color: var(--gold-d); background: transparent; } .cmdbar .btn.gold:hover { background: var(--gold-l); }
.cmdbar .btn.danger { color: var(--red); background: transparent; } .cmdbar .btn.danger:hover { background: var(--red-l); }
.content { padding: 18px 24px 60px; }
.menu-btn { display: none; }
.topbar { display: none; }

/* ---------- cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.card .hd { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 44px; }
.card .hd h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.card .hd .spacer { flex: 1; }
.card .bd { padding: 16px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; position: relative; border-inline-start: 4px solid var(--line-2); }
.kpi .lbl { color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 22px; font-weight: 600; color: var(--text); }
.kpi .sub { font-size: 11.5px; color: var(--muted); }
.kpi.green { border-inline-start-color: var(--green); } .kpi.green .val { color: var(--green-d); }
.kpi.red { border-inline-start-color: var(--red); } .kpi.red .val { color: var(--red); }
.kpi.gold { border-inline-start-color: var(--gold); } .kpi.gold .val { color: var(--gold-d); }
.kpi.blue { border-inline-start-color: var(--accent); } .kpi.blue .val { color: var(--accent-d); }
.kpi::after { display: none; }
.kpi.clickable { cursor: pointer; } .kpi.clickable:hover { border-color: var(--accent); box-shadow: var(--shadow-8); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.toolbar .f { display: flex; flex-direction: column; gap: 2px; }
.toolbar .f label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.toolbar .spacer { flex: 1; }
.toolbar .actions { display: flex; gap: 6px; }
.toolbar input, .toolbar select { min-height: 32px; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.form.c2 { grid-template-columns: repeat(2, 1fr); } .form.c4 { grid-template-columns: repeat(4, 1fr); } .form.c1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field label .req { color: var(--red); }
.field.span2 { grid-column: span 2; } .field.span3 { grid-column: span 3; } .field.full { grid-column: 1 / -1; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=search], select, textarea {
  border: 1px solid var(--line-3); border-radius: var(--radius); padding: 5px 8px; background: #fff; color: var(--text); width: 100%; min-height: 32px; transition: border-color .1s, box-shadow .1s;
}
input:hover, select:hover, textarea:hover { border-color: var(--text-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 -2px 0 0 var(--accent); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--nav); color: var(--muted); border-color: var(--line); }
textarea { min-height: 64px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-size: 11.5px; color: var(--muted); }
.static { min-height: 32px; padding: 5px 8px; background: var(--nav); border-radius: var(--radius); border: 1px solid var(--line); font-weight: 600; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-3); background: #fff; color: var(--text); border-radius: var(--radius); padding: 0 14px; min-height: 32px; cursor: pointer; font-weight: 600; white-space: nowrap; transition: background .1s, border-color .1s; line-height: 1; }
.btn:hover { background: var(--nav); border-color: var(--text-2); text-decoration: none; }
.btn:active { background: #e1dfdd; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.btn.gold { background: var(--gold-l); border-color: #e8d48b; color: var(--gold-d); } .btn.gold:hover { background: #fdeaa5; }
.btn.danger { background: #fff; border-color: #e0a3a6; color: var(--red); } .btn.danger:hover { background: var(--red-l); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.blue { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 0 10px; min-height: 26px; font-size: 12px; }
.btn.icon { padding: 0; min-height: 32px; width: 32px; }
.btn svg { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- grid (table) ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; height: 36px; }
.tbl tbody tr:hover td { background: var(--nav); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 600; background: var(--accent-ll); border-top: 2px solid var(--accent); }
.tbl .lvl1 td { font-weight: 700; background: var(--nav); } .tbl .lvl2 td { font-weight: 600; }
.tbl .indent { display: inline-block; }
.tbl .sub { color: var(--muted); font-size: 11.5px; display: block; font-weight: 400; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.tbl input, .tbl select { min-height: 28px; padding: 3px 6px; }
.pager { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface); }
.pager .hint { margin-inline-end: auto; }
.pager select { width: auto; min-height: 26px; padding: 2px 6px; }

/* ---------- badges (Fluent tags) ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 2px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--nav); color: var(--text-2); border: 1px solid transparent; }
.badge.draft { background: var(--nav); color: var(--muted); }
.badge.review, .badge.pending, .badge.returned { background: var(--gold-l); color: var(--gold-d); }
.badge.confirmed, .badge.approved, .badge.paid { background: var(--accent-l); color: var(--accent-d); }
.badge.posted, .badge.open, .badge.active { background: var(--green-l); color: var(--green-d); }
.badge.rejected, .badge.canceled, .badge.closed, .badge.inactive { background: var(--red-l); color: var(--red); }
.badge.reversed { background: #efe4f7; color: #5c2d91; }
.badge.donation { background: var(--green-l); color: var(--green-d); } .badge.expense { background: #fbe3d6; color: var(--orange); } .badge.manual { background: var(--accent-l); color: var(--accent-d); } .badge.reversal { background: #efe4f7; color: #5c2d91; }
.badge.gold { background: var(--gold-l); color: var(--gold-d); }

/* ---------- status flow (process bar) ---------- */
.flow { display: flex; align-items: center; gap: 0; margin: 4px 0 14px; flex-wrap: wrap; }
.flow .st { display: flex; align-items: center; gap: 6px; padding: 5px 14px; background: var(--nav); color: var(--muted); font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); }
.flow .st.done { background: var(--green-l); color: var(--green-d); border-color: #b8e0b8; }
.flow .st.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.flow .st.bad { background: var(--red-l); color: var(--red); }
.flow .sep { width: 14px; height: 1px; background: var(--line-2); }

/* ---------- modal (dialog) ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 48px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 760px; box-shadow: var(--shadow-64); animation: pop .12s ease-out; }
.modal.lg { max-width: 1060px; } .modal.sm { max-width: 460px; }
.modal .mh { display: flex; align-items: center; padding: 14px 20px 6px; }
.modal .mh h3 { font-size: 18px; font-weight: 600; flex: 1; }
.modal .mb { padding: 12px 20px 20px; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 20px 18px; }
.modal .x { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); width: 32px; height: 32px; border-radius: 2px; } .modal .x:hover { background: var(--nav); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0 } to { transform: none; opacity: 1 } }
.err { background: var(--red-l); color: var(--red); border-inline-start: 4px solid var(--red); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 600; }
.info { background: var(--accent-ll); color: var(--text-2); border-inline-start: 4px solid var(--accent); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.warn { background: var(--gold-l); color: var(--text-2); border-inline-start: 4px solid var(--gold); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }

/* ---------- toast (message bar) ---------- */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 2px; box-shadow: var(--shadow-16); font-weight: 600; animation: pop .2s; max-width: 440px; border-inline-start: 4px solid #fff; }
.toast.ok { background: var(--green-d); border-inline-start-color: var(--green-l); } .toast.err { background: var(--red); border-inline-start-color: var(--red-l); } .toast.warn { background: var(--gold-d); }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 18px; }
.kv .k, .kv-grid .k { font-size: 11.5px; color: var(--muted); }
.kv .v, .kv-grid .v { font-weight: 600; color: var(--text); }
.section-title { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line-2); }
.section-title:first-child { margin-top: 0; }
.journal-prev { background: var(--nav); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.journal-prev table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.journal-prev td, .journal-prev th { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.journal-prev th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 2px; cursor: pointer; }
.tree .node:hover { background: var(--nav); }
.tree .node.sel { background: var(--accent-l); font-weight: 600; }
.tree .node .code { color: var(--muted); font-size: 12px; min-width: 40px; direction: ltr; }
.tree .node .tg { width: 18px; text-align: center; color: var(--muted); font-size: 11px; }
.tree ul { list-style: none; padding-inline-start: 18px; margin: 0; }
.tree .node .badge { margin-inline-start: auto; }
.tree .inactive { opacity: .5; text-decoration: line-through; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--nav); border: 1px solid var(--line); border-radius: 2px; font-size: 12.5px; }
.att button { border: 0; background: none; color: var(--red); cursor: pointer; }
.chart-box { position: relative; height: 260px; }
.loader { padding: 40px; text-align: center; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill-tabs { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); background: var(--surface); padding: 0 6px; }
.pill-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 10px 14px; cursor: pointer; font-weight: 400; color: var(--text-2); font-size: 13.5px; margin-bottom: -1px; }
.pill-tabs button:hover { color: var(--text); background: var(--nav); }
.pill-tabs button.active { color: var(--accent-d); border-bottom-color: var(--accent); font-weight: 600; }
.balanced-ok { color: var(--green-d); font-weight: 700; } .balanced-no { color: var(--red); font-weight: 700; }
.print-head { display: none; }
.err-text { color: var(--red); font-size: 12.5px; } .ok-text { color: var(--green-d); }
.alloc-row { display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.ck-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.ck-item .ck-lbl { flex: 1; }
.tbl tr.row-danger td { background: var(--red-l); }
.tbl.lines input, .tbl.lines select { width: 100%; min-width: 60px; }
.doc-control th, .doc-control td { border: 1px solid var(--line); padding: 4px 8px; }

/* ---------- login (Dynamics-style split page with animated YSN brand panel) ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); margin: 0; }
.login-brand { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--navy) 0%, #0b3a74 55%, #0f6cbd 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px; color: #fff; }
.login-brand .ysn { width: min(520px, 80%); height: auto; aspect-ratio: 2/1; filter: drop-shadow(0 18px 40px rgba(0,0,0,.35)); animation: brandIn 1s ease-out both; }
.login-brand .brand-text { text-align: center; animation: brandIn 1s ease-out .9s both; }
.login-brand .brand-text b { display: block; font-size: 17px; letter-spacing: .5px; font-weight: 600; }
.login-brand .brand-text span { display: block; font-size: 13px; opacity: .85; margin-top: 4px; }
.login-brand .brand-foot { position: absolute; bottom: 22px; font-size: 12px; opacity: .7; letter-spacing: .4px; }
.login-brand .orbs span { position: absolute; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(143,240,255,.35), rgba(143,240,255,0) 70%); animation: orb 14s ease-in-out infinite; }
.login-brand .orbs span:nth-child(1) { width: 420px; height: 420px; top: -140px; inset-inline-end: -120px; }
.login-brand .orbs span:nth-child(2) { width: 300px; height: 300px; bottom: -100px; inset-inline-start: -80px; animation-delay: -5s; }
.login-brand .orbs span:nth-child(3) { width: 200px; height: 200px; top: 55%; inset-inline-end: 12%; animation-delay: -9s; }
@keyframes orb { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px, 24px) scale(1.12); } }
@keyframes brandIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.login { width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-16); padding: 36px 34px 28px; text-align: center; align-self: center; justify-self: center; margin: 24px; }
.login img { width: 72px; height: 72px; }
.login h1 { font-size: 20px; margin: 10px 0 2px; color: var(--navy); font-weight: 600; }
.login p { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login .field { text-align: start; margin-bottom: 14px; }
.login .btn { width: 100%; margin-top: 6px; min-height: 36px; }
@media (prefers-reduced-motion: reduce) { .login-brand .orbs span, .login-brand .ysn, .login-brand .brand-text { animation: none; } }

/* ---------- responsive ---------- */
/* ---------- HR (Dynamics worker form): entity header, FastTabs, persona, attendance calendar ---------- */
.modal.xl { max-width: 1240px; }
.ent-head { display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); padding: 14px 18px; margin-bottom: 12px; border-radius: var(--radius); }
.ent-av { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; flex: none; letter-spacing: .5px; }
.ent-av.sus { background: var(--gold); } .ent-av.term { background: var(--line-3); }
.ent-id { min-width: 0; }
.ent-title { font-size: 20px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ent-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ent-badges { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.ent-facts { display: flex; gap: 0; margin-inline-start: auto; flex-wrap: wrap; }
.ent-facts > div { padding: 2px 18px; border-inline-start: 1px solid var(--line); min-width: 96px; }
.ent-facts .k { font-size: 11.5px; color: var(--muted); } .ent-facts .v { font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; }
.ent-facts .warn-f .v { color: var(--orange); }
.fasttab { background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; box-shadow: var(--shadow-2); border-radius: var(--radius); }
.fasttab > .ft-h { display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer; user-select: none; min-height: 46px; }
.fasttab > .ft-h:hover { background: var(--accent-ll); }
.fasttab > .ft-h h4 { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); white-space: nowrap; }
.fasttab > .ft-h .chev { width: 14px; height: 14px; color: var(--muted); transform: rotate(90deg); transition: transform .15s; flex: none; }
.fasttab.closed > .ft-h .chev { transform: rotate(180deg); }
.fasttab > .ft-h .ft-sum { display: none; gap: 18px; color: var(--muted); font-size: 12px; margin-inline-start: auto; flex-wrap: wrap; }
.fasttab.closed > .ft-h .ft-sum { display: flex; }
.fasttab > .ft-h .ft-sum b { color: var(--text-2); font-weight: 600; margin-inline-start: 4px; }
.fasttab > .ft-h .ft-act { margin-inline-start: auto; }
.fasttab.closed > .ft-h .ft-act { display: none; }
.fasttab > .ft-b { padding: 6px 16px 16px; }
.fasttab.closed > .ft-b { display: none; }
.fgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 28px; }
.fgrid .fv .k { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.fgrid .fv .v { font-size: 13.5px; min-height: 24px; border-bottom: 1px solid var(--line); padding: 2px 0 4px; color: var(--text); overflow-wrap: anywhere; }
.persona { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.persona .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-l); color: var(--accent-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; }
.persona .pn { display: block; font-weight: 600; color: var(--text); } .persona .ps { display: block; font-size: 11.5px; color: var(--muted); }
.pct-bar { position: relative; height: 20px; background: var(--nav); border-radius: 2px; overflow: hidden; min-width: 90px; }
.pct-bar span { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent-l); border-inline-end: 2px solid var(--accent); }
.pct-bar b { position: relative; padding: 0 6px; font-size: 12px; line-height: 20px; }
ol.steps { margin: 0; padding-inline-start: 20px; line-height: 1.9; font-size: 13px; color: var(--text-2); }
.emp-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; max-height: 280px; overflow: auto; border: 1px solid var(--line); padding: 8px; }
.tbl.grid-edit input { width: 100%; min-width: 60px; }
.payslip .ps-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--navy); }
.payslip .ps-net { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 8px; padding: 10px 14px; background: var(--accent-ll); border-inline-start: 4px solid var(--accent); font-size: 15px; }
.payslip .ps-net b { font-size: 20px; color: var(--accent-d); }
.dev-card .hd .dev-ic { width: 10px; height: 10px; border-radius: 50%; background: var(--line-3); flex: none; }
.dev-card .hd .dev-ic.ok { background: var(--green); } .dev-card .hd .dev-ic.bad { background: var(--red); } .dev-card .hd .dev-ic.off { background: var(--gold); }
.ac-tot { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 10px; font-size: 12.5px; color: var(--muted); }
.ac-tot b { color: var(--text); margin-inline-start: 3px; } .ac-tot .bad b { color: var(--red); } .ac-tot .warn b { color: var(--orange); } .ac-tot .ok b { color: var(--green-d); }
.att-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.att-cal .ac-h { font-size: 11.5px; color: var(--muted); text-align: center; padding: 2px 0; font-weight: 600; }
.att-cal .ac-d { border: 1px solid var(--line); min-height: 58px; padding: 4px 6px; font-size: 11px; display: flex; flex-direction: column; gap: 1px; background: var(--surface); border-radius: 2px; }
.att-cal .ac-d.empty { border: 0; background: transparent; }
.att-cal .ac-d .n { font-weight: 600; font-size: 12.5px; color: var(--text); }
.att-cal .ac-d .t { color: var(--muted); }
.att-cal .ac-d .ax { font-weight: 600; font-size: 11px; } .att-cal .ac-d .ax.late { color: var(--orange); } .att-cal .ac-d .ax.ot { color: var(--accent-d); }
.att-cal .st-present { border-inline-start: 3px solid var(--green); }
.att-cal .st-absent { background: var(--red-l); border-inline-start: 3px solid var(--red); }
.att-cal .st-leave { background: var(--accent-ll); border-inline-start: 3px solid var(--accent); }
.att-cal .st-weekend, .att-cal .st-holiday, .att-cal .st-future { background: var(--nav); }
.att-cal .st-off_worked { background: var(--accent-ll); border-inline-start: 3px solid var(--accent-d); }
.att-cal .st-missing_out { background: var(--gold-l); border-inline-start: 3px solid var(--gold); }
@media (max-width: 1100px) { .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ent-head { flex-wrap: wrap; } .ent-facts { margin-inline-start: 0; width: 100%; } .emp-pick { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .fgrid { grid-template-columns: 1fr; } .ent-facts > div { padding: 2px 10px; min-width: 0; } .att-cal .ac-d { min-height: 44px; padding: 2px 3px; } .att-cal .ac-d .t, .att-cal .ac-d .ax { display: none; } .emp-pick { grid-template-columns: 1fr; } }

/* ---------- Security: roles & permissions (Dynamics security roles) ---------- */
.roles-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 12px; align-items: start; }
.role-list { padding: 6px 0; position: sticky; top: 8px; max-height: calc(100vh - 170px); overflow: auto; }
.role-list .rl { display: block; padding: 8px 14px; border-inline-start: 3px solid transparent; color: var(--text); text-decoration: none; }
.role-list .rl:hover { background: var(--accent-ll); }
.role-list .rl.on { background: var(--accent-l); border-inline-start-color: var(--accent); }
.role-list .rl.dim { opacity: .55; }
.role-list .rl-n { display: block; font-weight: 600; font-size: 13.5px; }
.role-list .rl-m { display: block; font-size: 11.5px; color: var(--muted); }
.perm-grp .pg-cnt { font-size: 12px; color: var(--muted); background: var(--nav); padding: 0 8px; border-radius: 10px; }
.perm-grp .ft-act { margin-inline-start: auto; }
.perm-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.perm-row:hover { background: var(--accent-ll); }
.perm-row.on { background: #f3f9fd; }
.perm-row input { margin-top: 3px; }
.perm-row .pr-t b { font-weight: 600; }
.perm-row .pr-d { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.perm-row code { font-size: 11px; color: var(--muted-2); }
.perm-eff { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.perm-eff .pe-g { border: 1px solid var(--line); padding: 8px 10px; }
.perm-eff .pe-h { font-weight: 600; margin-bottom: 4px; }
.perm-eff .pe-p { font-size: 12.5px; padding: 1px 0; } .perm-eff .pe-p.on { color: var(--green-d); } .perm-eff .pe-p.off { color: var(--muted-2); }
.perm-matrix th.rc { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; vertical-align: bottom; min-width: 34px; font-size: 12px; }
.perm-matrix th.rc .sub { display: inline; margin-inline-start: 6px; }
.perm-matrix td.mc { text-align: center; } .perm-matrix .yes { color: var(--green-d); font-weight: 700; }
.perm-matrix tr.mg td { background: var(--nav); font-weight: 600; }
@media (max-width: 900px) { .roles-layout { grid-template-columns: 1fr; } .role-list { position: static; max-height: 220px; } .perm-eff { grid-template-columns: 1fr; } }
/* ---------- theme engine (shared by the non-Dynamics themes; each theme adds /css/themes/<key>.css) ---------- */
.appbar .theme-btn { background: transparent; border: 0; color: inherit; width: 36px; height: 36px; border-radius: 2px; cursor: pointer; display: inline-grid; place-items: center; }
.appbar .theme-btn:hover { background: rgba(255,255,255,.14); }
html:not([data-theme="dynamics"]) .shell { padding-top: var(--th-top, var(--appbar)); }
html:not([data-theme="dynamics"]) .pagehead { top: var(--th-top, var(--appbar)); }
html:not([data-theme="dynamics"]) .main { margin-inline-start: 0; }
html:not([data-theme="dynamics"]) .sidebar { top: var(--th-top, var(--appbar)); transform: translateX(100%); transition: transform .18s ease; box-shadow: var(--shadow-16); z-index: 60; }
html[dir="ltr"]:not([data-theme="dynamics"]) .sidebar { transform: translateX(-100%); }
html:not([data-theme="dynamics"]) .sidebar.open { transform: none; }
.th-overlay { position: fixed; inset: 0; z-index: 45; }
@media (max-width: 900px) { #thNav .od-menu, #thNav .cl-mods, .cl-mods, #thBar { display: none !important; } .appbar .env { display: none; } }
/* theme picker */
.th-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.th-card { text-align: start; background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; color: var(--text); position: relative; }
.th-card:hover { border-color: var(--accent); box-shadow: var(--shadow-8); }
.th-card.on { border-color: var(--accent); background: var(--accent-ll); }
.th-card .badge { position: absolute; top: 8px; inset-inline-end: 8px; }
.th-prev { position: relative; display: block; height: 96px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #f6f6f6; margin-bottom: 4px; }
.th-prev i { position: absolute; display: block; }
.th-prev .p-top { inset: 0 0 auto 0; height: 16px; background: var(--c0); border-bottom: 1px solid rgba(0,0,0,.08); }
.th-prev .p-a, .th-prev .p-b, .th-prev .p-c { background: #fff; border: 1px solid #e3e3e3; border-radius: 2px; }
.th-prev-side .p-nav { top: 16px; bottom: 0; inset-inline-start: 0; width: 26%; background: var(--c1); }
.th-prev-side .p-a { top: 24px; inset-inline-start: 30%; inset-inline-end: 6px; height: 12px; border-inline-start: 3px solid var(--c2); }
.th-prev-side .p-b { top: 42px; inset-inline-start: 30%; width: 30%; height: 44px; } .th-prev-side .p-c { top: 42px; inset-inline-end: 6px; width: 33%; height: 44px; }
.th-prev-top .p-top { border-bottom: 3px solid var(--c1); height: 18px; } .th-prev-top .p-nav { top: 5px; inset-inline-start: 30%; width: 50%; height: 7px; background: repeating-linear-gradient(90deg, var(--c2) 0 14px, transparent 14px 20px); opacity: .7; }
.th-prev-top .p-a { top: 28px; left: 8%; right: 8%; height: 14px; } .th-prev-top .p-b { top: 48px; left: 8%; width: 40%; height: 40px; } .th-prev-top .p-c { top: 48px; right: 8%; width: 40%; height: 40px; }
.th-prev-menubar .p-top { background: linear-gradient(var(--c0), #e3e7ee); } .th-prev-menubar .p-nav { top: 16px; left: 0; right: 0; height: 18px; background: linear-gradient(#fff, #e6eaf0); border-bottom: 1px solid #c9d1db; }
.th-prev-menubar .p-a { top: 20px; inset-inline-start: 6px; width: 60%; height: 10px; background: repeating-linear-gradient(90deg, var(--c1) 0 8px, transparent 8px 16px); border: 0; }
.th-prev-menubar .p-b { top: 42px; left: 6%; right: 6%; height: 16px; border-top: 3px solid var(--c1); } .th-prev-menubar .p-c { top: 64px; left: 6%; width: 30%; height: 22px; background: var(--c2); border: 0; }
.th-prev-apps { background: linear-gradient(135deg, #f4eef3, #e6d9e3); } .th-prev-apps .p-top { background: var(--c0); }
.th-prev-apps .p-nav { top: 30px; left: 18%; right: 18%; height: 40px; background: radial-gradient(circle at 12px 12px, var(--c0) 7px, transparent 8px) 0 0 / 28px 24px, radial-gradient(circle at 12px 12px, var(--c2) 7px, transparent 8px) 14px 12px / 28px 24px; }
.th-prev-tiles { background: #f5f6f7; } .th-prev-tiles .p-top { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.th-prev-tiles .p-a, .th-prev-tiles .p-b, .th-prev-tiles .p-c { top: 30px; width: 26%; height: 50px; border-radius: 6px; border-top: 3px solid var(--c1); } .th-prev-tiles .p-a { left: 6%; } .th-prev-tiles .p-b { left: 37%; } .th-prev-tiles .p-c { left: 68%; }
.th-prev-drawer { background: var(--c1); } .th-prev-drawer .p-top { height: 18px; background: var(--c0); }
.th-prev-drawer .p-nav { top: 18px; left: 0; right: 0; height: 22px; background: linear-gradient(120deg, #e9e2da, #d8cdc1 60%, #efe8e1); }
.th-prev-drawer .p-a { top: 46px; left: 6%; width: 40%; height: 40px; border-radius: 8px; } .th-prev-drawer .p-b { top: 46px; right: 6%; width: 44%; height: 40px; border-radius: 8px; } .th-prev-drawer .p-c { top: 24px; inset-inline-end: 8px; width: 34px; height: 10px; border-radius: 10px; background: var(--c0); border: 0; }
@media (max-width: 800px) { .th-cards { grid-template-columns: 1fr 1fr; } }
/* QuickBooks Desktop home (workflow panels) — used in every theme, it is the landing page of the QuickBooks theme */
.qbd-home { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }
.qbd-panel { background: #fff; border: 1px solid #cfd6df; border-radius: 6px; margin-bottom: 14px; overflow: hidden; }
.qbd-panel h3 { margin: 0; padding: 7px 12px; background: #1f3b5c; color: #fff; font-size: 13px; letter-spacing: .03em; }
.qbd-panel.donors 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-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; }
.qbd-ic { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 112px; height: 82px; border: 1px solid #d5dbe3; border-radius: 6px; background: linear-gradient(#fff, #f2f5f9); color: #1f2d3d; font-size: 12px; text-align: center; gap: 6px; text-decoration: none; }
.qbd-ic svg { width: 24px; height: 24px; color: #2e6db4; } .qbd-ic:hover { border-color: #2e6db4; background: #eaf1fb; text-decoration: none; }
.qbd-arrow { color: #8a97a8; font-size: 18px; }
.qbd-side { padding: 6px 12px 12px; } .qbd-side .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f2f5; } .qbd-side .row b { color: #b8322f; }
@media (max-width: 1000px) { .qbd-home { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .form { grid-template-columns: repeat(2, 1fr); } .form.c4 { grid-template-columns: repeat(2, 1fr); } .kv { grid-template-columns: repeat(2, 1fr); } .appbar .brand small { display: none; } }
@media (max-width: 800px) {
  .sidebar { transform: translateX(100%); transition: transform .2s; box-shadow: -8px 0 30px rgba(0,0,0,.2); } .sidebar.open { transform: none; }
  .main { margin-inline-start: 0; } .menu-btn { display: inline-flex; }
  .g2, .g3, .g4, .two { grid-template-columns: 1fr; } .form, .form.c4, .form.c2 { grid-template-columns: 1fr; } .field.span2, .field.span3 { grid-column: auto; }
  .content { padding: 12px; } .pagehead { padding: 8px 12px 0; } .cmdbar { margin: 0 -12px; padding: 2px 8px; }
  .login-page { grid-template-columns: 1fr; } .login-brand { min-height: 220px; padding: 24px; } .login-brand .ysn { width: 70%; } .login-brand .brand-foot { display: none; } .appbar .user .who { display: none; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; font-size: 12px; font-family: 'Cairo', 'Segoe UI', sans-serif; }
  .appbar, .sidebar, .pagehead, .toolbar, .btn, .no-print, .toasts, .modal-bg, .pill-tabs { display: none !important; }
  .shell { padding-top: 0; } .main { margin: 0; } .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  .print-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 14px; }
  .print-head img { width: 50px; }
  .tbl th { position: static; }
}
