/* Client Needs tab (client-needs.js): a page over the globe, like Admin. */
#needs { display: none; }
.mode-btn[hidden] { display: none !important; }
body.mode-needs #needs { display: block; position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  background: var(--bg, #0a0f14); padding: 0 24px 40px; border-top: 76px solid var(--bg, #0a0f14); }
body.mode-needs #left, body.mode-needs #right, body.mode-needs #globe, body.mode-needs .panel,
body.mode-needs #st-panel { display: none !important; }
body.mode-needs #mode-switch { z-index: 45; }   /* the tab bar stays clickable above the page */
@media (max-width: 760px) { .mode-btn[data-mode="needs"] { display: none !important; } }

.cn-page { width: min(2240px, 100%); margin: 0 auto; }
.cn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cn-head h2 { margin: 0; font-size: 19px; }
.cn-lede { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.cn-head-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cn-head-acts .btn-ghost, .cn-head-acts .btn-go { padding: 8px 14px; }
.cn-seg { display: flex; gap: 3px; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.cn-seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.cn-seg button.on { background: rgba(255,255,255,0.09); color: var(--text); }
.cn-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.cn-check[hidden] { display: none; }
.cn-check input { accent-color: var(--green); }
.cn-check.small { font-size: 11px; margin-left: 8px; }

.cn-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 12px; }
.cn-kpi { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cn-kpi b { display: block; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cn-kpi span { color: var(--muted); font-size: 12px; }
.cn-kpi.us { cursor: pointer; border-color: rgba(248,113,113,0.4); }
.cn-kpi.us b, .cn-kpi.us span { color: #f87171; }
.cn-kpi.us:hover, .cn-kpi.us.on { background: rgba(248,113,113,0.12); border-color: #f87171; }
@media (max-width: 760px) { .cn-kpis { grid-template-columns: 1fr 1fr; } }

.cn-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cn-flabel { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.cn-ms { position: relative; }
.cn-ms-btn, .cn-one select, .cn-search input { background: var(--soft); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 12.5px; outline: none; }
.cn-ms-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 150px; cursor: pointer; }
.cn-ms-btn:hover, .cn-one select:hover { border-color: var(--muted); }
.cn-ms-label.some, .cn-one select.some { color: var(--green-lt, #4ade80); font-weight: 600; }
.cn-one select { width: auto; min-width: 104px; cursor: pointer; }
.cn-one select option { color: var(--text); background: #111827; font-weight: 400; }
.cn-caret { color: var(--muted); }
.cn-ms-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 220px; max-height: 320px; overflow-y: auto;
  background: var(--panel, #111820); border: 1px solid var(--line); border-radius: 12px; padding: 5px; box-shadow: 0 18px 50px rgba(0,0,0,0.5); }
.cn-ms-panel[hidden] { display: none; }
.cn-ms-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.cn-ms-opt:hover { background: var(--soft); }
.cn-ms-opt input { accent-color: var(--green); }
.cn-ms-opt span { flex: 1; white-space: nowrap; }
.cn-ms-opt i { font-style: normal; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cn-ms-foot { border-top: 1px solid var(--line); margin-top: 4px; padding: 6px 8px 3px; }
.cn-ms-foot button, .cn-reset, .cn-link { background: none; border: 0; padding: 0; color: var(--green-lt, #4ade80); font: inherit; font-size: 12px; cursor: pointer; }
.cn-ms-foot button:hover, .cn-reset:hover, .cn-link:hover { text-decoration: underline; }
.cn-search { flex: 1; min-width: 200px; max-width: 360px; }
.cn-search input { width: 100%; }
.cn-search input:focus { border-color: var(--green); }
.cn-reset { padding-bottom: 9px; color: var(--muted); }

.cn-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); }
.cn-table { width: 100%; min-width: 1980px; border-collapse: collapse; font-size: 12.5px; }
.cn-table th { text-align: left; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel, #111820); }
.cn-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cn-table tbody tr:last-child td { border-bottom: 0; }
.cn-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cn-table tr.cn-need { cursor: pointer; }
.cn-table tr.cn-need:hover td { background: rgba(255,255,255,0.035); }
.cn-table tr.cn-need.sel td { background: rgba(34,197,94,0.08); }
.cn-table:not(.flat) tr.cn-need td:first-child { padding-left: 30px; }
.cn-table tr.cn-grp td { background: rgba(255,255,255,0.045); padding: 8px 10px; cursor: pointer; white-space: nowrap; }
.cn-table tr.cn-grp:hover td { background: rgba(255,255,255,0.07); }
.cn-tw { display: inline-block; width: 16px; color: var(--muted); }
.cn-co { font-weight: 650; font-size: 13.5px; color: var(--text); }
a.cn-co { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.25); text-underline-offset: 3px; }
a.cn-co:hover { color: var(--green-lt, #4ade80); }
.cn-flag { margin: 0 6px; }
.cn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-left: 8px; vertical-align: 1px; }
.cn-mute { color: var(--muted); }
.cn-strong { font-weight: 650; }
.cn-good { color: #4ade80; } .cn-bad { color: #f87171; }
.cn-q { color: #fbbf24; font-weight: 700; cursor: help; }
.cn-clip { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cn-prod { max-width: 280px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cn-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cn-when { white-space: nowrap; color: var(--muted); }
.cn-count { margin-top: 8px; font-size: 12px; color: var(--muted); }
.cn-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.cn-empty.err { color: #f87171; }

.cn-chip, .cn-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap; color: #cbd5e1; background: rgba(148,163,184,0.12); }
.cn-mat-wax { color: #fde68a; border-color: rgba(253,230,138,0.4); background: rgba(253,230,138,0.1); }
.cn-mat-base_oil { color: #93c5fd; border-color: rgba(147,197,253,0.4); background: rgba(147,197,253,0.1); }
.cn-mat-white_oil { color: #e2e8f0; border-color: rgba(226,232,240,0.4); background: rgba(226,232,240,0.08); }
.cn-mat-bitumen { color: #a8a29e; border-color: rgba(168,162,158,0.5); background: rgba(168,162,158,0.12); }
.cn-mat-fatty_acids { color: #86efac; border-color: rgba(134,239,172,0.4); background: rgba(134,239,172,0.1); }
.cn-mat-vegetable_oil { color: #bef264; border-color: rgba(190,242,100,0.4); background: rgba(190,242,100,0.1); }
.cn-mat-solvent { color: #c4b5fd; border-color: rgba(196,181,253,0.4); background: rgba(196,181,253,0.1); }
.cn-fit-good { color: #4ade80; border-color: rgba(74,222,128,0.45); background: rgba(74,222,128,0.12); }
.cn-fit-partial { color: #fbbf24; border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.12); }
.cn-fit-none { color: #f87171; border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.12); }
.cn-fit-unknown { color: #94a3b8; }

.cn-sel { width: auto; font: inherit; font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--soft); color: #cbd5e1; cursor: pointer; }
.cn-sel option { color: var(--text); background: #111827; font-weight: 400; }
.cn-st-open { color: #a5b4fc; border-color: rgba(129,140,248,0.5); background: rgba(129,140,248,0.12); }
.cn-st-sourcing { color: #fdba74; border-color: rgba(251,146,60,0.5); background: rgba(251,146,60,0.12); }
.cn-st-quoted { color: #5eead4; border-color: rgba(45,212,191,0.45); background: rgba(45,212,191,0.12); }
.cn-st-sampling { color: #c4b5fd; border-color: rgba(196,181,253,0.45); background: rgba(196,181,253,0.12); }
.cn-st-won { color: #4ade80; border-color: rgba(74,222,128,0.45); background: rgba(74,222,128,0.12); }
.cn-st-lost, .cn-st-no_match { color: #f87171; border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.1); }
.cn-st-on_hold { color: #94a3b8; }
.cn-ball-us { color: #fca5a5; border-color: #ef4444; background: rgba(239,68,68,0.16); }
.cn-ball-client { color: #93c5fd; border-color: rgba(147,197,253,0.45); background: rgba(147,197,253,0.1); }
.cn-ball-closed, .cn-ball-none { color: #94a3b8; }
.cn-step { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font: inherit; font-size: 12.5px;
  color: var(--text); background: none; border: 1px dashed transparent; border-radius: 7px; padding: 2px 6px; margin: -2px -6px; cursor: text; }
.cn-step:hover { border-color: var(--muted); }
.cn-step.empty { color: var(--muted); }

.cn-pop { position: fixed; z-index: 70; width: 320px; background: var(--panel, #111820); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: 0 18px 60px rgba(0,0,0,0.6); }
.cn-pop[hidden] { display: none; }
.cn-pop-t { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.cn-pop textarea, .cn-f input, .cn-f select, .cn-f textarea, .cn-spec input, .cn-oe input, .cn-oe select { width: 100%; background: var(--soft); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 13px; outline: none; }
.cn-pop textarea:focus, .cn-f input:focus, .cn-f select:focus, .cn-f textarea:focus, .cn-spec input:focus, .cn-oe input:focus, .cn-oe select:focus { border-color: var(--green); }
.cn-pop textarea, .cn-f textarea { resize: vertical; }
.cn-f select option { color: var(--text); background: #111827; }
.cn-pop-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cn-pop-acts button { padding: 6px 14px; }

.cn-src .cn-ask { max-width: 380px; }
.cn-src .cn-ask + .cn-ask { margin-top: 3px; color: var(--muted); }
.cn-who { display: block; cursor: pointer; white-space: nowrap; }
.cn-who:hover { color: var(--green-lt, #4ade80); }
.cn-src td .cn-badge { margin-bottom: 2px; }

.cn-drawer { position: fixed; top: 70px; right: 0; bottom: 0; z-index: 50; width: min(700px, 100vw); display: flex; flex-direction: column;
  background: #111820; border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-top-left-radius: 16px;
  box-shadow: -24px 0 80px rgba(0,0,0,0.55); }
.cn-drawer[hidden] { display: none; }
.cn-d-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.cn-d-head h3 { margin: 0; font-size: 17px; }
.cn-d-head p { margin: 4px 0 0; font-size: 12.5px; }
.cn-d-head a { color: var(--green-lt, #4ade80); }
.cn-d-tags { font-size: 11.5px !important; }
.cn-x { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; align-self: flex-start; padding: 2px 6px; }
.cn-x:hover { color: var(--text); }
.cn-d-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.cn-sec { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px;
  display: flex; align-items: center; gap: 10px; }
.cn-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.cn-grid .wide { grid-column: 1 / -1; }
.cn-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.cn-f > span { font-size: 11px; color: var(--muted); }
.cn-f em { font-style: normal; color: #fbbf24; }
.cn-pair > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cn-spec { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 6px; margin-bottom: 6px; }
.cn-spec-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; }
.cn-spec-x:hover { color: #f87171; }
.cn-link { align-self: flex-start; }
.cn-buy { font-size: 12.5px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.cn-co-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin-top: 4px; max-height: 240px; overflow-y: auto;
  background: var(--panel, #111820); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,0.5); }
.cn-co-list[hidden] { display: none; }
.cn-co-list button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 12.5px;
  padding: 7px 10px; cursor: pointer; }
.cn-co-list button:hover { background: var(--soft); }
.cn-links { display: flex; flex-direction: column; gap: 12px; }
.cn-src { font-size: 12.5px; }
.cn-src code { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
  margin: 0 8px; font-size: 11px; color: var(--muted); }
.cn-resp { margin-top: 6px; font-size: 12.5px; line-height: 1.45; }
.cn-resp:empty { display: none; }
.cn-resp-h { font-weight: 600; margin-bottom: 3px; }
.cn-resp blockquote { margin: 6px 0 0; padding: 6px 10px; border-left: 2px solid var(--line); color: var(--muted); white-space: pre-wrap; }
.cn-link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cn-link-row .btn-ghost { padding: 7px 12px; font-size: 12.5px; }
.cn-link-row .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.cn-d-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.cn-d-msg { flex: 1; font-size: 12.5px; color: var(--muted); }
.cn-d-msg.err { color: #f87171; }
.cn-d-msg a { color: var(--text); text-decoration: underline; cursor: pointer; }
/* the app's global label style (small caps, block) is for the rails, not these forms */
#needs label { text-transform: none; letter-spacing: 0; margin-bottom: 0; font-weight: inherit; }
#needs .cn-check, #needs .cn-ms-opt { display: inline-flex; }
#needs .cn-ms-opt { display: flex; color: var(--text); }
#needs .cn-f { display: flex; }
.cn-pop, .cn-ms-panel, .cn-co-list { background: #111820; }

/* Potential supplier: a few options, one per line, readable at a glance */
.cn-sup { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 210px; max-width: 280px; }
.cn-sup-list { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: none; border: 1px dashed transparent; border-radius: 8px; padding: 3px 6px; margin: -3px -6px; cursor: text; }
button.cn-sup-list:hover { border-color: var(--muted); }
.cn-sup-list.static { cursor: default; margin: 0; padding: 0; min-width: 210px; max-width: 300px; }
.cn-sup-i { display: grid; grid-template-columns: 22px 1fr; align-items: baseline; font-size: 13.5px; line-height: 1.35; font-weight: 500; }
.cn-sup-i > span:last-child { overflow-wrap: anywhere; }
.cn-sup-f { color: var(--muted); text-align: center; font-size: 13px; }
.cn-sup-more { background: rgba(255,255,255,0.07); border: 1px solid var(--line); border-radius: 999px; color: var(--green-lt, #4ade80);
  font: inherit; font-size: 11.5px; font-weight: 600; padding: 2px 9px; margin-left: 16px; cursor: pointer; }
.cn-sup-more:hover { border-color: var(--green-lt, #4ade80); }
.cn-pop textarea { font-size: 13.5px; line-height: 1.45; }

/* Product requested: the name, then the spec the client stated as chips */
.cn-pname { font-weight: 650; font-size: 13px; max-width: 320px; }
.cn-specs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; max-width: 330px; }
.cn-spec-chip { font-size: 11px; line-height: 1.5; padding: 0 7px; border-radius: 6px; white-space: nowrap; color: #cbd5e1;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.cn-approx { color: var(--muted); margin-right: 2px; }
.cn-per, .cn-nowrap, .cn-dcc { white-space: nowrap; }
.cn-table th.cn-th-sort { cursor: pointer; }
.cn-table th.cn-th-sort:hover, .cn-table th.cn-th-sort.on { color: var(--green-lt, #4ade80); }

/* Our product / Supplier: one line per option, the same height in both
   cells, so each product sits next to who supplies it */
.cn-opts { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.cn-ol { display: flex; align-items: center; gap: 7px; height: 22px; white-space: nowrap; }
.cn-ol i { flex: none; width: 13px; text-align: right; font-style: normal; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cn-ol-n { overflow: hidden; text-overflow: ellipsis; max-width: 250px; font-size: 13px; font-weight: 600; }
.cn-ol.lead .cn-ol-n { font-weight: 400; color: #b9c5cd; }
.cn-ol .cn-badge { flex: none; }
.cn-ol .cn-sup-f { flex: none; width: 20px; }
.cn-opts .cn-sup-more { margin: 1px 0 0 20px; }
.cn-opt-none { display: flex; align-items: center; gap: 7px; height: 22px; white-space: nowrap; }

/* the drawer's option editor */
.cn-oe-sum { font-size: 12.5px; margin-bottom: 8px; }
.cn-oe { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.cn-oe-h, .cn-oe-r { display: grid; grid-template-columns: 16px minmax(0, 1.6fr) minmax(0, 1fr) 50px 104px 48px; gap: 6px; align-items: center; }
.cn-oe-h { padding: 0 9px; }
.cn-oe-h span { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cn-oe-r { background: rgba(255,255,255,0.035); border: 1px solid var(--line); border-radius: 11px; padding: 8px 8px 7px; }
.cn-oe-i { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cn-oe input, .cn-oe select { padding: 6px 8px; font-size: 12.5px; }
.cn-oe-p { font-weight: 600; }
.cn-oe-c { text-transform: uppercase; text-align: center; }
.cn-oe select.cn-oe-f { font-weight: 700; font-size: 11.5px; cursor: pointer; }
.cn-oe select.cn-oe-f option { color: var(--text); background: #111827; font-weight: 400; }
.cn-oe-acts { display: flex; justify-content: flex-end; }
.cn-oe-acts button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 5px; font-size: 13px; }
.cn-oe-acts button:hover { color: var(--text); }
.cn-oe-acts .cn-oe-x:hover { color: #f87171; }
.cn-oe-acts button:disabled { opacity: 0.25; cursor: default; }
.cn-oe-note, .cn-oe-buy { grid-column: 2 / -1; }
.cn-oe input.cn-oe-note { font-size: 12px; color: #cbd5e1; }
.cn-oe-buy { font-size: 11.5px; color: var(--muted); padding-left: 2px; }
.cn-oe-buy b { color: var(--text); }

/* the product stays in view while the row is scrolled sideways to its options */
.cn-table td.cn-stick, .cn-table th.cn-stick { position: sticky; left: 0; z-index: 2; background: #0e1419; box-shadow: 1px 0 0 var(--line); }
.cn-table th.cn-stick { z-index: 3; background: #111820; }
.cn-table tr.cn-need:hover td.cn-stick { background: #141b21; }
.cn-table tr.cn-need.sel td.cn-stick { background: #10221c; }
.cn-table td.cn-stick { min-width: 250px; }
.cn-grp-in { position: sticky; left: 10px; display: inline-block; }
.cn-oe select.cn-fit-good { color: #4ade80; border-color: rgba(74,222,128,0.45); background: rgba(74,222,128,0.12); }
.cn-oe select.cn-fit-partial { color: #fbbf24; border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.12); }
.cn-oe select.cn-fit-none { color: #f87171; border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.12); }
.cn-oe select.cn-fit-unknown { color: #94a3b8; }
