/* MBI ESG360 design system — Bootstrap 5 theme layer.
   Palette: navy #10243A · emerald #087F6D · teal #17A398 · background #F5F7FA · surface #FFFFFF */
:root {
  --esg-navy: #10243A;
  --esg-navy-2: #17324F;
  --esg-emerald: #087F6D;
  --esg-emerald-dark: #066457;
  --esg-teal: #17A398;
  --esg-bg: #F5F7FA;
  --esg-surface: #FFFFFF;
  --esg-tint: #E9F5F3;
  --esg-line: #E2E8EE;
  --esg-ink: #1C2B3A;
  --esg-muted: #5F6F80;
  --sidebar-w: 248px;
  --sidebar-w-min: 68px;
  --topbar-h: 58px;
  --bs-primary: #087F6D;
  --bs-primary-rgb: 8, 127, 109;
  --bs-link-color: #087F6D;
  --bs-link-color-rgb: 8, 127, 109;
  --bs-link-hover-color: #066457;
  --bs-link-hover-color-rgb: 6, 100, 87;
  --bs-body-bg: var(--esg-bg);
  --bs-body-color: var(--esg-ink);
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.9rem;
  --bs-border-color: var(--esg-line);
  --bs-border-radius: 0.5rem;
}
[data-bs-theme="dark"] {
  --esg-bg: #0D1722;
  --esg-surface: #15222F;
  --esg-tint: #12302E;
  --esg-line: #263646;
  --esg-ink: #E4EBF2;
  --esg-muted: #9AAABB;
  --bs-body-bg: var(--esg-bg);
  --bs-body-color: var(--esg-ink);
  --bs-border-color: var(--esg-line);
  --bs-link-color: #4FCFC0;
  --bs-link-color-rgb: 79, 207, 192;
  --bs-link-hover-color: #7FE0D4;
  --bs-link-hover-color-rgb: 127, 224, 212;
  --bs-secondary-color: var(--esg-muted);
}
body { min-height: 100vh; }
a { text-underline-offset: 2px; }
.skip-link { position: absolute; z-index: 2000; background: #fff; padding: .5rem 1rem; }
:focus-visible { outline: 2px solid var(--esg-teal); outline-offset: 2px; }

/* ---- Shell ---------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, var(--esg-navy) 0%, var(--esg-navy-2) 60%, #0E3A44 100%);
  color: #D5DFE9; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: width .18s ease, flex-basis .18s ease, transform .2s ease; z-index: 1040;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; color: #fff; text-decoration: none; min-height: var(--topbar-h); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--esg-teal); display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 34px; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-name { font-weight: 700; letter-spacing: .04em; font-size: 1rem; }
.brand-sub { font-size: .68rem; color: #9FB3C6; letter-spacing: .03em; }
.side-nav { padding: .5rem .7rem; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .58rem .75rem; margin-bottom: 2px; border: 0; background: transparent; color: #D5DFE9;
  border-radius: .5rem; text-decoration: none; font-weight: 500; font-size: .88rem; text-align: left; white-space: nowrap;
}
.side-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-link.active, .side-toggle.open { background: var(--esg-emerald); color: #fff; }
.side-link .chev { margin-left: auto; width: 15px; height: 15px; transition: transform .15s; }
.side-toggle:not(.collapsed) .chev { transform: rotate(180deg); }
.side-sub { background: rgba(255,255,255,.06); border-radius: .5rem; margin: 0 0 4px; padding: .25rem 0; }
.sub-link { display: block; padding: .42rem .75rem .42rem 2.7rem; color: #C3D1DE; text-decoration: none; font-size: .84rem; border-left: 3px solid transparent; white-space: nowrap; }
.sub-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sub-link.active { color: #fff; font-weight: 600; border-left-color: var(--esg-teal); background: rgba(23,163,152,.18); }
.side-foot { padding: .5rem .7rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }

.sidebar-collapsed .sidebar { width: var(--sidebar-w-min); flex-basis: var(--sidebar-w-min); }
.sidebar-collapsed .side-label, .sidebar-collapsed .brand-text, .sidebar-collapsed .chev, .sidebar-collapsed .side-sub { display: none !important; }
.sidebar-collapsed .side-link { justify-content: center; padding: .65rem 0; }
.sidebar-collapsed .brand { justify-content: center; padding: 1rem 0; }
.sidebar-backdrop { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: linear-gradient(90deg, var(--esg-emerald) 0%, #0B8F7C 55%, var(--esg-teal) 100%); color: #fff;
  display: flex; align-items: center; gap: .75rem; padding: 0 1rem; position: sticky; top: 0; z-index: 1030;
}
.page-heading { font-size: 1.05rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .55rem; min-width: 0; white-space: nowrap; overflow: hidden; }
.page-heading svg { width: 20px; height: 20px; flex: 0 0 20px; }
.ph-sep { width: 1px; height: 18px; background: rgba(255,255,255,.55); }
.ph-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex: 0 0 36px; }
.icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.icon-btn svg { width: 19px; height: 19px; }
.notif-dot { position: absolute; top: 2px; right: 0; background: #F5A524; color: #1c1c1c; font-size: .62rem; font-weight: 700; border-radius: 999px; padding: 0 5px; line-height: 1.5; }
.top-search { align-items: center; gap: .4rem; background: rgba(255,255,255,.16); border-radius: 999px; padding: 0 .8rem; height: 34px; }
.top-search svg { width: 15px; height: 15px; opacity: .9; }
.top-search input { background: transparent; border: 0; color: #fff; width: 230px; font-size: .85rem; outline: none; }
.top-search input::placeholder { color: rgba(255,255,255,.8); }
.top-search:focus-within { background: rgba(255,255,255,.26); box-shadow: 0 0 0 2px rgba(255,255,255,.5); }
.ctx-form { display: flex; gap: .35rem; }
.ctx-select { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; height: 34px; padding: 0 .7rem; font-size: .82rem; max-width: 210px; }
.ctx-select option { color: #1C2B3A; }
.ctx-year { max-width: 110px; min-width: 96px; }
.user-btn { display: flex; align-items: center; gap: .5rem; background: transparent; border: 0; color: #fff; font-size: .85rem; padding: 0 .25rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--esg-navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.maintenance-bar { background: #FFF3CD; color: #664D03; padding: .45rem 1.25rem; font-size: .85rem; display: flex; gap: .5rem; align-items: center; }
.maintenance-bar svg { width: 16px; height: 16px; }
.content { padding: 1rem 1.5rem 2rem; flex: 1; outline: none; }
.crumbs { margin-bottom: .9rem; font-size: .8rem; }
.crumbs .breadcrumb-item, .crumbs a { color: var(--esg-muted); }
.app-foot { padding: .75rem 1.5rem; font-size: .75rem; color: var(--esg-muted); border-top: 1px solid var(--esg-line); }

/* ---- Components ----------------------------------------------------------- */
.card { border: 1px solid var(--esg-line); border-radius: .75rem; background: var(--esg-surface); box-shadow: 0 1px 2px rgba(16,36,58,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--esg-line); font-weight: 600; padding: .8rem 1.1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-header svg { width: 17px; height: 17px; color: var(--esg-emerald); }
.card-body { padding: 1.1rem; }
.section-title { font-size: .95rem; font-weight: 600; margin: 0; }
.filter-panel { background: var(--esg-tint); border-radius: .75rem; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.filter-panel .form-label { font-size: .78rem; color: var(--esg-muted); margin-bottom: .2rem; }
.btn { font-size: .85rem; font-weight: 600; }
.btn-pill { border-radius: 999px; padding-left: 1.15rem; padding-right: 1.15rem; letter-spacing: .01em; }
.btn-primary { --bs-btn-bg: var(--esg-emerald); --bs-btn-border-color: var(--esg-emerald); --bs-btn-hover-bg: var(--esg-emerald-dark); --bs-btn-hover-border-color: var(--esg-emerald-dark); --bs-btn-active-bg: var(--esg-emerald-dark); --bs-btn-active-border-color: var(--esg-emerald-dark); --bs-btn-disabled-bg: var(--esg-emerald); --bs-btn-disabled-border-color: var(--esg-emerald); }
.btn-outline-primary { --bs-btn-color: var(--esg-emerald); --bs-btn-border-color: var(--esg-emerald); --bs-btn-hover-bg: var(--esg-emerald); --bs-btn-hover-border-color: var(--esg-emerald); --bs-btn-active-bg: var(--esg-emerald); --bs-btn-active-border-color: var(--esg-emerald); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #4FCFC0; --bs-btn-border-color: #4FCFC0; }
.btn-link-action { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .82rem; text-decoration: none; text-transform: uppercase; letter-spacing: .03em; background: none; border: 0; padding: 0; color: var(--bs-link-color); }
.btn-link-action svg { width: 15px; height: 15px; }
.btn svg { width: 15px; height: 15px; vertical-align: -2px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.toolbar .spacer { flex: 1; }
.form-label { font-weight: 500; font-size: .84rem; margin-bottom: .3rem; }
.form-control, .form-select { font-size: .88rem; border-color: #CBD5DF; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { border-color: #33485C; background-color: #0F1B27; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--esg-teal); box-shadow: 0 0 0 .2rem rgba(23,163,152,.2); }
.form-check-input:checked { background-color: var(--esg-emerald); border-color: var(--esg-emerald); }
.req { color: #C2410C; }
.form-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--esg-muted); font-weight: 700; border-bottom: 1px solid var(--esg-line); padding-bottom: .35rem; margin: 1.25rem 0 .25rem; }

.table-wrap { border: 1px solid var(--esg-line); border-radius: .75rem; overflow: auto; background: var(--esg-surface); }
.table { margin: 0; font-size: .86rem; --bs-table-bg: transparent; }
.table thead th { background: var(--esg-navy); color: #fff; font-weight: 600; font-size: .8rem; white-space: nowrap; border: 0; padding: .65rem .8rem; position: sticky; top: 0; }
.table thead th[data-sort] { cursor: pointer; user-select: none; }
.table thead th[data-sort]::after { content: "↕"; opacity: .45; margin-left: .35rem; font-size: .75rem; }
.table thead th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.table thead th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.table td { padding: .6rem .8rem; vertical-align: middle; border-color: var(--esg-line); }
.table tbody tr:hover > td { background: rgba(23,163,152,.06); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.status-badge { font-weight: 600; font-size: .72rem; border-radius: 999px; padding: .3em .7em; }
.status-success { background: #DDF3EC; color: #0A5C47; } .status-secondary { background: #E8EDF2; color: #44546A; }
.status-warning { background: #FDF0CD; color: #7A5200; } .status-danger { background: #FBE1DF; color: #8E1B14; }
.status-dark { background: #D5DBE2; color: #1C2B3A; } .status-info { background: #DCEFFA; color: #0B4F71; }
[data-bs-theme="dark"] .status-success { background: #0E3B31; color: #7BE0C2; } [data-bs-theme="dark"] .status-secondary { background: #263646; color: #C3D1DE; }
[data-bs-theme="dark"] .status-warning { background: #46360B; color: #F6D271; } [data-bs-theme="dark"] .status-danger { background: #4A1A17; color: #F5A7A1; }
[data-bs-theme="dark"] .status-dark { background: #33485C; color: #E4EBF2; } [data-bs-theme="dark"] .status-info { background: #0F3447; color: #9AD4F2; }

.kpi-card { padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; height: 100%; text-decoration: none; color: inherit; }
a.kpi-card:hover { border-color: var(--esg-teal); }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--esg-tint); color: var(--esg-emerald); display: flex; align-items: center; justify-content: center; flex: 0 0 44px; }
[data-bs-theme="dark"] .kpi-icon { color: #4FCFC0; }
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .78rem; color: var(--esg-muted); }
.chart { width: 100%; height: 300px; }
.notice { background: var(--esg-tint); border-left: 4px solid var(--esg-teal); border-radius: .5rem; padding: .75rem 1rem; font-size: .85rem; display: flex; gap: .6rem; }
.notice svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--esg-emerald); margin-top: 1px; }
.notice-warn { background: #FFF6DD; border-left-color: #E0A100; } .notice-warn svg { color: #9A6B00; }
[data-bs-theme="dark"] .notice-warn { background: #3A2E0C; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--esg-muted); }
.empty-state svg { width: 40px; height: 40px; stroke-width: 1.4; margin-bottom: .6rem; color: #9FB3C6; }
.empty-state h3 { font-size: 1rem; color: var(--esg-ink); margin-bottom: .3rem; }

/* Organisation tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 1.4rem; border-left: 1px solid var(--esg-line); }
.tree-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-bottom: 1px solid var(--esg-line); }
.tree-row:hover { background: rgba(23,163,152,.06); }
.tree-toggle { width: 22px; height: 22px; border: 0; background: transparent; color: var(--esg-muted); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.tree-toggle svg { width: 15px; height: 15px; transition: transform .15s; }
.tree-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.tree-spacer { width: 22px; flex: 0 0 22px; }
.tree-name { font-weight: 600; color: var(--esg-ink); text-decoration: none; }
.tree-name:hover { color: var(--esg-emerald); }
.tree-meta { font-size: .76rem; color: var(--esg-muted); }
.tree-row .spacer { flex: 1; }
.tree li.inactive > .tree-row .tree-name { color: var(--esg-muted); text-decoration: line-through; }
.tree li.collapsed-node > ul { display: none; }

/* Settings tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .9rem; }
.tile { background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: .75rem; padding: 1.2rem .8rem 1rem; text-align: center; text-decoration: none; color: var(--esg-ink); display: flex; flex-direction: column; align-items: center; gap: .6rem; font-weight: 600; font-size: .86rem; transition: box-shadow .15s, transform .15s, border-color .15s; }
.tile:hover { border-color: var(--esg-teal); box-shadow: 0 6px 18px rgba(16,36,58,.08); transform: translateY(-2px); color: var(--esg-ink); }
.tile-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--esg-tint); color: var(--esg-emerald); display: flex; align-items: center; justify-content: center; }
.tile-icon svg { width: 28px; height: 28px; stroke-width: 1.6; }
.tile small { font-weight: 400; color: var(--esg-muted); font-size: .74rem; }

.dl-grid { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .45rem 1rem; margin: 0; font-size: .87rem; }
.dl-grid dt { color: var(--esg-muted); font-weight: 500; } .dl-grid dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--esg-line); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--esg-teal); border: 2px solid var(--esg-surface); }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-meta { font-size: .76rem; color: var(--esg-muted); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--esg-line); font-size: .87rem; }
.check-list li:last-child { border-bottom: 0; }
.check-list svg { width: 17px; height: 17px; flex: 0 0 17px; }
.check-ok svg { color: var(--esg-emerald); } .check-todo svg { color: #B58100; }
.check-list a { margin-left: auto; font-size: .78rem; white-space: nowrap; }
.formula-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.formula-result { font-size: .82rem; margin-top: .35rem; min-height: 1.2rem; }
.perm-matrix th.role-col { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: .6rem .3rem; font-size: .76rem; vertical-align: bottom; }
.perm-matrix td.cb { text-align: center; }
.token-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--esg-tint); border: 1px dashed var(--esg-teal); border-radius: .5rem; padding: .7rem .9rem; word-break: break-all; }
.toast { border: 0; color: #fff; font-size: .87rem; }
.toast-success { background: #0A6B5B; } .toast-danger { background: #A32820; } .toast-warning { background: #8A5F00; } .toast-info { background: var(--esg-navy-2); }
.toast .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.modal-header { border-bottom-color: var(--esg-line); } .modal-footer { border-top-color: var(--esg-line); }
.pagination { --bs-pagination-active-bg: var(--esg-emerald); --bs-pagination-active-border-color: var(--esg-emerald); --bs-pagination-color: var(--esg-emerald); }
.loading { position: relative; pointer-events: none; opacity: .7; }
.btn.loading::after { content: ""; width: .9em; height: .9em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; margin-left: .5em; vertical-align: -1px; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-page { text-align: center; padding: 3rem 1rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--esg-teal); line-height: 1; }

/* ---- Screens ------------------------------------------------------------------ */
.tabbar { display: flex; align-items: center; gap: 1.4rem; border-bottom: 1px solid var(--esg-line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabbar .tab { padding: .55rem .15rem; color: var(--esg-muted); text-decoration: none; font-weight: 600; font-size: .86rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabbar .tab:hover { color: var(--esg-ink); }
.tabbar .tab.active { color: var(--bs-link-color); border-bottom-color: var(--esg-emerald); }
.tabbar .spacer { flex: 1; }
.tabbar .btn { margin-bottom: .35rem; }
.seg { display: inline-flex; border: 1px solid var(--esg-emerald); border-radius: .4rem; overflow: hidden; }
.seg-item { padding: .35rem .9rem; font-size: .78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; text-decoration: none; color: var(--esg-ink); border-right: 1px solid var(--esg-line); background: var(--esg-surface); }
.seg-item:last-child { border-right: 0; }
.seg-item small { font-weight: 500; color: var(--esg-muted); }
.seg-item.active { background: var(--esg-tint); color: var(--bs-link-color); box-shadow: inset 0 0 0 1px var(--esg-emerald); }
.form-page { max-width: 880px; }
.form-actions { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: .9rem 1.1rem; border-top: 1px solid var(--esg-line); flex-wrap: wrap; }
.form-actions .btn { min-width: 8rem; }
.table-wrap .form-actions, .card > .form-actions { justify-content: flex-end; }
.form-page .form-actions { justify-content: center; }
.status-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem 1.5rem; background: var(--esg-surface); border: 1px solid var(--esg-line); border-left: 4px solid var(--esg-teal); border-radius: .75rem; padding: .8rem 1.1rem; margin-bottom: 1rem; font-size: .86rem; }
.ss-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--esg-muted); }
.dash-card { padding: 1.1rem 1.1rem 1.2rem; display: flex; flex-direction: column; }
.dash-title { font-size: .98rem; font-weight: 600; text-align: center; margin: 0 0 .6rem; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.dash-title svg { width: 19px; height: 19px; color: var(--esg-muted); }
.chart-donut { height: 190px; }
.ratio-title { text-align: center; font-size: .82rem; font-weight: 600; margin: .4rem 0 .3rem; }
.ratio-list { list-style: none; margin: 0 auto .9rem; padding: 0; width: 100%; max-width: 230px; font-size: .84rem; }
.ratio-list li { display: flex; align-items: center; gap: .5rem; padding: .16rem 0; }
.ratio-list .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.ratio-val { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--esg-muted); }
.btn-detail { align-self: center; margin-top: auto; min-width: 7.5rem; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.dash-card .table-wrap { margin-bottom: .9rem; }
.hub { display: grid; grid-template-columns: 240px 1fr; background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: .75rem; overflow: hidden; }
.hub-profile { padding: 1.3rem 1.1rem; display: flex; flex-direction: column; align-items: flex-start; }
.hub-name { font-size: 1.05rem; font-weight: 600; }
.hub-role { display: flex; align-items: center; gap: .5rem; background: var(--esg-bg); border-radius: .5rem; padding: .45rem .7rem; font-size: .84rem; font-weight: 600; width: 100%; margin-bottom: .35rem; }
.hub-role svg { width: 18px; height: 18px; color: var(--esg-emerald); }
.hub-tiles { background: var(--esg-bg); padding: 1.1rem; border-left: 1px solid var(--esg-line); }
[data-bs-theme="dark"] .hub-tiles { background: #101C28; }
.route-card { border-color: var(--esg-line); }
.route-title { font-size: 1rem; font-weight: 600; }
.route-aff { border: 2px solid var(--esg-emerald); border-radius: .5rem; padding: .45rem .7rem; font-weight: 600; margin-bottom: .9rem; }
.route-steps { background: var(--esg-bg); border-radius: .6rem; padding: .9rem; }
[data-bs-theme="dark"] .route-steps { background: #101C28; }
.route-list { padding-left: 1.2rem; margin-bottom: .5rem; } .route-list li { margin-bottom: .45rem; }
.msg-card { background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: .6rem; padding: .7rem 1rem .6rem; margin-bottom: .7rem; box-shadow: 0 1px 2px rgba(16,36,58,.04); }
.msg-card.unread { border-left: 4px solid var(--esg-teal); }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--esg-line); padding-bottom: .45rem; }
.msg-title { font-weight: 600; } .msg-time { color: var(--esg-muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg-body { padding: .55rem 0; font-size: .87rem; color: var(--esg-ink); overflow-wrap: anywhere; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; font-size: .76rem; color: var(--esg-muted); }
.msg-foot svg { width: 13px; height: 13px; margin-right: .3rem; vertical-align: -2px; } .msg-foot .spacer { flex: 1; }
.composer { --bs-offcanvas-width: 380px; background: var(--esg-surface); }
.composer .offcanvas-header { border-bottom: 1px solid var(--esg-line); }
.counter { text-align: right; font-size: .72rem; color: var(--esg-muted); margin-top: .15rem; font-variant-numeric: tabular-nums; }
.composer legend { float: none; width: auto; font-size: .84rem; font-weight: 500; margin-bottom: .3rem; }
.composer-actions { display: flex; justify-content: center; gap: .75rem; margin-top: 1.25rem; } .composer-actions .btn { min-width: 7.5rem; }
.day-pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.day-pill { border: 1px solid #CBD5DF; border-radius: 999px; padding: .2rem .65rem; font-size: .76rem; cursor: pointer; user-select: none; background: var(--esg-surface); }
.btn-check:checked + .day-pill { background: var(--esg-emerald); border-color: var(--esg-emerald); color: #fff; }
.btn-check:focus-visible + .day-pill { outline: 2px solid var(--esg-teal); outline-offset: 2px; }
.dropzone { background: var(--esg-tint); border: 2px dashed transparent; border-radius: .75rem; padding: 2rem 1rem; text-align: center; transition: border-color .15s; }
.dropzone > svg { width: 44px; height: 44px; color: #9FB3C6; stroke-width: 1.4; }
.dropzone.dragover { border-color: var(--esg-teal); }
.dz-text { font-weight: 600; margin-top: .4rem; overflow-wrap: anywhere; }
.accordion { --bs-accordion-border-color: var(--esg-line); --bs-accordion-active-bg: var(--esg-tint); --bs-accordion-active-color: var(--esg-ink); --bs-accordion-btn-focus-box-shadow: 0 0 0 .2rem rgba(23,163,152,.2); --bs-accordion-bg: var(--esg-surface); }
.accordion-button { font-weight: 600; font-size: .9rem; }
.btn-outline-danger.btn-pill { --bs-btn-color: #A32820; --bs-btn-border-color: #A32820; --bs-btn-hover-bg: #A32820; --bs-btn-hover-border-color: #A32820; }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--esg-line); --bs-list-group-color: var(--esg-ink); font-size: .87rem; }
@media (max-width: 767.98px) { .hub { grid-template-columns: 1fr; } .hub-tiles { border-left: 0; border-top: 1px solid var(--esg-line); } }

/* ---- Guest (sign-in) pages -------------------------------------------------- */
.guest-body { background: var(--esg-bg); }
.guest-wrap { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; min-height: 100vh; }
.guest-panel { background: linear-gradient(160deg, var(--esg-navy) 0%, #0E3A44 55%, var(--esg-emerald) 120%); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.guest-brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; letter-spacing: .05em; font-size: 1.1rem; }
.guest-headline { font-size: 1.7rem; font-weight: 700; line-height: 1.25; max-width: 22ch; }
.guest-sub { color: #C3D6DF; max-width: 44ch; }
.guest-foot { font-size: .8rem; color: #9FB3C6; margin: 0; }
.guest-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.guest-card { width: 100%; max-width: 400px; background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: 1rem; padding: 2rem; box-shadow: 0 10px 30px rgba(16,36,58,.07); }
.guest-card h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.guest-version { font-size: .75rem; color: var(--esg-muted); margin-top: 1rem; }

/* ---- Installer ------------------------------------------------------------------ */
.inst-wrap { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.inst-side { background: linear-gradient(170deg, var(--esg-navy) 0%, #0E3A44 70%, var(--esg-emerald) 140%); color: #fff; padding: 2rem 1.5rem; display: flex; flex-direction: column; }
.inst-steps { list-style: none; padding: 0; margin: 0; }
.inst-steps li { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; color: #9FB3C6; font-size: .9rem; }
.inst-num { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex: 0 0 26px; }
.inst-steps li.done { color: #BFE7E0; } .inst-steps li.done .inst-num { background: var(--esg-teal); border-color: var(--esg-teal); color: #fff; }
.inst-steps li.current { color: #fff; font-weight: 600; } .inst-steps li.current .inst-num { background: #fff; color: var(--esg-navy); border-color: #fff; }
.inst-main { padding: 2rem 1.25rem; display: flex; justify-content: center; align-items: flex-start; }
.inst-card { width: 100%; max-width: 860px; background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: 1rem; padding: 2rem; box-shadow: 0 10px 30px rgba(16,36,58,.07); }
.inst-card h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: .75rem; }
.inst-box { background: var(--esg-bg); border: 1px solid var(--esg-line); border-radius: .75rem; padding: 1rem 1.1rem; height: 100%; }
.inst-key { border-left: 4px solid var(--esg-teal); }
.inst-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; } .inst-actions .btn { min-width: 9rem; }
.inst-test { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
@media (max-width: 991.98px) { .inst-wrap { grid-template-columns: 1fr; } .inst-side { padding: 1rem 1.25rem; } .inst-steps { display: flex; flex-wrap: wrap; gap: .25rem .9rem; } .inst-steps li { padding: .15rem 0; font-size: .78rem; } .inst-side .guest-foot { display: none; } .inst-card { padding: 1.25rem; } }

/* ---- Responsive ---------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(16,36,58,.45); z-index: 1035; }
  .sidebar-collapsed .sidebar { width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  .sidebar-collapsed .side-label, .sidebar-collapsed .brand-text, .sidebar-collapsed .chev { display: initial !important; }
  .sidebar-collapsed .side-sub.show { display: block !important; }
  .sidebar-collapsed .side-link { justify-content: flex-start; padding: .58rem .75rem; }
  .content { padding: .9rem .9rem 1.5rem; }
  .ctx-select { max-width: 130px; }
  .guest-wrap { grid-template-columns: 1fr; }
  .guest-panel { display: none; }
}
@media (max-width: 575.98px) {
  .ph-section, .ph-sep { display: none; }
  .ctx-year { display: none; }
  .dl-grid { grid-template-columns: 1fr; gap: 0 0; } .dl-grid dd { margin-bottom: .5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .sidebar, .topbar, .app-foot, .toolbar, .filter-panel, .crumbs { display: none !important; } .content { padding: 0; } }


/* ---- Phase 2: data collection, submissions, approval ---------------------------------------- */
.period-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.period-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .32rem .8rem; border: 1px solid var(--esg-line); border-radius: 999px; background: var(--esg-surface); color: var(--esg-ink); text-decoration: none; font-size: .8rem; font-weight: 600; }
.period-pill:hover { border-color: var(--esg-teal); color: var(--esg-ink); }
.period-pill.active { background: var(--esg-emerald); border-color: var(--esg-emerald); color: #fff; }
.period-pill.is-closed { color: var(--esg-muted); }
.period-pill.active.is-closed { color: #fff; }
.period-pill svg { width: 12px; height: 12px; }
h2.section-title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .7rem; }
h2.section-title svg { width: 18px; height: 18px; color: var(--esg-emerald); }
.tile-bar { width: 100%; height: 5px; border-radius: 3px; background: var(--esg-line); overflow: hidden; }
.tile-bar span { display: block; height: 100%; background: var(--esg-teal); }
.tile-done .tile-icon { background: #DDF3EC; color: #0A5C47; }
[data-bs-theme="dark"] .tile-done .tile-icon { background: #0E3B31; color: #7BE0C2; }
.group-row th { background: var(--esg-tint) !important; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--esg-muted); padding-top: .4rem !important; padding-bottom: .4rem !important; }
.entry-table td { vertical-align: top; }
.entry-table input.num, .grid-table input.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-error > td { background: rgba(214, 69, 58, .06) !important; }
.sticky-actions { position: sticky; bottom: 0; background: var(--esg-bg, var(--bs-body-bg)); padding: .75rem 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; border-top: 1px solid var(--esg-line); margin-top: .75rem; }
.grid-wrap { overflow-x: auto; }
.grid-table { min-width: 100%; width: max-content; }
.grid-table th.grid-kpi { position: sticky; left: 0; z-index: 2; background: var(--esg-surface); min-width: 13rem; max-width: 17rem; font-weight: 600; font-size: .82rem; white-space: normal; }
.grid-table thead th.grid-kpi { z-index: 3; background: var(--esg-navy); color: #fff; }
.grid-table td.grid-cell { padding: .25rem .2rem; text-align: center; vertical-align: top; }
.grid-table td.grid-cell input { padding: .25rem .4rem; width: 5.4rem; font-size: .8rem; }
.grid-table thead th { padding: .5rem .3rem; }
.grid-table th.grid-kpi { padding-left: .8rem; }
.grid-table td.grid-cell input[readonly] { background: var(--esg-tint); color: var(--esg-muted); }
.grid-table .invalid-feedback { font-size: .68rem; max-width: 7rem; text-align: left; white-space: normal; }
.grid-status { font-weight: 400; min-height: 1.3rem; }
.grid-status svg { width: 13px; height: 13px; color: var(--esg-muted); }
.grid-status .status-badge { font-size: .6rem; }
.stage-track { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 0; padding: .8rem 1rem; margin: 0 0 1rem; background: var(--esg-surface); border: 1px solid var(--esg-line); border-radius: .75rem; }
.stage { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 600; color: var(--esg-muted); flex: 1 1 auto; min-width: 7.5rem; position: relative; }
.stage::after { content: ""; flex: 1; height: 2px; background: var(--esg-line); margin: 0 .6rem; min-width: 1rem; }
.stage:last-child { flex: 0 0 auto; } .stage:last-child::after { display: none; }
.stage-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--esg-line); background: var(--esg-surface); flex: 0 0 14px; }
.stage.done { color: var(--esg-ink); } .stage.done .stage-dot { background: var(--esg-teal); border-color: var(--esg-teal); } .stage.done::after { background: var(--esg-teal); }
.stage.current { color: var(--bs-link-color); } .stage.current .stage-dot { border-color: var(--esg-emerald); box-shadow: 0 0 0 3px rgba(8,127,109,.2); background: var(--esg-emerald); }
.stage.is-alert.current { color: #8E1B14; } .stage.is-alert .stage-dot { background: #D6453A; border-color: #D6453A; box-shadow: 0 0 0 3px rgba(214,69,58,.2); }
.route-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.route-steps li { display: flex; gap: .7rem; align-items: flex-start; font-size: .86rem; }
.rs-no { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; border: 2px solid var(--esg-line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem; color: var(--esg-muted); }
.rs-no svg { width: 14px; height: 14px; }
.route-steps li.done .rs-no { background: var(--esg-teal); border-color: var(--esg-teal); color: #fff; }
.route-steps li.current .rs-no { border-color: var(--esg-emerald); color: var(--esg-emerald); box-shadow: 0 0 0 3px rgba(8,127,109,.18); }
.tl-comment { margin-top: .3rem; padding: .45rem .65rem; background: var(--esg-tint); border-radius: .4rem; font-size: .82rem; overflow-wrap: anywhere; }
.cover { display: flex; align-items: center; gap: .5rem; }
.cover-bar { width: 90px; height: 6px; border-radius: 3px; background: var(--esg-line); overflow: hidden; }
.cover-bar span { display: block; height: 100%; background: var(--esg-teal); }
.chart-tall { height: 360px; }
details.card > summary.card-header { cursor: pointer; list-style: none; }
details.card > summary.card-header::-webkit-details-marker { display: none; }
.status-badge svg { width: 11px; height: 11px; vertical-align: -1px; }
@media (max-width: 767.98px) { .stage { min-width: 46%; } .stage::after { display: none; } }
.ratio-cols { columns: 2; column-gap: 2rem; } .ratio-cols li { break-inside: avoid; } @media (max-width: 575.98px) { .ratio-cols { columns: 1; } }

td.cell-code, a.cell-code { white-space: nowrap; }
.ratio-list.ratio-cols { max-width: 520px; column-gap: 2.5rem; } .ratio-cols a, .ratio-cols .ratio-val { white-space: nowrap; }

/* ---- Phase 3: environment and carbon -------------------------------------------------------- */
.kpi-sub { font-size: .74rem; color: var(--esg-muted); margin-top: .1rem; }
.kpi-value small { font-size: .7rem; font-weight: 500; color: var(--esg-muted); }
.kpi-delta { font-weight: 600; }
.kpi-delta.down { color: #0A7A5A; } .kpi-delta.up { color: #B4472E; }
[data-bs-theme="dark"] .kpi-delta.down { color: #6FD9B5; } [data-bs-theme="dark"] .kpi-delta.up { color: #FF9C85; }
.display-value { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.display-value small { font-size: .9rem; font-weight: 500; color: var(--esg-muted); }
.tabbar .tab svg { width: 15px; height: 15px; vertical-align: -2px; }
.tabbar { flex-wrap: wrap; }
.text-success svg, .text-danger svg { width: 14px; height: 14px; vertical-align: -2px; }
