body { background: #f5f7fa; font-size: .92rem; }
.app-nav { background: #1f4e78 !important; }
.app-nav .nav-link, .app-nav .navbar-brand { color: #fff !important; }
.card { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.table-sm td, .table-sm th { vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg-error { color: #b02a37; font-size: .82rem; }
.msg-warn { color: #997404; font-size: .82rem; }
.kpi .value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .label { color: #6c757d; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr.row-error { background: #fbe9eb; }
.mono { font-family: Consolas, "Courier New", monospace; }

/* head / sub-head tree on the sheet page (Bootstrap paints cells, so colour the cells) */
table.tree tr.tree-head > * { --bs-table-bg: #e8eff7; cursor: pointer; }
table.tree tr.tree-sub > * { --bs-table-bg: #f5f8fb; cursor: pointer; }
table.tree tr.tree-head:hover > *, table.tree tr.tree-sub:hover > * { --bs-table-bg: #dbe6f2; }
table.tree tr.row-error > * { --bs-table-bg: #fbe9eb; }
table.tree .tree-icon { display: inline-block; width: 1rem; transition: transform .15s; }
table.tree tr.collapsed .tree-icon { transform: rotate(-90deg); }

/* ===================================================================== NetSuite-style header and menus */
:root {
  --ns-top: #13293d;          /* top bar */
  --ns-tabs: #1f3b57;         /* tab bar */
  --ns-tab-hover: #2a4c6e;
  --ns-accent: #f0a830;       /* current tab underline */
  --ns-ink: #1f2d3a;
  --ns-muted: #6b7a89;
  --ns-line: #d7dee6;
  --ns-panel: #f3f6f9;
}
body { background: #eef1f5; color: var(--ns-ink); }
.app-nav { display: none; }   /* the old bar, if a page still has it */

.ns-header { position: sticky; top: 0; z-index: 1030; margin-bottom: 1rem; box-shadow: 0 2px 6px rgba(15, 30, 45, .25); }
.ns-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 1rem; height: 52px; padding: 0 1rem; background: var(--ns-top); color: #fff; }
.ns-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; white-space: nowrap; }
.ns-brand:hover { color: #fff; }
.ns-logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: linear-gradient(135deg, #f0a830, #e07b24); color: #13293d; font-size: 1.05rem; }
.ns-brand-text { font-weight: 600; font-size: 1.02rem; line-height: 1.05; letter-spacing: .01em; }
.ns-brand-text small { display: block; font-weight: 400; font-size: .68rem; color: #9fb3c8; letter-spacing: .06em; text-transform: uppercase; }

.ns-search { position: relative; flex: 0 1 430px; margin-left: 1rem; }
.ns-search > i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: #8aa0b6; font-size: .85rem; }
.ns-search input { width: 100%; height: 32px; padding: 0 2.2rem 0 2rem; border: 1px solid #2f4a64; border-radius: 4px; background: #1d3650; color: #fff; font-size: .85rem; }
.ns-search input::placeholder { color: #8aa0b6; }
.ns-search input:focus { outline: none; background: #fff; color: var(--ns-ink); border-color: #fff; box-shadow: 0 0 0 3px rgba(240, 168, 48, .35); }
.ns-search kbd { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); padding: 0 .35rem; font-size: .7rem; background: transparent; border: 1px solid #3d5873; color: #8aa0b6; }
.ns-search input:focus ~ kbd { display: none; }
.ns-results { z-index: 1060; position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--ns-line); border-radius: 6px; box-shadow: 0 10px 28px rgba(15, 30, 45, .22); overflow: hidden; }
.ns-results a { display: flex; gap: .65rem; align-items: center; padding: .5rem .8rem; color: var(--ns-ink); text-decoration: none; border-left: 3px solid transparent; }
.ns-results a i { color: #46637f; width: 1.1rem; text-align: center; }
.ns-results a small { display: block; color: var(--ns-muted); font-size: .72rem; }
.ns-results a.sel, .ns-results a:hover { background: #eef4fa; border-left-color: var(--ns-accent); }
.ns-none { padding: .6rem .8rem; color: var(--ns-muted); font-size: .85rem; }

.ns-top-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.ns-top-link { color: #cfdbe7; text-decoration: none; font-size: .85rem; padding: .3rem .5rem; border-radius: 4px; }
.ns-top-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.ns-user { display: flex; align-items: center; gap: .45rem; color: #fff; text-decoration: none; font-size: .85rem; }
.ns-user:hover { color: #fff; }
.ns-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #2f4a64; color: #cfdbe7; }
.ns-burger { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; padding: 0 .25rem; }

.ns-tabs { background: var(--ns-tabs); padding: 0 .5rem; }
.ns-tablist { display: flex; margin: 0; padding: 0; list-style: none; }
.ns-tab { position: relative; }
.ns-tab-link { display: flex; align-items: center; gap: .4rem; height: 40px; padding: 0 1rem; color: #dbe5ef; text-decoration: none; font-size: .86rem; font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.ns-tab-link i { opacity: .8; }
.ns-tab:hover > .ns-tab-link, .ns-tab.open > .ns-tab-link { background: var(--ns-tab-hover); color: #fff; }
.ns-tab.active > .ns-tab-link { color: #fff; border-bottom-color: var(--ns-accent); background: rgba(255, 255, 255, .06); }

.ns-mega { display: none; position: absolute; top: 100%; left: 0; z-index: 1040; min-width: 260px; padding: .9rem .6rem .7rem; gap: .25rem;
  background: #fff; border: 1px solid var(--ns-line); border-top: 3px solid var(--ns-accent); border-radius: 0 0 6px 6px; box-shadow: 0 14px 32px rgba(15, 30, 45, .22); }
.ns-mega-end { left: auto; right: 0; }
@media (min-width: 992px) {
  .ns-tab:hover > .ns-mega, .ns-tab.open > .ns-mega { display: flex; }
}
.ns-col { min-width: 230px; padding: 0 .4rem; }
.ns-col + .ns-col { border-left: 1px solid #edf1f5; }
.ns-col h6 { margin: 0 .5rem .45rem; color: var(--ns-muted); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ns-col a { display: flex; gap: .6rem; align-items: flex-start; padding: .42rem .55rem; border-radius: 4px; color: var(--ns-ink); text-decoration: none; font-size: .86rem; line-height: 1.25; }
.ns-col a i { color: #46637f; width: 1.1rem; text-align: center; margin-top: .05rem; }
.ns-col a small { display: block; color: var(--ns-muted); font-size: .72rem; margin-top: .1rem; }
.ns-col a:hover { background: #eef4fa; color: #0d3a63; }
.ns-col a.current { background: #fff6e6; box-shadow: inset 3px 0 0 var(--ns-accent); font-weight: 600; }
.ns-col-cta { display: flex; align-items: stretch; }
.ns-col a.ns-cta { flex-direction: column; justify-content: center; gap: .25rem; width: 100%; padding: .8rem; background: var(--ns-panel); border: 1px dashed #c3cfdb; }
.ns-col a.ns-cta i { font-size: 1.3rem; color: #e07b24; }

@media (max-width: 991.98px) {
  .ns-burger { display: block; }
  .ns-search { display: none; }
  .ns-header.ns-open .ns-search { display: block; position: absolute; top: 52px; left: 0; right: 0; margin: 0; padding: .5rem; background: var(--ns-top); flex-basis: auto; }
  .ns-header.ns-open .ns-search > i { left: 1.2rem; }
  .ns-header.ns-open .ns-search kbd { display: none; }
  .ns-tabs { display: none; }
  .ns-header.ns-open .ns-tabs { display: block; padding-top: 48px; max-height: calc(100vh - 52px); overflow-y: auto; }
  .ns-tablist { flex-direction: column; }
  .ns-tab-link { height: 42px; }
  .ns-mega { display: block; position: static; box-shadow: none; border: 0; border-radius: 0; background: #183049; padding: .25rem 0 .6rem 1rem; }
  .ns-col { padding: 0; min-width: 0; }
  .ns-col + .ns-col { border-left: 0; }
  .ns-col h6 { color: #8aa0b6; margin-top: .4rem; }
  .ns-col a { color: #dbe5ef; }
  .ns-col a i, .ns-col a small { color: #8aa0b6; }
  .ns-col a:hover, .ns-col a.current { background: rgba(255, 255, 255, .07); color: #fff; }
  .ns-col a.ns-cta { background: transparent; border-color: #3d5873; }
}

/* ===================================================================== pages: title bar, cards, tables */
main > .d-flex:has(> div > h1), main > div > .d-flex:has(> div > h1) { padding-bottom: .65rem; border-bottom: 1px solid var(--ns-line); }
main h1.h4 { font-weight: 600; font-size: 1.32rem; color: #13293d; letter-spacing: -.005em; }
main h1.h4 > .bi { color: #e07b24; margin-right: .2rem; }
.card { border: 1px solid #dfe5ec; border-radius: 6px; box-shadow: 0 1px 2px rgba(15, 30, 45, .05); }
.card-header { background: linear-gradient(#fafbfd, #f1f4f8) !important; border-bottom: 1px solid #dfe5ec; font-weight: 600; color: #22384e; }
.table > thead > tr > th, .table > thead.table-light > tr > th { background: #e9eef4; color: #2b3e52; font-weight: 600; font-size: .78rem; border-bottom: 1px solid #c9d3de; }
.btn { border-radius: 4px; }
.btn-primary { background: #1f5d99; border-color: #1f5d99; }
.btn-primary:hover, .btn-primary:focus { background: #184d80; border-color: #184d80; }

/* ===================================================================== report links (PDF / Excel / zip) everywhere */
a.btn[href*=".pdf"], a.btn[href*=".xlsx"], a.btn[href*=".zip"],
form[action*=".pdf"] button.btn, form[action*=".xlsx"] button.btn {
  background: #fff; color: #22384e; border: 1px solid #c5d0db; font-weight: 500; box-shadow: 0 1px 1px rgba(15, 30, 45, .04);
}
a.btn[href*=".pdf"]:hover, a.btn[href*=".xlsx"]:hover, a.btn[href*=".zip"]:hover,
form[action*=".pdf"] button.btn:hover, form[action*=".xlsx"] button.btn:hover {
  background: #f3f7fb; color: #0d3a63; border-color: #8fa6bd;
}
a.btn[href*=".pdf"] .bi, form[action*=".pdf"] button.btn .bi { color: #c8372d; }
a.btn[href*=".xlsx"] .bi, form[action*=".xlsx"] button.btn .bi { color: #1d7044; }
a.btn[href*=".zip"] .bi { color: #8a5a00; }

/* a group of report links: "Reports  [PDF a] [PDF b] ..." */
.rpt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .45rem .6rem; background: var(--ns-panel); border: 1px solid #e1e7ee; border-radius: 6px; }
.rpt-bar-label { color: var(--ns-muted); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-right: .25rem; }
.rpt-link { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .6rem; background: #fff; border: 1px solid #c5d0db; border-radius: 4px; color: #22384e; text-decoration: none; font-size: .8rem; font-weight: 500; }
.rpt-link:hover { border-color: #8fa6bd; background: #f3f7fb; color: #0d3a63; }
.rpt-link .bi-file-earmark-pdf { color: #c8372d; }
.rpt-link .bi-file-earmark-excel { color: #1d7044; }
.rpt-fmt { padding: 0 .3rem; border-radius: 3px; font-size: .62rem; font-weight: 700; letter-spacing: .04em; background: #fbe9e7; color: #a12c23; }
.rpt-fmt.xlsx { background: #e4f3ea; color: #1d7044; }

/* ===================================================================== reports centre */
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.rc-panel { background: #fff; border: 1px solid #dfe5ec; border-radius: 6px; overflow: hidden; }
.rc-panel > h2 { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .65rem .9rem; font-size: .92rem; font-weight: 600; color: #22384e; background: linear-gradient(#fafbfd, #f1f4f8); border-bottom: 1px solid #dfe5ec; }
.rc-panel > h2 .bi { color: #e07b24; }
.rc-item { display: flex; gap: .7rem; padding: .6rem .9rem; color: var(--ns-ink); text-decoration: none; border-bottom: 1px solid #eef2f6; }
.rc-item:last-child { border-bottom: 0; }
.rc-item:hover { background: #f5f9fc; }
.rc-item > .bi { font-size: 1.15rem; color: #46637f; margin-top: .05rem; }
.rc-item .rc-name { font-weight: 600; font-size: .88rem; color: #0d3a63; }
.rc-item .rc-desc { color: var(--ns-muted); font-size: .78rem; line-height: 1.3; }
.rc-item .rc-fmts { margin-left: auto; display: flex; gap: .25rem; align-items: flex-start; white-space: nowrap; }
.rc-filter { max-width: 360px; }
.rc-item[hidden], .rc-panel[hidden] { display: none; }
