/* ==========================================================================
   Design proposal 2 (js/ui-b.js) — active when <html data-ui="b">.
   Navy sidebar, gold accent, white top bar with search, after the
   "Engineering Finance" mockup. The screens themselves keep their markup;
   only the tokens change, so every screen follows.
   ========================================================================== */
:root[data-ui="b"] {
  --b-navy: #0B2545; --b-navy-2: #13315c; --b-navy-3: #1d4571; --b-gold: #C9A227; --b-gold-2: #e3bd4a;
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #fafbfd; --surface-3: #f0f3f9;
  --ink: #0e1726; --ink-2: #475569; --ink-3: #7b8aa0; --line: #e3e8f0; --line-strong: #d0d8e4;
  --primary: #0B2545; --primary-strong: #13315c; --primary-soft: #e8eef8; --on-primary: #ffffff; --focus: #1d4571;
  --accent: #C9A227; --accent-soft: #fff4d6;
  --radius: 12px; --radius-lg: 14px; --radius-xl: 20px;
  --shadow-1: 0 1px 2px rgba(15,23,42,.06); --shadow-2: 0 4px 14px rgba(15,23,42,.08); --shadow-3: 0 20px 60px rgba(15,23,42,.18);
  --font: "Cairo", "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --bx-sb: 268px; --bx-sb-c: 72px; --bx-top: 62px;
}
:root[data-ui="b"][data-theme="dark"] {
  --bg: #08111f; --surface: #0f1b2e; --surface-2: #132238; --surface-3: #1a2b45; --ink: #e8eef8; --ink-2: #aab7cc; --ink-3: #8090a8; --line: #1f3150; --line-strong: #2a3f63;
  --primary: #e3bd4a; --primary-strong: #f0cf6a; --primary-soft: #2b2610; --on-primary: #0B2545; --focus: #e3bd4a;
}
@media (prefers-color-scheme: dark) {
  :root[data-ui="b"]:where(:not([data-theme="light"])) {
    --bg: #08111f; --surface: #0f1b2e; --surface-2: #132238; --surface-3: #1a2b45; --ink: #e8eef8; --ink-2: #aab7cc; --ink-3: #8090a8; --line: #1f3150; --line-strong: #2a3f63;
    --primary: #e3bd4a; --primary-strong: #f0cf6a; --primary-soft: #2b2610; --on-primary: #0B2545; --focus: #e3bd4a;
  }
}

/* ---------- Shell ---------- */
[data-ui="b"] body { background: var(--bg); }
.bx-app { display: grid; grid-template-columns: var(--bx-sb) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .24s ease; }
.bx-app.bx-collapsed { grid-template-columns: var(--bx-sb-c) minmax(0, 1fr); }
.bx-col { min-width: 0; display: flex; flex-direction: column; }
.bx-main { padding: 24px 28px 96px; outline: none; }
.bx-main .page { max-width: 1500px; }

/* Sidebar */
.bx-sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--b-navy); color: #fff; z-index: 40; border-inline-end: 1px solid rgba(255,255,255,.05); }
.bx-sb-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: var(--bx-top); border-bottom: 1px solid rgba(255,255,255,.07); }
.bx-mark { width: 38px; height: 38px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none; padding: 4px; box-shadow: 0 6px 16px rgba(201,162,39,.25); }
.bx-mark img { width: 100%; height: 100%; object-fit: contain; }
.bx-co { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.bx-co b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx-co small { font-size: 10.5px; color: var(--b-gold-2); font-weight: 600; }
.bx-sb .bx-ic { color: rgba(255,255,255,.7); }
.bx-sb .bx-ic:hover { background: rgba(255,255,255,.08); color: #fff; }
.bx-filter { margin: 10px 12px 4px; position: relative; }
.bx-filter span { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.45); }
.bx-filter input { width: 100%; height: 34px; border-radius: 9px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06); color: #fff; padding-inline: 32px 10px; font-size: 12.5px; }
.bx-filter input::placeholder { color: rgba(255,255,255,.45); }
.bx-filter input:focus { outline: none; border-color: var(--b-gold); background: rgba(255,255,255,.1); }
.bx-nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.bx-sec { padding: 4px 0 6px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 4px; }
.bx-h, .bx-g { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: rgba(255,255,255,.45); text-transform: uppercase; }
.bx-g { padding: 8px 12px 2px 34px; }
html[dir="rtl"] .bx-g { padding: 8px 34px 2px 12px; }
.bx-h svg { width: 13px; height: 13px; }
.bx-item, .bx-op, .bx-mh { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; color: rgba(255,255,255,.74); font-size: 12.8px; font-weight: 500; text-decoration: none !important; position: relative; background: none; border: 0; text-align: start; }
.bx-item:hover, .bx-mh:hover { background: rgba(255,255,255,.06); color: #fff; }
.bx-item[aria-current="page"] { background: rgba(201,162,39,.16); color: var(--b-gold-2); font-weight: 600; }
.bx-item[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--b-gold); }
.bx-i { display: grid; place-items: center; flex: none; width: 20px; }
.bx-i svg { width: 17px; height: 17px; }
.bx-l { flex: 1; min-width: 0; display: grid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx-l small { font-size: 10.5px; color: rgba(255,255,255,.45); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.bx-n { font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; display: grid; place-items: center; }
.bx-star { opacity: 0; color: rgba(255,255,255,.5); font-size: 13px; padding: 0 2px; cursor: pointer; }
.bx-star.on { color: var(--b-gold-2); opacity: .9; }
.bx-item:hover .bx-star, .bx-item:focus-visible .bx-star { opacity: 1; }
.bx-op { margin: 4px 0 6px; background: linear-gradient(135deg, var(--b-gold) 0%, var(--b-gold-2) 100%); color: var(--b-navy); font-weight: 700; justify-content: center; box-shadow: 0 8px 20px rgba(201,162,39,.25); }
.bx-op:hover { filter: brightness(1.06); color: var(--b-navy); }
.bx-op[aria-current="page"] { outline: 2px solid #fff; }
.bx-mod { border-radius: 10px; }
.bx-mh { font-weight: 600; color: rgba(255,255,255,.85); }
.bx-mh .bx-i { width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.07); }
.bx-mod.cur > .bx-mh .bx-i { background: rgba(201,162,39,.2); color: var(--b-gold-2); }
.bx-c { transition: transform .2s; opacity: .5; }
.bx-mod.open > .bx-mh .bx-c { transform: rotate(180deg); }
.bx-mb { display: none; padding: 2px 0 6px; }
.bx-mod.open > .bx-mb { display: block; }
.bx-mb .bx-item { padding-inline-start: 18px; font-size: 12.5px; }
.bx-user { display: flex; align-items: center; gap: 10px; margin: 8px 10px 12px; padding: 8px; border-radius: 11px; background: rgba(255,255,255,.05); border: 0; color: #fff; text-align: start; }
.bx-user:hover { background: rgba(255,255,255,.09); }
.bx-user .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--b-gold), var(--b-gold-2)); color: var(--b-navy); font-weight: 800; font-size: 11.5px; flex: none; }
.bx-user b { font-size: 12.5px; } .bx-user small { color: rgba(255,255,255,.55); font-size: 10.5px; }

/* Collapsed rail: icons only, labels as tooltips */
.bx-collapsed .bx-sb .bx-l, .bx-collapsed .bx-sb .bx-n, .bx-collapsed .bx-sb .bx-star, .bx-collapsed .bx-sb .bx-c, .bx-collapsed .bx-filter, .bx-collapsed .bx-g, .bx-collapsed .bx-h, .bx-collapsed .bx-recent { display: none; }
.bx-collapsed .bx-sb-head { flex-direction: column; padding: 10px 6px; }
.bx-collapsed .bx-item, .bx-collapsed .bx-mh, .bx-collapsed .bx-op { justify-content: center; padding: 8px 0; }
.bx-collapsed .bx-mb .bx-item { padding-inline-start: 0; }
.bx-collapsed .bx-user { justify-content: center; }

/* Top bar */
.bx-top { position: sticky; top: 0; z-index: 30; height: var(--bx-top); display: flex; align-items: center; gap: 8px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-1); }
.bx-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); flex: none; position: relative; }
.bx-ic:hover { background: var(--surface-3); color: var(--ink); }
.bx-ic svg { width: 18px; height: 18px; }
.bx-burger { display: none; }
.bx-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.bx-crumbs a { color: var(--ink-2); padding: 4px 6px; border-radius: 7px; display: inline-flex; align-items: center; }
.bx-crumbs a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.bx-crumbs a svg { width: 15px; height: 15px; }
.bx-crumbs span { color: var(--ink); font-weight: 600; padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; }
.bx-sep { display: inline-grid; opacity: .45; } .bx-sep svg { width: 12px; height: 12px; }
.bx-search { position: relative; flex: 1 1 320px; max-width: 460px; margin-inline-start: auto; }
.bx-search > svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.bx-search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-3); padding-inline: 38px 34px; font-size: 13px; }
.bx-search input:focus { outline: none; border-color: var(--focus); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.bx-search kbd { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; background: var(--surface); }
.bx-res { position: absolute; top: calc(100% + 6px); inset-inline: 0; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 6px; z-index: 60; }
.bx-rg { font-size: 10.5px; font-weight: 700; color: var(--ink-3); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.bx-ri { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 9px; text-align: start; }
.bx-ri span { display: grid; min-width: 0; } .bx-ri b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .bx-ri small { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-ri svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.bx-ri.on, .bx-ri:hover { background: var(--primary-soft); }
.bx-rf { font-size: 11px; color: var(--ink-3); padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.bx-empty { padding: 16px; text-align: center; color: var(--ink-3); }
.bx-right { display: flex; align-items: center; gap: 6px; flex: none; }
.bx-new { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 0; font-weight: 700; color: var(--b-navy); background: linear-gradient(135deg, var(--b-gold) 0%, var(--b-gold-2) 100%); box-shadow: 0 6px 16px rgba(201,162,39,.25); }
.bx-new svg { width: 16px; height: 16px; }
.bx-chip { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.bx-chip:hover { border-color: var(--focus); }
.bx-chip svg { width: 14px; height: 14px; }
.bx-dot { position: absolute; top: 3px; inset-inline-end: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 9.5px; font-style: normal; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.bx-pop { position: fixed; z-index: 120; min-width: 260px; max-width: 360px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 6px; animation: page-in .18s ease; }
.bx-pop-h { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 8px 10px 6px; display: flex; gap: 6px; align-items: center; }
.bx-pi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: none; color: var(--ink); text-align: start; text-decoration: none !important; }
.bx-pi:hover { background: var(--surface-3); }
.bx-pi svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.bx-pi span { display: grid; min-width: 0; } .bx-pi small { color: var(--ink-3); font-size: 11px; }
.bx-pi.all { border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; color: var(--primary-strong); font-weight: 600; }
.bx-scrim { display: none; }

/* Screens in design 2: flatter cards, bigger titles, gold eyebrow */
[data-ui="b"] .page-head { margin-bottom: 18px; }
[data-ui="b"] .page-head h1 { font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
[data-ui="b"] .page-head .eyebrow { color: #a07f12; }
[data-ui="b"][data-theme="dark"] .page-head .eyebrow { color: var(--b-gold-2); }
[data-ui="b"] .card { border-radius: 14px; border-color: var(--line); box-shadow: var(--shadow-1); }
[data-ui="b"] .stat .value { font-weight: 800; }
[data-ui="b"] .tbl thead th { background: var(--surface-2); color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
[data-ui="b"] .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
[data-ui="b"] .tile.hero.tone-teal { background: linear-gradient(135deg, var(--b-navy-2) 0%, var(--b-navy) 100%); box-shadow: 0 10px 26px rgba(11,37,69,.28); }
[data-ui="b"] .tile.hero.tone-navy { background: linear-gradient(135deg, #b8901a 0%, var(--b-gold) 100%); box-shadow: 0 10px 26px rgba(201,162,39,.3); }
[data-ui="b"] .cc-hero { background: linear-gradient(135deg, var(--b-navy) 0%, var(--b-navy-3) 100%); }

/* Phone: the sidebar becomes a drawer */
@media (max-width: 900px) {
  .bx-app, .bx-app.bx-collapsed { grid-template-columns: minmax(0, 1fr); }
  .bx-sb { position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px; max-width: 86vw; transform: translateX(-105%); transition: transform .24s ease; }
  html[dir="rtl"] .bx-sb { transform: translateX(105%); }
  body.bx-sb-open .bx-sb { transform: none; box-shadow: var(--shadow-3); }
  body.bx-sb-open .bx-scrim { display: block; position: fixed; inset: 0; background: rgba(8,17,31,.45); z-index: 35; }
  .bx-collapse { display: none; }
  .bx-burger { display: grid; }
  .bx-top { padding: 0 10px; gap: 4px; }
  .bx-crumbs, .bx-chip.bx-ui span, .bx-new span, .bx-search kbd { display: none; }
  .bx-search { flex: 1 1 auto; max-width: none; }
  .bx-main { padding: 14px 12px 96px; }
  .bx-right [data-act="reset"], .bx-right [data-act="theme"] { display: none; }
}
@media print { .bx-sb, .bx-top, .bx-scrim { display: none !important; } .bx-app { display: block; } .bx-main { padding: 0; } }
