/* InsightWorx app layer on the CostusWorx Fluent kit (assets/fluent-kit/fluent-core.css, synced, never edit).
   Sections in kit order. Colour and px-font literals live ONLY in TOKENS (php <kit>/tools/check_layer.php). */

/* ===== TOKENS ===== */
:root {
  /* Customer pulse heatmap: spend against the customer's own normal (b = below, a = above) */
  --ss-heat-b2: var(--v6-bad); --ss-heat-b1: #F1A7AE; --ss-heat-n: #EDEBE9; --ss-heat-a1: #9CC3E8; --ss-heat-a2: var(--v6-action);
  --ss-heat-none: var(--v6-surface); --ss-heat-ink-dark: #FFFFFF;
  --ss-chart-h: 270px; --ss-spark-h: 34px;
}

/* ===== BASE ===== */
.ss-main { max-width: 1400px; overflow-x: hidden; }
.ss-main > .v6-msgbar { margin-bottom: 12px; }

/* ===== COMPONENTS ===== */
/* Avatar menu: the sign-out button lives in a form. */
.v6-menu form { margin: 0; }
.v6-menu form button { width: 100%; }

/* Password peek: the eye sits inside the input; padding-right keeps typed text clear of it. */
.ss-pw-wrap { position: relative; display: flex; }
.ss-pw-wrap .v6-input { flex: 1; min-width: 0; padding-right: 40px; }
.ss-pw-peek { position: absolute; top: 0; right: 0; bottom: 0; width: 36px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: var(--v6-t2); cursor: pointer; border-radius: var(--v6-r-sm); }
.ss-pw-peek:hover { color: var(--v6-t1); }
.ss-pw-peek:focus-visible { outline: 2px solid var(--v6-action); outline-offset: -2px; }
.ss-pw-peek svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ss-pw-peek .ss-pw-slash { display: none; }
.ss-pw-peek[aria-pressed="true"] .ss-pw-slash { display: inline; }

/* Sign-in card messages */
.v6-login-card .v6-msgbar { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 12px; border-radius: var(--v6-r-sm); }
.v6-login-card .v6-msgbar > span { flex: 1; min-width: 0; }

/* Sign-in card links (Forgot password?, Back to sign in) */
.ss-login-links { margin: 0; text-align: center; font-size: var(--v6-fs-cap); }

/* ===== APP ===== */
/* Small helpers shared by the copied pages */
.ss-sub { display: block; font-size: var(--v6-fs-cap); color: var(--v6-t3); }
.ss-gap { margin-top: 16px; }

/* Company switcher (header menu and the chooser page) */
.ss-co-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: var(--v6-r-md); }
.ss-co-btn:hover { background: var(--v6-brand-deep); }
.ss-co-btn:focus-visible { outline: 2px solid var(--v6-surface); outline-offset: 2px; }
.ss-co-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.ss-co-menu { left: 0; right: auto; top: 100%; margin-top: 4px; }
.ss-co-menu form { margin: 0; }
.ss-co-menu button { width: 100%; text-align: left; }
.ss-co-menu button[aria-current="true"] { font-weight: 700; }
@media (max-width: 640px) { .ss-co-menu { position: fixed; left: 8px; right: 8px; top: calc(var(--v6-hdr-h) + 4px); width: auto; max-width: none; margin-top: 0; } }
.ss-co-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 560px; }
.ss-co-list form { margin: 0; }
.ss-co-pick { width: 100%; text-align: left; font: inherit; padding: 12px 14px; border: var(--v6-line) solid var(--v6-stroke); border-radius: var(--v6-r-md); background: var(--v6-surface); color: inherit; cursor: pointer; }
.ss-co-pick:hover { border-color: var(--v6-action); background: var(--v6-surface-2); }
.ss-co-pick:focus-visible { outline: 2px solid var(--v6-action); outline-offset: 2px; }
.ss-co-pick strong { display: block; color: var(--v6-brand); }
.ss-co-here { border-color: var(--v6-action); }

/* Settings: Users and roles */
.ss-roles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ss-check { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.ss-code { width: 7rem; }
.ss-hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ss-actions { white-space: nowrap; }
.ss-actions form { display: inline; margin: 0; }

/* Two-factor sign-in (twofactor.php, twofactor_setup.php) */
.ss-2fa-card { max-width: 26rem; }
.ss-qr { display: block; width: 220px; height: 220px; margin: 8px auto 12px; background: var(--v6-surface); padding: 8px; border-radius: 4px; }
.ss-key { text-align: center; margin: 4px 0 12px; }
.ss-key code, .ss-codes code { font-family: Consolas, "Courier New", monospace; font-size: 1.05rem; letter-spacing: .06em; }
.ss-steps { margin: 8px 0; padding-left: 1.25rem; }
.ss-otp { font-family: Consolas, "Courier New", monospace; letter-spacing: .2em; font-size: 1.2rem; }
.ss-codes { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }

/* Site map: pages not built yet are shown, disabled, with a pill saying when they arrive */

/* ===== OVERVIEW ===== */
.ss-row { display: grid; gap: 16px; margin-bottom: 16px; }
.ss-r-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.ss-r-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ss-r-11 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ss-r-1 { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1150px) { .ss-r-32, .ss-r-21, .ss-r-11 { grid-template-columns: minmax(0, 1fr); } }
.ss-row > .v6-block { margin: 0 4px 0 0; min-width: 0; }
.ss-wide { margin-bottom: 16px; }
.ss-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ss-tag { font-size: var(--v6-fs-cap2); color: var(--v6-t3); text-transform: uppercase; letter-spacing: .04em; }
.ss-hint { font-size: var(--v6-fs-cap); color: var(--v6-t3); margin: 6px 0 0; }
.ss-up { color: var(--v6-ok); font-weight: 600; }
.ss-dn { color: var(--v6-bad); font-weight: 600; }
.ss-wn { color: var(--v6-warn); font-weight: 600; }

/* Text that drills down: a real button that reads as a kit link (underline on hover) */
.ss-link { display: inline; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: var(--v6-action); text-align: left; cursor: pointer; text-decoration: none; text-underline-offset: 2px; overflow-wrap: anywhere; }
.ss-link:hover { color: var(--v6-action-h); text-decoration: underline; }
.ss-link:focus-visible, .ss-att-item:focus-visible { outline: var(--v6-focus-w) solid var(--v6-focus); outline-offset: 2px; }

/* Plain-English summary */
.ss-story-p { margin: 0; line-height: 1.6; font-size: var(--v6-fs-body); }

/* Needs attention */
.ss-att { list-style: none; margin: 0; padding: 0; }
.ss-att li { border-bottom: var(--v6-line) solid var(--v6-hover); }
.ss-att li:last-child { border-bottom: 0; }
.ss-att-item { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border: 0; background: transparent; font: inherit; color: var(--v6-t1); text-align: left; cursor: pointer; border-radius: var(--v6-r-sm); }
.ss-att-item:hover { background: var(--v6-surface-2); }
.ss-att-tx { flex: 1; min-width: 0; font-size: var(--v6-fs-body); line-height: 1.45; overflow-wrap: anywhere; }
.ss-go { color: var(--v6-t4); font-size: var(--v6-fs-sub2); line-height: 1; }
.ss-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.ss-dot-bad { background: var(--v6-bad); }
.ss-dot-warn { background: var(--v6-warn); }
.ss-dot-info { background: var(--v6-action); }

/* KPI tiles: links to the section that explains them */
.ss-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .ss-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.ss-tile { position: relative; min-width: 0; display: block; color: var(--v6-t1); text-decoration: none; }
.ss-tile::after { content: '›'; position: absolute; right: 12px; top: 8px; color: var(--v6-t4); font-size: var(--v6-fs-sub1); }
.ss-tile .v6-kpi-value { overflow-wrap: anywhere; }
.ss-delta { font-size: var(--v6-fs-cap); line-height: var(--v6-lh-cap); margin-top: 4px; color: var(--v6-t3); }
.ss-spark { height: var(--ss-spark-h); margin-top: 8px; }

/* Charts (assets/js/charts.js draws the SVG inside) */
.ss-chart { position: relative; height: var(--ss-chart-h); }
.ss-svg { display: block; overflow: visible; }
.ss-svg text { font-family: var(--v6-font); font-size: var(--v6-fs-cap2); fill: var(--v6-t3); }
.ss-svg .ss-c-legend { font-size: var(--v6-fs-cap); fill: var(--v6-t2); }
.ss-svg .ss-c-val-sm { font-size: var(--v6-fs-cap2); }
.ss-svg .ss-c-val { font-weight: 600; fill: var(--v6-t2); }
.ss-svg .ss-c-total { font-size: var(--v6-fs-sub2); font-weight: 600; fill: var(--v6-t1); }
.ss-svg .ss-c-empty { font-size: var(--v6-fs-cap); }
.ss-c-grid { stroke: var(--v6-hover); stroke-width: 1; }
.ss-c-zero { stroke: var(--v6-t4); stroke-width: 1; }
.ss-c-link { stroke: var(--v6-t4); stroke-width: 1; stroke-dasharray: 3 3; }
.ss-c-hit { fill: transparent; }
.ss-c-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ss-c-thick { stroke-width: 2.5; }
.ss-c-dashed { stroke-dasharray: 6 4; }
.ss-c-dotted { stroke-width: 1.5; stroke-dasharray: 2 3; }
.ss-c-band { fill-opacity: .14; }
.ss-c-area { fill-opacity: .1; }
.ss-c-dot { stroke: var(--v6-surface); stroke-width: 1; }
.ss-c-drill { cursor: pointer; }
.ss-c-bar.ss-c-drill:hover, .ss-c-slice.ss-c-drill:hover { opacity: .8; }
.ss-c-hit.ss-c-drill:hover { fill: var(--v6-sel); fill-opacity: .5; }
.ss-c-drill:focus { outline: none; }
.ss-c-drill:focus-visible { outline: var(--v6-focus-w) solid var(--v6-focus); }

/* Customer pulse heatmap */
.ss-heat-wrap { max-width: 100%; }
.ss-heat { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 3px; font-size: var(--v6-fs-cap); }
.ss-heat th { font-weight: 400; color: var(--v6-t3); font-size: var(--v6-fs-cap2); text-align: center; padding: 0 0 2px; }
.ss-heat th.ss-heat-name { width: 24%; text-align: left; font-size: var(--v6-fs-cap); color: var(--v6-t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-heat thead th.ss-heat-name { color: var(--v6-t3); }
.ss-heat .ss-heat-name .ss-link { color: var(--v6-t1); text-decoration: none; }
.ss-heat .ss-heat-name .ss-link:hover { color: var(--v6-action); }
.ss-heat td { height: 26px; border-radius: 3px; text-align: center; font-size: var(--v6-fs-cap2); color: transparent; cursor: pointer; overflow: hidden; white-space: nowrap; }
.ss-heat td:hover, .ss-heat td:focus-visible { outline: 2px solid var(--v6-t1); color: var(--v6-t1); }
.ss-heat .ss-heat-now { width: 11%; text-align: right; color: var(--v6-t2); background: transparent; cursor: default; font-size: var(--v6-fs-cap); }
.ss-heat td.ss-heat-now:hover { outline: 0; }
.ss-heat td.ss-heat-now.ss-dn { color: var(--v6-bad); }
.ss-heat td.ss-heat-now.ss-up { color: var(--v6-ok); }
.ss-heat-b2 { background: var(--ss-heat-b2); }
.ss-heat-b1 { background: var(--ss-heat-b1); }
.ss-heat-n { background: var(--ss-heat-n); }
.ss-heat-a1 { background: var(--ss-heat-a1); }
.ss-heat-a2 { background: var(--ss-heat-a2); }
.ss-heat-none { background: var(--ss-heat-none); box-shadow: inset 0 0 0 1px var(--v6-hover); }
.ss-heat td.ss-heat-b2:hover, .ss-heat td.ss-heat-a2:hover, .ss-heat td.ss-heat-b2:focus-visible, .ss-heat td.ss-heat-a2:focus-visible { color: var(--ss-heat-ink-dark); }
.ss-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--v6-fs-cap); color: var(--v6-t3); margin-top: 10px; }
.ss-legend i { width: 22px; height: 10px; border-radius: 2px; display: inline-block; }

/* Bars inside table cells (stock cover) */
.ss-bar { height: 6px; border-radius: 3px; background: var(--v6-hover); overflow: hidden; min-width: 70px; margin-bottom: 2px; }
.ss-bar > span { display: block; height: 100%; }
.ss-bar-bad { background: var(--v6-bad); }
.ss-bar-warn { background: var(--v6-warn); }
.ss-bar-ok { background: var(--v6-ok); }
.ss-w0 { width: 2%; } .ss-w1 { width: 10%; } .ss-w2 { width: 20%; } .ss-w3 { width: 30%; } .ss-w4 { width: 40%; } .ss-w5 { width: 50%; }
.ss-w6 { width: 60%; } .ss-w7 { width: 70%; } .ss-w8 { width: 80%; } .ss-w9 { width: 90%; } .ss-w10 { width: 100%; }
.ss-cards td .ss-sub { margin-top: 2px; }

/* Reconciliation note under the page */
.ss-recon { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: var(--v6-fs-cap); color: var(--v6-t3); }
.ss-recon .v6-ic { color: var(--v6-ok); }
.ss-recon-bad, .ss-recon-bad .v6-ic { color: var(--v6-bad); }

/* Phones: tables become cards, the heatmap keeps the last 6 months */
@media (max-width: 700px) {
  .ss-cards thead { display: none; }
  .ss-cards, .ss-cards tbody, .ss-cards tr, .ss-cards td { display: block; width: 100%; box-sizing: border-box; }
  .ss-cards tr { padding: 8px 0; border-bottom: var(--v6-line) solid var(--v6-row); }
  .ss-cards td { height: auto; border: 0; padding: 2px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: right; }
  .ss-cards td::before { content: attr(data-label); color: var(--v6-t3); font-size: var(--v6-fs-cap); text-align: left; flex: none; }
  .ss-cards td.num { text-align: right; }
  .ss-cards td[data-label="Fabric"], .ss-cards td[data-label="Product"] { display: block; text-align: left; font-weight: 600; }
  .ss-cards td[data-label="Fabric"]::before, .ss-cards td[data-label="Product"]::before { content: none; }
  .ss-cards td .ss-bar { flex: 1; max-width: 50%; margin-top: 7px; }
  .ss-heat .ss-heat-old { display: none; }
  .ss-heat th.ss-heat-name { width: 34%; }
  .ss-heat .ss-heat-now { width: 16%; }
  .ss-chart { height: 240px; }
}

/* ===== DRAWER ===== */
/* The drill-through drawer (assets/js/drawer.js) on the kit's scrim + panel: breadcrumb, headline figures, actions, chart, tables. */
.v6-panel.ss-drawer { width: min(640px, 100vw); }
.ss-drawer:focus, .ss-drawer .v6-panel-head h2:focus { outline: none; }
.ss-dr-lock { overflow: hidden; }
.ss-dr-back[hidden] { display: none; }
.ss-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: var(--v6-fs-cap); color: var(--v6-t3); margin-bottom: 10px; }
.ss-crumbs a { color: var(--v6-action); overflow-wrap: anywhere; }
.ss-crumbs b { color: var(--v6-t1); font-weight: 600; overflow-wrap: anywhere; }
.ss-dr-sep { color: var(--v6-t4); }
.ss-dr-sub { margin: 0 0 10px; }
.ss-dr-msg { margin: 8px 0; }
.ss-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ss-kv div { background: var(--v6-surface-2); border-radius: var(--v6-r-sm); padding: 8px; min-width: 0; }
.ss-kv small { display: block; color: var(--v6-t3); font-size: var(--v6-fs-cap2); }
.ss-kv b { display: block; font-size: var(--v6-fs-sub2); overflow-wrap: anywhere; }
.ss-dtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ss-dtools .v6-btn { text-decoration: none; }
.ss-dsub { font-weight: 600; margin: 16px 0 6px; font-size: var(--v6-fs-body); }
.ss-dr-chart { height: 220px; margin-bottom: 12px; }
.ss-dr-notes { margin-bottom: 12px; }
.ss-dr-notes li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; }
.ss-dr-table { max-width: 100%; overflow-x: auto; }
.ss-dr-grid tr.ss-dr-go { cursor: pointer; }
/* The whole link is one box, so a label that wraps onto two lines is clickable across all of it. */
.ss-dr-link { display: inline-block; max-width: 100%; color: var(--v6-action); text-decoration: none; text-underline-offset: 2px; overflow-wrap: anywhere; }
.ss-dr-link:hover { color: var(--v6-action-h); text-decoration: underline; }
.ss-dr-link:focus-visible, .ss-dr-crumb:focus-visible, .ss-dtools .v6-btn:focus-visible { outline: var(--v6-focus-w) solid var(--v6-focus); outline-offset: 2px; }
@media (max-width: 700px) {
  .ss-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-dr-chart { height: 200px; }
}

/* ===== LIST PAGES ===== */
/* Sales, Customer pulse, Forecast and Stock: the Overview cards at full width plus sortable tables (assets/js/table-sort.js). */
.ss-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; margin: 0; border: 0; background: none; font: inherit; font-weight: 600; color: inherit; text-align: left; cursor: pointer; }
.ss-sort:hover { color: var(--v6-action); }
.ss-sort:focus-visible { outline: var(--v6-focus-w) solid var(--v6-focus); outline-offset: 2px; }
.ss-sort::after { content: '↕'; color: var(--v6-t4); font-size: var(--v6-fs-cap2); }
th[aria-sort="ascending"] .ss-sort::after { content: '▲'; color: var(--v6-action); }
th[aria-sort="descending"] .ss-sort::after { content: '▼'; color: var(--v6-action); }
th.num .ss-sort { justify-content: flex-end; width: 100%; }
.ss-tfoot td { font-weight: 600; border-top: var(--v6-line) solid var(--v6-row); }
/* Month picker on the sales page */
.ss-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.ss-pick .v6-input { width: auto; }
/* Dead stock decisions: "Open since 14 Oct", red after 30 days; the decide form in the last column */
.ss-since { display: block; margin-top: 4px; font-size: var(--v6-fs-cap); color: var(--v6-t3); }
.ss-since-old { color: var(--v6-bad); font-weight: 600; }
.ss-decide { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 260px; }
.ss-decide select.v6-input { width: auto; }
.ss-decide input.v6-input { flex: 1; min-width: 120px; }
@media (max-width: 700px) {
  .ss-decide { min-width: 0; width: 100%; }
}
/* Settings, Thresholds */
.ss-thresholds .v6-input { max-width: 140px; }
/* Settings, Data: Rebuild figures */
.ss-rebuild { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 16px; }
/* Stock cover: the item name gets room to read, its code stays whole on the line below (V3). */
.ss-cover-t td[data-label="Fabric"] { min-width: 160px; }
.ss-cover-t td[data-label="Product"] { min-width: 160px; }
.ss-cover-t .ss-sub { white-space: nowrap; }

/* "InsightWorx by CostusWorx" lockup in the header: the endorsement line is quieter than the product name. */
.ss-by { font-weight: 400; opacity: .8; }
@media (max-width: 600px) { .ss-by { display: none; } }

/* Area switcher at the foot of the site map (kit .v6-area); its menu opens upward. */
.ss-area-wrap { position: relative; flex-shrink: 0; display: flex; flex-direction: column; }
.ss-area-wrap .v6-area { width: 100%; }
.ss-area-menu { top: auto; bottom: calc(100% + 4px); left: 8px; right: auto; width: 220px; }
.ss-area-menu a[aria-current] { font-weight: 600; }
.ss-area-menu .v6-area-tile { width: 24px; height: 24px; }
/* Header search is a form (kit .v6-search). */
form.v6-search { margin: 0; }
/* Search results */
.ss-search-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.ss-search-form input { flex: 1; min-width: 0; max-width: 420px; }
.ss-results { list-style: none; margin: 0; padding: 0; }
.ss-results li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: var(--v6-line) solid var(--v6-row); }
.ss-results li:last-child { border-bottom: 0; }
