/* ============================================================
   MITHRA 2026 — Recreated product UI (live HTML, crisp)
   Categorization table · spend treemap · data-flow · widgets
   ============================================================ */

/* ---- generic product card chrome ---- */
.pui {
  font-family: var(--font-body);
  color: var(--ink);
  --pui-border: #E7ECF5;
  --pui-muted: #697077;
}

/* ---- breadcrumb category pills ---- */
.cat-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: #1f2733;
  padding: 5px 11px; border: 1px solid var(--pui-border); border-radius: 999px; background: #fff;
  white-space: nowrap;
}
.cat-chip.leaf-green { border-color: #9bd9b1; color: #1c7d40; }
.cat-chip.leaf-red { border-color: #f0a9ae; color: #c4151f; }
.cat-chip .cc-x { width: 12px; height: 12px; opacity: .6; }
.cat-sep { color: #c2cad6; font-size: 13px; }

/* ---- categorization table ---- */
.tbl-cat { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; }
.tbl-cat thead th {
  text-align: left; font-weight: 600; color: #1f2733; font-size: 13px;
  padding: 16px 18px; border-bottom: 1.5px solid #e2e8f2; white-space: nowrap;
}
.tbl-cat tbody td { padding: 16px 18px; border-bottom: 1px solid #eef2f8; vertical-align: middle; color: #2b333f; }
.tbl-cat tbody tr:last-child td { border-bottom: none; }
.tbl-cat .ck { width: 16px; height: 16px; border: 1.6px solid #c2cad6; border-radius: 4px; display: inline-block; }
.tbl-cat .amt { font-variant-numeric: tabular-nums; white-space: nowrap; color: #1f2733; }
.tbl-cat .sup { font-weight: 500; color: #1f2733; }
.tbl-cat .reason { color: var(--pui-muted); font-size: 12.5px; max-width: 190px; }
/* compact variant — fits narrow split columns (e.g. platform Foundation tab) */
.tbl-cat.tbl-compact { font-size: 12.5px; }
.tbl-cat.tbl-compact thead th { padding: 12px 11px; font-size: 12px; }
.tbl-cat.tbl-compact tbody td { padding: 11px 11px; }
.tbl-cat.tbl-compact .cat-chip { font-size: 11.5px; padding: 4px 9px; }
.tbl-cat.tbl-compact .conf { font-size: 11px; padding: 3px 8px; }

/* ---- spend treemap ---- */
.treemap { width: 100%; background: #fff; }
.tm-head { padding: 18px 22px; border-bottom: 1px solid #eef2f8; }
.tm-head .tm-all { font-family: var(--font-head); font-weight: 600; font-size: 17px; color: #1f2733; }
.tm-head .tm-total { color: var(--pui-muted); font-size: 13px; margin-top: 3px; }
.tm-grid { display: grid; gap: 4px; padding: 4px; }
.tm-row { display: grid; gap: 4px; }
.tm-cell { border-radius: 6px; padding: 16px 18px; color: #fff; position: relative; overflow: hidden; min-height: 76px; display: flex; flex-direction: column; justify-content: flex-start; }
.tm-cell b { font-family: var(--font-head); font-weight: 600; font-size: clamp(13px,1.2vw,16px); line-height: 1.2; }
.tm-cell span { font-size: 12.5px; opacity: .82; margin-top: 4px; }
.tm-cell.dark-txt { color: #2b333f; }
.tm-cell.dark-txt span { opacity: .65; }
/* spend color ramp (deep ocean -> light) */
.tm-1 { background: #001D6C; } .tm-2 { background: #2a3a78; } .tm-3 { background: #3f4f86; }
.tm-4 { background: #5a6a9c; } .tm-5 { background: #8893b3; } .tm-6 { background: #aab2cb; }
.tm-7 { background: #c7cddd; } .tm-8 { background: #dde2ec; } .tm-9 { background: #eaedf4; }

/* ---- data-flow strip (7 steps) ---- */
.flow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 22px; position: relative; }
@media (max-width: 1080px){ .flow { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 640px){ .flow { grid-template-columns: repeat(2,1fr); } }
.flow-step {
  background: #fff; border: 1px solid var(--soft-border); border-radius: var(--radius);
  padding: 22px 18px; position: relative; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.flow-step:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--cool-water); }
.flow-step .fs-n { font-family: var(--font-body); font-weight: 600; font-size: 12px; color: var(--cool-water); letter-spacing: .08em; }
.flow-step .fs-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--off-white); color: var(--really-blue); display: grid; place-items: center; margin: 14px 0 16px; }
.flow-step .fs-ic svg { width: 21px; height: 21px; }
.flow-step h4 { font-size: 17px; font-family: var(--font-head); margin-bottom: 7px; }
.flow-step p { font-size: 13px; color: var(--slate); line-height: 1.45; }
.flow-step::after {
  content: ""; position: absolute; right: -17px; top: 50%; width: 11px; height: 11px;
  border-top: 2px solid var(--clear-sky); border-right: 2px solid var(--clear-sky);
  transform: translateY(-50%) rotate(45deg); z-index: 2;
}
.flow-step:last-child::after { display: none; }
@media (max-width: 1080px){ .flow-step:nth-child(4n)::after { display:none; } }
@media (max-width: 640px){ .flow-step:nth-child(2n)::after { display:none; } }
/* 5-step flow (supplier normalization) — steps down cleanly; drop connectors once wrapped */
.flow-5 { grid-template-columns: repeat(5,1fr); }
@media (max-width: 1080px){ .flow-5 { grid-template-columns: repeat(3,1fr); } .flow-5 .flow-step::after { display: none; } }
@media (max-width: 640px){ .flow-5 { grid-template-columns: repeat(2,1fr); } }

/* ---- KPI widget chip ---- */
.kpi-chip { background: #fff; border-radius: 18px; box-shadow: var(--shadow-md); padding: 20px 22px; min-width: 210px; }
.kpi-chip .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-chip .kpi-title { font-family: var(--font-head); font-weight: 600; color: #1f2733; font-size: 17px; }
.kpi-chip .kpi-ic { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--soft-border); display: grid; place-items: center; color: var(--deep-ocean); }
.kpi-chip .kpi-big { font-family: var(--font-head); font-weight: 700; font-size: 44px; line-height: 1; color: var(--ink); margin: 12px 0 8px; letter-spacing: -.03em; }
.kpi-chip .kpi-delta { color: var(--green); font-weight: 600; font-size: 14px; }
.kpi-bar { height: 8px; border-radius: 999px; background: #eef2f8; margin-top: 14px; overflow: hidden; display: flex; }
.kpi-bar i { display: block; height: 100%; }

/* confidence pill */
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.conf-hi { background: var(--green-bg); color: #1c7d40; }
.conf-med { background: var(--amber-bg); color: #8a6d05; }
.conf-low { background: var(--coral-bg); color: #c4151f; }

/* health status badge */
.health { display:inline-flex; align-items:center; font-size:11.5px; font-weight:600; padding:4px 11px; border-radius:999px; color:#fff; }
.health-crit { background: var(--coral); }
.health-rev { background: var(--amber); color:#6b5403; }
.health-info { background: var(--cool-water); }

/* initiative tracker rows */
.init-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 15px 16px; border-bottom: 1px solid #eef2f8; }
.init-row:last-child { border-bottom: none; }
.init-row b { font-family: var(--font-head); font-weight: 600; font-size: 14.5px; color: #1f2733; display: block; }
.init-row span:not(.pill):not(.dot) { font-size: 12.5px; color: var(--pui-muted); }
.init-row .init-val { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--really-blue); white-space: nowrap; }
@media (max-width: 520px){ .init-row { grid-template-columns: 1fr auto; } .init-row .pill { display: none; } }

/* before / after */
.ba { display: grid; gap: 14px; }
.ba-side { background: #fff; border: 1px solid var(--soft-border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.ba-before { border-left: 3px solid var(--coral); }
.ba-after { border-left: 3px solid var(--green); }
.ba-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pui-muted); display: block; margin-bottom: 12px; }
.ba-after .ba-tag { color: #1c7d40; }
.ba-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid #f0f3f8; font-size: 13px; }
.ba-line:first-of-type { border-top: none; }
.ba-line .ba-name { color: #2b333f; font-weight: 500; }
.ba-line .ba-name.muted { color: #aab2bf; font-style: italic; }
.ba-line .ba-cat { font-size: 11.5px; }
.ba-mid { display: grid; place-items: center; color: var(--cool-water); }
.ba-mid svg, .ba-mid.ic svg { width: 20px; height: 20px; transform: rotate(90deg); }

/* ---- taxonomy builder ---- */
.tax-bd { padding: 22px 24px 24px; }
.tax-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tax-title { font-family: var(--font-head); font-weight: 600; font-size: 18px; color: #1f2733; display: flex; align-items: center; gap: 10px; }
.tax-title .tax-count { font-family: var(--font-body); font-weight: 600; font-size: 11.5px; color: var(--really-blue); background: var(--off-white); border: 1px solid var(--soft-border); padding: 3px 10px; border-radius: 999px; }
.tax-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tax-btn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-body); font-weight: 600; font-size: 12.5px; color: #3a4452; background: #fff; border: 1px solid var(--soft-border); border-radius: 9px; padding: 8px 13px; transition: border-color .15s, color .15s, background .15s; }
.tax-btn svg { width: 15px; height: 15px; }
.tax-btn:hover { border-color: var(--cool-water); color: var(--really-blue); }
.tax-btn.danger { color: var(--coral); }
.tax-btn.danger:hover { border-color: #f0a9ae; background: var(--coral-bg); color: var(--coral); }

.tax-search { display: flex; align-items: center; gap: 9px; margin: 16px 0 18px; max-width: 300px; border: 1px solid var(--soft-border); border-radius: 10px; padding: 10px 13px; color: var(--pui-muted); }
.tax-search svg { width: 16px; height: 16px; flex: 0 0 auto; }
.tax-search span { font-size: 13px; }

.tax-ice { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: stretch; }
@media (max-width: 560px){ .tax-ice { grid-template-columns: 1fr; } }

/* level-1 spine (spend-weighted bars) */
.tax-spine { display: flex; flex-direction: column; gap: 6px; }
.tax-node { border-radius: 11px; padding: 15px 16px; color: #fff; position: relative; display: flex; flex-direction: column; min-height: 64px; overflow: hidden; }
.tax-node .tn-name { font-family: var(--font-head); font-weight: 600; font-size: 15.5px; line-height: 1.15; }
.tax-node .tn-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; }
.tax-node .tn-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tax-node .tn-share { font-size: 11.5px; opacity: .72; }
.tn-net { background: linear-gradient(150deg, #0a2da0, #001D6C); flex-grow: 64; }
.tn-hw { background: linear-gradient(150deg, #2bb255, #1c8a3d); flex-grow: 36; }
.tax-node.is-active { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.tax-node.is-active::after { content: ""; position: absolute; right: 8px; top: 16px; width: 7px; height: 7px; border-top: 2px solid rgba(255,255,255,.85); border-right: 2px solid rgba(255,255,255,.85); transform: rotate(45deg); }

/* level-2 leaf detail list */
.tax-leaves { border: 1px solid var(--soft-border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.tax-leaves-hd { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pui-muted); border-bottom: 1px solid #eef2f8; }
.tax-leaves-hd .tlh-dot { width: 8px; height: 8px; border-radius: 50%; background: #0a2da0; }
.tax-leaves-bd { padding: 5px 0; display: flex; flex-direction: column; justify-content: space-between; flex: 1; }
.tax-leaf { display: grid; grid-template-columns: 124px 1fr 58px; align-items: center; gap: 12px; padding: 0 16px; height: 25px; }
.tax-leaf .tl-name { font-size: 12.5px; color: #2b333f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tax-leaf .tl-track { height: 7px; background: #eef2f8; border-radius: 999px; overflow: hidden; }
.tax-leaf .tl-track i { display: block; height: 100%; background: linear-gradient(90deg, #2a3a78, #4f6cdc); border-radius: 999px; }
.tax-leaf .tl-val { font-size: 11.5px; color: #697077; text-align: right; font-variant-numeric: tabular-nums; }
.tax-leaf:hover { background: var(--off-white); }

/* opportunity card */
.opp-card { background:#fff; border:1px solid var(--soft-border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-md); }
.opp-card .opp-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.opp-type { font-size:12px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color: var(--really-blue); background: var(--off-white); padding:5px 11px; border-radius:999px; }
.opp-val { font-family: var(--font-head); font-weight:700; font-size:30px; color: var(--ink); letter-spacing:-.02em; }
.opp-card h4 { font-size:18px; margin-bottom:6px; color: var(--ink); }
.opp-row { display:flex; align-items:flex-start; gap:10px; padding:9px 0; border-top:1px solid #f0f3f8; font-size:13.5px; color:var(--slate); }
.opp-row .ic { width:16px;height:16px;color:var(--cool-water);flex:0 0 auto;margin-top:2px; }
.opp-actions { display:flex; gap:10px; margin-top:16px; }

/* ---- human-in-the-loop review queue ---- */
.rev-q { display: flex; flex-direction: column; }
.rev-item { padding: 16px 18px; border-bottom: 1px solid #eef2f8; }
.rev-item:last-child { border-bottom: none; }
.rev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rev-head b { font-family: var(--font-head); font-weight: 600; font-size: 14.5px; color: #1f2733; display: block; }
.rev-head .rev-meta { font-size: 12.5px; color: var(--pui-muted); }
.rev-ai { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 12px 0 9px; }
.rev-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pui-muted); }
.rev-why { font-size: 12.5px; color: var(--pui-muted); line-height: 1.45; }
.rev-why b { color: #3a4452; font-weight: 600; }
.rev-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.rev-actions .tax-btn.go { border-color: #9bd9b1; color: #1c7d40; }
.rev-actions .tax-btn.go:hover { background: var(--green-bg); border-color: #9bd9b1; color: #1c7d40; }

/* ---- ranked opportunities dashboard ---- */
.opp-rank { display: flex; flex-direction: column; }
.opp-rank-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #eef2f8; }
.opp-rank-hd .orh-val { font-family: var(--font-head); font-weight: 700; font-size: 27px; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.opp-rank-hd .orh-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--pui-muted); margin-bottom: 6px; display: block; }
.opp-rank-hd .orh-side { font-size: 12px; color: var(--pui-muted); text-align: right; }
.opp-rr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid #eef2f8; }
.opp-rr:last-child { border-bottom: none; }
.opp-rr .orr-n { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--really-blue); font-variant-numeric: tabular-nums; }
.opp-rr .orr-type { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--cool-water); }
.opp-rr .orr-main b { font-family: var(--font-head); font-weight: 600; font-size: 14px; color: #1f2733; display: block; margin-top: 2px; }
.opp-rr .orr-meta { font-size: 12px; color: var(--pui-muted); margin-top: 2px; display: block; }
.opp-rr .orr-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.opp-rr .orr-val { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.opp-rr .orr-right .conf { margin-top: 0; }

/* ---- supplier normalization detail ---- */
.sup-detail { background: #fff; }
.sd-head { padding: 18px 20px; border-bottom: 1px solid #eef2f8; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sd-head .sd-name { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: #1f2733; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-head .sd-sub { font-size: 12.5px; color: var(--pui-muted); margin-top: 5px; }
.sd-head .sd-total { text-align: right; white-space: nowrap; }
.sd-head .sd-total b { font-family: var(--font-head); font-weight: 700; font-size: 19px; color: var(--really-blue); display: block; line-height: 1; letter-spacing: -.02em; }
.sd-head .sd-total span { font-size: 11.5px; color: var(--pui-muted); }
.sd-children { padding: 6px 8px; }
.sd-childhd { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pui-muted); padding: 10px 12px 6px; }
.sd-child { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; }
.sd-child:hover { background: var(--off-white); }
.sd-child .sdc-name { font-size: 13px; color: #94a0b0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-child .sdc-src { font-size: 10.5px; font-weight: 600; color: var(--cool-water); background: var(--off-white); border: 1px solid var(--soft-border); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.sd-child .sdc-amt { font-variant-numeric: tabular-nums; font-size: 13px; color: #1f2733; font-weight: 500; text-align: right; white-space: nowrap; }
.sd-foot { display: flex; align-items: center; gap: 8px; padding: 13px 20px; border-top: 1px solid #eef2f8; font-size: 12px; color: var(--pui-muted); }
.sd-foot .ic { width: 15px; height: 15px; color: var(--green); flex: 0 0 auto; }
