* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
        Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  background: #f5f6f8;
  color: #1f2330;
}
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.25rem;
  background: #1f2330; color: #fff;
  border-bottom: 1px solid #0d0f15;
}
.topbar .brand { font-size: 1.05rem; }
.topbar .brand strong { color: #51cf66; letter-spacing: .5px; }
/* .muted globally renders #71788a — too dim against the dark topbar.
   Override just inside the brand block so the "Customer & Orders
   Manager" subtitle reads clearly on the dark background. */
.topbar .brand .muted { color: #ffffff; }
.tabs { display: flex; gap: .25rem; margin-left: 1rem; }
.tabs .tab {
  background: transparent; border: 0; color: #c7cbd6;
  padding: .45rem .85rem; border-radius: 6px; cursor: pointer;
  font: inherit;
}
.tabs .tab:hover { background: #2d3142; color: #fff; }
.tabs .tab.active { background: #4cc2ff; color: #0d0f15; font-weight: 600; }
.stats {
  margin-left: auto; font-size: .85rem; color: #c7cbd6;
  display: flex; gap: 1rem;
}
.stats span b { color: #fff; }

main { padding: 1.25rem 1.25rem; max-width: 1800px; margin: 0 auto; }

/* Operations sub-nav — only visible when the Operations top tab is active. */
.ops-subnav {
  display: flex; gap: .35rem;
  margin: -.25rem 0 1rem;
  padding: .35rem .65rem;
  background: #fff;
  border: 1px solid #e2e6ee; border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .03);
}
.ops-subnav .ops-sub-tab {
  background: transparent; color: #1f2330;
  border: 1px solid transparent; border-radius: 6px;
  padding: .35rem .85rem; cursor: pointer;
  font: inherit; font-weight: 500;
}
.hidden { display: none !important; }
.ops-subnav.hidden { display: none; }
.ops-subnav .ops-sub-tab:hover  { background: #f3f6fb; }
.ops-subnav .ops-sub-tab.active { background: #1f2330; color: #fff; }
.ops-subnav .ops-sub-tab.hidden { display: none; }

.panel {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 8px;
  padding: 1.25rem; margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .03);
}
.panel.hidden { display: none; }
.panel-head { margin-bottom: 1rem; }
.panel-head h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.muted { color: #71788a; }

.row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-bottom: .75rem;
}
.row input[type="text"], .row input:not([type]) {
  padding: .4rem .6rem; border: 1px solid #d0d4de; border-radius: 6px;
  min-width: 320px; font: inherit;
}
.check { display: flex; align-items: center; gap: .35rem; }

input[type="text"], input:not([type]), input[type="file"] {
  font: inherit;
}

button {
  font: inherit; cursor: pointer;
  background: #4cc2ff; color: #0d0f15; border: 0;
  border-radius: 6px; padding: .45rem .9rem; font-weight: 600;
}
button:hover { background: #29b1ff; }
button.danger { background: #fff; color: #b3261e; border: 1px solid #f1c5c1; font-weight: 500; }
button.danger:hover { background: #fdecea; }

.table-scroll { overflow: auto; border: 1px solid #e2e6ee; border-radius: 6px; }
/* Roughly 6 rows tall: header (~32px) + 6 rows (~30px) + a hair. */
.lookup-scroll { max-height: 220px; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
th, td {
  text-align: left; padding: .4rem .6rem; border-bottom: 1px solid #eef0f4;
  white-space: nowrap;
}
th {
  position: sticky; top: 0; background: #f7f8fb; z-index: 1;
  font-weight: 600; color: #2c3142;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafbfd; }

.pivot th, .pivot td { white-space: nowrap; }
.pivot td.row-label, .pivot th:first-child { font-weight: 600; background: #f7f8fb; position: sticky; left: 0; z-index: 2; }
.pivot td.num { font-variant-numeric: tabular-nums; }
.pivot tr.total td { background: #eef5fb; font-weight: 600; }
.pivot th.year { background: #1f2330; color: #fff; }
.pivot th.month { background: #2d3142; color: #c7cbd6; font-weight: 500; }
.pivot th.total { background: #4cc2ff; color: #0d0f15; }
.pivot td.total { background: #eef5fb; font-weight: 600; }
/* Current-month column: subtle tint so it stands out from past/future months */
.pivot th.month.cur-month { background: #3a5f8a; color: #ddeeff; }
.pivot td.cur-month { background: rgba(77, 171, 247, 0.10); }
.pivot tr.total td.cur-month { background: rgba(77, 171, 247, 0.20); }

/* Small "i" info icon next to a category label. Native title tooltip
   shows on hover — sufficient for an explanatory hint, no JS needed. */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  margin-left: 4px;
  border-radius: 50%;
  background: #6c7a8c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  vertical-align: middle;
  user-select: none;
}
.info-icon:hover { background: #4f5a6e; }

/* Visually separate years: thicker left border at year-start cells,
   plus a subtle tint on every other year's columns. */
.pivot th.year-start,
.pivot th.month.year-start,
.pivot td.year-start {
  border-left: 2px solid #1f2330 !important;
}
.pivot th.month.year-tint { background: #3a4358; }
.pivot tbody td.year-tint { background: #f4f6fb; }
.pivot tbody tr:hover td.year-tint { background: #eaeef7; }
.pivot tbody tr.total td.year-tint { background: #dde8f3; }
.pivot th.total.year-tint { background: #29b1ff; }

/* Drill-down cells in the Yearly Revenue stacked tables: clickable to
   open the Orders tab pre-filtered to the contributing rows. Empty
   (zero-value) cells aren't given the .drill class so they don't
   masquerade as clickable. */
.pivot td.drill {
  cursor: pointer;
  color: #1a5fb4;
  text-decoration: underline dotted #c4d4e8;
  text-underline-offset: 2px;
}
.pivot td.drill:hover {
  background: #e6f1fb;
  text-decoration: underline solid #1a5fb4;
}
.pivot tr.total td.drill { color: #0d4a8a; }

/* Yearly Revenue: per-year stacked layout. */
.yearly-rev-controls {
  display: flex; align-items: flex-start; gap: .65rem;
  margin: .5rem 0 1rem;
  flex-wrap: wrap;
}
/* Each label stacks: text on top, select below */
.yearly-rev-controls label {
  display: flex; flex-direction: column; gap: .2rem;
  font-size: .72rem; font-weight: 700; color: #6b7280;
  text-transform: uppercase; letter-spacing: .05em;
}
.yearly-rev-controls select {
  font: inherit; font-size: .85rem; font-weight: 400;
  color: #1f2330;
  min-width: 7rem;
  padding: .25rem;
}
.ecp-controls {
  display: flex; align-items: center; gap: 1rem;
  margin: .5rem 0 1rem;
  flex-wrap: wrap;
}

/* Collapsible "How to read this" decision-tree explainer. */
details.ecp-explainer {
  margin: .25rem 0 1rem;
  border: 1px solid #d0d4de; border-radius: 6px;
  background: #fbfbfd;
}
details.ecp-explainer > summary {
  cursor: pointer;
  padding: .55rem .8rem;
  font-weight: 600;
  user-select: none;
}
details.ecp-explainer[open] > summary { border-bottom: 1px solid #e2e6ee; }
.ecp-explainer-scroll {
  overflow-x: auto;
  padding: .75rem .5rem;
}
.ecp-explainer-svg {
  width: 100%;
  min-width: 1100px;     /* horizontal scroll on narrow viewports */
  height: auto;
  font: 13px/1.3 -apple-system, "Segoe UI", system-ui, sans-serif;
}
.ecp-explainer-key {
  padding: 0 1rem .75rem;
  font-size: .9em;
  line-height: 1.5;
}
.ecp-box { stroke: #5b6b80; stroke-width: 1; fill: #fff; }
.ecp-box-text { fill: #1f2330; }
.ecp-root     { fill: #1f2330; stroke: #1f2330; }
.ecp-root + text { fill: #fff; font-weight: 600; }
.ecp-decision { fill: #e3effb; stroke: #5187c6; }
.ecp-info     { fill: #fff3cd; stroke: #b58105; }
.ecp-leaf     { stroke-width: 1.5; }
.ecp-leaf-future { fill: #d6ecff; stroke: #2563a8; }
.ecp-leaf-aa     { fill: #fff0c2; stroke: #b58105; }
.ecp-leaf-rev    { fill: #d4f5dc; stroke: #1e7f3a; }
.ecp-leaf-pu     { fill: #e6e8ee; stroke: #6c7382;
                   stroke-dasharray: 4 3; }
.ecp-leaf-skip   { fill: #f3f3f5; stroke: #aab0bd;
                   stroke-dasharray: 4 3; }
.ecp-leaf-skip + text { fill: #6c7382; }
.ecp-edge { stroke: #6c7382; stroke-width: 1.2; fill: none; }
.ecp-edge-label {
  fill: #6c7382;
  font-size: 11px;
  font-style: italic;
}
.ecp-controls label { font-weight: 600; }
.ecp-controls select { min-width: 8rem; padding: .25rem; }
.ecp-toggle { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; }
.pivot tr.total-row td, .pivot tr.total-row th {
  background: #eef5fb;
  font-weight: 700;
  border-top: 2px solid #c8d6e5;
}
.pivot tr.ecp-subtotal td, .pivot tr.ecp-subtotal th {
  background: #f4f6fb;
  font-weight: 600;
  border-top: 1px dashed #c8d6e5;
}
/* 5% size bump on the Expected Contract Payments – Forecast data
   tables. Scales both text and cell padding proportionally so the
   table reads slightly larger without affecting other reports. */
#ecp-table table.pivot { font-size: calc(0.87rem * 1.05); }
#ecp-table table.pivot th,
#ecp-table table.pivot td { padding: calc(0.4rem * 1.05) calc(0.6rem * 1.05); }

/* Frozen-column behaviour on the Expected Contract Payments table.
   Column 1 (Year, rowspan'd) sticks at left:0; column 2 (Bucket / total
   row labels) sticks immediately to its right. Everything from the
   month columns onward scrolls horizontally inside .table-scroll. */
#ecp-table .table-scroll {
  /* the wrapper already has overflow:auto from .table-scroll */
  position: relative;
}
#ecp-table table.pivot td.year-label {
  position: sticky;
  left: 0;
  z-index: 4;           /* above bucket label, which is above data cells */
  min-width: 4rem;
  width: 4rem;
}
#ecp-table table.pivot td.ecp-bucket-label {
  position: sticky;
  left: 4rem;           /* matches year-label width */
  z-index: 3;
  background: #f7f8fb;  /* must be opaque so data cells don't show through */
  min-width: 18rem;
  max-width: 22rem;
  white-space: normal;  /* allow wrap for long labels */
}
#ecp-table table.pivot tr.total td.ecp-bucket-label {
  background: #eef5fb;  /* match the total-row tint */
}
#ecp-table table.pivot tr.ecp-subtotal td.ecp-bucket-label {
  background: #f4f6fb;  /* match the subtotal tint */
}
/* Header row's first two <th> cells need to stick too, otherwise they
   scroll away from the columns they label. */
#ecp-table table.pivot thead th:nth-child(1) {
  position: sticky; left: 0; z-index: 5;
}
#ecp-table table.pivot thead th:nth-child(2) {
  position: sticky; left: 4rem; z-index: 5;
  min-width: 18rem;
}
.result.import-confirm {
  background: #f7f8fb;
  border: 1px solid #c8d6e5;
  border-radius: 6px;
  padding: 1rem;
}
.import-confirm-head { margin-bottom: .75rem; }
.import-confirm-head .muted {
  display: block;
  margin-top: .25rem;
  font-size: .9em;
}
.import-confirm-options {
  display: flex; flex-direction: column; gap: .4rem;
  margin: .5rem 0 1rem;
}
.import-type-opt {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .5rem .6rem; border: 1px solid #dde3eb;
  border-radius: 4px; cursor: pointer;
  background: #fff;
}
.import-type-opt:hover { background: #f3f6fb; }
.import-type-opt input[type="radio"] { margin-top: .15rem; }
.import-type-name { font-weight: 600; }
.import-type-desc { font-size: .85em; margin-top: .15rem; }
.import-confirm-actions {
  display: flex; gap: .5rem; justify-content: flex-end;
}
.import-auto-confirm {
  margin: 0 0 .65rem;
  padding: .4rem .6rem;
  background: #fff3bf;
  border: 1px solid #ffec99;
  border-radius: 4px;
  font-size: .82rem;
  color: #6a5418;
}
.import-auto-confirm.import-auto-cancelled {
  background: #f1f3f5; border-color: #dee2e6; color: #6b7280;
}
#import-auto-secs { font-weight: 700; font-variant-numeric: tabular-nums; }
/* Year cell rowspans across each year-block; bold + tinted to anchor it. */
.pivot td.year-label {
  background: #1f2330;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  vertical-align: middle;
}
/* Visual gap above each new year-block (after the first). */
.pivot tr.year-start td { border-top: 2px solid #1f2330; }

.upload {
  display: flex; gap: .75rem; align-items: center;
  padding: .9rem 1rem; border: 1px dashed #b9c0cc; border-radius: 8px;
  background: #fafbfd;
}
.upload button[disabled] { opacity: .5; cursor: not-allowed; }
.metabase-fetch-section {
  margin-top: .75rem;
  padding: .75rem 1rem;
  border: 1px solid #d0d4de;
  border-radius: 8px;
  background: #fafbfd;
}
.metabase-fetch-label {
  font-weight: 600;
  font-size: .85rem;
  color: #4a5070;
  margin-bottom: .5rem;
}
.metabase-fetch-fields {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}
.metabase-fetch-fields label {
  display: flex;
  flex-direction: column;
  font-size: .8rem;
  color: #6b7280;
  gap: .2rem;
}
.metabase-fetch-fields input[type="date"],
.metabase-fetch-fields input[type="text"],
.metabase-fetch-fields select {
  padding: .3rem .5rem;
  border: 1px solid #b9c0cc;
  border-radius: 5px;
  font: inherit;
  font-size: .9rem;
}
.metabase-fetch-fields button[disabled] { opacity: .5; cursor: not-allowed; }
.result { margin-top: .75rem; }
.result.ok    { color: #155724; background: #d4edda; padding: .6rem .8rem; border-radius: 6px; }
.result.err   { color: #842029; background: #f8d7da; padding: .6rem .8rem; border-radius: 6px; }
.result.progress-block { background: #f7f9fc; padding: .85rem 1rem; border: 1px solid #e2e6ee; border-radius: 8px; color: #1f2330; }

.progress {
  position: relative;
  width: 100%;
  background: #eaecef;
  border-radius: 999px;
  height: 22px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.progress-bar {
  background: linear-gradient(90deg, #4cc2ff, #29b1ff);
  height: 100%;
  width: 0;
  transition: width 0.18s ease-out;
}
.progress-bar.err { background: linear-gradient(90deg, #f5c2c0, #ee6e62); }
.progress-bar.ok  { background: linear-gradient(90deg, #6fdc8c, #2faa56); }
.progress-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 600; color: #1f2330;
  letter-spacing: .2px;
  pointer-events: none;
}
.progress-meta {
  display: flex; justify-content: space-between;
  margin-top: .35rem; font-size: .8rem; color: #71788a;
  font-variant-numeric: tabular-nums;
}

.lookup-stack {
  display: flex; flex-direction: column; gap: .75rem;
}
.lookup-section {
  border: 1px solid #e2e6ee; border-radius: 8px; background: #fff;
}
.lookup-section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem .85rem;
  font-weight: 600; color: #1f2330;
  user-select: none;
  border-radius: 8px;
}
.lookup-section > summary::-webkit-details-marker { display: none; }
.lookup-section > summary:hover { background: #f7f8fb; }
.lookup-section[open] > summary {
  background: #f7f8fb;
  border-bottom: 1px solid #e2e6ee;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.lookup-caret {
  display: inline-block; transition: transform .15s ease;
  color: #71788a; font-size: .9em;
}
.lookup-section[open] > summary .lookup-caret { transform: rotate(90deg); }
.lookup-title { font-weight: 600; }
.lookup-hint {
  margin-left: auto;
  font-weight: 400; font-size: .82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}
.lookup-body { padding: .85rem; }
@media (max-width: 720px) {
  .lookup-hint { display: none; }
}

/* Lookups: red attention badge shown next to titles when there are
   placeholder rows the admin still needs to fill in. */
.attn-badge {
  display: inline-block;
  margin-left: .35rem;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: #b3261e;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: middle;
  min-width: 1.4em;
  text-align: center;
}
/* Tab badges sit on a dark bar — keep the red vivid against the dark */
.tabs .tab .attn-badge { background: #ff3b30; }
.tabs .tab.active .attn-badge { background: #b3261e; }

/* Highlight rows whose secondary fields are still blank. */
tr.lookup-incomplete td { background: #fff5f5; }
tr.lookup-incomplete:hover td { background: #ffe9e9; }
tr.lookup-incomplete td:first-child {
  border-left: 3px solid #b3261e;
}
.import-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .55rem;
}
.import-meta .muted { font-size: .85rem; }
.import-meta code { background: #f1f3f7; padding: 0 .3rem; border-radius: 3px; }
.import-busy { background: #fff8e6; border: 1px solid #f5d77a; padding: .75rem; border-radius: 6px; }

a.failures-link {
  color: #b3261e; font-weight: 600; text-decoration: none;
  border-bottom: 1px dotted #b3261e;
}
a.failures-link:hover { color: #6b160f; border-bottom-style: solid; }

.needs-attn {
  display: inline-block;
  margin-left: .4rem;
  padding: 0 .4rem;
  border-radius: 4px;
  background: #fde2e1;
  color: #b3261e;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Click-to-edit affordance for lookup rows. Read-only rows (non-admins)
   keep the default cursor and don't get the hover highlight. */
tr.lookup-row { cursor: pointer; }
tr.lookup-row:hover td { background: #eef4fb; }
tr.lookup-incomplete.lookup-row:hover td { background: #ffe1e1; }
tr.lookup-row.lookup-readonly { cursor: default; }
tr.lookup-row.lookup-readonly:hover td { background: inherit; }
tr.lookup-row.lookup-readonly[title] { /* defensive: ensure no tooltip */ }

/* Brief highlight on the row that was just saved — incomplete rows sort
   to the top, so after filling them in they jump to the bottom and the
   admin needs a visual cue that the change took effect. */
@keyframes lookup-flash-fade {
  0%   { background: #fff3b0; }
  100% { background: transparent; }
}
tr.lookup-flash td {
  animation: lookup-flash-fade 1.8s ease-out;
}

/* Locked natural-key input while editing — visually indicate it's
   read-only so the admin doesn't try to change it. */
.lookup-form input.lookup-key-readonly {
  background: #f1f3f7;
  color: #5b6172;
  cursor: not-allowed;
  font-style: italic;
}

/* Suggested values pre-filled from a similar already-classified row.
   The yellow tint signals "this isn't saved yet — review before
   submitting"; the marker clears the moment the admin types. */
.lookup-form input.lookup-suggested {
  background: #fff8d6;
  border-color: #d4ad17;
  font-style: italic;
}

.muted-btn.lookup-cancel {
  background: #fff; color: #1f2330; font-weight: 500;
  border: 1px solid #d0d4de; padding: .35rem .75rem;
}
.muted-btn.lookup-cancel:hover { background: #f7f8fb; }

/* Inline save-status under the form. Spans the whole grid row so it
   doesn't push other form controls around. */
.lookup-status {
  grid-column: 1 / -1;
  font-size: .82rem;
  color: #455161;
  min-height: 1.1rem;
}
.lookup-status:empty { display: none; }
.lookup-status.saving { color: #455161; }
.lookup-status.saved  { color: #1d8a4f; font-weight: 600; }
.lookup-status.error  { color: #b3261e; font-weight: 600; }

.lookup-form {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .5rem;
  margin-bottom: .75rem;
}
.lookup-form input {
  padding: .35rem .55rem; border: 1px solid #d0d4de; border-radius: 6px;
}
.badge {
  display: inline-block; padding: .05rem .45rem; border-radius: 10px;
  font-size: .75rem; font-weight: 600;
}
.badge.yes { background: #d4edda; color: #155724; }

/* ---- Formula columns (Excel cols AL..BC) ---- */
th.fcol {
  background: #fdf6dd !important;
  color: #5b4a08;
  white-space: nowrap;
}
th.fcol .fbadge {
  display: inline-block;
  background: #b8860b;
  color: #fff;
  font: 700 .68rem ui-monospace, "SF Mono", Menlo, monospace;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 5px;
  letter-spacing: .3px;
  vertical-align: 1px;
}
td.fcol {
  background: #fffbe6;
}
tr:hover td.fcol { background: #fff5b8; }
tr.expanded td.fcol { background: #fff2a8; }

td.expander {
  width: 24px; text-align: center;
  cursor: pointer; user-select: none;
  color: #71788a;
}
td.expander::before {
  content: "\25B8"; /* ▸ */
  display: inline-block;
  transition: transform .15s ease;
  font-size: .9rem;
}
tr.expanded td.expander::before {
  transform: rotate(90deg);
  color: #b8860b;
}

tr.formula-row td {
  background: #f6f8fc;
  padding: .9rem 1.1rem;
  border-bottom: 2px solid #d8dde7;
}
.fdetails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .55rem .85rem;
}
.fcard {
  background: #fff;
  border: 1px solid #e2e6ee;
  border-left: 3px solid #b8860b;
  border-radius: 4px;
  padding: .45rem .6rem .55rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.fcard .fhead {
  display: flex; align-items: center; gap: .4rem;
}
.fcard .fxl {
  background: #b8860b; color: #fff;
  font: 700 .65rem ui-monospace, "SF Mono", Menlo, monospace;
  padding: 1px 5px; border-radius: 3px;
  letter-spacing: .3px;
}
.fcard .flabel {
  font-weight: 600; font-size: .82rem; color: #1f2330;
}
.fcard .fvalue {
  font: 700 .9rem ui-monospace, "SF Mono", Menlo, monospace;
  color: #0d0f15;
  word-break: break-all;
  margin-top: .1rem;
}
.fcard .fvalue.empty { color: #b9c0cc; font-weight: 500; font-style: italic; }
.fcard .fdesc {
  font-size: .73rem; color: #71788a; line-height: 1.35;
}
.fcard .fexpr {
  margin-top: .25rem;
  font: .7rem/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  color: #455161;
  background: #eef0f4;
  padding: 3px 6px; border-radius: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Orders controls: view toggle, filter row, pager, popover ---- */
.orders-controls { gap: .6rem; align-items: center; }
.orders-controls label.check select {
  font: inherit; padding: .2rem .35rem;
  border: 1px solid #d0d4de; border-radius: 5px;
}
button.primary {
  background: #4cc2ff; color: #0d0f15;
  font-weight: 700;
  border: 1px solid transparent;
}
button.primary:hover { background: #29b1ff; }
td.orders-placeholder {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #71788a;
  background: #fafbfd;
  font-size: .9rem;
}
td.orders-placeholder b { color: #1f2330; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1.1em; height: 1.1em;
  border: 2px solid #c8cdd6;
  border-top-color: #1f2330;
  border-radius: 50%;
  animation: cam-spin .8s linear infinite;
  vertical-align: -0.2em;
}
.loading-block {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: 2.5rem 1rem;
  color: #71788a; font-size: .95rem;
}
.loading-block .spinner { width: 1.4em; height: 1.4em; border-width: 3px; }
td.loading-cell {
  text-align: center;
  padding: 3rem 1rem;
  color: #1f2330;
  background: #fafbfd;
  font-size: 1rem;
  font-weight: 500;
}
td.loading-cell .spinner {
  width: 1.6em; height: 1.6em; border-width: 3px;
  margin-right: .65rem;
}
.orders-controls .spinner {
  margin-left: .35rem;
  width: 1em; height: 1em; border-width: 2px;
}
@keyframes cam-spin { to { transform: rotate(360deg); } }

/* Report freshness header (last-generated indicator + Regenerate button) */
.report-freshness {
  display: flex; align-items: center; gap: .65rem;
  margin: 0 0 .85rem;
  padding: .5rem .75rem;
  background: #f7f8fb;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  font-size: .85rem;
}
.report-freshness .muted { color: #5b6172; }
.report-stale-pill {
  display: inline-block;
  padding: .1rem .55rem; border-radius: 999px;
  background: #fff3cd; color: #856404;
  font-size: .75rem; font-weight: 600;
  border: 1px solid #ffe69c;
}
.report-refresh {
  margin-left: auto;
  background: #fff !important; color: #1f2330 !important;
  border: 1px solid #d0d4de !important;
  padding: .3rem .7rem !important;
  font-weight: 500 !important;
}
.report-refresh:hover:not(:disabled) { background: #f7f8fb !important; }
.report-refresh:disabled { opacity: .55; cursor: progress; }

/* Last-import info bar (shown above reports that depend on an import) */
.import-info-bar {
  display: flex; align-items: center; gap: .55rem;
  margin: 0 0 .65rem;
  padding: .5rem .75rem;
  background: #eef4fb;
  border: 1px solid #c8d8ec;
  border-left: 4px solid #4a78b8;
  border-radius: 6px;
  font-size: .85rem;
  color: #1f2a44;
}
.import-info-bar .muted { color: #5b6172; }
.import-info-bar code {
  background: #fff; border: 1px solid #d8e0ec;
  padding: 0 .35rem; border-radius: 3px;
  font-size: .8rem;
}
.import-info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem;
  background: #4a78b8; color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.import-info-text { line-height: 1.35; }
.import-info-bar-empty {
  background: #fff8e8; border-color: #f0d99a; border-left-color: #c89a2b;
  color: #6a5418;
}
.view-toggle {
  display: inline-flex;
  border: 1px solid #d0d4de; border-radius: 6px; overflow: hidden;
}
.view-toggle button {
  background: #fff; color: #1f2330; font-weight: 500;
  border: 0; padding: .35rem .8rem; border-radius: 0;
}
.view-toggle button.active { background: #1f2330; color: #fff; }
.view-toggle button + button { border-left: 1px solid #d0d4de; }

.formula-help-btn {
  background: #fdf6dd; color: #5b4a08; border: 1px solid #e6d896;
  font-weight: 600; cursor: pointer;
}
.formula-help-btn .fbadge {
  background: #b8860b; color: #fff;
  font: 700 .72rem ui-monospace, "SF Mono", Menlo, monospace;
  padding: 1px 5px; border-radius: 3px; margin-right: 5px;
}
.muted-btn {
  background: #f7f8fb; color: #455161; border: 1px solid #d0d4de;
  font-weight: 500;
}

.formula-popover {
  position: fixed;
  z-index: 50;
  width: min(820px, 92vw);
  max-height: min(70vh, 600px);
  overflow: auto;
  background: #fff;
  border: 1px solid #d0d4de;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(13,15,21,.18), 0 4px 8px rgba(13,15,21,.06);
  padding: .85rem 1rem;
}
.formula-popover.hidden { display: none; }
.formula-popover-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: .55rem;
  border-bottom: 1px solid #eef0f4; padding-bottom: .4rem;
}

/* Sortable header */
th.sortable { cursor: pointer; user-select: none; position: sticky; }
th.sortable:hover { background: #eef2fb; }
th.sortable .sort-mark {
  font-size: .75rem; color: #b9c0cc; margin-left: 4px;
  display: inline-block;
}
th.sortable.sort-asc  .sort-mark::after  { content: "▲"; color: #1f2330; }
th.sortable.sort-desc .sort-mark::after  { content: "▼"; color: #1f2330; }
th.sortable.sort-none .sort-mark::after  { content: "↕"; color: #b9c0cc; }
th.fcol.sortable:hover { background: #f9f0c4; }

/* Filter row in thead */
tr.filter-row th {
  background: #f7f8fb;
  padding: .25rem .35rem;
  font-weight: 400;
  border-bottom: 1px solid #e2e6ee;
  position: sticky; top: 32px;  /* below the header row */
  z-index: 1;
}
tr.filter-row th.fcol  { background: #fcf2c7; }
tr.filter-row .filter-input,
tr.filter-row select {
  width: 100%;
  font: inherit; font-size: .78rem;
  padding: 2px 4px;
  border: 1px solid #d8dde7;
  border-radius: 3px;
  background: #fff;
}
tr.filter-row .date-filter {
  display: flex; gap: 3px;
}
tr.filter-row .date-filter select {
  flex: 1; min-width: 0; padding: 2px;
}
tr.filter-row .num-filter::placeholder { color: #b9c0cc; }
tr.filter-row .filter-clear {
  font: 700 .7rem ui-monospace, monospace;
  color: #b9c0cc; cursor: pointer;
  border: 0; background: transparent; padding: 0 2px;
}
tr.filter-row .filter-clear:hover { color: #b3261e; }

/* Pager */
.pager {
  display: flex; align-items: center; gap: .4rem;
  margin-top: .85rem; padding: .55rem .75rem;
  border: 1px solid #e2e6ee; border-radius: 6px;
  background: #fafbfd;
  flex-wrap: wrap;
}
.pager button {
  background: #fff; color: #1f2330; border: 1px solid #d0d4de;
  padding: .3rem .55rem; font-weight: 500; min-width: 30px;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .page-input {
  width: 60px; text-align: center;
  padding: .3rem .4rem; border: 1px solid #d0d4de; border-radius: 6px;
  font: inherit; font-variant-numeric: tabular-nums;
}
.pager .page-info { color: #455161; }
.pager .pager-spacer { flex: 1; }
.pager select {
  padding: .3rem .4rem; border: 1px solid #d0d4de; border-radius: 6px;
  font: inherit;
}

/* Refund + revenue badges in dynamic rows */
td .num-cell { font-variant-numeric: tabular-nums; }

/* ---- Reports tab: sidebar + main ---- */
.reports-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1.25rem;
  align-items: start;
  transition: grid-template-columns .18s ease;
}
.reports-layout.sidebar-collapsed {
  grid-template-columns: 28px 1fr;
  gap: .5rem;
}
@media (max-width: 900px) {
  .reports-layout { grid-template-columns: 1fr; }
  .reports-layout.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar-collapse-btn { display: none; }
}

.reports-sidebar {
  border-right: 1px solid #e2e6ee;
  padding: .25rem 1rem .25rem 0;
  overflow: hidden;
}
.reports-layout.sidebar-collapsed .reports-sidebar {
  padding: .25rem 0 0;
  border-right-color: #e2e6ee;
}
.reports-layout.sidebar-collapsed .sidebar-body { display: none; }

/* Toggle button */
.sidebar-collapse-btn {
  display: block;
  margin-left: auto;           /* push to right edge of sidebar */
  width: 22px; height: 22px;
  padding: 0;
  line-height: 22px;
  text-align: center;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  margin-bottom: .4rem;
}
.sidebar-collapse-btn:hover {
  background: #f0f4ff;
  color: #1f2330;
  border-color: #a5b4fc;
}
/* When collapsed the button is the only visible element — center it */
.reports-layout.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

.reports-sidebar h3 {
  margin: 0 0 .75rem; font-size: .8rem;
  text-transform: uppercase; color: #71788a; letter-spacing: .8px;
}
.reports-group { margin-bottom: 1.1rem; }
.reports-group-name {
  font-size: .72rem; color: #71788a;
  text-transform: uppercase; letter-spacing: .6px;
  margin: 0 0 .35rem .35rem;
}
.report-link {
  display: block; width: 100%;
  text-align: left;
  background: transparent; color: #1f2330;
  border: 0; padding: .5rem .65rem;
  border-radius: 6px; margin-bottom: 1px;
  font-weight: 500; font-size: .9rem; cursor: pointer;
}
.report-link:hover { background: #eef2fb; }
.report-link.active {
  background: #1f2330; color: #fff;
  font-weight: 600;
}

.reports-main {
  /* Grid items default to min-width: auto, which lets a wide child
     (e.g. a 1600px-wide pivot table) blow the column out instead of
     scrolling inside it. Force it back so .table-scroll handles
     horizontal overflow. */
  min-width: 0;
}
.reports-main h2 { margin: 0 0 .15rem; }
.reports-main .table-scroll { max-width: 100%; }

/* Reports → Home: card grid */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.report-card {
  display: flex; flex-direction: column;
  text-align: left;
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  font: inherit;
  transition: transform .12s ease-out, box-shadow .12s ease-out, border-color .12s;
}
.report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(13,15,21,.08);
  border-color: #4cc2ff;
}
.report-card-cat {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #4cc2ff;
  margin-bottom: .35rem;
}
.report-card-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: #1f2330;
  margin-bottom: .4rem;
}
.report-card-desc {
  font-size: .82rem;
  color: #455161;
  line-height: 1.45;
  flex: 1;
}
.report-card-cta {
  margin-top: .85rem;
  color: #4cc2ff;
  font-size: .82rem;
  font-weight: 600;
}

/* MSP/Reseller report-specific table tweaks */
.report-table-controls {
  display: flex; gap: .75rem; align-items: center;
  margin-bottom: .75rem; flex-wrap: wrap;
}
.report-table-controls input {
  padding: .35rem .55rem; border: 1px solid #d0d4de;
  border-radius: 6px; font: inherit; min-width: 280px;
}
.pivot th.col-sticky-1, .pivot td.col-sticky-1 {
  position: sticky; left: 0;
  background: #f7f8fb; z-index: 2;
  min-width: 220px; max-width: 320px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pivot th.col-sticky-2, .pivot td.col-sticky-2 {
  position: sticky; left: 220px;
  background: #f7f8fb; z-index: 2;
  min-width: 130px;
  white-space: nowrap;
}
.pivot tbody tr:hover td.col-sticky-1,
.pivot tbody tr:hover td.col-sticky-2 { background: #eef2fb; }
.pivot tbody tr.total td.col-sticky-1,
.pivot tbody tr.total td.col-sticky-2 { background: #dde8f3; }

/* ---- Auth: login + setup screens ---- */
.auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2330, #2d3142);
  z-index: 100;
}
.auth-screen.hidden { display: none; }
.auth-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.75rem 2rem;
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
  width: 360px; max-width: 90vw;
}
.auth-card h1 {
  margin: 0 0 .25rem; color: #4cc2ff; letter-spacing: 1px;
}
.auth-card p { margin: 0 0 1rem; }
.auth-card label {
  display: block; margin-bottom: .75rem;
  font-size: .82rem; color: #455161; font-weight: 500;
}
.auth-card label input {
  display: block; width: 100%;
  padding: .55rem .65rem; margin-top: .25rem;
  border: 1px solid #d0d4de; border-radius: 6px;
  font: inherit;
}
.auth-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  margin-top: .25rem;
}
.auth-actions button { padding: .55rem 1rem; }
.auth-error {
  margin-top: .65rem;
  padding: .5rem .75rem;
  background: #f8d7da; color: #842029;
  border-radius: 6px; font-size: .85rem;
}
.auth-error.hidden, .auth-ok.hidden { display: none; }
.auth-ok {
  margin-top: .65rem;
  padding: .5rem .75rem;
  background: #d4edda; color: #155724;
  border-radius: 6px; font-size: .85rem;
}

/* ---- User menu in topbar ---- */
.user-menu {
  position: relative;
  margin-left: 1rem;
  font-size: .85rem; color: #c7cbd6;
}
.user-icon-btn {
  background: transparent; color: #c7cbd6;
  border: 1px solid #2d3142;
  border-radius: 50%;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
}
.user-icon-btn:hover { background: #2d3142; color: #fff; border-color: #4cc2ff; }
.user-icon-btn[aria-expanded="true"] { background: #2d3142; color: #fff; }
.user-icon-btn .user-icon {
  width: 20px; height: 20px; fill: currentColor;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 200px;
  background: #fff;
  color: #1f2330;
  border: 1px solid #d0d4de;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  padding: .35rem 0;
  z-index: 120;
}
.user-dropdown.hidden { display: none; }
.user-dropdown-header {
  padding: .55rem .9rem .65rem;
  border-bottom: 1px solid #ecedf2;
  font-size: .82rem; color: #455161;
}
.user-dropdown-header #user-info b { color: #1f2330; margin-right: 4px; }
.user-dropdown-item {
  display: block; width: 100%;
  padding: .55rem .9rem;
  background: transparent; border: 0; cursor: pointer;
  text-align: left;
  font: inherit; color: #1f2330;
}
.user-dropdown-item:hover { background: #f4f6fb; }

#app-shell.hidden { display: none; }
.admin-only.hidden { display: none; }

/* ---- Modal (change password) ---- */
.modal {
  position: fixed; inset: 0;
  background: rgba(13, 15, 21, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 110;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  width: 380px; max-width: 92vw;
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
}
.modal-card h3 { margin: 0 0 1rem; }
.modal-card label {
  display: block; margin-bottom: .65rem;
  font-size: .82rem; color: #455161; font-weight: 500;
}
.modal-card label input {
  display: block; width: 100%;
  padding: .5rem .6rem; margin-top: .25rem;
  border: 1px solid #d0d4de; border-radius: 6px;
  font: inherit;
}
.modal-card .auth-actions { margin-top: 1rem; }
.modal-card .auth-actions button:first-child {
  background: #fff; color: #455161; border: 1px solid #d0d4de; font-weight: 500;
}

/* Wide modal variant — used by the Reseller Renewals drill, where we
   list joined reseller_orders + orders rows and need horizontal room
   for ~18 columns. */
.modal-card.wide { width: 92vw; max-width: 1500px; }
.modal-card.wide .table-scroll { max-height: 70vh; overflow: auto; }

/* Reseller Renewals drill: joined-orders columns (subscription
   expiration date, order_state, payment_status, …) come from a
   different table than the reseller-side columns. Tint them so the
   user can tell at a glance which side a value comes from. */
.yro-joined-th, .yro-joined-td {
  background: #eef5fb;
  color: #1c4767;
}
.yro-joined-th { border-bottom-color: #b6cee0 !important; }
/* Renewal-side columns — tinted green so the user can tell them
   apart from both the reseller-side (default) and orders-side (blue)
   columns in the Reseller Renewals drill. */
.yro-renew-th, .yro-renew-td {
  background: #ecf8ee;
  color: #1f5031;
}
.yro-renew-th { border-bottom-color: #bcd9c2 !important; }
.rr-cell-drill { cursor: pointer; }
.rr-cell-drill:hover { background: #e6f0ff; }

/* CC Outstanding report */
#cco-table thead th { background: #f5f7fa; }
.cco-cell-drill { cursor: pointer; }
.cco-cell-drill:hover { background: #e6f0ff; }
.cco-paid-row td {
  background: #d4edda;
  font-weight: 600;
  border-top: 2px solid #28a745;
  border-bottom: 2px solid #28a745;
}
.cco-paid-badge {
  display: inline-block;
  background: #d4edda;
  color: #155724;
  border: 1px solid #28a745;
  border-radius: 3px;
  font-size: .75rem;
  padding: .1rem .4rem;
  vertical-align: middle;
}
.rr-section-head td {
  background: #f0f3f8;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #4f5a6e;
  padding: .45rem .75rem;
  border-top: 2px solid #b9c5d6;
}

/* Future-Contracts drill page — full-width panel with vertical and
   horizontal scroll on the table area. The .panel container already
   provides outer padding; here we just size the scroll viewport. */
.fc-page-head {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.fc-page-head h2 { margin: 0; }
.fc-page-head #fc-page-meta { flex-basis: 100%; margin-top: .25rem; }
#fc-page-scroll {
  /* Fill the viewport below the header — both axes scroll. */
  max-height: calc(100vh - 200px);
  overflow: auto;
}
.fc-page-table { width: 100%; }
.fc-page-table th, .fc-page-table td {
  padding: .35rem .55rem; font-size: .82rem; white-space: nowrap;
}
.fc-page-table thead th {
  position: sticky; top: 0; background: #2d3142; color: #c7cbd6;
  z-index: 2;
}
.fc-page-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Click-to-copy reference: any short identifier (sales order number,
   license key, contract main-order #) rendered with this class becomes
   a small button that copies the value to the clipboard on click. */
.copy-ref {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #d6dbe5;
  border-radius: 4px;
  background: #f7f9fc;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .82rem;
  color: #1f2330;
  cursor: pointer;
  user-select: all;            /* makes manual copy work too */
  transition: background 120ms, border-color 120ms;
}
.copy-ref:hover  { background: #eef3fb; border-color: #b6c2d6; }
.copy-ref:focus  { outline: 2px solid #5aa9ff; outline-offset: 1px; }
.copy-ref-flash  { background: #d2efd6 !important; border-color: #76c084 !important; }

/* Invoice Calculation report — small controls bar above the table. */
.invoice-controls {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  margin: .75rem 0;
}
.invoice-controls label {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .85rem; color: #455161;
}
.invoice-controls input[type="text"] {
  padding: .3rem .5rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; min-width: 220px;
}
.invoice-controls select {
  padding: .3rem .5rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit;
}
#inv-meta { margin: .5rem 0 .75rem; }
.invoice-table .total td { background: #eef5fb; font-weight: 600; }
.invoice-table .total td.row-label { background: #d8e6f3; }

/* Permissions admin matrix — compact table, tinted section divider rows. */
.perm-table { max-width: 800px; }
.perm-table th, .perm-table td { padding: .35rem .55rem; }
.perm-table tr.perm-section td {
  background: #2d3142; color: #c7cbd6;
  font-weight: 600; text-transform: uppercase; font-size: .78rem;
}
.perm-table input[type="checkbox"] { transform: scale(1.15); cursor: pointer; }
.perm-table input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .55; }
.perm-select { font-size: .8rem; padding: .15rem .25rem; min-width: 60px; }
.perm-select:disabled { opacity: .55; cursor: not-allowed; }
.perm-actions {
  display: flex; align-items: center; gap: 1rem;
  margin: 1rem 0 .25rem;
}

.tab.hidden { display: none; }

/* Orders toolbar: Update-Date range picker injected at runtime. */
.orders-daterange {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-left: .5rem;
}
.orders-daterange label {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .85rem;
}
.orders-daterange input[type="date"] {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit;
}

/* Freeze List report styling. */
.freeze-tabs {
  display: flex; gap: .5rem; margin: .5rem 0 1rem;
}
.freeze-tabs .muted-btn.active {
  background: #1f2330; color: #fff; border-color: #1f2330;
}
.freeze-decision-panel {
  background: #f7f9fc; border: 1px solid #e3e6ee; border-radius: 6px;
  padding: .75rem; margin: .75rem 0;
}
.freeze-decision-panel h3 { margin: 0 0 .5rem; font-size: .95rem; }
.freeze-decision-panel .decision-row {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  margin-bottom: .5rem;
}
.freeze-decision-panel .decision-row label.grow { flex: 1 1 100%; }
.freeze-decision-panel textarea {
  width: 100%; padding: .35rem .5rem;
  border: 1px solid #d0d4de; border-radius: 5px; font: inherit;
}
/* ── Freeze list single-customer summary cards ──────────────────── */
.fl-summary-cards {
  display: flex; gap: 1rem; margin: .75rem 0 .5rem; flex-wrap: wrap;
}
.fl-summary-card {
  flex: 1 1 340px; min-width: 280px; max-width: 560px;
  background: #f7f9fc; border: 1px solid #dde2ee; border-radius: 8px;
  padding: .75rem 1rem; box-sizing: border-box;
}
.fl-sc-header { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem; }
.fl-sc-title   { font-weight: 700; font-size: .9rem; color: #1f2330; }
.fl-sc-subtitle { font-size: .8rem; color: #4a5568;
                  font-family: ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace; }
.fl-sc-metrics { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .55rem; }
.fl-sc-metric  {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 6px;
  padding: .35rem .6rem; min-width: 110px;
}
.fl-sc-metric-out { border-color: #f0a070; background: #fff8f5; }
.fl-sc-metric-label { display: block; font-size: .72rem; color: #71788a; margin-bottom: .15rem; }
.fl-sc-metric-val   { display: block; font-size: .95rem; font-weight: 700;
                       color: #1f2330; font-variant-numeric: tabular-nums; }
.fl-sc-metric-out .fl-sc-metric-val { color: #b84a00; }
.fl-sc-table { width: 100%; border-collapse: collapse; font-size: .8rem; margin-bottom: .4rem; }
.fl-sc-table th { text-align: left; color: #71788a; font-weight: 600;
                   border-bottom: 1px solid #e2e6ee; padding: .2rem .3rem; }
.fl-sc-table td { padding: .2rem .3rem; border-bottom: 1px solid #f0f2f7; }
.fl-sc-cat  { color: #1f2330; }
.fl-sc-num  { text-align: right; font-variant-numeric: tabular-nums; }
.fl-sc-out  { color: #b84a00; font-weight: 600; }
.fl-sc-dates { font-size: .75rem; margin-top: .35rem; }
.fl-sc-actions {
  margin-top: .45rem;
  font-size: .78rem;
  border-top: 1px solid #eef0f5;
  padding-top: .35rem;
}
.fl-sc-metric-link {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.fl-sc-emails { margin-bottom: .45rem; font-size: .78rem; line-height: 1.6; }
.fl-sc-email-tag {
  display: inline-block; background: #e8f0fe; color: #1a4ca8;
  border-radius: 3px; padding: 0 5px; margin: 1px 2px;
  font-family: ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
}

.fl-orders-table th, .fl-orders-table td { padding: .3rem .5rem; font-size: .8rem; }
.fl-orders-table thead th {
  position: sticky; top: 0; background: #2d3142; color: #c7cbd6; z-index: 2;
}
.fl-orders-table tr.fl-refund-row td { background: #fff1f1; }
.fl-bucket {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: .75rem; font-weight: 600;
}
.fl-bucket-paid    { background: #d2efd6; color: #1a4a25; }
.fl-bucket-refund  { background: #fce0e0; color: #7a1d1d; }
.fl-bucket-90      { background: #ffd7d7; color: #7a1d1d; }
.fl-bucket-60      { background: #ffe4c4; color: #7a4d1d; }
.fl-bucket-30      { background: #fff7c2; color: #6a571d; }
.fl-bucket-fresh   { background: #e6f0ff; color: #1f2f5a; }

.fl-multi-table th, .fl-multi-table td { padding: .3rem .45rem; font-size: .8rem; }
.fl-multi-table thead th {
  position: sticky; top: 0; background: #2d3142; color: #c7cbd6; z-index: 2;
}
.fl-multi-table textarea { width: 100%; min-width: 180px; resize: vertical; font: inherit; }
.fl-multi-table select   { font: inherit; }
.fl-multi-table tbody tr td.num { font-variant-numeric: tabular-nums; }
.fl-multi-table .fl-link {
  color: #1a4ca8; text-decoration: none; cursor: pointer;
}
.fl-multi-table .fl-link:hover { text-decoration: underline; }
.fl-multi-table .fl-email-link {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .82rem;
}

/* Cap the multi-mode list height so users always see the top + bottom
   scrollbars in the same viewport. Tuned to ~half the viewport so the
   email textarea + status + scroll bar + grid + bottom scrollbar all
   fit comfortably without scrolling the outer page. */
.fl-multi-scroll {
  max-height: calc(100vh - 380px);
  min-height: 240px;
}

/* Freeze list recommendation badges */
.fl-rec-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.fl-rec-communicate      { background: #d1fae5; color: #065f46; }
.fl-rec-monitor          { background: #fef3c7; color: #92400e; }
.fl-rec-freeze-candidate { background: #fee2e2; color: #991b1b; }
.fl-rec-label { font-size: .82rem; font-weight: 600; color: #374151; }

/* Freeze list related accounts section */
.fl-related-section {
  margin-top: .65rem;
}
.fl-related-title {
  font-size: .82rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: .4rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.fl-rel-tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 3px;
  padding: .05rem .4rem;
}

/* Freeze list — active license banner */
.fl-active-lic-banner {
  border-radius: 8px;
  padding: .6rem .9rem;
  margin-bottom: .7rem;
  border-left: 4px solid;
}
.fl-active-lic-paid   { background: #f0fdf4; border-color: #16a34a; }
.fl-active-lic-unpaid { background: #fffbeb; border-color: #d97706; }
.fl-al-banner-head {
  font-weight: 700; font-size: .88rem; margin-bottom: .45rem;
}
.fl-active-lic-paid   .fl-al-banner-head { color: #15803d; }
.fl-active-lic-unpaid .fl-al-banner-head { color: #b45309; }
.fl-al-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.fl-al-table th {
  text-align: left; color: #374151; font-weight: 600;
  padding: .15rem .4rem; border-bottom: 1px solid #e5e7eb;
}
.fl-al-table td { padding: .2rem .4rem; }
.fl-al-paid   { color: #15803d; font-weight: 600; }
.fl-al-unpaid { color: #b45309; font-weight: 600; }
.fl-al-source {
  display: inline-block; font-size: .72rem; font-weight: 600;
  background: #e0e7ff; color: #3730a3; border-radius: 3px; padding: 0 .35rem;
}
.fl-al-source-reseller { background: #f3e8ff; color: #7c3aed; }

/* Freeze list reseller-license table */
.fl-reseller-lic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-top: .3rem;
}
.fl-reseller-lic-table th {
  text-align: left;
  background: #f0f0ff;
  color: #3730a3;
  padding: .25rem .45rem;
  font-weight: 600;
  border-bottom: 2px solid #c7d2fe;
}
.fl-reseller-lic-table td {
  padding: .25rem .45rem;
  border-bottom: 1px solid #f0f2f7;
  vertical-align: middle;
}
.fl-reseller-lic-table tr:hover td { background: #f8f8ff; }

/* Monthly Order Value report */
.mov-controls {
  display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap;
  margin: .75rem 0;
}
.mov-controls label {
  display: inline-flex; flex-direction: column; gap: .25rem;
  font-size: .82rem;
}
.mov-controls select {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit;
}
.mov-scroll { max-height: min(calc(100vh - 200px), 1000px); min-height: 320px; }
.mov-section-title {
  margin: 1rem 0 .35rem; font-size: .95rem; font-weight: 600; color: #2d3142;
}
.mov-hint {
  margin: 0 0 .5rem; padding: .4rem .6rem;
  font-size: .8rem; line-height: 1.45;
  background: #f4f6fa; border-left: 3px solid #b9c5d6; border-radius: 4px;
}
.mov-hint code {
  background: #e7ecf3; padding: 0 .2rem; border-radius: 3px;
  font-size: .78rem;
}
.mov-table th, .mov-table td { padding: .35rem .55rem; }
.mov-table thead th {
  position: sticky; top: 0; background: #2d3142; color: #c7cbd6; z-index: 2;
}
.mov-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.mov-table tr.total td { background: #eef5fb; font-weight: 600; }
.mov-table td.drill { cursor: pointer; }
.mov-table td.drill:hover { background: #e6f0ff; }

.invoice-controls label.grow { flex: 1 1 280px; }

/* Lookup bulk-action bar — sits between the form/search and the table.
   Compact layout; the bulk-edit form is collapsed inside a <details>
   so the bar stays a single line until the admin needs the heavier
   tooling. */
.lookup-bulk-bar {
  background: #f5f7fb;
  border: 1px solid #e3e6ee;
  border-radius: 6px;
  padding: .5rem .65rem;
  margin: .5rem 0;
}
.lookup-bulk-bar .bulk-row {
  display: flex; gap: .65rem; align-items: center; flex-wrap: wrap;
}
.lookup-bulk-bar .bulk-edit-form { margin-top: .35rem; }
.lookup-bulk-bar .bulk-edit-form summary {
  cursor: pointer; padding: .15rem 0; font-size: .85rem;
}
.lookup-bulk-bar .bulk-edit-form[open] summary { color: #1f2330; font-weight: 600; }
.lookup-bulk-bar .bulk-field {
  display: inline-flex; flex-direction: column; gap: .15rem;
  font-size: .78rem;
}
.lookup-bulk-bar .bulk-field input {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; min-width: 160px;
}
table .bulk-head, table td.bulk-cell {
  width: 28px; text-align: center;
  background: inherit;
}
table td.bulk-cell input { cursor: pointer; }

/* Imports history: cap filename column so it doesn't push the row
   counts off-screen. The full name is in the cell's title attribute. */
#imports-table td.imp-filename {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  display: inline-block;
  padding: 1px 8px; border-radius: 10px;
  font-size: .72rem; font-weight: 700;
}
.role-badge.admin { background: #1f2330; color: #4cc2ff; }
.role-badge.user  { background: #eef2fb; color: #455161; }

/* ---- MSP/Reseller report extras: toggles, top scrollbar, filter row ---- */
.report-table-controls .clear-filters,
.report-table-controls .export-csv,
.report-table-controls .cols-toggle {
  background: #fff; color: #455161;
  border: 1px solid #d0d4de;
  font-weight: 500;
}
.report-table-controls .clear-filters { margin-left: auto; }
.report-table-controls .export-csv {
  background: #1f2330; color: #4cc2ff; border-color: #1f2330;
}
.report-table-controls .export-csv:hover { background: #2d3142; }

/* Columns popover (hide/show toggles) */
.cols-popover { position: relative; display: inline-block; }
.cols-popover-content {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid #d0d4de;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0,0,0,.15);
  padding: .65rem .75rem;
  display: flex; flex-direction: column; gap: .35rem;
  min-width: 200px;
}
.cols-popover-content.hidden { display: none; }
.cols-popover-content .heading {
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: #71788a;
  margin-bottom: .15rem;
}
.cols-popover-content label.chk {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: #1f2330;
  padding: .2rem .35rem;
  border-radius: 4px;
  cursor: pointer; user-select: none;
}
.cols-popover-content label.chk:hover { background: #eef2fb; }
.cols-popover-content label.chk:has(input:not(:checked)) {
  color: #b9c0cc; text-decoration: line-through;
}
.cols-popover-content label.chk input { margin: 0; }

.hscroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  border: 1px solid #e2e6ee;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #fafbfd;
}
.hscroll-top .hscroll-spacer { height: 1px; }
.hscroll-top + .table-scroll { border-top-left-radius: 0; border-top-right-radius: 0; }

.report-help {
  font-size: .75rem; color: #71788a;
  margin: .35rem 0 .25rem;
}
.report-help code {
  background: #eef0f4; padding: 1px 5px; border-radius: 3px;
  color: #455161;
}
.badge.no  { background: #f8d7da; color: #842029; }
.badge.refund { background: #fff3cd; color: #664d03; }

/* Notes tab — admin-only task list. Add-form on top, full-width
   table of tasks below. The system (this CLI agent) updates Status;
   users only add tasks via the form. */
/* ── Notes tab sub-nav ─────────────────────────────────────────────── */
.notes-subnav {
  display: flex; gap: .4rem;
  margin-bottom: 1rem; border-bottom: 2px solid #e5e7eb;
  padding-bottom: .5rem;
}
.notes-sub-tab {
  padding: .35rem .85rem; border-radius: 6px 6px 0 0;
  background: none; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 500; color: #6b7280;
}
.notes-sub-tab.active {
  background: #1f2330; color: #fff; font-weight: 600;
}
.notes-sub-tab:hover:not(.active) { background: #f3f4f6; color: #374151; }

/* ── My Notes layout ───────────────────────────────────────────────── */
#notes-panel-my-notes {
  display: flex; gap: 1.25rem; align-items: flex-start;
}
#mn-list-pane { flex: 1 1 0; min-width: 0; }
.mn-toolbar {
  display: flex; gap: .6rem; align-items: center;
  margin-bottom: .75rem; flex-wrap: wrap;
}
.mn-filters { display: flex; gap: .4rem; }
.mn-filters select { font: inherit; font-size: .82rem; padding: .25rem .5rem;
  border: 1px solid #d1d5db; border-radius: 5px; }
.mn-badge {
  background: #f03e3e; color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; padding: .1rem .5rem;
}

/* Note cards */
.mn-card {
  display: flex; border: 1px solid #e5e7eb; border-radius: 8px;
  margin-bottom: .55rem; overflow: hidden; cursor: pointer;
  transition: box-shadow .12s;
  background: #fff;
}
.mn-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mn-card-bar { width: 4px; flex-shrink: 0; }
.mn-card-content { flex: 1; padding: .6rem .75rem; min-width: 0; }
.mn-card-header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.mn-card-title { font-weight: 600; font-size: .9rem; color: #1f2330; }
.mn-card-meta  { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }
.mn-card-body  { font-size: .82rem; color: #4b5568; margin: .2rem 0; white-space: pre-wrap; word-break: break-word; }
.mn-card-tags  { margin: .2rem 0; }
.mn-card-footer { display: flex; align-items: center; gap: .45rem; margin-top: .3rem; flex-wrap: wrap; }
.mn-card-done { background: none; border: 1px solid #d1d5db; border-radius: 4px;
  cursor: pointer; padding: .1rem .45rem; font-size: .78rem; margin-left: auto;
  color: #374151; }
.mn-card-done:hover { background: #d1fae5; border-color: #6ee7b7; }

.mn-tag { display: inline-block; background: #f1f3f5; border-radius: 3px;
  padding: .05rem .4rem; font-size: .72rem; color: #495057; margin-right: .2rem; }
.mn-rem-icon { font-size: .8rem; }
.mn-expiry-tag { font-size: .72rem; }
.mn-status-tag { font-size: .72rem; background: #e9ecef; border-radius: 3px; padding: .05rem .35rem; color: #495057; }

.mn-pri-badge {
  display: inline-block; padding: .05rem .4rem; border-radius: 3px;
  font-size: .72rem; font-weight: 700; text-transform: capitalize;
}
.mn-pri-low      { background: #ebfbee; color: #2f9e44; }
.mn-pri-medium   { background: #fff9db; color: #e67700; }
.mn-pri-high     { background: #fff4e6; color: #d9480f; }
.mn-pri-critical { background: #ffe3e3; color: #c92a2a; }

/* Editor drawer */
.mn-editor {
  width: 360px; flex-shrink: 0;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 0; overflow: hidden;
}
.mn-editor-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem .9rem; background: #1f2330; color: #fff;
  font-weight: 600; font-size: .9rem;
}
.mn-close-btn {
  background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 1rem;
}
.mn-close-btn:hover { color: #fff; }
.mn-editor-body { padding: .85rem .9rem; overflow-y: auto; max-height: calc(100vh - 200px); }
.mn-title-input, .mn-body-input, .mn-input {
  width: 100%; box-sizing: border-box;
  padding: .35rem .55rem;
  border: 1px solid #d1d5db; border-radius: 5px;
  font: inherit; font-size: .85rem;
  background: #fff;
}
.mn-title-input { font-weight: 600; margin-bottom: .45rem; }
.mn-body-input  { resize: vertical; margin-bottom: .6rem; }
.mn-input { margin-bottom: .25rem; }
.mn-label { font-size: .72rem; font-weight: 700; color: #6b7280; text-transform: uppercase;
  letter-spacing: .05em; display: block; margin-bottom: .2rem; }
.mn-field-group { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.mn-row { display: flex; gap: .6rem; margin-bottom: .5rem; }

/* Priority pills */
.mn-priority-pills { display: flex; gap: .3rem; flex-wrap: wrap; }
.mn-pill {
  padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1.5px solid #d1d5db; background: #fff; cursor: pointer; color: #374151;
}
.mn-pill:hover { border-color: #9ca3af; }
.mn-pill[data-p="low"].mn-pill-active      { background:#ebfbee; border-color:#2f9e44; color:#2f9e44; }
.mn-pill[data-p="medium"].mn-pill-active   { background:#fff9db; border-color:#e67700; color:#e67700; }
.mn-pill[data-p="high"].mn-pill-active     { background:#fff4e6; border-color:#d9480f; color:#d9480f; }
.mn-pill[data-p="critical"].mn-pill-active { background:#ffe3e3; border-color:#c92a2a; color:#c92a2a; }

/* Color dots */
.mn-color-dots { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.mn-color-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
}
.mn-color-dot.mn-color-active { border-color: #1f2330; box-shadow: 0 0 0 2px #fff inset; }
.mn-color-none { background: #e5e7eb; }
.mn-color-none.mn-color-active { border-color: #6b7280; }

/* Reminder section details */
.mn-section { margin-top: .55rem; }
.mn-section-head {
  cursor: pointer; font-size: .8rem; font-weight: 700;
  color: #374151; padding: .3rem 0; user-select: none;
}
.mn-section-body { padding: .4rem 0 0; }
.mn-esc-row { align-items: flex-end; margin-bottom: .35rem; }

/* Editor action bar */
.mn-editor-actions {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  margin-top: .75rem; padding-top: .65rem;
  border-top: 1px solid #e5e7eb;
}

/* Notification toasts */
.mn-toast-container {
  position: fixed; right: 1rem; bottom: 1rem;
  z-index: 9999; display: flex; flex-direction: column;
  gap: .5rem; pointer-events: none;
  max-width: min(340px, 90vw);
}
.mn-toast {
  pointer-events: auto; background: #fff;
  border: 1px solid #d1d5db; border-left: 4px solid #fcc419;
  border-radius: 8px; padding: .6rem .8rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  font-size: .84rem; opacity: 0; transform: translateX(20px);
  transition: opacity .22s, transform .22s;
}
.mn-toast.mn-toast-show { opacity: 1; transform: none; }
.mn-toast-head { display: flex; align-items: center; gap: .35rem; margin-bottom: .2rem; }
.mn-toast-icon { font-size: .85rem; }
.mn-toast-title { font-weight: 600; flex: 1; }
.mn-toast-x { background: none; border: none; cursor: pointer; color: #9ca3af; font-size: 1rem; }
.mn-toast-x:hover { color: #374151; }
.mn-toast-meta { font-size: .75rem; color: #6b7280; display: flex; gap: .4rem; align-items: center; }

.tasks-add {
  padding: .75rem 1rem;
  border: 1px solid #d0d4de; border-radius: 6px; background: #fff;
  margin: .5rem 0 1rem;
}
.tasks-add h3 { margin: 0 0 .5rem; }
.tasks-add textarea {
  width: 100%; box-sizing: border-box;
  font: 13px/1.45 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  padding: .6rem .75rem;
  border: 1px solid #d0d4de; border-radius: 6px;
  background: #fbfbfd; resize: vertical;
}
.tasks-add-actions {
  display: flex; align-items: center; gap: .6rem;
  margin-top: .5rem;
}
.tasks-list-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .25rem .5rem;
  margin-top: .5rem;
  font-weight: 600;
}
.tasks-table th, .tasks-table td { vertical-align: top; }
.tasks-table .task-col-id      { width: 4rem;  white-space: nowrap; }
.tasks-table .task-col-status  { width: 9rem;  white-space: nowrap; }
.tasks-table .task-col-updated { width: 12rem; white-space: nowrap; }
.tasks-table .task-col-actions { width: 6rem;  white-space: nowrap; }
.tasks-table .task-col-body    { white-space: pre-wrap; word-break: break-word; }
.task-edit-btn { font-size: .8rem; padding: .15rem .5rem; }
.task-edit-ta {
  width: 100%; min-height: 4rem;
  padding: .35rem .45rem;
  border: 1px solid #d0d4de; border-radius: 4px;
  font: inherit; resize: vertical;
}
.task-edit-actions {
  display: flex; align-items: center; gap: .4rem;
  margin-top: .35rem;
}
.task-edit-actions button { font-size: .8rem; padding: .15rem .55rem; }
.task-edit-status { font-size: .78rem; }

/* Task-completion notifier — gentle toasts in the bottom-right when
   the auto-poll cron finishes a note. */
.task-notifier-container {
  position: fixed;
  right: 1rem; bottom: 1rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: .55rem;
  pointer-events: none;
  max-width: min(360px, 90vw);
}
.task-notifier-toast {
  pointer-events: auto;
  background: #fff;
  border: 1px solid #c3e6cb;
  border-left: 4px solid #2ea44f;
  border-radius: 8px;
  padding: .6rem .75rem;
  box-shadow: 0 8px 24px rgba(13, 15, 21, .14),
              0 2px 6px  rgba(13, 15, 21, .06);
  font-size: .85rem;
  color: #1f2330;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .22s ease, transform .22s ease;
  cursor: pointer;
}
.task-notifier-toast.task-notifier-show {
  opacity: 1;
  transform: translateX(0);
}
.task-notifier-head {
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .25rem;
}
.task-notifier-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.2rem; height: 1.2rem;
  background: #2ea44f; color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}
.task-notifier-title { font-weight: 600; flex: 1 1 auto; }
.task-notifier-x {
  background: transparent; border: 0; cursor: pointer;
  color: #6b7280; font-size: 1.05rem; line-height: 1;
  padding: 0 .15rem; border-radius: 3px;
}
.task-notifier-x:hover { background: #f1f3f5; color: #1f2330; }
.task-notifier-body {
  font-size: .82rem; line-height: 1.35; color: #1f2330;
  word-break: break-word;
}
.task-notifier-meta { font-size: .72rem; margin-top: .25rem; }
.task-status-dot {
  display: inline-block; width: .65rem; height: .65rem;
  border-radius: 50%;
  background: #c8d0db;
  margin-right: .3rem;
  vertical-align: 1px;
}
.task-row.task-status-not-started .task-status-dot { background: #c8d0db; }
.task-row.task-status-in-progress .task-status-dot { background: #fbbc04; }
.task-row.task-status-completed   .task-status-dot { background: #2ea44f; }
.task-row.task-status-completed .task-col-body {
  opacity: .65;
}

/* ============================================================== *
 *  MSP / Reseller – Growth Quadrant visualization                 *
 * ============================================================== */
.gq-controls {
  display: flex; flex-wrap: wrap; gap: .85rem; align-items: center;
  margin: .75rem 0 .5rem;
  font-size: .85rem;
}
.gq-controls label {
  display: inline-flex; align-items: center; gap: .35rem;
}
.gq-controls select, .gq-controls input {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff;
}
.gq-legend {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  margin: 0 0 .6rem;
  font-size: .8rem;
}
.gq-key { display: inline-flex; align-items: center; gap: .35rem; }
.gq-swatch {
  display: inline-block;
  width: 14px; height: 14px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(13,15,21,.15);
}
.gq-color-msp  { background: #4dabf7; }
.gq-color-res  { background: #b197fc; }
.gq-color-both { background: #38d9a9; }

.gq-chart-wrap {
  background: #fff;
  border: 1px solid #e2e6ee; border-radius: 8px;
  padding: .25rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(13,15,21,.04);
}
.gq-chart {
  width: 100%; height: auto;
  display: block;
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
  border-radius: 6px;
}
.gq-plot-bg { fill: #ffffff; stroke: #e2e6ee; stroke-width: 1; }
.gq-quad           { opacity: .35; }
.gq-quad-star      { fill: #d3f9d8; }   /* high growth + high revenue */
.gq-quad-cc        { fill: #fff3bf; }   /* low growth + high revenue */
.gq-quad-qm        { fill: #d0ebff; }   /* high growth + low revenue */
.gq-quad-dog       { fill: #ffe3e3; }   /* low growth + low revenue */
.gq-quad-label {
  fill: #6b7280; font-size: 13px; font-weight: 700; opacity: .65;
  pointer-events: none;
}

.gq-grid       { stroke: #e8ecf3; stroke-width: 1; stroke-dasharray: 2 4; }
.gq-grid-zero  { stroke: #adb5bd; stroke-width: 1.5; stroke-dasharray: none; }
.gq-tick-x, .gq-tick-y { fill: #6b7280; font-size: 11px; }
.gq-axis-title { fill: #1f2330; font-size: 12px; font-weight: 600; }
.gq-empty      { fill: #6b7280; font-size: 14px; }

.gq-bubble {
  stroke: #ffffff; stroke-width: 1.4;
  fill-opacity: .82;
  transition: fill-opacity .15s ease, stroke-width .15s ease;
  cursor: pointer;
}
.gq-bubble:hover {
  fill-opacity: 1; stroke-width: 2.5; stroke: #1f2330;
}
.gq-bubble.gq-color-msp  { fill: #4dabf7; }
.gq-bubble.gq-color-res  { fill: #b197fc; }
.gq-bubble.gq-color-both { fill: #38d9a9; }
.gq-bubble-label {
  fill: #1f2330; font-size: 11px; font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: #ffffff; stroke-width: 3; stroke-linejoin: round;
}

.gq-tooltip {
  position: absolute; z-index: 60;
  background: rgba(13, 15, 21, .94); color: #fff;
  padding: .55rem .75rem; border-radius: 6px;
  font-size: .8rem; line-height: 1.35;
  box-shadow: 0 4px 14px rgba(13,15,21,.25);
  pointer-events: none;
  max-width: 320px;
}
.gq-tooltip.hidden { display: none; }
.gq-tip-org { font-weight: 700; margin-bottom: .25rem; }
.gq-tip-row { white-space: nowrap; }
.gq-tip-row.muted { color: #adb5bd; font-size: .75rem; margin-top: .2rem; }

.gq-tables    { margin-top: 1rem; }
.gq-table-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.gq-table-pair h3 { margin: 0 0 .35rem; font-size: .95rem; }
.gq-table-pair table { width: 100%; font-size: .8rem; }
.gq-pos { color: #2b8a3e; font-weight: 600; }
.gq-neg { color: #c92a2a; font-weight: 600; }
@media (max-width: 760px) {
  .gq-table-pair { grid-template-columns: 1fr; }
}

/* ============================================================== *
 *  Order Processing Patterns – visual report                      *
 * ============================================================== */
.opp-controls {
  display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end;
  margin: .25rem 0 .85rem;
  font-size: .85rem;
}
.opp-controls label {
  display: inline-flex; flex-direction: column; gap: .2rem;
}
.opp-controls select {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff; min-width: 180px;
}
.opp-controls button { align-self: flex-end; }
.opp-h3 {
  margin: 1.1rem 0 .5rem; font-size: 1rem;
}
.opp-chart-wrap {
  background: #fff;
  border: 1px solid #e2e6ee; border-radius: 8px;
  padding: .25rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(13,15,21,.04);
}
.opp-chart {
  width: 100%; height: auto;
  display: block;
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
  border-radius: 6px;
}
.opp-plot-bg { fill: #ffffff; stroke: #e2e6ee; stroke-width: 1; }
.opp-grid    { stroke: #e8ecf3; stroke-width: 1; stroke-dasharray: 2 4; }
.opp-tick-x, .opp-tick-y { fill: #6b7280; font-size: 11px; }
.opp-axis-title { fill: #1f2330; font-size: 12px; font-weight: 600; }
.opp-legend     { fill: #1f2330; font-size: 12px; }
.opp-bar {
  cursor: pointer;
  transition: opacity .12s ease;
}
.opp-bar:hover { opacity: .85; }
.opp-bar-create { fill: #4dabf7; }   /* blue */
.opp-bar-paid   { fill: #51cf66; }   /* green */
.opp-bar-bin    { fill: #845ef7; }   /* purple */
.opp-bar-value  { fill: #1f2330; font-size: 11px; font-weight: 600; }

.opp-tooltip {
  position: absolute; z-index: 60;
  background: rgba(13, 15, 21, .94); color: #fff;
  padding: .5rem .7rem; border-radius: 6px;
  font-size: .8rem; line-height: 1.4;
  box-shadow: 0 4px 14px rgba(13,15,21,.25);
  pointer-events: none;
  max-width: 280px;
}
.opp-tooltip.hidden { display: none; }
.opp-tip-head { font-weight: 700; margin-bottom: .2rem; }
.opp-legend-item:hover rect { stroke: #1f2330; stroke-width: 1.5; }

/* ---- Customer search ---- */
.cs-controls {
  display: flex; gap: .55rem; align-items: center;
  margin: .25rem 0 .85rem;
  flex-wrap: wrap;
}
.cs-controls input[type="text"] {
  flex: 1 1 22rem; min-width: 12rem; max-width: 32rem;
  padding: .35rem .55rem;
  border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit;
}
.cs-trunc { color: #c89a2b; font-weight: 600; }

/* Customer Search — mode badge + override menu */
.cs-controls { position: relative; }
.cs-mode-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .55rem; border-radius: 5px;
  font-size: .78rem; font-weight: 600;
  cursor: pointer; user-select: none; white-space: nowrap;
  border: 1px solid transparent; transition: background .1s;
}
.cs-mode-fast   { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.cs-mode-slow   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cs-mode-manual { box-shadow: 0 0 0 2px currentColor; }
.cs-mode-badge:hover { filter: brightness(.94); }
.cs-mode-reset  { margin-left: .2rem; opacity: .6; font-size: .72rem; }
.cs-mode-reset:hover { opacity: 1; }
.cs-mode-menu {
  position: absolute; z-index: 200; top: 2.4rem; left: 0;
  background: #fff; border: 1px solid #d1d5db; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: .3rem 0; min-width: 290px;
}
.cs-mode-opt {
  display: block; width: 100%; text-align: left;
  padding: .45rem .85rem; background: none; border: none;
  cursor: pointer; font-size: .85rem; color: #1f2330; line-height: 1.4;
}
.cs-mode-opt:hover { background: #f0f4ff; }

.cs-flag-label {
  display: flex; align-items: center; gap: .25rem;
  font-size: .83rem; color: #374151; cursor: pointer;
  white-space: nowrap; user-select: none;
}
.cs-vt-link { font-size: .8rem; font-family: ui-monospace, monospace; color: #3730a3; }
.cs-tier {
  display: inline-block;
  padding: .1rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  border: 1px solid transparent;
}
.cs-tier-direct { background: #f1f3f5; color: #495057;        border-color: #dee2e6; }
.cs-tier-msp    { background: #d0ebff; color: #0b5394;        border-color: #a5d8ff; }
.cs-tier-res    { background: #ede1ff; color: #553c9a;        border-color: #d0bfff; }
.cs-tier-both   { background: #d3f9d8; color: #287233;        border-color: #b2f2bb; }

/* ── Collections & Renewal Intelligence ──────────────────────── */
.cri-controls { display:flex; gap:.6rem; align-items:center; margin:.25rem 0 .85rem; flex-wrap:wrap; }
.cri-controls select { font:inherit; font-size:.85rem; padding:.3rem .5rem; border:1px solid #d0d4de; border-radius:5px; }

.cri-kpi { display:flex; gap:.6rem; flex-wrap:wrap; margin:.5rem 0 .75rem; }
.cri-kpi-chip {
  display:flex; flex-direction:column; align-items:center; gap:.1rem;
  padding:.45rem .9rem; border-radius:8px; border:2px solid transparent;
  cursor:pointer; background:#f8fafc; min-width:120px; transition:border .12s;
}
.cri-kpi-chip.active { border-color: currentColor; }
.cri-kpi-n { font-size:1.4rem; font-weight:700; line-height:1; }
.cri-kpi-l { font-size:.72rem; color:#6b7280; white-space:nowrap; }
.cri-kpi-a  { color:#c92a2a; }
.cri-kpi-b  { color:#e67700; }
.cri-kpi-c1a { color:#1971c2; }
.cri-kpi-c1b { color:#c92a2a; }
.cri-kpi-c2  { color:#6741d9; }
.cri-kpi-d  { color:#2f9e44; }
.cri-kpi-e  { color:#868e96; }
.cri-tab-e  { color:#868e96 !important; font-style:italic; }

.cri-tabs { display:flex; gap:.3rem; margin:.25rem 0 .6rem; flex-wrap:wrap; border-bottom:2px solid #e5e7eb; padding-bottom:.4rem; }
.cri-tab {
  padding:.3rem .8rem; border-radius:6px 6px 0 0; border:none;
  background:none; cursor:pointer; font-size:.83rem; font-weight:500; color:#6b7280;
}
.cri-tab.active { background:#1f2330; color:#fff; font-weight:600; }
.cri-tab:hover:not(.active) { background:#f3f4f6; color:#374151; }

.cri-table th, .cri-table td { padding:.3rem .5rem; font-size:.8rem; }
.cri-org-cell {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.cri-table thead th { position:sticky; top:0; background:#2d3142; color:#c7cbd6; z-index:2; }
.cri-table thead th[data-cri-sort]:hover { background:#3d4258; }
.cri-out { color:#c92a2a; font-weight:600; }

.cri-score-bar {
  display:inline-flex; align-items:center; gap:.3rem;
  width:80px; height:14px; background:#f1f3f5; border-radius:3px; overflow:hidden;
  position:relative; font-size:.7rem;
}
.cri-score-fill { position:absolute; left:0; top:0; height:100%; background:#51cf66; opacity:.7; }
.cri-score-lbl  { position:relative; z-index:1; margin-left:auto; padding-right:3px; font-weight:600; color:#1f2330; }

.cri-exp-red   { color:#c92a2a; font-weight:700; }
.cri-exp-amber { color:#e67700; font-weight:600; }
.cri-exp-green { color:#2f9e44; }

/* ============================================================== *
 *  Executive Pulse dashboard                                      *
 * ============================================================== */
.exec-period {
  font-size: .85rem; margin: 0 0 .6rem;
}
.exec-kpi {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem; margin: 0 0 1rem;
}
.exec-kpi-tile {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 8px;
  padding: .8rem .9rem;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .03);
}
.exec-kpi-warn { border-color: #ffe69c; background: #fff8e6; }
.exec-kpi-label { font-size: .8rem; color: #6b7280; font-weight: 600; }
.exec-kpi-value { font-size: 1.55rem; font-weight: 700; color: #1f2330; margin: .15rem 0; }
.exec-kpi-value-sub {
  font-size: 1rem; color: #6b7280; font-weight: 600; margin-left: .15rem;
}
.exec-kpi-warn .exec-kpi-value { color: #b3261e; }
.exec-kpi-sub   { font-size: .78rem; color: #6b7280; }
.exec-pos { color: #2b8a3e; }
.exec-neg { color: #c92a2a; }

.exec-row {
  display: grid; grid-template-columns: 360px 1fr; gap: 1rem;
  margin-bottom: 1rem;
}
.exec-panel {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 8px;
  padding: .85rem 1rem;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .03);
}
.exec-panel h3 { margin: 0 0 .55rem; font-size: 1rem; }
.exec-panel-full { margin-bottom: 1rem; }

/* Donut */
.exec-donut-wrap {
  display: flex; align-items: center; gap: .8rem;
}
.exec-donut { width: 220px; height: 180px; flex: 0 0 220px; }
.exec-donut-c1 { fill: #1f2330; font-size: 18px; font-weight: 700; }
.exec-donut-c2 { fill: #6b7280; font-size: 11px; }
.exec-legend { display: flex; flex-direction: column; gap: .45rem; flex: 1 1 auto; min-width: 0; }
.exec-legend-row { display: flex; align-items: flex-start; gap: .5rem; }
.exec-legend-text { flex: 1 1 auto; min-width: 0; }
.exec-legend-name { display: block; font-size: .82rem; color: #1f2330; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-legend-val  { display: block; font-size: .75rem; color: #6b7280; font-weight: 600; }
.exec-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  flex-shrink: 0; margin-top: 2px;
  box-shadow: 0 0 0 1px rgba(13,15,21,.15);
}

/* AOV bars */
.exec-aov-row {
  display: grid; grid-template-columns: 130px 1fr; gap: .65rem;
  padding: .35rem 0;
  border-bottom: 1px solid #f1f3f5;
}
.exec-aov-row:last-child { border-bottom: 0; }
.exec-aov-name { font-weight: 600; align-self: center; font-size: .9rem; }
.exec-aov-bars { display: flex; flex-direction: column; gap: .3rem; }
.exec-aov-pair {
  display: grid; grid-template-columns: 70px 1fr 130px; gap: .5rem; align-items: center;
  font-size: .8rem;
}
.exec-aov-label { color: #6b7280; }
.exec-aov-bar {
  height: 12px; border-radius: 3px;
  min-width: 1px;
  background: #4dabf7;
}
.exec-aov-bar-alt { opacity: .55; }
.exec-aov-val { font-weight: 600; text-align: right; white-space: nowrap; }

/* Heatmap table */
.exec-heatmap td.exec-heat-cell { font-weight: 600; }

/* Geo bars */
.exec-geo-table th, .exec-geo-table td { vertical-align: middle; }
.exec-geo-bar-wrap {
  background: #f1f3f5; border-radius: 3px; height: 14px; min-width: 8rem;
}
.exec-geo-bar { height: 14px; border-radius: 3px; }
.exec-geo-up   { background: #51cf66; }
.exec-geo-down { background: #ff6b6b; }
.exec-geo-flat { background: #adb5bd; }
.exec-geo-pill {
  display: inline-block;
  padding: .1rem .45rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700;
  border: 1px solid transparent;
}
.exec-geo-up.exec-geo-pill   { background: #d3f9d8; color: #2b6a32; border-color: #b2f2bb; }
.exec-geo-down.exec-geo-pill { background: #ffe3e3; color: #b3261e; border-color: #ffc9c9; }
.exec-geo-flat.exec-geo-pill { background: #f1f3f5; color: #495057; border-color: #dee2e6; }

@media (max-width: 980px) {
  .exec-kpi { grid-template-columns: repeat(2, 1fr); }
  .exec-row { grid-template-columns: 1fr; }
}
.opp-legend-dim rect { fill-opacity: .25; }
.opp-legend-dim text { fill: #adb5bd; }
.opp-legend-hint { fill: #adb5bd; font-size: 10px; font-style: italic; }

/* ============================================================== *
 *  Revenue Breakdown – Sankey                                     *
 * ============================================================== */
.sankey-controls {
  display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end;
  margin: .25rem 0 .85rem;
  font-size: .85rem;
}
.sankey-controls label {
  display: inline-flex; flex-direction: column; gap: .2rem;
}
.sankey-controls select {
  padding: .25rem .4rem; border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff; min-width: 140px;
}
#sankey-meta { margin-bottom: .55rem; font-size: .9rem; }
.sankey-chart-wrap {
  background: #fff;
  border: 1px solid #e2e6ee; border-radius: 8px;
  padding: .25rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(13,15,21,.04);
}
.sankey-chart {
  width: 100%; height: auto;
  display: block;
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
  border-radius: 6px;
}
.sankey-empty { fill: #6b7280; font-size: 14px; }

/* Link bands: keep them readable on top of each other by giving each
   one a soft default opacity and brightening on hover. */
.sankey-link {
  fill-opacity: .42;
  transition: fill-opacity .14s ease;
  cursor: pointer;
}
.sankey-link:hover { fill-opacity: .72; }

.sankey-node {
  stroke: rgba(13,15,21,.18); stroke-width: 1;
  cursor: pointer;
  transition: stroke-width .14s ease;
}
.sankey-node:hover { stroke-width: 2.5; stroke: #1f2330; }
.sankey-node-label {
  fill: #1f2330; font-size: 12px; font-weight: 600;
  paint-order: stroke;
  stroke: #ffffff; stroke-width: 3; stroke-linejoin: round;
  pointer-events: none;
}

.sankey-tooltip {
  position: absolute; z-index: 60;
  background: rgba(13, 15, 21, .94); color: #fff;
  padding: .5rem .7rem; border-radius: 6px;
  font-size: .8rem; line-height: 1.4;
  box-shadow: 0 4px 14px rgba(13,15,21,.25);
  pointer-events: none;
  max-width: 320px;
}
.sankey-tooltip.hidden { display: none; }
.sankey-tip-head { font-weight: 700; margin-bottom: .25rem; }
.sankey-tooltip .muted { color: #adb5bd; }

@media (max-width: 760px) {
  .sankey-controls select { min-width: 0; width: 100%; }
}

/* Dimension-slot picker (column-by-column dropdowns). */
.sankey-dim-controls {
  display: flex; flex-direction: column; gap: .35rem;
  padding: .6rem .75rem;
  background: #f7f8fb;
  border: 1px solid #e2e6ee; border-radius: 6px;
  min-width: 320px;
}
.sankey-dim-label { font-size: .8rem; font-weight: 600; }
#sankey-dim-slots {
  display: flex; flex-direction: column; gap: .3rem;
}
.sankey-dim-slot {
  display: flex; align-items: center; gap: .4rem;
}
.sankey-dim-num {
  flex: 0 0 auto;
  width: 1.4rem; height: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: #1f2330; color: #fff;
  border-radius: 50%; font-size: .72rem; font-weight: 700;
}
.sankey-dim-pick {
  flex: 1 1 auto; min-width: 0;
  padding: .25rem .4rem;
  border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff;
}
.sankey-dim-pick option:disabled { color: #adb5bd; }
.sankey-dim-x {
  flex: 0 0 auto;
  width: 1.6rem; height: 1.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #6b7280;
  border: 1px solid #d0d4de; border-radius: 4px;
  font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.sankey-dim-x:hover { background: #ffe3e3; color: #b3261e; }
.sankey-add-btn { align-self: flex-start; font-size: .8rem; }
.sankey-add-btn:disabled { opacity: .5; cursor: not-allowed; }
button.primary {
  background: #4cc2ff; color: #0d0f15; border: 1px solid #2b9eda;
  font-weight: 600;
}
button.primary:hover { background: #3bb3f0; }

.sankey-col-title {
  fill: #6b7280; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.sankey-trunc-note {
  display: inline-block; margin: .25rem .35rem .25rem 0;
  padding: .2rem .55rem; border-radius: 4px;
  background: #fff3bf; color: #6a5418;
  font-size: .78rem;
}

/* Filter slots: similar look to dimension slots but wider so the
   value picker + selected chips fit on one line for typical cases. */
.sankey-filter-slot {
  display: flex; align-items: flex-start; gap: .4rem;
  padding: .15rem 0;
}
.sankey-filter-pick {
  flex: 0 0 12rem;
  padding: .25rem .4rem;
  border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff;
}
.sankey-filter-vals-wrap {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: .25rem;
}
.sankey-filter-vals {
  flex: 0 0 auto; max-width: 18rem;
  padding: .25rem .4rem;
  border: 1px solid #d0d4de; border-radius: 5px;
  font: inherit; background: #fff;
}
.sankey-filter-vals[disabled] { opacity: .5; }
.sankey-filter-chips {
  display: flex; flex-wrap: wrap; gap: .25rem;
}
.sankey-filter-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .15rem .15rem .55rem;
  background: #e7f5ff; color: #1864ab;
  border: 1px solid #a5d8ff; border-radius: 999px;
  font-size: .78rem; line-height: 1.2;
  max-width: 22rem;
}
.sankey-filter-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem;
  background: transparent; color: #1864ab;
  border: 0; border-radius: 50%;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.sankey-filter-chip-x:hover { background: #a5d8ff; color: #0b3d6e; }

/* ============================================================== *
 * Mobile-friendly overrides. Scoped to viewports <= 760px so the  *
 * desktop layout (1100+ px tables, sticky cols, etc.) is unchanged *
 * on full-size screens. Goals:                                    *
 *   - topbar wraps, tabs scroll horizontally with no clipping     *
 *   - panels lose heavy padding so screen real estate isn't wasted *
 *   - data tables remain on a horizontal scroller (preserves      *
 *     column widths) but the surrounding chrome reflows           *
 *   - filter rows stack vertically, controls become full-width    *
 *   - import/freshness bars wrap, no overflow                     *
 * ============================================================== */
@media (max-width: 760px) {
  body { font-size: 13px; }

  main { padding: .65rem .65rem; }

  .topbar {
    flex-wrap: wrap; gap: .5rem; padding: .55rem .75rem;
  }
  .topbar .brand { flex-basis: 100%; font-size: 1rem; }
  /* Tabs scroll horizontally instead of wrapping (preserves order
     and keeps the active pill recognizable). */
  .tabs {
    margin-left: 0; gap: .15rem;
    flex-wrap: nowrap; overflow-x: auto;
    width: 100%; padding-bottom: .15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tabs::-webkit-scrollbar { height: 3px; }
  .tabs .tab {
    flex-shrink: 0;
    padding: .4rem .7rem;
    font-size: .85rem;
  }
  /* User stats: hide the bulky numbers on mobile so the topbar
     stays clean. The /api/me endpoint still loads them — they just
     don't take screen space. */
  .stats { display: none; }
  .user-menu, .user-info { margin-left: auto; }

  /* Panels are wall-to-wall on mobile to avoid wasted gutters. */
  .panel {
    padding: .85rem .75rem;
    margin-bottom: .85rem;
    border-radius: 6px;
  }
  .panel-head h2 { font-size: 1.05rem; }
  .panel-head .muted { font-size: .8rem; }

  /* Filter / control rows stack vertically and span full width. */
  .row { gap: .5rem; }
  .row > label, .row > select, .row > input, .row > button {
    flex: 1 1 100%; min-width: 0;
  }
  .row input[type="number"] { flex: 0 0 5rem; }

  /* The various report control panels (yearly-rev, mov, ecp...)
     follow the same stack-vertically pattern. */
  .yearly-rev-controls,
  .mov-controls,
  .tasks-add-actions {
    flex-direction: column; align-items: stretch; gap: .5rem;
  }
  .yearly-rev-controls > *,
  .mov-controls > *,
  .tasks-add-actions > * { width: 100%; }
  .yearly-rev-controls select,
  .mov-controls select { min-width: 0; width: 100%; }

  /* Freshness + import-info bars wrap cleanly. */
  .report-freshness,
  .import-info-bar {
    flex-wrap: wrap; padding: .45rem .55rem;
    font-size: .8rem;
  }
  .report-refresh { margin-left: 0; width: 100%; }
  .import-info-text { font-size: .8rem; line-height: 1.35; word-break: break-word; }
  .import-info-bar code { font-size: .72rem; word-break: break-all; }

  /* Tables: keep their natural width but let the wrapper scroll
     horizontally; otherwise wide pivots overflow off-screen. */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.pivot, table.tasks-table { font-size: .8rem; }
  table.pivot th, table.pivot td,
  table.tasks-table th, table.tasks-table td {
    padding: .35rem .45rem;
  }

  /* Notes / tasks: id column is decorative — drop it on mobile so
     the body gets more room. Status column collapses to just the
     colored dot (the text label is redundant next to the row tint). */
  .tasks-table .task-col-id,
  .tasks-table th.task-col-id { display: none; }
  .tasks-table .task-col-status {
    white-space: nowrap; font-size: 0;   /* hides the text node */
  }
  .tasks-table .task-col-status .task-status-dot { font-size: 14px; }

  /* Auth screen: card spans the viewport on mobile. */
  .auth-card { width: 92vw; max-width: none; padding: 1.25rem; }
  /* Modals: full-width with comfortable padding. */
  .modal-card { width: 92vw; max-width: none; }

  /* Forms: file pickers + buttons stack with proper hit-targets. */
  input[type="file"] { width: 100%; }
  button, .muted-btn { min-height: 36px; }

  /* Long horizontal scrollers (MSP/ECP tables) — let them scroll
     even though sticky columns aren't preserved (acceptable on a
     small viewport where horizontal scroll is the norm). */
  .mov-scroll, .ecp-year-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Orders tab controls (search + filter selects). Inherited `.row`
     rules already stack the inner elements; this just tightens gaps. */
  .orders-controls { gap: .45rem; }

  /* Reports sidebar/main: existing 900px rule already flips to one
     column; ensure no leftover min-width keeps the sidebar wide. */
  .reports-sidebar, .reports-main { min-width: 0; }

  /* Lookups admin: the 5-column grid is unusable on a phone — stack
     each field on its own row. */
  .lookup-form {
    grid-template-columns: 1fr;
    gap: .35rem;
  }
  .lookup-form input { width: 100%; }

  /* Pager: wrap onto two lines with the spacer collapsed. */
  .pager {
    flex-wrap: wrap; gap: .35rem;
  }
  .pager .pager-spacer { display: none; }
  .pager .page-info { flex-basis: 100%; order: -1; text-align: center; }
}

/* Extra-small (phone portrait, < 420px): trim further but keep the
   same structural rules — just smaller padding and tighter tables. */
@media (max-width: 420px) {
  main { padding: .45rem .45rem; }
  .panel { padding: .65rem .55rem; }
  table.pivot, table.tasks-table { font-size: .75rem; }
  .topbar .brand { font-size: .95rem; }
}

/* ── Product Penetration report ────────────────────────────────────── */
.pp-wrap { display: flex; flex-direction: column; gap: 1.25rem; }

.pp-filters {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  background: #f5f7fb; border: 1px solid #e2e6ee;
  border-radius: 8px; padding: .9rem 1rem;
}
.pp-fieldset {
  border: none; padding: 0; margin: 0;
}
.pp-fieldset legend {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: #71788a; margin-bottom: .4rem;
}
.pp-check-group { display: flex; flex-wrap: wrap; gap: .3rem .75rem; }
.pp-check {
  display: flex; align-items: center; gap: .3rem;
  font-size: .83rem; color: #1f2330; cursor: pointer; white-space: nowrap;
}
.pp-check input { accent-color: #2563eb; cursor: pointer; }
.pp-select {
  background: #fff; border: 1px solid #d0d5e0;
  color: #1f2330; border-radius: 5px; padding: .3rem .6rem;
  font-size: .85rem; min-width: 180px;
}
.pp-select-multi {
  padding: 0; min-width: 150px;
}
.pp-select-multi option {
  padding: .25rem .6rem;
}
.pp-fieldset-check {
  display: flex; align-items: flex-end; padding-bottom: .15rem;
}
.pp-check-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; color: #1f2330; cursor: pointer; white-space: nowrap;
}
.pp-check-label input[type=checkbox] { accent-color: #2563eb; cursor: pointer; }

.pp-summary-strip {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center;
  background: #eef5ff; border: 1px solid #c3d9f8;
  border-radius: 8px; padding: .75rem 1.1rem;
}
.pp-stat { display: flex; flex-direction: column; gap: .15rem; }
.pp-stat-val { font-size: 1.35rem; font-weight: 700; color: #1a5fb4; }
.pp-stat-lbl { font-size: .72rem; color: #71788a; text-transform: uppercase; letter-spacing: .05em; }
.pp-stat-note { font-size: .78rem; color: #71788a; font-style: italic; margin-left: auto; }

.pp-section-title { font-size: .9rem; font-weight: 600; color: #1f2330; margin: 0; }
.pp-click-hint    { font-size: .75rem; font-weight: 400; color: #71788a; }

.pp-chart-scroll { overflow-x: auto; }
.pp-bar-svg { display: block; max-width: 100%; min-width: 700px; }
.pp-bar-svg-clickable .pp-bar-row-click:hover ~ * { opacity: .85; }
.pp-bar-row-click:hover { fill: rgba(74,126,245,.08) !important; }

.pp-drill-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px solid #e2e6ee;
}
.pp-back-btn {
  background: #f0f2f7; border: 1px solid #d0d5e0; border-radius: 5px;
  padding: .3rem .8rem; font-size: .82rem; cursor: pointer; white-space: nowrap;
  color: #1a4ca8;
}
.pp-back-btn:hover { background: #e2e8f4; }
.pp-drill-title {
  font-size: 1rem; font-weight: 700; color: #1f2330;
}
.pp-drill-sub {
  display: block; font-size: .8rem; color: #4a5568; margin-top: .2rem;
}

.pp-bar-label        { font-size: 12px; fill: #1f2330; }
.pp-bar-pct-inside   { font-size: 11px; fill: rgba(255,255,255,0.92); font-weight: 700; }
.pp-bar-pct-outside  { font-size: 11px; fill: #1f2330; font-weight: 600; }
.pp-bar-count        { font-size: 10.5px; fill: #71788a; }

.pp-depth-wrap { overflow-x: auto; }
.pp-depth-svg  { display: block; max-width: 600px; }
.pp-depth-label      { font-size: 12px; fill: #1f2330; }
.pp-depth-count      { font-size: 11px; fill: #1f2330; font-weight: 600; }
.pp-depth-pct        { font-size: 10.5px; fill: #71788a; }
.pp-depth-axis-label { font-size: 11px; fill: #71788a; }

/* ── Product Readiness ───────────────────────────────────────────────── */
#tab-readiness { padding: 0; }
#rd-root { height: 100%; }

.rd-layout {
  display: flex;
  height: calc(100vh - 90px);
  overflow: hidden;
}

/* Sidebar */
.rd-sidebar {
  width: 240px; min-width: 200px;
  border-right: 1px solid #e2e6ee;
  overflow-y: auto;
  background: #f9fafc;
}
.rd-sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1rem .5rem; border-bottom: 1px solid #e2e6ee;
}
.rd-sb-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #71788a; cursor: pointer; }
.rd-sb-title:hover { color: #1f2330; }
.rd-add-btn {
  background: #fff; border: 1px solid #d0d4de; color: #1f2330;
  border-radius: 4px; font-size: .75rem; padding: .2rem .5rem; cursor: pointer;
}
.rd-add-btn:hover { background: #f0f2f7; }
.rd-sb-section-toggle {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .85rem .4rem; cursor: pointer;
  border-bottom: 1px solid #e2e6ee; user-select: none;
  background: #f2f4f8;
}
.rd-sb-section-toggle:hover { background: #eaecf2; }
.rd-sb-title   { flex: 1; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #71788a; }
.rd-sb-chevron { font-size: .7rem; color: #a0a7b8; }
.rd-sb-collapse { overflow: hidden; }
.rd-sb-collapsed { display: none; }

.rd-sb-overview-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .85rem; cursor: pointer;
  border-bottom: 2px solid #e2e6ee; transition: background .1s;
  font-weight: 600;
}
.rd-sb-overview-item:hover  { background: #f0f2f7; }
.rd-sb-overview-item.rd-sb-item-active { background: #e8f0fe !important; border-left: 2px solid #4a7ef5; }
.rd-sb-overview-icon { font-size: .95rem; color: #71788a; flex-shrink: 0; width: 22px; text-align: center; }
.rd-sb-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .85rem; cursor: pointer;
  border-bottom: 1px solid #f0f2f7; transition: background .1s;
}
.rd-sb-item:hover     { background: #f0f2f7; }
.rd-sb-item-active    { background: #e8f0fe !important; border-left: 2px solid #4a7ef5; }
.rd-sb-logo           { width: 22px; height: 22px; object-fit: contain; border-radius: 3px; }
.rd-sb-logo-placeholder { width: 22px; height: 22px; background: #e2e6ee; border-radius: 3px; flex-shrink: 0; }
.rd-sb-name           { flex: 1; font-size: .85rem; color: #1f2330; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-sb-status         { font-size: .85rem; flex-shrink: 0; }
.rd-sb-empty          { padding: 1rem; font-size: .83rem; color: #71788a; }
.rd-sb-section-head   { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #71788a; padding: .9rem 1rem .35rem; }
.rd-full-width-btn    { width: calc(100% - 2rem); margin: 0 1rem .4rem; font-size: .8rem; }
.rd-sb-collapse .rd-full-width-btn:first-child { margin-top: .5rem; }
.rd-sb-collapse .rd-full-width-btn:last-child  { margin-bottom: .75rem; }
.rd-hide-btn          { color: #b05000; }
.rd-hide-btn-active   { color: #1a7a36; }
.rd-show-hidden-active { font-weight: 600; color: #4a7ef5; }
.rd-sb-item-hidden    { opacity: .55; font-style: italic; }
.rd-detail-hidden-badge { display:inline-block; background:#fff3cd; color:#856404; border:1px solid #ffc107;
                          border-radius:4px; font-size:.75rem; padding:2px 8px; margin-left:.5rem; vertical-align:middle; }

/* Status colours — on light background */
.rd-s-none       { color: #adb5bd; }
.rd-s-pending    { color: #c09010; }
.rd-s-progress   { color: #1a7abf; }
.rd-s-approved   { color: #2e8a40; }
.rd-s-blocked    { color: #c0392b; }
.rd-s-full-check { color: #1a7a36; font-size: 1rem; font-weight: 700; }

/* Main content area */
.rd-main { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; background: #fff; }
.rd-placeholder { display: flex; align-items: center; justify-content: center; height: 200px; }

/* Detail header */
.rd-detail { max-width: 1100px; }
.rd-detail-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.rd-detail-logo   { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; border: 1px solid #e2e6ee; }
.rd-detail-title-block { flex: 1; }
.rd-detail-name   { margin: 0 0 .35rem; font-size: 1.4rem; color: #1f2330; }
.rd-detail-status { font-size: .9rem; font-weight: 600; }
.rd-detail-actions { display: flex; gap: .5rem; flex-shrink: 0; align-items: flex-start; }

.rd-description {
  background: #f9fafc; border: 1px solid #e2e6ee;
  border-radius: 7px; padding: .85rem 1rem;
  font-size: .88rem; line-height: 1.6; color: #3a4155;
  margin-bottom: 1rem; white-space: pre-wrap;
}

/* Links */
.rd-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .85rem; }
.rd-link-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #f0f2f7; border: 1px solid #d0d4de;
  border-radius: 20px; padding: .3rem .75rem;
  font-size: .82rem; color: #3a4155; text-decoration: none; transition: background .1s;
}
.rd-link-chip:hover { background: #e2e6ee; color: #1f2330; }
.rd-links-admin { margin-bottom: 1rem; }
.rd-links-toggle { font-size: .8rem; }
.rd-links-form { margin-top: .6rem; }

/* Approval board (legacy two-col, kept for safety) */
.rd-board { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.5rem; }
.rd-board-col {}
.rd-level-head {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .07em;
  color: #71788a; margin: 0 0 .75rem; border-bottom: 1px solid #e2e6ee; padding-bottom: .4rem;
}
.rd-cards { display: flex; flex-direction: column; gap: .6rem; }
.rd-no-approvals { font-size: .83rem; padding: .5rem 0; color: #71788a; }

/* Approval card */
.rd-card { background: #fff; border: 1px solid #e2e6ee; border-radius: 8px; padding: .8rem .9rem; }
.rd-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.rd-card-dept { font-weight: 600; font-size: .88rem; color: #1f2330; }
.rd-card-notes { font-size: .82rem; color: #71788a; margin-bottom: .35rem; line-height: 1.5; }
.rd-card-meta  { font-size: .75rem; margin-bottom: .4rem; color: #71788a; }
.rd-card-footer { display: flex; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }

/* Badges */
.rd-badge { font-size: .72rem; font-weight: 700; padding: .15rem .45rem; border-radius: 12px; letter-spacing: .04em; }
.rd-as-pending   { background: #fff8e1; color: #8a6000; border: 1px solid #f0d060; }
.rd-as-approved  { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.rd-as-notready  { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.rd-rs-open      { background: #fff8e1; color: #8a6000; border: 1px solid #f0d060; }
.rd-rs-progress  { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.rd-rs-done      { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* Requirements */
.rd-req { background: #f9fafc; border: 1px solid #e2e6ee; border-radius: 5px; padding: .5rem .65rem; margin-top: .4rem; font-size: .82rem; }
.rd-req-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .2rem; }
.rd-req-title  { flex: 1; font-weight: 500; color: #1f2330; }
.rd-req-btns   { display: flex; gap: .3rem; margin-left: auto; }
.rd-icon-btn   { background: none; border: none; color: #71788a; cursor: pointer; font-size: .85rem; padding: .1rem .3rem; border-radius: 3px; }
.rd-icon-btn:hover { background: #f0f2f7; color: #1f2330; }
.rd-req-desc   { color: #71788a; margin-bottom: .25rem; line-height: 1.4; }
.rd-req-meta   { display: flex; gap: .75rem; flex-wrap: wrap; }
.rd-req-dept   { color: #1a7abf; font-size: .78rem; }
.rd-req-eta    { color: #c09010; font-size: .78rem; }

/* Inline forms */
.rd-form-inner { display: flex; flex-direction: column; gap: .5rem; padding: .65rem; background: #f9fafc; border: 1px solid #e2e6ee; border-radius: 6px; margin-top: .5rem; }
.rd-form-req   { border-top: 1px solid #e2e6ee; margin-top: .5rem; }
.rd-form-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #71788a; }
.rd-form-input, .rd-form-select, .rd-form-textarea {
  background: #fff; border: 1px solid #d0d4de; color: #1f2330;
  border-radius: 5px; padding: .35rem .6rem;
  font-size: .85rem; font-family: inherit; width: 100%; box-sizing: border-box;
}
.rd-form-input:focus, .rd-form-select:focus, .rd-form-textarea:focus {
  outline: none; border-color: #4a7ef5; box-shadow: 0 0 0 2px rgba(74,126,245,.1);
}
.rd-form-select { appearance: auto; }
.rd-form-textarea { resize: vertical; }
.rd-form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.rd-form-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rd-form-row .rd-form-select { flex: 1; min-width: 140px; }
.rd-form-page { max-width: 700px; display: flex; flex-direction: column; gap: .7rem; }
.rd-form-page h3 { margin: 0 0 .25rem; color: #1f2330; }
.rd-divider { border: none; border-top: 1px solid #e2e6ee; margin: .75rem 0; }
.rd-approval-form, .rd-req-form { }

/* Slots table */
.rd-slots-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rd-slots-table th { text-align: left; color: #71788a; font-size: .75rem; text-transform: uppercase; padding: .4rem .6rem; border-bottom: 1px solid #e2e6ee; }
.rd-slots-table td { padding: .45rem .6rem; border-bottom: 1px solid #f0f2f7; }
.rd-slot-cell { text-align: center; }
.rd-slot-cell input { accent-color: #4a7ef5; width: 18px; height: 18px; cursor: pointer; }

/* Roles table */
.rd-roles-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: .75rem; }
.rd-roles-table th { text-align: left; color: #71788a; font-size: .75rem; text-transform: uppercase; padding: .4rem .6rem; border-bottom: 1px solid #e2e6ee; }
.rd-roles-table td { padding: .4rem .6rem; border-bottom: 1px solid #f0f2f7; color: #1f2330; }

/* Links admin rows */
.rd-link-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; flex-wrap: wrap; }
.rd-link-row .rd-form-select { width: 110px; flex-shrink: 0; }
.rd-link-row .rd-link-label  { width: 140px; flex-shrink: 0; }
.rd-link-row .rd-link-url    { flex: 1; min-width: 160px; }

@media (max-width: 900px) {
  .rd-layout { flex-direction: column; height: auto; }
  .rd-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e2e6ee; max-height: 220px; }
  .rd-board { grid-template-columns: 1fr; }
  .rd-main { padding: 1rem; }
}

/* ── Audit log ─────────────────────────────────────────────────────── */
.rd-audit-section { margin-top: 2rem; border-top: 1px solid #e2e6ee; padding-top: .75rem; }
.rd-audit-toggle {
  background: none; border: none; color: #71788a;
  font-size: .82rem; cursor: pointer; display: flex; align-items: center; gap: .4rem;
  padding: 0; letter-spacing: .03em;
}
.rd-audit-toggle:hover { color: #1f2330; }
.rd-audit-chevron { font-size: .7rem; }
.rd-audit-body { margin-top: .6rem; }
.rd-audit-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.rd-audit-table tbody tr:hover { background: #f9fafc; }
.rd-audit-table td { padding: .3rem .5rem; border-bottom: 1px solid #f0f2f7; vertical-align: top; color: #1f2330; }
.rd-audit-ts     { color: #71788a; white-space: nowrap; width: 10rem; }
.rd-audit-actor  { color: #1f2330; white-space: nowrap; width: 9rem; font-weight: 500; }
.rd-audit-action { color: #3a4155; white-space: nowrap; width: 12rem; }
.rd-audit-summary { color: #71788a; }
.rd-audit-summary strong { color: #1f2330; }
.rd-audit-expand { width: 1.5rem; text-align: center; }
.rd-audit-expand-btn {
  background: #fff; border: 1px solid #d0d4de; color: #71788a;
  border-radius: 3px; cursor: pointer; width: 18px; height: 18px;
  line-height: 1; font-size: .8rem; padding: 0;
}
.rd-audit-expand-btn:hover { background: #f0f2f7; color: #1f2330; }
.rd-audit-detail {
  margin-top: .35rem; padding: .5rem; background: #f9fafc; border: 1px solid #e2e6ee;
  border-radius: 4px; font-size: .75rem; color: #71788a;
  white-space: pre; overflow-x: auto; max-width: 40vw;
}

/* ── Product overview table ────────────────────────────────────────── */
.rd-overview-table { width: 100%; border-collapse: collapse; font-size: .88rem; max-width: 900px; }
.rd-overview-table thead th {
  padding: .5rem .75rem; text-align: left; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em; color: #71788a;
  border-bottom: 1px solid #e2e6ee; background: #f9fafc;
}
.rd-ov-row { cursor: pointer; transition: background .1s; }
.rd-ov-row:hover { background: #f0f2f7; }
.rd-overview-table td { padding: .5rem .75rem; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.rd-ov-logo img, .rd-ov-logo-ph { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; background: #e2e6ee; display: block; }
.rd-ov-name   { font-weight: 500; color: #1f2330; }
.rd-ov-cat    { font-size: .8rem; color: #71788a; }
.rd-ov-status { color: #71788a; font-size: .83rem; }
.rd-ov-cat-row td { background: #f5f6f8; padding: .4rem .75rem .3rem; border-bottom: 1px solid #e2e6ee; border-top: 2px solid #e2e6ee; }
.rd-ov-cat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #3a4155; display: block; margin-bottom: .15rem; }
.rd-ov-cat-products { font-size: .75rem; color: #71788a; line-height: 1.5; }
.rd-detail-category { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #71788a; margin-bottom: .2rem; }
.rd-ov-center { text-align: center; font-size: .83rem; color: #71788a; }
.rd-ov-all    { color: #2e8a40; font-weight: 600; }
.rd-ov-partial { color: #c09010; }

/* ── Approval matrix table ─────────────────────────────────────────── */
.rd-approval-table { width: 100%; border-collapse: collapse; margin-top: 1.2rem; font-size: .84rem; }
.rd-approval-table thead th {
  padding: .45rem .75rem; text-align: left;
  background: #f9fafc; color: #71788a;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid #e2e6ee;
}
.rd-at-dept { width: 14rem; }
.rd-at-row td { border-bottom: 1px solid #f0f2f7; padding: .18rem .75rem; vertical-align: middle; }
.rd-at-dept-cell { color: #3a4155; font-size: .83rem; font-weight: 500; }
.rd-at-cell { padding: .18rem .6rem !important; }
.rd-at-inner { display: flex; flex-direction: column; gap: .2rem; }
.rd-at-top   { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rd-at-assigned { font-size: .78rem; color: #495057; }
.rd-at-notes { font-size: .78rem; color: #71788a; line-height: 1.4; }
.rd-at-by    { font-size: .75rem; color: #adb5bd; }
.rd-at-none  { font-size: .8rem; color: #adb5bd; }
.rd-at-edit  { font-size: .75rem; padding: .1rem .35rem; margin-left: auto; }
.rd-at-req-toggle { font-size: .73rem; padding: .1rem .35rem; color: #71788a; }
.rd-at-form  { margin-top: .35rem; }
.rd-at-req-row td { background: #f9fafc; padding: .5rem .75rem .75rem; border-bottom: 1px solid #e2e6ee; }
.rd-at-req-cell { padding-left: 1.5rem !important; }

/* ── Category product groups list ──────────────────────────────────── */
.rd-cat-products-section { margin-bottom: 1.2rem; }
.rd-cat-products-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .45rem; }
.rd-cat-products-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #71788a; font-weight: 600; }
.rd-cat-products-edit-btn { font-size: .73rem; padding: .1rem .4rem; }
.rd-cat-products-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.rd-cat-product-chip {
  background: #f0f2f7; border: 1px solid #d0d4de; border-radius: 4px;
  padding: .18rem .55rem; font-size: .78rem; color: #3a4155;
}
.rd-cat-products-empty { font-size: .82rem; }

/* ── Slot templates ────────────────────────────────────────────────── */
.rd-tpl-load-bar { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.rd-tpl-select   { min-width: 160px; }
.rd-tpl-panel    { max-width: 860px; }
.rd-tpl-card {
  border: 1px solid #e2e6ee; border-radius: 7px;
  padding: .75rem 1rem; margin-bottom: .65rem; background: #fff;
}
.rd-tpl-card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.rd-tpl-card-name { font-weight: 600; font-size: .95rem; flex: 1; color: #1f2330; }
.rd-tpl-card-count { font-size: .78rem; color: #71788a; background: #f0f2f7; border-radius: 10px; padding: .1rem .5rem; }
.rd-tpl-level-row { font-size: .8rem; color: #71788a; margin-bottom: .2rem; }
.rd-tpl-level-row strong { color: #3a4155; }

/* ── Scheduler ──────────────────────────────────────────────── */
.sched-section { margin-bottom: 1.5rem; }
.sched-section-head {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .6rem;
}
.sched-section-title { font-weight: 600; font-size: 1rem; color: #1f2330; flex: 1; }
.sched-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sched-table th {
  text-align: left; padding: .45rem .7rem;
  background: #f4f6fb; color: #5a6282;
  border-bottom: 2px solid #e2e6ee; white-space: nowrap;
}
.sched-table td {
  padding: .4rem .7rem; border-bottom: 1px solid #edf0f7;
  vertical-align: top;
}
.sched-table tr:last-child td { border-bottom: none; }
.sched-enabled-on  { color: #1a8a43; font-weight: 600; }
.sched-enabled-off { color: #aab0c0; }
.sched-status-queued   { color: #8a6c00; }
.sched-status-fetching { color: #2563b0; }
.sched-status-importing{ color: #2563b0; }
.sched-status-done     { color: #1a8a43; font-weight: 600; }
.sched-status-error    { color: #c0392b; font-weight: 600; }
.sched-status-paused   { color: #b07d00; font-weight: 600; }
.sched-error-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: #c0392b; font-size: .78rem; }

.sched-form-wrap {
  background: #f8f9fd; border: 1px solid #e2e6ee;
  border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.sched-form .sched-form-row {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.sched-form label { display: flex; flex-direction: column; gap: .25rem;
  font-size: .82rem; color: #5a6282; font-weight: 500; }
.sched-form input[type=text],
.sched-form input[type=datetime-local],
.sched-form select {
  padding: .38rem .6rem; border: 1px solid #cdd2e0;
  border-radius: 5px; font-size: .85rem; background: #fff;
  min-width: 180px;
}
.sched-params-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem 1rem; margin-bottom: .75rem;
}
.sched-param-block { display: flex; flex-direction: column; gap: .25rem; }
.sched-param-block label { font-size: .8rem; color: #5a6282; font-weight: 500; }
.sched-param-mode { display: flex; gap: .5rem; margin-bottom: .25rem; }
.sched-param-mode button {
  font-size: .75rem; padding: .18rem .55rem;
  border: 1px solid #cdd2e0; border-radius: 4px;
  background: #fff; cursor: pointer; color: #5a6282;
}
.sched-param-mode button.active {
  background: #2563b0; color: #fff; border-color: #2563b0;
}
.sched-param-input, .sched-param-select {
  width: 100%; padding: .35rem .55rem;
  border: 1px solid #cdd2e0; border-radius: 5px;
  font-size: .83rem; background: #fff;
}
.sched-form-actions { margin-top: .5rem; }
.sched-toggle-label { flex-direction: row !important; align-items: center; gap: .4rem !important; }
.sched-pagination { margin-top: .6rem; display: flex; gap: .4rem; }

.btn-small {
  padding: .28rem .7rem; font-size: .78rem; border-radius: 5px;
  border: 1px solid #cdd2e0; background: #fff; cursor: pointer;
  color: #3a4155; white-space: nowrap;
}
.btn-small:hover { background: #f0f2f7; }
.btn-small.btn-cancel { color: #888; }
.btn-small.btn-danger  { color: #c0392b; border-color: #e2b4af; }
.btn-small.btn-danger:hover { background: #fdf0ef; }
.btn-primary {
  padding: .42rem 1.1rem; font-size: .88rem; border-radius: 6px;
  border: none; background: #2563b0; color: #fff; cursor: pointer;
  font-weight: 600;
}
.btn-primary:hover { background: #1a4f99; }

/* ── Microsoft SSO button ─────────────────────────────────────── */
.ms-sso-btn {
  display: flex; align-items: center; justify-content: center; gap: .65rem;
  width: 100%; padding: .65rem 1rem;
  background: #fff; border: 1px solid #8c8c8c; border-radius: 4px;
  color: #1f2330; font-size: .92rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .15s, box-shadow .15s;
  margin-top: .5rem;
}
.ms-sso-btn:hover {
  background: #f5f5f5; box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.ms-sso-btn svg { flex-shrink: 0; }
.user-email-input {
  padding: .28rem .5rem; border: 1px solid #cdd2e0;
  border-radius: 4px; font-size: .82rem; width: 200px;
}

/* ── License Timeline ─────────────────────────────────────── */
.lt-excl-vt-label {
  display: flex; align-items: center; gap: .3rem;
  font-size: .75rem; color: #6b7280; cursor: pointer;
  white-space: nowrap; user-select: none;
}
.lt-filter-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: .8rem 1.1rem .9rem;
  margin-bottom: .75rem;
}
.lt-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .45rem .8rem;
}
.lt-filter-row + .lt-filter-row {
  margin-top: .6rem;
}

/* ── Email rows in License Timeline ── */
.lt-email-row {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin-bottom: .3rem;
}
.lt-email-input-wrap {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.lt-email-row .lt-search-input {
  width: 220px;
  min-width: 0;
}
/* Deleted-account styling */
.lt-email-input.lt-email-deleted {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,.18);
  color: #991b1b;
}
/* vTiger ID badge that appears next to the email after a successful load */
.lt-email-vt-badge {
  display: inline-block;
  font-size: .72rem; font-weight: 600;
  font-family: ui-monospace, monospace;
  background: #e0e7ff; color: #3730a3;
  border-radius: 4px; padding: .1rem .45rem;
  white-space: nowrap; text-decoration: none;
  align-self: center;
}
.lt-email-vt-badge:hover { background: #c7d2fe; }

.lt-email-deleted-msg {
  font-size: .72rem;
  color: #dc2626;
  font-weight: 600;
  max-width: 220px;
  line-height: 1.3;
}
.lt-email-flag {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .78rem;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.lt-email-flag.lt-flag-disabled {
  opacity: .38;
  cursor: not-allowed;
}
.lt-email-flag.lt-flag-disabled input {
  cursor: not-allowed;
}
.lt-email-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: transparent;
  color: #9ca3af;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.lt-email-remove:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.lt-email-remove-hidden { visibility: hidden; pointer-events: none; }
.lt-add-email-btn {
  margin-left: .5rem;
  font-size: .72rem;
  font-weight: 600;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: .1rem .45rem;
  color: #4b5563;
  cursor: pointer;
  vertical-align: middle;
}
.lt-add-email-btn:hover { background: #f0f4ff; border-color: #a5b4fc; color: #1e3a5f; }
.lt-clear-emails-btn { color: #b91c1c; border-color: #fca5a5; }
.lt-clear-emails-btn:hover { background: #fef2f2; border-color: #f87171; color: #991b1b; }
.lt-filter-group {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.lt-filter-label {
  font-size: .7rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.lt-search-input { min-width: 220px; }
.lt-filter-sep {
  width: 1px; height: 28px;
  background: #e2e8f0;
  align-self: flex-end;
  margin: 0 .1rem;
}
/* keep old class name so nothing else breaks */
.lt-controls { display: none; }
.lt-search-wrap { position: relative; }
.lt-dropdown {
  position: absolute;
  z-index: 200;
  left: 0; top: 100%;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  max-height: 240px;
  overflow-y: auto;
  min-width: 280px;
}
.lt-drop-item {
  padding: .45rem .75rem;
  cursor: pointer;
  line-height: 1.4;
  font-size: .88rem;
}
.lt-drop-item:hover { background: #f0f4ff; }
.lt-pp-wrap { display: flex; align-items: center; gap: .5rem; }
/* License Timeline — compact spend summary strip */
.lt-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .55rem;
  padding: .28rem .65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .75rem;
  margin-top: .35rem;
}
.lt-sum-lbl  { font-weight: 700; color: #6b7280; text-transform: uppercase;
               letter-spacing: .05em; margin-right: .2rem; }
.lt-sum-dot  { color: #d1d5db; padding: 0 .05rem; }
.lt-sum-paid    { color: #166534; }
.lt-sum-unpaid  { color: #92400e; }
.lt-sum-0       { color: #92400e; }
.lt-sum-30      { color: #b45309; }
.lt-sum-60      { color: #c2410c; }
.lt-sum-90      { color: #991b1b; }

.lt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.2rem;
  font-size: .82rem;
  margin: .25rem 0;
}
.lt-leg-item { display: inline-flex; align-items: center; gap: .35rem; }
.lt-leg-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.08);
}
/* Thin bar for payment-line legend entries */
.lt-leg-pay-swatch {
  display: inline-block;
  width: 22px; height: 4px;
  border-radius: 2px;
}
/* Visual separator between bar-stage entries and payment-line entries */
.lt-leg-sep {
  display: inline-block;
  width: 1px; height: 12px;
  background: #d1d5db;
  align-self: center;
  margin: 0 .1rem;
}
/* Truncation banner when more than 50 accounts are found */
.lt-trunc-banner {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .65rem .9rem;
  margin-bottom: 1rem;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  font-size: .85rem;
  color: #78350f;
  line-height: 1.45;
}
.lt-trunc-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }

.lt-cust-section { margin-bottom: 1.75rem; }

/* Split Gantt layout: sticky label column + scrollable timeline */
.lt-gantt-wrap {
  display: flex;
  align-items: flex-start;
  width: fit-content;     /* shrink-wrap so lt-grid-wrap scroll kicks in */
  min-width: 100%;        /* but never narrower than the container */
}
.lt-labels-col {
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 4;
  /* white background so it covers the timeline when scrolled */
  background: #fff;
  /* subtle shadow to signal the column is fixed */
  box-shadow: 3px 0 6px -2px rgba(0,0,0,.10);
}
.lt-timeline-col {
  flex-shrink: 0;
}
.lt-cust-header {
  display: inline-flex;
  align-items: baseline;
  gap: .6rem;
  padding: .35rem .6rem;
  background: #f0f4ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 5px 5px 0;
  margin-bottom: .4rem;
  flex-wrap: wrap;
  min-width: 260px;
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
  /* Horizontal pin is done via JS scroll-compensation transform.
     position:sticky inside overflow-x:auto is unreliable cross-browser. */
  will-change: transform;
  position: relative;
  z-index: 5;
}
.lt-cust-email { font-weight: 600; font-size: .92rem; color: #1e3a5f; }
.lt-cust-org   { font-size: .82rem; }
.lt-cust-vtiger {
  font-size: .8rem;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 4px;
  padding: .1rem .45rem;
  white-space: nowrap;
}
.lt-cell { cursor: default; transition: opacity .1s; }
.lt-cell:hover { opacity: .8; }
.lt-tooltip {
  position: fixed;
  background: rgba(17,24,39,.92);
  color: #f9fafb;
  padding: .45rem .7rem;
  border-radius: 6px;
  font-size: .8rem;
  line-height: 1.55;
  pointer-events: none;
  z-index: 9999;
  max-width: 260px;
  white-space: pre-wrap;
}

/* ============================================================
   Revenue Movers – YoY Analysis
   ============================================================ */
#rd-wrap { padding: .75rem 1rem 1.5rem; }

.rd-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  padding: .6rem .75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: .6rem;
  font-size: .83rem;
}
.rd-filter-bar label { display: flex; align-items: center; gap: .3rem; }
.rd-filter-bar select,
.rd-filter-bar input[type="number"] {
  font: inherit; font-size: .82rem;
  padding: .22rem .4rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
}
.rd-num-input { width: 75px; }
.rd-vs { font-weight: 600; color: #6b7280; }
.rd-check { cursor: pointer; }

.rd-dim-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .6rem;
  padding: .4rem .75rem;
  font-size: .8rem;
  margin-bottom: .5rem;
}
.rd-dim-label { color: #6b7280; font-size: .78rem; margin-right: .2rem; }
.rd-dim-toggle {
  display: flex; align-items: center; gap: .25rem; cursor: pointer;
  padding: .15rem .45rem;
  border-radius: 12px;
  border: 1px solid var(--dc, #d1d5db);
  color: var(--dc, #374151);
  background: color-mix(in srgb, var(--dc, #6b7280) 8%, #fff);
  font-size: .78rem;
  user-select: none;
  transition: background .12s;
}
.rd-dim-toggle:hover { background: color-mix(in srgb, var(--dc, #6b7280) 16%, #fff); }

.rd-summary {
  font-size: .82rem; color: #374151;
  padding: .35rem .75rem;
  background: #f0f9ff;
  border-left: 3px solid #0ea5e9;
  border-radius: 0 6px 6px 0;
  margin-bottom: .5rem;
}

.rd-sort-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
  font-size: .8rem;
}
.rd-sort-btn {
  padding: .2rem .6rem; font-size: .78rem; cursor: pointer;
  border: 1px solid #d1d5db; border-radius: 5px;
  background: #fff; color: #374151;
  transition: background .1s;
}
.rd-sort-btn:hover { background: #f1f5f9; }
.rd-sort-btn.active { background: #1e40af; color: #fff; border-color: #1e40af; }

.rd-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rd-table thead th {
  padding: .4rem .6rem; background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  text-align: left; font-weight: 600; color: #374151;
  white-space: nowrap;
}
.rd-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.rd-table tbody tr:hover { background: #f8fafc; }
.rd-table td { padding: .35rem .6rem; vertical-align: middle; }

.rd-rank { width: 36px; color: #9ca3af; font-size: .75rem; text-align: right; }
.rd-dim-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 10px;
  border: 1px solid;
  font-size: .72rem; font-weight: 600;
  white-space: nowrap;
}
.rd-item { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rd-amt { text-align: right; font-variant-numeric: tabular-nums; color: #374151; white-space: nowrap; }
.rd-prev { color: #6b7280; }
.rd-delta-cell { width: 200px; }
.rd-delta-wrap { position: relative; display: flex; align-items: center; gap: .4rem; }
.rd-bar {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 20px; border-radius: 3px;
  border: 1px solid; opacity: .4;
  min-width: 2px;
  pointer-events: none;
}
.rd-delta-val { position: relative; z-index: 1; font-weight: 600; white-space: nowrap; font-size: .8rem; padding-left: 2px; }
.rd-pct { text-align: right; font-weight: 500; white-space: nowrap; font-size: .8rem; }
.rd-more { font-size: .8rem; color: #6b7280; padding: .4rem .6rem; }
.rd-empty { color: #6b7280; padding: .75rem; font-size: .83rem; }

/* Region drilldown */
.rd-region-row { cursor: pointer; }
.rd-region-row:hover td { background: #f0f4ff !important; }
.rd-expand-icon { font-size: .75rem; color: #6366f1; display: inline-block; width: 1em; }
.rd-country-row td { background: #fafafa; border-bottom: 1px solid #f1f5f9; }
.rd-country-row:last-child td { border-bottom: 2px solid #e2e8f0; }
.rd-country-item { padding-left: 2rem !important; font-size: .8rem; color: #374151; }
/* ============================================================
   Initiatives – Critical Initiatives Tracker (scoped to #ini-app-root)
   ============================================================ */

:root {
  --navy: #07143a;
  --navy-2: #0b1d4d;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #e2e8f0;
  --soft: #f4f6fa;
  --blue: #1f4e78;
  --blue-soft: #ddebf7;
  --red: #d92d20;
  --red-soft: #fee4e2;
  --orange: #f79009;
  --orange-soft: #fff1d6;
  --yellow: #facc15;
  --yellow-soft: #fff8cc;
  --green: #027a48;
  --green-soft: #dcfae6;
  --purple: #a100fd;
  --pink: #d43f8d;
  --shadow: 0 20px 60px rgba(17, 24, 39, 0.16);
}

#ini-app-root button,
#ini-app-root input,
#ini-app-root select,
#ini-app-root textarea {
  font: inherit;
}

#ini-app-root .app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

#ini-app-root .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 24px;
  background: linear-gradient(180deg, var(--navy) 0%, #09183f 55%, #06112f 100%);
  color: #fff;
}

#ini-app-root .brand {
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

#ini-app-root .logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#ini-app-root .brand-logo {
  display: flex;
  align-items: center;
  width: 168px;
  max-width: 100%;
  overflow: visible;
}

#ini-app-root .brand-logo svg {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
}

#ini-app-root .brand-sub {
  margin: 10px 0 0;
  color: #9aa7cf;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#ini-app-root .tagline {
  margin: 12px 0 0;
  font-style: italic;
  background: linear-gradient(90deg, #ff8a00, #d43f8d, #a100fd);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

#ini-app-root .nav-group-title {
  margin: 0 0 10px;
  color: #8d99bd;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#ini-app-root .nav-list {
  display: grid;
  gap: 7px;
}

#ini-app-root .nav-button,
#ini-app-root .quick-button,
#ini-app-root .utility-card {
  width: 100%;
  border: 0;
  color: #b8c3e1;
  background: transparent;
  text-align: left;
}

#ini-app-root .nav-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
}

#ini-app-root .nav-button:hover,
#ini-app-root .quick-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

#ini-app-root .nav-button.active {
  color: #fff;
  background: #253e86;
  box-shadow: inset 4px 0 0 #d43f8d;
}

#ini-app-root .nav-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

#ini-app-root .nav-icon {
  width: 20px;
  color: currentColor;
}

#ini-app-root .badge {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

#ini-app-root .quick-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

#ini-app-root .sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 7px;
}

#ini-app-root .utility-card {
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

#ini-app-root .utility-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 3px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

#ini-app-root .utility-card p {
  margin: 0;
  color: #9aa7cf;
  font-size: 11px;
  line-height: 1.25;
}

#ini-app-root .workspace {
  min-width: 0;
}

#ini-app-root .topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 34px;
  background: rgba(245, 247, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

#ini-app-root .top-title {
  margin: 0;
  font-size: 18px;
  color: var(--muted);
}

#ini-app-root .top-title strong {
  display: block;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.12;
}

#ini-app-root .sync-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

#ini-app-root .main {
  padding: 34px;
}

#ini-app-root .page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

#ini-app-root .page-head > .btn {
  flex: 0 0 auto;
  margin-top: 4px;
}

#ini-app-root .eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#ini-app-root h1,
#ini-app-root h2,
#ini-app-root h3,
#ini-app-root p {
  margin-top: 0;
}

#ini-app-root h1 {
  margin-bottom: 8px;
  font-size: 38px;
  line-height: 1.08;
}

#ini-app-root h2 {
  font-size: 22px;
}

#ini-app-root .gradient-title {
  background: linear-gradient(90deg, #ff8a00, #d43f8d, #a100fd);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

#ini-app-root .muted {
  color: var(--muted);
}

#ini-app-root .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#ini-app-root .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
}

#ini-app-root .btn:hover {
  border-color: #b9c6d8;
}

#ini-app-root .btn.primary {
  border: 0;
  background: linear-gradient(90deg, #ff8a00, #d43f8d);
  color: white;
  box-shadow: 0 8px 18px rgba(212, 63, 141, 0.16);
}

#ini-app-root .btn.danger {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}

#ini-app-root .btn.ghost {
  background: transparent;
}

#ini-app-root .icon {
  width: 16px;
  height: 16px;
}

#ini-app-root .grid {
  display: grid;
  gap: 16px;
}

#ini-app-root .kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#ini-app-root .kpi-card {
  min-height: 128px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

#ini-app-root .kpi-card button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

#ini-app-root .kpi-label {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#ini-app-root .kpi-value {
  margin-top: 12px;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

#ini-app-root .urgency-green {
  color: var(--green);
}

#ini-app-root .urgency-orange {
  color: var(--orange);
}

#ini-app-root .urgency-red {
  color: var(--red);
}

#ini-app-root .section {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}

#ini-app-root .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

#ini-app-root .section-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#ini-app-root .section-head .muted {
  margin: 6px 0 0;
}

#ini-app-root .section-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

#ini-app-root .section-collapse-btn:hover {
  border-color: rgba(255, 146, 2, 0.45);
  background: rgba(255, 146, 2, 0.1);
  color: var(--ink);
}

#ini-app-root .dashboard-section.collapsed .section-head {
  border-bottom: 0;
}

#ini-app-root .dashboard-section.collapsed .section-body {
  display: none;
}

#ini-app-root .dashboard-section.collapsed .section-collapse-btn {
  transform: rotate(-90deg);
}

#ini-app-root .section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#ini-app-root .section-actions .btn,
#ini-app-root .inline-actions .btn,
#ini-app-root .modal-foot .btn {
  min-height: 32px;
  padding: 6px 10px;
}

#ini-app-root .section-body {
  padding: 20px;
  overflow-x: auto;
}

#ini-app-root .attention-block + .attention-block {
  margin-top: 18px;
}

#ini-app-root .mini-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

#ini-app-root .mini-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#ini-app-root .attention-table,
#ini-app-root .data-table {
  width: 100%;
  border-collapse: collapse;
}

#ini-app-root .attention-table th,
#ini-app-root .attention-table td,
#ini-app-root .data-table th,
#ini-app-root .data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

#ini-app-root .attention-table th,
#ini-app-root .data-table th {
  background: #eef2f8;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#ini-app-root .wrap-cell {
  max-width: 360px;
  white-space: normal;
  line-height: 1.45;
}

#ini-app-root .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f8;
  color: #475467;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#ini-app-root .pill.green {
  background: var(--green-soft);
  color: var(--green);
}

#ini-app-root .pill.yellow {
  background: var(--yellow-soft);
  color: #a15c00;
}

#ini-app-root .pill.orange {
  background: var(--orange-soft);
  color: #b54708;
}

#ini-app-root .pill.red {
  background: var(--red-soft);
  color: var(--red);
}

#ini-app-root .dept-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

#ini-app-root .dept-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

#ini-app-root .dept-card.issue {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(217, 45, 32, 0.08);
}

#ini-app-root .dept-card.watch {
  border-color: var(--orange);
}

#ini-app-root .dept-card.clear {
  border-color: #b7e4c7;
}

#ini-app-root .dept-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 16px;
}

#ini-app-root .dept-stat {
  color: var(--muted);
  font-size: 13px;
}

#ini-app-root .matrix-toolbar,
#ini-app-root .filter-bar,
#ini-app-root .form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#ini-app-root .filter-help {
  margin: 12px 0 0;
  color: #667085;
  font-weight: 700;
}

#ini-app-root .task-status-filter {
  grid-template-columns: minmax(150px, 180px) minmax(220px, 280px) minmax(260px, 1fr);
  align-items: end;
  margin-bottom: 16px;
}

#ini-app-root .task-status-filter .filter-help {
  align-self: end;
  margin: 0;
  padding-bottom: 8px;
}

#ini-app-root .filter-bar .btn {
  align-self: end;
  justify-self: start;
  min-height: 32px;
  padding: 6px 10px;
}

#ini-app-root .filter-summary {
  align-self: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  color: #667085;
  font-weight: 800;
}

#ini-app-root .filter-summary strong {
  color: var(--ink);
  font-size: 22px;
  margin-right: 6px;
}

#ini-app-root .matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

#ini-app-root .matrix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#ini-app-root .legend-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.04);
}

#ini-app-root .legend-swatch.red {
  background: var(--red);
}

#ini-app-root .legend-swatch.yellow {
  background: #d69b00;
}

#ini-app-root .legend-swatch.green {
  background: var(--green);
}

#ini-app-root .legend-swatch.blue {
  background: var(--blue);
}

#ini-app-root .form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#ini-app-root .form-field {
  display: grid;
  gap: 6px;
}

#ini-app-root .form-field.full {
  grid-column: 1 / -1;
}

#ini-app-root label {
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ini-app-root input,
#ini-app-root select,
#ini-app-root textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd8e6;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

#ini-app-root textarea {
  min-height: 96px;
  resize: vertical;
}

#ini-app-root input:focus,
#ini-app-root select:focus,
#ini-app-root textarea:focus {
  outline: 3px solid rgba(161, 0, 253, 0.16);
  border-color: var(--purple);
}

#ini-app-root .required-missing {
  background: var(--yellow-soft);
  border-color: var(--yellow);
}

#ini-app-root .matrix-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#ini-app-root .matrix {
  width: 100%;
  min-width: 1960px;
  border-collapse: collapse;
  table-layout: fixed;
}

#ini-app-root .matrix th,
#ini-app-root .matrix td {
  min-width: 132px;
  height: 64px;
  border: 1px solid var(--line);
  text-align: center;
  padding: 8px;
  overflow-wrap: anywhere;
}

#ini-app-root .matrix th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2f8;
  font-weight: 900;
  font-size: 12px;
  line-height: 1.25;
}

#ini-app-root .matrix .row-head {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  background: #dfe8f5;
  text-align: left;
  padding-left: 12px;
}

#ini-app-root .matrix thead th:first-child {
  left: 0;
  z-index: 3;
}

#ini-app-root .matrix-cell-button {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

#ini-app-root .matrix-cell-button.has-items {
  background: #fae8ff;
  color: #a100a9;
}

#ini-app-root .matrix-cell-button.status-red {
  background: var(--red-soft);
  box-shadow: inset 0 0 0 2px var(--red);
  color: var(--red);
}

#ini-app-root .matrix-cell-button.status-yellow {
  background: var(--yellow-soft);
  box-shadow: inset 0 0 0 2px var(--yellow);
  color: #a15c00;
}

#ini-app-root .matrix-cell-button.status-red-yellow {
  background: linear-gradient(135deg, var(--red-soft) 0 50%, var(--yellow-soft) 50% 100%);
  box-shadow: inset 0 0 0 2px var(--red);
  color: #7a271a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

#ini-app-root .matrix-cell-button.status-green {
  background: var(--green-soft);
  box-shadow: inset 0 0 0 2px #22c55e;
  color: var(--green);
}

#ini-app-root .matrix-cell-button.status-neutral {
  background: #eef2ff;
  color: var(--blue);
}

#ini-app-root .stakeholder-grid {
  display: grid;
  gap: 12px;
}

#ini-app-root .stakeholder-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#ini-app-root .stakeholder-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#ini-app-root .stakeholder-card h3 {
  margin: 0;
}

#ini-app-root .stakeholder-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
}

#ini-app-root .person-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

#ini-app-root .person-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 78, 120, 0.12);
  color: inherit;
  padding: 0;
}

#ini-app-root .person-pill .icon {
  width: 13px;
  height: 13px;
}

#ini-app-root .compact-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

#ini-app-root .inline-people-picker {
  position: relative;
  min-width: 220px;
}

#ini-app-root .inline-people-picker summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid #cfd8e6;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

#ini-app-root .inline-people-picker summary::-webkit-details-marker {
  display: none;
}

#ini-app-root .inline-people-picker summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid #98a2b3;
  border-bottom: 2px solid #98a2b3;
  transform: rotate(45deg);
}

#ini-app-root .inline-people-picker[open] summary {
  border-color: var(--purple);
  outline: 3px solid rgba(161, 0, 253, 0.16);
}

#ini-app-root .inline-people-picker[open] summary::after {
  transform: rotate(225deg);
}

#ini-app-root .inline-people-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  width: min(360px, 80vw);
  max-height: 260px;
  margin-top: 6px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(12, 20, 38, 0.16);
}

#ini-app-root .table-control {
  min-width: 138px;
}

#ini-app-root .selector-field {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

#ini-app-root .selector-field legend {
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 6px;
}

#ini-app-root .check-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#ini-app-root .check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d7dfeb;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}

#ini-app-root .check-pill input {
  width: auto;
  min-height: 0;
  padding: 0;
}

#ini-app-root .custom-people-field {
  margin-top: 12px;
}

#ini-app-root .inline-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#ini-app-root .task-row {
  background: #fffdf0;
}

#ini-app-root .task-row.missing {
  background: #fff6b8;
}

#ini-app-root .task-row.complete {
  background: #f0fdf4;
}

#ini-app-root .task-row input,
#ini-app-root .task-row select {
  min-width: 160px;
}

#ini-app-root .inline-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

#ini-app-root .empty {
  padding: 34px;
  color: #98a2b3;
  text-align: center;
  font-size: 18px;
}

#ini-app-root .audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 34px;
}

#ini-app-root .audit-heading {
  margin: 0 0 10px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#ini-app-root .audit-note {
  margin: 0 0 10px;
  color: #98a2b3;
  font-size: 12px;
  font-style: italic;
}

#ini-app-root .audit-row,
#ini-app-root .audit-bar-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #475467;
  text-align: left;
}

#ini-app-root .audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px;
  font-weight: 700;
}

#ini-app-root .audit-row:hover,
#ini-app-root .audit-bar-row:hover {
  color: var(--ink);
  background: #f8fafc;
}

#ini-app-root .audit-count {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

#ini-app-root .audit-count.red {
  color: var(--red);
}

#ini-app-root .audit-count.green {
  color: var(--green);
}

#ini-app-root .audit-bar-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  font-weight: 800;
}

#ini-app-root .audit-bar {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f3f8;
}

#ini-app-root .audit-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8a00, #d43f8d, #a100fd);
}

#ini-app-root .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 18, 35, 0.58);
}

#ini-app-root .modal {
  width: min(920px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

#ini-app-root .modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

#ini-app-root .modal-head h2 {
  margin: 0;
}

#ini-app-root .modal-body {
  padding: 22px;
}

#ini-app-root .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px 22px;
}

#ini-app-root .toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 700;
}

#ini-app-root .toast.error {
  background: var(--red);
}

#ini-app-root .toast.success {
  background: var(--green);
}

#ini-app-root .settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

#ini-app-root .code-box {
  display: block;
  overflow-x: auto;
  padding: 12px;
  border-radius: 10px;
  background: #0b1220;
  color: #d7e3ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 1100px) {
  #ini-app-root .app-shell {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  #ini-app-root .brand-sub,
  #ini-app-root .tagline,
  #ini-app-root .nav-text,
  #ini-app-root .quick-button span,
  #ini-app-root .utility-card p {
    display: none;
  }

  #ini-app-root .sidebar {
    padding: 20px 16px;
    align-items: stretch;
  }

  #ini-app-root .nav-button,
  #ini-app-root .quick-button {
    justify-content: center;
  }

  #ini-app-root .brand-logo {
    width: 42px;
    overflow: hidden;
    margin: 0 auto;
  }

  #ini-app-root .brand-logo svg {
    width: 168px;
    max-width: none;
  }

  #ini-app-root .kpi-grid,
  #ini-app-root .dept-grid,
  #ini-app-root .matrix-toolbar,
  #ini-app-root .filter-bar,
  #ini-app-root .audit-grid,
  #ini-app-root .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #ini-app-root .app-shell {
    grid-template-columns: 1fr;
  }

  #ini-app-root .sidebar {
    position: static;
    height: auto;
  }

  #ini-app-root .main,
  #ini-app-root .topbar {
    padding: 20px;
  }

  #ini-app-root .page-head,
  #ini-app-root .topbar {
    flex-direction: column;
  }

  #ini-app-root .kpi-grid,
  #ini-app-root .dept-grid,
  #ini-app-root .matrix-toolbar,
  #ini-app-root .filter-bar,
  #ini-app-root .task-status-filter,
  #ini-app-root .form-grid,
  #ini-app-root .form-grid.two,
  #ini-app-root .audit-grid,
  #ini-app-root .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Initiatives – Modal overrides (sticky header/footer, proper z-index)
   ============================================================ */

/* Font inheritance for the entire initiatives panel */
#ini-app-root {
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #111827;
}

/* Backdrop: above CAM's user-menu dropdown (z-index:120) */
#ini-app-root .modal-backdrop {
  z-index: 1000;
}

/* Modal: flex column so head/foot are sticky, body scrolls */
#ini-app-root .modal {
  width: min(960px, 96vw);
  max-height: min(840px, 92vh);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(7, 20, 58, 0.30), 0 4px 16px rgba(7, 20, 58, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* clip children, NOT scroll the whole modal */
}

/* Header: fixed, never scrolls */
#ini-app-root .modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 18px 18px 0 0;
}

#ini-app-root .modal-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: #0f172a;
}

#ini-app-root .modal-head .eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

#ini-app-root .modal-head .muted {
  margin: 6px 0 0;
  font-size: 13px;
  color: #667085;
  line-height: 1.45;
}

/* Body: scrollable, fills remaining space */
#ini-app-root .modal-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  line-height: 1.55;
  font-size: 13.5px;
}

/* Footer: fixed at bottom, never scrolls */
#ini-app-root .modal-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 0 0 18px 18px;
}

/* Readable typography inside modals */
#ini-app-root .modal-body p,
#ini-app-root .modal-body label {
  font-size: 13px;
  line-height: 1.55;
}

#ini-app-root .modal-body .form-field > label,
#ini-app-root .modal-body label.form-field {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #667085;
  gap: 5px;
}

#ini-app-root .modal-body input,
#ini-app-root .modal-body select,
#ini-app-root .modal-body textarea {
  font-size: 13.5px;
  line-height: 1.45;
  padding: 9px 11px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  width: 100%;
}

#ini-app-root .modal-body textarea {
  min-height: 88px;
  resize: vertical;
}

/* Make the needs text areas in the matrix modal readable */
#ini-app-root .modal-body .grid label.form-field {
  font-size: 12px;
}

#ini-app-root .modal-body .grid textarea {
  font-size: 13px;
  min-height: 72px;
}

/* Section inside modal — remove double borders */
#ini-app-root .modal-body .section {
  margin-top: 20px;
  border-radius: 10px;
}

/* ============================================================
   Initiatives – Modal positioning fix (roots are at body level)
   ============================================================ */

/* Modal/toast roots live outside #ini-app-root — no scoping needed */
#ini-modal-root .modal-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 20, 58, 0.62);
  box-sizing: border-box;
}

#ini-modal-root .modal {
  width: min(860px, 96vw);
  max-height: min(840px, 92vh);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(7, 20, 58, 0.32), 0 4px 20px rgba(7, 20, 58, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #111827;
}

/* Sticky header */
#ini-modal-root .modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 18px 18px 0 0;
}
#ini-modal-root .modal-head h2 { margin: 0; font-size: 19px; color: #0f172a; line-height: 1.2; }
#ini-modal-root .modal-head .eyebrow {
  margin: 0 0 4px; font-size: 11px; font-weight: 900;
  letter-spacing: 0.16em; text-transform: uppercase; color: #1f4e78;
}
#ini-modal-root .modal-head .muted {
  margin: 5px 0 0; font-size: 13px; color: #667085; line-height: 1.4;
}

/* Scrollable body */
#ini-modal-root .modal-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px;
  line-height: 1.55;
}

/* Sticky footer with buttons */
#ini-modal-root .modal-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 18px 18px;
}

/* Form inputs inside modal */
#ini-modal-root label {
  font-size: 11px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase; color: #667085;
}
#ini-modal-root input,
#ini-modal-root select,
#ini-modal-root textarea {
  width: 100%; min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #cfd8e6; border-radius: 8px;
  background: #fff; color: #111827;
  font: inherit; font-size: 13.5px;
  box-sizing: border-box;
}
#ini-modal-root textarea { min-height: 80px; resize: vertical; }
#ini-modal-root input:focus,
#ini-modal-root select:focus,
#ini-modal-root textarea:focus {
  outline: 3px solid rgba(161,0,253,.15); border-color: #a100fd;
}

/* 2-column grid for needs slots (matrix modal) */
#ini-modal-root .modal-body .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Form grids inside modal — consistent 2-column layout */
#ini-modal-root .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
#ini-modal-root .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#ini-modal-root .form-field { display: grid; gap: 5px; }
#ini-modal-root .form-field.full { grid-column: 1 / -1; }

/* Section inside modal body */
#ini-modal-root .modal-body .section {
  margin-top: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* Task table inside modal */
#ini-modal-root .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#ini-modal-root .data-table th {
  padding: 9px 12px; background: #eef2f8;
  color: #98a2b3; font-size: 11px; font-weight: 900;
  letter-spacing: .12em; text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0; text-align: left;
}
#ini-modal-root .data-table td {
  padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
}
#ini-modal-root .data-table input,
#ini-modal-root .data-table select { min-width: 0; font-size: 12.5px; }

/* Toast */
#ini-toast-root .toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 10100;
  max-width: 400px; padding: 13px 16px; border-radius: 12px;
  background: #07143a; color: #fff; font-weight: 700; font-size: 13.5px;
  box-shadow: 0 16px 40px rgba(7,20,58,.22);
  font-family: Aptos, Inter, ui-sans-serif, system-ui, sans-serif;
}
#ini-toast-root .toast.error   { background: #d92d20; }
#ini-toast-root .toast.success { background: #027a48; }

/* ============================================================
   Initiatives – Matrix modal: full redesign
   ============================================================ */

/* Reset any previous ini-modal-root rules with higher specificity */
#ini-modal-root .modal-backdrop {
  position: fixed !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  padding: 20px !important;
  background: rgba(7, 20, 58, 0.65) !important;
  z-index: 10000 !important;
  box-sizing: border-box !important;
}

#ini-modal-root .modal {
  width: min(820px, 100%) !important;
  max-height: min(860px, 94vh) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  box-shadow: 0 32px 80px rgba(7,20,58,.28), 0 2px 8px rgba(7,20,58,.08) !important;
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  font-size: 14px !important;
  color: #111827 !important;
  border: 1px solid rgba(31,78,120,.12) !important;
}

/* ---- Header ---- */
#ini-modal-root .modal-head {
  flex: 0 0 auto !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 18px 22px 16px !important;
  background: linear-gradient(135deg, #07143a 0%, #0b1d4d 100%) !important;
  border-radius: 15px 15px 0 0 !important;
  border-bottom: none !important;
}
#ini-modal-root .modal-head .eyebrow {
  margin: 0 0 3px !important;
  font-size: 10px !important; font-weight: 900 !important;
  letter-spacing: .18em !important; text-transform: uppercase !important;
  color: #8d99bd !important;
}
#ini-modal-root .modal-head h2 {
  margin: 0 0 4px !important;
  font-size: 18px !important; font-weight: 800 !important;
  line-height: 1.2 !important;
  color: #ffffff !important;
}
#ini-modal-root .modal-head .muted {
  margin: 0 !important; font-size: 12px !important;
  color: #9aa7cf !important; line-height: 1.4 !important;
}
#ini-modal-root .modal-head .btn.ghost {
  background: rgba(255,255,255,.1) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  color: #c8d3f0 !important;
  border-radius: 8px !important;
  padding: 6px !important; min-height: auto !important;
  flex: 0 0 auto !important; margin-top: 2px !important;
}
#ini-modal-root .modal-head .btn.ghost:hover {
  background: rgba(255,255,255,.2) !important; color: #fff !important;
}

/* ---- Scrollable body ---- */
#ini-modal-root .modal-body {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 22px !important;
  background: #f8fafc !important;
}

/* ---- Needs grid: 2 columns, numbered slots ---- */
#ini-modal-root .modal-body .grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  margin-bottom: 20px !important;
}
#ini-modal-root .modal-body .grid .form-field {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 12px !important;
  box-shadow: 0 1px 3px rgba(7,20,58,.04) !important;
  transition: border-color .15s !important;
}
#ini-modal-root .modal-body .grid .form-field:focus-within {
  border-color: #1f4e78 !important;
  box-shadow: 0 0 0 3px rgba(31,78,120,.1) !important;
}
#ini-modal-root .modal-body .grid .form-field > label,
#ini-modal-root .modal-body .grid label.form-field > :first-child {
  font-size: 10px !important; font-weight: 900 !important;
  letter-spacing: .14em !important; text-transform: uppercase !important;
  color: #6b7280 !important; display: none !important; /* replaced by counter below */
}
/* Number badge via CSS counter */
#ini-modal-root .modal-body .grid { counter-reset: need-slot; }
#ini-modal-root .modal-body .grid .form-field { counter-increment: need-slot; position: relative; }
#ini-modal-root .modal-body .grid .form-field::before {
  content: counter(need-slot);
  position: absolute !important; top: 10px !important; right: 12px !important;
  width: 22px !important; height: 22px !important;
  background: #1f4e78 !important; color: #fff !important;
  font-size: 11px !important; font-weight: 900 !important;
  border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  line-height: 22px !important; text-align: center !important;
}
#ini-modal-root .modal-body .grid textarea {
  width: 100% !important;
  min-height: 76px !important;
  padding: 8px 36px 8px 10px !important;
  border: none !important; outline: none !important;
  background: transparent !important;
  resize: vertical !important;
  font: inherit !important; font-size: 13px !important;
  line-height: 1.5 !important; color: #111827 !important;
  box-sizing: border-box !important;
}
#ini-modal-root .modal-body .grid textarea::placeholder { color: #9ca3af !important; }

/* ---- Tasks section inside modal ---- */
#ini-modal-root .modal-body .section {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  margin-top: 0 !important;
}
#ini-modal-root .modal-body .section-head {
  padding: 10px 16px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  background: #f8fafc !important;
  display: flex !important; align-items: center !important;
}
#ini-modal-root .modal-body .section-head h2 {
  margin: 0 !important; font-size: 11px !important; font-weight: 900 !important;
  letter-spacing: .14em !important; text-transform: uppercase !important;
  color: #6b7280 !important;
}
#ini-modal-root .modal-body .section-body { padding: 0 !important; overflow-x: auto !important; }
#ini-modal-root .modal-body .empty {
  padding: 20px !important; text-align: center !important;
  color: #9ca3af !important; font-size: 13px !important;
  background: #fff !important;
}

/* Tasks table: compact, readable */
#ini-modal-root .modal-body .data-table { width: 100% !important; border-collapse: collapse !important; font-size: 12.5px !important; }
#ini-modal-root .modal-body .data-table th {
  padding: 8px 10px !important;
  background: #f1f5f9 !important;
  color: #64748b !important; font-size: 10px !important; font-weight: 800 !important;
  letter-spacing: .1em !important; text-transform: uppercase !important;
  border-bottom: 1px solid #e2e8f0 !important;
  white-space: nowrap !important; text-align: left !important;
}
#ini-modal-root .modal-body .data-table td {
  padding: 7px 10px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
}
/* Hide redundant dept columns inside matrix modal (already in header) */
#ini-modal-root .modal-body .data-table th:nth-child(1),
#ini-modal-root .modal-body .data-table td:nth-child(1),
#ini-modal-root .modal-body .data-table th:nth-child(2),
#ini-modal-root .modal-body .data-table td:nth-child(2),
#ini-modal-root .modal-body .data-table th:nth-child(3),
#ini-modal-root .modal-body .data-table td:nth-child(3) { display: none !important; }

#ini-modal-root .modal-body .data-table input,
#ini-modal-root .modal-body .data-table select {
  width: 100% !important; min-width: 90px !important;
  padding: 5px 7px !important;
  border: 1px solid #e2e8f0 !important; border-radius: 6px !important;
  font: inherit !important; font-size: 12px !important;
  background: #fff !important; color: #111827 !important;
  box-sizing: border-box !important;
}
#ini-modal-root .modal-body .data-table input:focus,
#ini-modal-root .modal-body .data-table select:focus {
  outline: none !important; border-color: #1f4e78 !important;
  box-shadow: 0 0 0 2px rgba(31,78,120,.12) !important;
}
#ini-modal-root .modal-body .task-row { background: #fffdf0 !important; }
#ini-modal-root .modal-body .task-row.missing { background: #fff8f0 !important; }
#ini-modal-root .modal-body .task-row.complete { background: #f0fdf4 !important; }
#ini-modal-root .modal-body .task-row:hover td { background: rgba(31,78,120,.03) !important; }

/* Action buttons in task rows */
#ini-modal-root .modal-body .inline-actions {
  display: flex !important; gap: 5px !important; flex-wrap: nowrap !important;
}
#ini-modal-root .modal-body .inline-actions .btn {
  min-height: 28px !important; padding: 4px 8px !important;
  font-size: 11px !important; white-space: nowrap !important;
  border-radius: 6px !important; border: 1px solid #e2e8f0 !important;
  background: #fff !important; color: #374151 !important; cursor: pointer !important;
}
#ini-modal-root .modal-body .inline-actions .btn:hover { background: #f1f5f9 !important; }
#ini-modal-root .modal-body .inline-actions .btn.danger {
  border-color: #fecdca !important; background: #fef2f2 !important; color: #b91c1c !important;
}
#ini-modal-root .modal-body .required-missing {
  background: #fffbeb !important; border-color: #fcd34d !important;
}

/* ---- Footer ---- */
#ini-modal-root .modal-foot {
  flex: 0 0 auto !important;
  display: flex !important; justify-content: flex-end !important; gap: 8px !important;
  padding: 14px 22px !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #fff !important;
  border-radius: 0 0 15px 15px !important;
}
#ini-modal-root .modal-foot .btn {
  min-height: 36px !important; padding: 8px 18px !important;
  font-size: 13px !important; font-weight: 700 !important;
  border-radius: 8px !important; cursor: pointer !important;
  border: 1px solid #e2e8f0 !important; background: #fff !important; color: #374151 !important;
}
#ini-modal-root .modal-foot .btn:hover { background: #f1f5f9 !important; }
#ini-modal-root .modal-foot .btn.primary {
  background: linear-gradient(135deg, #1f4e78, #2563eb) !important;
  border: none !important; color: #fff !important;
  box-shadow: 0 2px 8px rgba(37,99,235,.3) !important;
}
#ini-modal-root .modal-foot .btn.primary:hover {
  background: linear-gradient(135deg, #1a3f63, #1d4ed8) !important;
}

/* Other modals (non-matrix): clean white header instead of navy */
#ini-modal-root .modal-head.light-head {
  background: #f8fafc !important;
}
#ini-modal-root .modal-head.light-head h2 { color: #0f172a !important; }
#ini-modal-root .modal-head.light-head .eyebrow { color: #1f4e78 !important; }
#ini-modal-root .modal-head.light-head .muted { color: #667085 !important; }
#ini-modal-root .modal-head.light-head .btn.ghost {
  background: transparent !important; border-color: #e2e8f0 !important;
  color: #6b7280 !important;
}

/* Form fields in non-matrix modals */
#ini-modal-root .modal-body .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#ini-modal-root .modal-body .form-grid.two { grid-template-columns: 1fr 1fr; }
#ini-modal-root .modal-body .form-field { display: grid; gap: 5px; }
#ini-modal-root .modal-body .form-field.full { grid-column: 1 / -1; }
#ini-modal-root .modal-body input:not([type="checkbox"]),
#ini-modal-root .modal-body select,
#ini-modal-root .modal-body textarea:not(.grid textarea) {
  width: 100% !important; min-height: 38px !important;
  padding: 8px 11px !important;
  border: 1px solid #cfd8e6 !important; border-radius: 8px !important;
  background: #fff !important; color: #111827 !important;
  font: inherit !important; font-size: 13px !important;
  box-sizing: border-box !important;
}
#ini-modal-root .modal-body input:not([type="checkbox"]):focus,
#ini-modal-root .modal-body select:focus,
#ini-modal-root .modal-body textarea:not(.grid textarea):focus {
  outline: none !important;
  border-color: #1f4e78 !important; box-shadow: 0 0 0 3px rgba(31,78,120,.1) !important;
}
#ini-modal-root .modal-body label:not(.check-pill):not(.btn) {
  font-size: 10.5px !important; font-weight: 900 !important;
  letter-spacing: .1em !important; text-transform: uppercase !important;
  color: #667085 !important;
}

/* ============================================================
   Initiatives – Matrix modal: fix horizontal scroll in tasks table
   ============================================================ */

/* No horizontal overflow in the tasks section */
#ini-modal-root .modal-body .section-body { overflow-x: hidden !important; }
#ini-modal-root .modal-body .data-table { table-layout: fixed !important; }

/* Column widths that fit without scrolling */
#ini-modal-root .modal-body .data-table th:nth-child(4),
#ini-modal-root .modal-body .data-table td:nth-child(4) { width: 30% !important; }   /* Need */
#ini-modal-root .modal-body .data-table th:nth-child(5),
#ini-modal-root .modal-body .data-table td:nth-child(5) { width: 25% !important; }   /* Task */
#ini-modal-root .modal-body .data-table th:nth-child(6),
#ini-modal-root .modal-body .data-table td:nth-child(6) { width: 12% !important; }   /* Owner */
#ini-modal-root .modal-body .data-table th:nth-child(7),
#ini-modal-root .modal-body .data-table td:nth-child(7) { width: 11% !important; }   /* ETA */
#ini-modal-root .modal-body .data-table th:nth-child(8),
#ini-modal-root .modal-body .data-table td:nth-child(8) { width: 10% !important; }   /* Status */
#ini-modal-root .modal-body .data-table th:nth-child(9),
#ini-modal-root .modal-body .data-table td:nth-child(9) { width: 12% !important; }   /* Actions */

/* Truncate long text cells instead of overflowing */
#ini-modal-root .modal-body .data-table td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
/* But let Need and Task cells wrap */
#ini-modal-root .modal-body .data-table td:nth-child(4),
#ini-modal-root .modal-body .data-table td:nth-child(5) {
  white-space: normal !important; overflow: visible !important; word-break: break-word !important;
}

/* Shrink action buttons to fit the column */
#ini-modal-root .modal-body .inline-actions { gap: 3px !important; flex-wrap: nowrap !important; }
#ini-modal-root .modal-body .inline-actions .btn {
  min-height: 26px !important; padding: 3px 6px !important;
  font-size: 10.5px !important; white-space: nowrap !important;
}

/* ============================================================
   Initiatives – Modal: target #ini-modal-bd (appended to body)
   ============================================================ */

#ini-modal-bd {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: rgba(7,20,58,.65) !important;
  z-index: 99999 !important;
  box-sizing: border-box !important;
}
#ini-modal-bd .modal {
  width: min(820px, 100%) !important;
  max-height: min(860px, 94vh) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 32px 80px rgba(7,20,58,.28), 0 2px 8px rgba(7,20,58,.08) !important;
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  font-size: 14px !important;
  color: #111827 !important;
}
#ini-modal-bd .modal-head {
  flex: 0 0 auto !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 18px 22px 16px !important;
  background: linear-gradient(135deg,#07143a,#0b1d4d) !important;
  border-radius: 16px 16px 0 0 !important;
}
#ini-modal-bd .modal-head .eyebrow {
  margin: 0 0 3px !important; font-size: 10px !important; font-weight: 900 !important;
  letter-spacing: .18em !important; text-transform: uppercase !important; color: #8d99bd !important;
}
#ini-modal-bd .modal-head h2 {
  margin: 0 0 4px !important; font-size: 18px !important; font-weight: 800 !important;
  color: #fff !important; line-height: 1.2 !important;
}
#ini-modal-bd .modal-head .muted { margin: 0 !important; font-size: 12px !important; color: #9aa7cf !important; }
#ini-modal-bd .modal-head .btn.ghost {
  background: rgba(255,255,255,.1) !important; border: 1px solid rgba(255,255,255,.18) !important;
  color: #c8d3f0 !important; border-radius: 8px !important;
  padding: 6px !important; min-height: auto !important; flex: 0 0 auto !important;
  cursor: pointer !important;
}
#ini-modal-bd .modal-head .btn.ghost:hover { background: rgba(255,255,255,.2) !important; color: #fff !important; }
#ini-modal-bd .modal-body {
  flex: 1 1 0 !important; min-height: 0 !important;
  overflow-y: auto !important; padding: 22px !important;
  background: #f8fafc !important;
}
#ini-modal-bd .modal-foot {
  flex: 0 0 auto !important;
  display: flex !important; justify-content: flex-end !important; gap: 8px !important;
  padding: 14px 22px !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #fff !important;
  border-radius: 0 0 16px 16px !important;
}
#ini-modal-bd .modal-foot .btn {
  min-height: 36px !important; padding: 8px 18px !important;
  font-size: 13px !important; font-weight: 700 !important; border-radius: 8px !important;
  cursor: pointer !important; border: 1px solid #e2e8f0 !important;
  background: #fff !important; color: #374151 !important;
}
#ini-modal-bd .modal-foot .btn:hover { background: #f1f5f9 !important; }
#ini-modal-bd .modal-foot .btn.primary {
  background: linear-gradient(135deg,#1f4e78,#2563eb) !important;
  border: none !important; color: #fff !important;
  box-shadow: 0 2px 8px rgba(37,99,235,.3) !important;
}
#ini-modal-bd .modal-foot .btn.primary:hover { background: linear-gradient(135deg,#1a3f63,#1d4ed8) !important; }

/* Needs grid */
#ini-modal-bd .modal-body .grid {
  display: grid !important; grid-template-columns: 1fr 1fr !important;
  gap: 12px !important; margin-bottom: 18px !important;
  counter-reset: need-slot !important;
}
#ini-modal-bd .modal-body .grid .form-field {
  counter-increment: need-slot !important;
  position: relative !important; display: flex !important; flex-direction: column !important;
  background: #fff !important; border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important; padding: 10px 36px 10px 12px !important;
  box-shadow: 0 1px 3px rgba(7,20,58,.04) !important;
}
#ini-modal-bd .modal-body .grid .form-field:focus-within {
  border-color: #1f4e78 !important; box-shadow: 0 0 0 3px rgba(31,78,120,.1) !important;
}
#ini-modal-bd .modal-body .grid .form-field::before {
  content: counter(need-slot) !important;
  position: absolute !important; top: 8px !important; right: 10px !important;
  width: 20px !important; height: 20px !important; line-height: 20px !important;
  background: #1f4e78 !important; color: #fff !important;
  font-size: 10px !important; font-weight: 900 !important;
  border-radius: 50% !important; text-align: center !important;
}
#ini-modal-bd .modal-body .grid textarea {
  width: 100% !important; min-height: 72px !important;
  border: none !important; outline: none !important; background: transparent !important;
  resize: vertical !important; font: inherit !important;
  font-size: 13px !important; color: #111827 !important; line-height: 1.5 !important;
  box-sizing: border-box !important; padding: 0 !important;
}
#ini-modal-bd .modal-body .grid textarea::placeholder { color: #9ca3af !important; }
#ini-modal-bd .modal-body .grid label.form-field > :first-child { display: none !important; }

/* Compact task list */
.mtl-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.mtl-header {
  padding: 9px 14px;
  font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
  color: #64748b; background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}
.mtl-need {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #f1f5f9;
}
.mtl-need:last-child { border-bottom: none; }
.mtl-need-text {
  font-size: 12.5px; font-weight: 600; color: #1e293b;
  margin-bottom: 6px; line-height: 1.4;
}
.mtl-tasks { display: flex; flex-direction: column; gap: 4px; }
.mtl-task {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  background: #f8fafc; font-size: 12px;
}
.mtl-task.mtl-empty { color: #9ca3af; font-style: italic; background: transparent; padding: 2px 0; }
.mtl-status {
  flex: 0 0 auto; padding: 2px 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 800; white-space: nowrap;
}
.mtl-task-name { flex: 1; color: #374151; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtl-task-meta { flex: 0 0 auto; font-size: 11px; color: #94a3b8; white-space: nowrap; }

/* Form fields in non-matrix modals */
#ini-modal-bd .modal-body .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#ini-modal-bd .modal-body .form-grid.two { grid-template-columns: 1fr 1fr; }
#ini-modal-bd .modal-body .form-field { display: grid; gap: 5px; }
#ini-modal-bd .modal-body .form-field.full { grid-column: 1 / -1; }
#ini-modal-bd .modal-body label:not(.check-pill):not(.btn) {
  font-size: 10.5px !important; font-weight: 900 !important;
  letter-spacing: .1em !important; text-transform: uppercase !important; color: #667085 !important;
}
#ini-modal-bd .modal-body input:not([type="checkbox"]),
#ini-modal-bd .modal-body select,
#ini-modal-bd .modal-body textarea:not(.grid textarea) {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid #cfd8e6; border-radius: 8px;
  background: #fff; color: #111827; font: inherit; font-size: 13px;
  box-sizing: border-box;
}
#ini-modal-bd .modal-body input:not([type="checkbox"]):focus,
#ini-modal-bd .modal-body select:focus,
#ini-modal-bd .modal-body textarea:not(.grid textarea):focus {
  outline: none; border-color: #1f4e78; box-shadow: 0 0 0 3px rgba(31,78,120,.1);
}
#ini-modal-bd .modal-body .selector-field { margin: 0; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; }
#ini-modal-bd .modal-body .selector-field legend { color: #667085; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: 0 6px; }
#ini-modal-bd .modal-body .check-pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
#ini-modal-bd .modal-body .check-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #d7dfeb; border-radius: 999px; padding: 6px 10px; background: #fff; color: #111827; cursor: pointer; font-size: 13px; }
#ini-modal-bd .modal-body .check-pill input { width: auto; min-height: 0; padding: 0; }

/* ============================================================
   Initiatives – Needs Dialog (openNeedsDialog)
   ============================================================ */
.nd-body { padding: 18px 20px !important; background: #f1f5f9 !important; }

.nd-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(7,20,58,.05);
  transition: border-color .15s;
}
.nd-card:focus-within { border-color: #1f4e78; box-shadow: 0 0 0 3px rgba(31,78,120,.08); }

/* Top row: status pill + meta + remove */
.nd-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.nd-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
}
.nd-meta {
  font-size: 11.5px; color: #6b7280;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nd-remove-btn {
  margin-left: auto; flex: 0 0 auto;
  padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  background: transparent; border: 1px solid #fecdca;
  color: #b91c1c;
  transition: background .12s;
}
.nd-remove-btn:hover { background: #fef2f2; }

/* Textarea */
.nd-textarea {
  width: 100%; box-sizing: border-box;
  min-height: 66px; padding: 9px 11px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  background: #f8fafc; color: #111827;
  font-family: inherit; font-size: 13.5px; line-height: 1.5;
  resize: vertical; display: block;
  transition: border-color .15s, background .15s;
}
.nd-textarea:focus {
  outline: none; border-color: #1f4e78;
  background: #fff; box-shadow: 0 0 0 3px rgba(31,78,120,.07);
}

/* Bottom row: ETA + Status + Save */
.nd-card-foot {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.nd-field {
  display: flex; flex-direction: column; gap: 4px;
}
.nd-field > span {
  font-size: 10px; font-weight: 900;
  letter-spacing: .1em; text-transform: uppercase; color: #6b7280;
}
.nd-field input[type="date"],
.nd-field select {
  min-height: 34px; padding: 5px 9px;
  border: 1px solid #d1d5db; border-radius: 7px;
  background: #fff; color: #111827;
  font-family: inherit; font-size: 13px;
  box-sizing: border-box;
}
.nd-field input[type="date"] { width: 140px; }
.nd-field select               { width: 150px; }
.nd-field input:focus, .nd-field select:focus {
  outline: none; border-color: #1f4e78;
  box-shadow: 0 0 0 2px rgba(31,78,120,.1);
}

/* Save button */
.nd-save-btn {
  margin-left: auto; align-self: flex-end;
  min-height: 34px; padding: 6px 18px;
  border-radius: 8px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: none;
  background: linear-gradient(135deg,#1f4e78,#2563eb);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,.25);
  transition: opacity .15s;
}
.nd-save-btn:disabled {
  background: #e2e8f0; color: #9ca3af;
  box-shadow: none; cursor: default;
}
.nd-save-btn:not(:disabled):hover { opacity: .88; }

/* Empty state */
.nd-empty {
  text-align: center; padding: 28px 20px;
  color: #9ca3af; font-size: 13.5px; line-height: 1.6;
  background: #fff; border-radius: 10px;
  border: 1px dashed #d1d5db;
}

/* Add New Need button */
.nd-add-btn {
  background: #fff !important;
  border: 1.5px dashed #1f4e78 !important;
  color: #1f4e78 !important;
  font-weight: 700 !important; font-size: 13px !important;
  border-radius: 8px !important;
  padding: 7px 16px !important; cursor: pointer !important;
}
.nd-add-btn:hover { background: #eff6ff !important; }

/* ============================================================
   Initiatives – ini-modal-box (replaces .modal to avoid CAM conflict)
   Styles mirror the standalone app's design exactly.
   ============================================================ */
:root {
  --ini-shadow: 0 20px 60px rgba(17,24,39,.16);
  --ini-line:   #e2e8f0;
  --ini-navy:   #07143a;
  --ini-navy2:  #0b1d4d;
  --ini-ink:    #111827;
  --ini-muted:  #667085;
}

.ini-modal-box {
  width: min(920px, 100%);
  min-height: min(600px, 80vh);
  max-height: min(920px, 96vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--ini-shadow);
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ini-ink);
}

/* Head */
.ini-modal-box .modal-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--ini-line);
  background: #f8fafc;
  border-radius: 18px 18px 0 0;
}
.ini-modal-box .modal-head h2 { margin: 0; font-size: 20px; line-height: 1.2; color: var(--ini-ink); }
.ini-modal-box .modal-head .eyebrow {
  margin: 0 0 5px; font-size: 11px; font-weight: 900;
  letter-spacing: .16em; text-transform: uppercase; color: #1f4e78;
}
.ini-modal-box .modal-head .muted { margin: 6px 0 0; font-size: 13px; color: var(--ini-muted); }
.ini-modal-box .modal-head .btn.ghost {
  background: transparent; border: 1px solid var(--ini-line);
  color: var(--ini-muted); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; line-height: 1;
  font-size: 15px; min-height: auto; flex: 0 0 auto;
}
.ini-modal-box .modal-head .btn.ghost:hover { background: #f1f5f9; color: var(--ini-ink); }

/* Scrollable body */
.ini-modal-box .modal-body {
  flex: 1 1 0; min-height: 0;
  overflow-y: auto;
  padding: 22px;
}

/* Sticky footer */
.ini-modal-box .modal-foot {
  flex: 0 0 auto;
  display: flex; justify-content: flex-end; align-items: center;
  gap: 8px; padding: 14px 22px 18px;
  border-top: 1px solid var(--ini-line);
  background: #f8fafc;
  border-radius: 0 0 18px 18px;
}

/* Buttons inside ini-modal-box */
.ini-modal-box .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 7px 14px;
  border: 1px solid var(--ini-line); border-radius: 8px;
  background: #fff; color: #344054;
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
}
.ini-modal-box .btn:hover { border-color: #b9c6d8; background: #f8fafc; }
.ini-modal-box .btn.primary {
  border: none;
  background: linear-gradient(90deg,#ff8a00,#d43f8d);
  color: #fff;
  box-shadow: 0 4px 12px rgba(212,63,141,.18);
}
.ini-modal-box .btn.primary:hover { opacity: .9; }
.ini-modal-box .btn.danger {
  border-color: #fecdca; background: #fee4e2; color: #d92d20;
}
.ini-modal-box .btn.danger:hover { background: #fecdca; }

/* Form fields */
.ini-modal-box .form-grid {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px;
}
.ini-modal-box .form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ini-modal-box .form-field { display: grid; gap: 6px; }
.ini-modal-box .form-field.full { grid-column: 1 / -1; }
.ini-modal-box label:not(.check-pill):not(.btn):not(.nd-field) {
  font-size: 11px; font-weight: 900;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ini-muted);
}
.ini-modal-box input:not([type="checkbox"]),
.ini-modal-box select,
.ini-modal-box textarea:not(.nd-textarea) {
  width: 100%; min-height: 40px; padding: 9px 11px;
  border: 1px solid #cfd8e6; border-radius: 9px;
  background: #fff; color: var(--ini-ink);
  font: inherit; font-size: 13.5px;
  box-sizing: border-box;
}
.ini-modal-box textarea:not(.nd-textarea) { min-height: 96px; resize: vertical; }
.ini-modal-box input:not([type="checkbox"]):focus,
.ini-modal-box select:focus,
.ini-modal-box textarea:not(.nd-textarea):focus {
  outline: 3px solid rgba(161,0,253,.16); border-color: #a100fd;
}
.ini-modal-box .required-missing { background: #fff8cc; border-color: #facc15; }

/* Selector / check-pill fields */
.ini-modal-box .selector-field {
  margin: 0; border: 1px solid var(--ini-line);
  border-radius: 10px; padding: 14px;
}
.ini-modal-box .selector-field legend {
  color: var(--ini-muted); font-size: 11px; font-weight: 900;
  letter-spacing: .08em; text-transform: uppercase; padding: 0 6px;
}
.ini-modal-box .check-pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ini-modal-box .check-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid #d7dfeb; border-radius: 999px;
  padding: 6px 10px; background: #fff; color: var(--ini-ink);
  font-size: 13px; cursor: pointer;
}
.ini-modal-box .check-pill input { width: auto; min-height: 0; padding: 0; }

/* Section inside modal body */
.ini-modal-box .section {
  margin-top: 20px; border: 1px solid var(--ini-line);
  border-radius: 12px; overflow: hidden; background: #fff;
}
.ini-modal-box .section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--ini-line); background: #f8fafc;
}
.ini-modal-box .section-head h2 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--ini-ink);
}
.ini-modal-box .section-body { padding: 18px; }
.ini-modal-box .empty { padding: 28px; color: #98a2b3; text-align: center; font-size: 14px; }

/* Data table inside modal */
.ini-modal-box .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ini-modal-box .data-table th {
  padding: 10px 12px; background: #eef2f8;
  color: #98a2b3; font-size: 11px; font-weight: 900;
  letter-spacing: .12em; text-transform: uppercase;
  border-bottom: 2px solid var(--ini-line); text-align: left;
}
.ini-modal-box .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--ini-line); }
.ini-modal-box .task-row { background: #fffdf0; }
.ini-modal-box .task-row.complete { background: #f0fdf4; }
.ini-modal-box .task-row.missing { background: #fff6b8; }
.ini-modal-box .data-table input,
.ini-modal-box .data-table select {
  min-width: 0; width: 100%; padding: 5px 8px;
  border: 1px solid #cfd8e6; border-radius: 6px;
  font: inherit; font-size: 12.5px;
}
.ini-modal-box .inline-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.ini-modal-box .inline-actions .btn { min-height: 28px; padding: 4px 9px; font-size: 12px; }

/* People / stakeholder pickers */
.ini-modal-box .person-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px;
  background: #ddebf7; color: #1f4e78; font-weight: 700; font-size: 13px;
}
.ini-modal-box .inline-people-picker {
  position: relative; min-width: 200px;
}
.ini-modal-box .inline-people-picker summary {
  display: flex; min-height: 38px; align-items: center;
  padding: 6px 10px; border: 1px solid #cfd8e6; border-radius: 9px;
  background: #fff; cursor: pointer; list-style: none;
}
.ini-modal-box .inline-people-menu {
  position: absolute; top: calc(100% + 4px); left: 0;
  display: flex; flex-wrap: wrap; gap: 7px;
  width: min(360px,80vw); max-height: 240px;
  overflow: auto; padding: 10px;
  border: 1px solid var(--ini-line); border-radius: 10px;
  background: #fff; box-shadow: 0 12px 36px rgba(12,20,38,.14);
  z-index: 1;
}

/* Toast */
#ini-toast-root .toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 100100;
  max-width: 400px; padding: 14px 16px; border-radius: 12px;
  background: var(--ini-navy); color: #fff; font-weight: 700;
  box-shadow: var(--ini-shadow);
  font-family: Aptos, Inter, ui-sans-serif, system-ui, sans-serif; font-size: 13.5px;
}
#ini-toast-root .toast.error   { background: #d92d20; }
#ini-toast-root .toast.success { background: #027a48; }

/* ============================================================
   Initiatives – Compact task table (renderCompactTaskRows)
   ============================================================ */
#ini-app-root .itl-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: .82rem;
}
#ini-app-root .itl-table th,
#ini-app-root .itl-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  overflow: hidden;
}
#ini-app-root .itl-table th {
  background: #eef2f8;
  color: #98a2b3;
  font-size: .72rem; font-weight: 900;
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0;
}
/* Column widths */
#ini-app-root .itl-dept    { width: 13%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ini-app-root .itl-need    { width: 42%; }
#ini-app-root .itl-eta     { width: 15%; }
#ini-app-root .itl-status  { width: 15%; }
#ini-app-root .itl-actions { width: 15%; text-align: center; }

/* Need cell: multi-line text */
#ini-app-root .itl-need-text {
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
  color: #374151;
}
/* ETA and Status inputs fill their column */
#ini-app-root .itl-table input[type="date"],
#ini-app-root .itl-table select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font: inherit; font-size: .8rem;
  background: #fff;
  box-sizing: border-box;
}
#ini-app-root .itl-table input:focus,
#ini-app-root .itl-table select:focus {
  outline: none;
  border-color: #1f4e78;
  box-shadow: 0 0 0 2px rgba(31,78,120,.1);
}
/* Action buttons — icon-only, compact */
#ini-app-root .itl-actions .btn {
  min-height: 28px; padding: 3px 8px;
  font-size: .75rem; border-radius: 6px;
  border: 1px solid #e2e8f0; background: #fff;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
}
#ini-app-root .itl-actions .btn:hover { background: #f1f5f9; }
#ini-app-root .itl-actions .btn.danger {
  border-color: #fecdca; background: #fef2f2; color: #b91c1c;
}
#ini-app-root .itl-actions .btn.danger:hover { background: #fecdca; }
/* Row colouring */
#ini-app-root .itl-table .task-row.missing  { background: #fffdf0; }
#ini-app-root .itl-table .task-row.complete { background: #f0fdf4; }
#ini-app-root .itl-table .task-row:hover td { background: #f8fafc; }

/* ============================================================
   Initiatives – Compact table ETA column fix
   ============================================================ */

/* Widen ETA column and tighten others so the date input fits */
#ini-app-root .itl-dept    { width: 11%; }
#ini-app-root .itl-need    { width: 40%; }
#ini-app-root .itl-eta     { width: 16%; }
#ini-app-root .itl-status  { width: 16%; }
#ini-app-root .itl-actions { width: 6%;  text-align: center; }

/* Date input: compact, no overflow */
#ini-app-root .itl-table input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 5px 4px;
  font-size: .78rem;
  box-sizing: border-box;
  overflow: hidden;
}
/* Hide the native calendar icon — it overflows the narrow column */
#ini-app-root .itl-table input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}
/* Keep the cell from letting the input escape */
#ini-app-root .itl-eta {
  overflow: hidden;
}

/* ============================================================
   Initiatives – ETA column: restore calendar icon, fix overflow
   ============================================================ */

/* Undo the display:none on the calendar icon */
#ini-app-root .itl-table input[type="date"]::-webkit-calendar-picker-indicator {
  display: inline-block;
  cursor: pointer;
  opacity: .65;
  padding: 0;
  margin: 0;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
/* Clip the input contents so the icon never escapes the border */
#ini-app-root .itl-table input[type="date"] {
  padding: 5px 4px 5px 6px;
  font-size: .77rem;
  overflow: hidden;
}

/* ============================================================
   Initiatives – Dashboard initiatives overview table
   ============================================================ */
#ini-app-root .iot-table {
  width: 100%; border-collapse: collapse;
  font-size: .83rem;
}
#ini-app-root .iot-table th {
  padding: 9px 12px; background: #eef2f8;
  color: #98a2b3; font-size: .72rem; font-weight: 900;
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0; text-align: left;
}
#ini-app-root .iot-table td {
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
#ini-app-root .iot-row:hover td { background: #f8fafc; }
#ini-app-root .iot-row:last-child td { border-bottom: none; }

#ini-app-root .iot-name { width: 30%; font-weight: 600; }
#ini-app-root .iot-stage { width: 10%; }
#ini-app-root .iot-owner { width: 14%; color: #374151; }
#ini-app-root .iot-num {
  width: 7%; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 700; color: #1f4e78;
}

#ini-app-root .iot-pill {
  display: inline-block;
  padding: 2px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 800; white-space: nowrap;
}

/* ============================================================
   Initiatives – Initiatives list table (ini-tbl)
   ============================================================ */
#ini-app-root .ini-tbl {
  width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .82rem;
}
#ini-app-root .ini-tbl th {
  padding: 9px 10px; background: #eef2f8;
  color: #98a2b3; font-size: .72rem; font-weight: 900;
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0; text-align: left;
}
#ini-app-root .ini-tbl td {
  padding: 7px 10px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle; overflow: hidden;
}
#ini-app-root .ini-tbl-row:hover td { background: #f8fafc; }
#ini-app-root .ini-tbl-row:last-child td { border-bottom: none; }

/* Column widths — total 100% */
#ini-app-root .ini-tbl-name    { width: 28%; }
#ini-app-root .ini-tbl-stage   { width: 11%; }
#ini-app-root .ini-tbl-pri     { width: 10%; }
#ini-app-root .ini-tbl-owner   { width: 16%; }
#ini-app-root .ini-tbl-date    { width: 12%; }
#ini-app-root .ini-tbl-status  { width: 12%; }
#ini-app-root .ini-tbl-actions { width: 11%; white-space: nowrap; }

/* Name button — fills cell, left-aligned */
#ini-app-root .ini-tbl-name-btn {
  border: none; background: none; padding: 0;
  font-weight: 700; color: #111827; text-align: left;
  width: 100%; white-space: normal; word-break: break-word;
  cursor: pointer; font-size: .82rem;
}
#ini-app-root .ini-tbl-name-btn:hover { color: #1f4e78; text-decoration: underline; }

/* Compact controls */
#ini-app-root .ini-tbl-ctl {
  width: 100%; padding: 4px 6px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  font: inherit; font-size: .79rem;
  background: #fff; color: #111827;
  box-sizing: border-box;
}
#ini-app-root .ini-tbl-ctl:focus {
  outline: none; border-color: #1f4e78;
  box-shadow: 0 0 0 2px rgba(31,78,120,.1);
}
/* Date input: hide calendar icon overflow */
#ini-app-root .ini-tbl-date input[type="date"]::-webkit-calendar-picker-indicator {
  width: 12px; height: 12px; opacity: .6; cursor: pointer;
}

/* Action buttons */
#ini-app-root .ini-tbl-actions .btn {
  min-height: 26px; padding: 3px 8px;
  font-size: .76rem; border-radius: 5px;
  border: 1px solid #e2e8f0; background: #fff;
  cursor: pointer; margin-right: 3px;
}
#ini-app-root .ini-tbl-actions .btn:hover { background: #f1f5f9; }

/* Owner inline picker — constrained to column */
#ini-app-root .ini-tbl-owner .inline-people-picker { min-width: 0; width: 100%; }
#ini-app-root .ini-tbl-owner .inline-people-picker summary {
  font-size: .79rem; padding: 4px 8px; min-height: 30px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#ini-app-root .ini-tbl-owner .compact-people { flex-wrap: nowrap; overflow: hidden; gap: 3px; }
#ini-app-root .ini-tbl-owner .person-pill { font-size: .72rem; padding: 2px 7px; }

/* Initiatives list – first column explicit left-align */
#ini-app-root .ini-tbl th.ini-tbl-name,
#ini-app-root .ini-tbl td.ini-tbl-name { text-align: left !important; }

/* ============================================================
   Initiatives – table header readable style + sort arrows
   ============================================================ */
#ini-app-root .ini-tbl th {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: none !important;
  border-bottom: none !important;
  padding: 11px 10px !important;
}
#ini-app-root .ini-tbl-sortable {
  cursor: pointer; user-select: none;
}
#ini-app-root .ini-tbl-sortable:hover { background: #334155 !important; }

#ini-app-root .ini-sort-arrow {
  font-size: .7rem; opacity: .4; margin-left: 4px;
}
#ini-app-root .ini-sort-arrow.active { opacity: 1; color: #93c5fd; }

/* First column — left-align both header and cells */
#ini-app-root .ini-tbl th.ini-tbl-name,
#ini-app-root .ini-tbl td.ini-tbl-name,
#ini-app-root .ini-tbl-name-btn { text-align: left !important; }

/* ============================================================
   Initiatives – Needs Matrix table header: match Initiatives style
   ============================================================ */
#ini-app-root .matrix th {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: none !important;
  border-bottom: none !important;
  padding: 11px 10px !important;
}

/* ============================================================
   Initiatives – Executive Dashboard table: dark header
   ============================================================ */
#ini-app-root .iot-table th,
#ini-app-root .itl-table th {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: none !important;
  border-bottom: none !important;
  padding: 11px 10px !important;
}

/* ============================================================
   Initiatives – Audit Log view
   ============================================================ */
#ini-app-root .al-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
#ini-app-root .al-table {
  width: 100%; border-collapse: collapse; font-size: .81rem;
  table-layout: fixed;
}
#ini-app-root .al-table th {
  background: #1e293b !important; color: #e2e8f0 !important;
  font-size: .75rem !important; font-weight: 700 !important;
  letter-spacing: .04em !important; text-transform: none !important;
  border-bottom: none !important; padding: 10px 10px !important;
}
#ini-app-root .al-table td {
  padding: 8px 10px; border-bottom: 1px solid #f1f5f9;
  vertical-align: top; overflow: hidden;
}
#ini-app-root .al-row:hover td { background: #f8fafc; }

/* Column widths */
#ini-app-root .al-ts     { width: 12%; white-space: nowrap; color: #6b7280; font-size: .77rem; }
#ini-app-root .al-user   { width: 11%; font-weight: 600; }
#ini-app-root .al-table th:nth-child(3),
#ini-app-root .al-table td:nth-child(3) { width: 9%; }
#ini-app-root .al-label  { width: 22%; }
#ini-app-root .al-table th:nth-child(5),
#ini-app-root .al-table td:nth-child(5) { width: 18%; }
#ini-app-root .al-detail { width: 28%; }

#ini-app-root .al-entity-badge {
  display: inline-block; padding: 1px 8px;
  border-radius: 999px; border: 1px solid;
  font-size: .72rem; font-weight: 800; white-space: nowrap;
}
#ini-app-root .al-action-pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px; font-size: .72rem; font-weight: 800;
}
#ini-app-root .al-field {
  display: inline-block; margin-left: 5px;
  padding: 1px 6px; border-radius: 4px;
  background: #f1f5f9; color: #475569;
  font-size: .72rem; font-weight: 700;
}
#ini-app-root .al-dept {
  display: block; font-size: .72rem; color: #9ca3af; margin-top: 2px;
}
#ini-app-root .al-change {
  display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap;
  font-size: .79rem;
}
#ini-app-root .al-old {
  text-decoration: line-through; color: #9ca3af;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; display: inline-block;
}
#ini-app-root .al-new {
  color: #111827; font-weight: 600;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; display: inline-block;
}
#ini-app-root .al-arrow { color: #9ca3af; flex: 0 0 auto; }

#ini-app-root .al-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 12px;
  font-size: .82rem; color: #6b7280;
  border-top: 1px solid #f1f5f9;
}

/* ============================================================
   Initiatives – Department Status card: two side-by-side bubbles
   ============================================================ */
#ini-app-root .dept-bubbles {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 6px;
}
#ini-app-root .dept-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.1;
}
#ini-app-root .dept-bubble-lbl {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .7;
  margin-top: 2px;
}
#ini-app-root .dept-bubble-by {
  background: #dbeafe;
  color: #1d4ed8;
}
#ini-app-root .dept-bubble-from {
  background: #dcfae6;
  color: #027a48;
}
/* Keep card header without the pill */
#ini-app-root .dept-card h3 {
  display: block;
  font-size: 14px;
  margin: 0;
  text-align: center;
}

/* Dept card bubbles — clickable buttons */
#ini-app-root .dept-bubble {
  cursor: pointer;
  border: none;
  transition: filter .12s, transform .1s;
}
#ini-app-root .dept-bubble:hover {
  filter: brightness(.92);
  transform: translateY(-1px);
}
#ini-app-root .dept-bubble:active { transform: translateY(0); }

/* Card is now a div — keep the pointer only on bubbles */
#ini-app-root .dept-card { cursor: default; }

/* Longer labels — allow wrapping and widen the bubble */
#ini-app-root .dept-bubble-lbl {
  font-size: .6rem !important;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 3px;
}
#ini-app-root .dept-bubble {
  min-width: 64px !important;
  padding: 6px 8px !important;
}

/* ============================================================
   Initiatives – Dept Status: initiative filter toolbar + total card
   ============================================================ */
#ini-app-root .dept-status-toolbar {
  margin-bottom: 14px;
}
#ini-app-root .dept-card-total {
  border: 2px solid #1e293b;
  background: #f8fafc;
}
#ini-app-root .dept-card-total h3 {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}
#ini-app-root .dept-card-total .dept-bubble-by {
  background: #dbeafe;
  color: #1d4ed8;
}
#ini-app-root .dept-card-total .dept-bubble-from {
  background: #dcfae6;
  color: #027a48;
}

/* ============================================================
   Initiatives – Department Tasks: initiative boxes (dti)
   ============================================================ */
#ini-app-root .dti-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
#ini-app-root .dti-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  min-width: 130px;
  max-width: 180px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
#ini-app-root .dti-box:hover {
  border-color: #1f4e78;
  box-shadow: 0 2px 10px rgba(31,78,120,.1);
  transform: translateY(-1px);
}
#ini-app-root .dti-box-active {
  border-color: #1f4e78;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(31,78,120,.12);
}
#ini-app-root .dti-box-name {
  font-size: .82rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  word-break: break-word;
}
#ini-app-root .dti-stage-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
}
#ini-app-root .dti-bubbles {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
#ini-app-root .dti-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 7px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
}
#ini-app-root .dti-bubble-lbl {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .75;
  margin-top: 1px;
}
#ini-app-root .dti-bubble-by   { background: #dbeafe; color: #1d4ed8; }
#ini-app-root .dti-bubble-from { background: #dcfae6; color: #027a48; }

/* ============================================================
   Initiatives – Department Dashboard dept selector bar
   ============================================================ */
#ini-app-root .ddd-dept-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
#ini-app-root .ddd-dept-btn {
  padding: 6px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  white-space: nowrap;
}
#ini-app-root .ddd-dept-btn:hover {
  border-color: #1f4e78;
  color: #1f4e78;
  background: #eff6ff;
}
#ini-app-root .ddd-dept-active {
  background: #1e293b;
  color: #fff;
  border-color: #1e293b;
}
#ini-app-root .ddd-dept-active:hover {
  background: #334155;
  border-color: #334155;
  color: #fff;
}

/* ============================================================
   Initiatives – Dept Dashboard: clickable bubbles inside box
   ============================================================ */

/* Box is now a div, not a button */
#ini-app-root .dti-box {
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Title area — clickable, selects the initiative */
#ini-app-root .dti-box-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: center;
}
#ini-app-root .dti-box-title:hover .dti-box-name { color: #1f4e78; text-decoration: underline; }

/* Bubbles are now buttons */
#ini-app-root .dti-bubble {
  cursor: pointer;
  border: none;
  font: inherit;
  transition: filter .12s, transform .1s;
}
#ini-app-root .dti-bubble:hover {
  filter: brightness(.88);
  transform: translateY(-2px);
}
#ini-app-root .dti-bubble:active { transform: none; }

/* Dept Dashboard – expand/collapse button */
#ini-app-root .ddd-expand-btn {
  display: block;
  margin: 10px auto 0;
  padding: 5px 18px;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #1f4e78;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
#ini-app-root .ddd-expand-btn:hover {
  border-color: #1f4e78;
  background: #eff6ff;
}

/* ============================================================
   Initiatives – Department Dashboard: status stacked bar in box
   ============================================================ */
#ini-app-root .dti-status-bar {
  display: flex;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
  gap: 1px;
}
#ini-app-root .dti-bar-seg {
  display: block;
  height: 100%;
  transition: filter .12s;
  cursor: default;
  min-width: 4px;
  border-radius: 2px;
}
#ini-app-root .dti-bar-seg:hover { filter: brightness(.8); }

/* Dept Dashboard status bar — single-div gradient, no flex children */
#ini-app-root .dti-status-bar {
  height: 7px !important;
  width: 100% !important;
  align-self: stretch !important;
  border-radius: 4px !important;
  margin-top: 6px !important;
  cursor: default !important;
  min-width: 0 !important;
  flex-shrink: 0 !important;
}

/* Fix: stretch box children so status bar gets full width */
#ini-app-root .dti-box {
  align-items: stretch !important;
}
#ini-app-root .dti-box-title,
#ini-app-root .dti-bubbles {
  align-self: center;
}
#ini-app-root .dti-status-bar {
  display: block !important;
  width: auto !important;
  align-self: auto !important;
  margin: 6px 0 0 !important;
}

/* Status bar: 7 equal fixed blocks, all statuses always shown */
#ini-app-root .dti-status-bar {
  display: flex !important;
  width: 100% !important;
  gap: 2px !important;
  height: 22px !important;
  margin-top: 6px !important;
  background: none !important;
  align-self: stretch !important;
}
#ini-app-root .dti-bar-seg {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 4px !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  color: rgba(0,0,0,0.55) !important;
  cursor: default !important;
  min-width: 0 !important;
  height: 100% !important;
}
#ini-app-root .dti-bar-zero {
  opacity: 0.18 !important;
}

/* Two-bar layout inside initiative box */
#ini-app-root .dti-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  align-self: stretch;
}
#ini-app-root .dti-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}
#ini-app-root .dti-bar-lbl {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6b7280;
  flex: 0 0 22px;
  text-align: right;
}
/* Bar inside row: override standalone margin, fill remaining space */
#ini-app-root .dti-bar-row .dti-status-bar {
  flex: 1 !important;
  margin-top: 0 !important;
  align-self: auto !important;
  width: auto !important;
}
/* Wider boxes to fit two labeled bars comfortably */
#ini-app-root .dti-box {
  min-width: 170px !important;
  max-width: 220px !important;
}

/* Add Need button inside active initiative box */
#ini-app-root .dti-add-need-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 4px 12px;
  border: 1.5px solid #1f4e78;
  border-radius: 999px;
  background: #fff;
  color: #1f4e78;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s;
  align-self: center;
}
#ini-app-root .dti-add-need-btn:hover { background: #eff6ff; }

/* ============================================================
   Initiatives – User Dashboard
   ============================================================ */
#ini-app-root .ud-box-dim { opacity: .45; }
#ini-app-root .ud-box-dim:hover { opacity: .7; }

#ini-app-root .ud-counts {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}
#ini-app-root .ud-count-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 4px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1.5px solid transparent;
  text-align: center;
}
#ini-app-root .ud-action.ud-has  { background:#fee2e2; border-color:#fca5a5; }
#ini-app-root .ud-feedback.ud-has { background:#f5f3ff; border-color:#c4b5fd; }

#ini-app-root .ud-count-num {
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.1;
  color: #374151;
}
#ini-app-root .ud-action.ud-has  .ud-count-num { color:#b91c1c; }
#ini-app-root .ud-feedback.ud-has .ud-count-num { color:#6d28d9; }

#ini-app-root .ud-count-lbl {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #9ca3af;
  line-height: 1.2;
  margin-top: 2px;
}
#ini-app-root .ud-all-clear {
  font-size: .72rem;
  color: #027a48;
  font-weight: 700;
  margin-top: 2px;
}

/* ============================================================
   Initiatives – Need card: Notes and Links sections
   ============================================================ */
.nd-section {
  margin-top: 10px;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}
.nd-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.nd-section-title {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6b7280;
}
.nd-notes {
  width: 100%;
  min-height: 60px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: #111827;
  resize: vertical;
  box-sizing: border-box;
}
.nd-notes:focus {
  outline: none;
  border-color: #1f4e78;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(31,78,120,.08);
}
.nd-link-add-btn {
  padding: 2px 9px;
  border: 1px solid #1f4e78;
  border-radius: 999px;
  background: #fff;
  color: #1f4e78;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.nd-link-add-btn:hover { background: #eff6ff; }
.nd-links-list { display: flex; flex-direction: column; gap: 5px; }
.nd-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nd-link-type {
  flex: 0 0 120px;
  padding: 5px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  background: #fff;
  color: #111827;
}
.nd-link-url {
  flex: 1;
  padding: 5px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  background: #fff;
  color: #111827;
  min-width: 0;
}
.nd-link-url:focus, .nd-link-type:focus {
  outline: none;
  border-color: #1f4e78;
  box-shadow: 0 0 0 2px rgba(31,78,120,.08);
}
.nd-link-del {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid #fecdca;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nd-link-del:hover { background: #fecdca; }

/* Stakeholder card – Default Owner */
#ini-app-root .stakeholder-default-owner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
}
#ini-app-root .sdo-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7280;
  white-space: nowrap;
}
#ini-app-root .sdo-select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #111827;
}
#ini-app-root .sdo-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Need card – Owner row */
.nd-owner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.nd-owner-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6b7280;
  white-space: nowrap;
  flex: 0 0 auto;
}
.nd-owner {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #111827;
}
.nd-owner:focus {
  outline: none;
  border-color: #1f4e78;
  box-shadow: 0 0 0 2px rgba(31,78,120,.08);
}

/* Need card – Save button at the bottom */
.nd-card-bottom {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
}

/* Saved link — clickable with delete button */
.nd-link-saved {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
}
.nd-link-anchor {
  flex: 1;
  font-size: 12.5px;
  color: #1d4ed8;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nd-link-anchor:hover { text-decoration: underline; }

/* Dashboard mode toggle (Department / User) */
#ini-app-root .dash-mode-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 16px;
}
#ini-app-root .dash-mode-btn {
  padding: 6px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font: inherit;
  font-size: .83rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, color .12s;
}
#ini-app-root .dash-mode-btn:hover { color: #111827; }
#ini-app-root .dash-mode-btn.active {
  background: #1e293b;
  color: #fff;
  box-shadow: 0 1px 4px rgba(7,20,58,.18);
}

/* Compact needs table – Owner column */
#ini-app-root .itl-dept    { width: 10% !important; }
#ini-app-root .itl-need    { width: 32% !important; }
#ini-app-root .itl-owner   { width: 13%; overflow: hidden; }
#ini-app-root .itl-eta     { width: 13% !important; }
#ini-app-root .itl-status  { width: 13% !important; }
#ini-app-root .itl-actions { width: 9% !important; }

#ini-app-root .itl-owner-text {
  display: block;
  font-size: .78rem;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
