/* ============================================================================
   New Stores — js/newstores-app.js (#newstores-screen, Sales ▾).
   GSB Design System v3.2 "Quiet" (tokens in gsb-tokens.css): snow page, white panels, a pine band for the headline,
   square corners, fills not borders, tabular figures. Moss = the store in focus; fjord = budget; dark dotted = the brand's
   median store; light grey = the brand's other openings; each store keeps one color everywhere (its slot in its business
   unit). Tables: one rule under the header, no grid lines. Dense: text beside charts, charts ~130–240px tall.
   Phone first: one column under 900px, wide tables scroll with the store name pinned.
   ========================================================================= */

#newstores-screen { font-family: var(--ds-font); color: var(--ds-fg); -webkit-font-smoothing: antialiased; }
#newstores-screen *:not(svg):not(svg *) { font-family: var(--ds-font) !important; box-sizing: border-box; }
#newstores-screen .nav-bar h2 {
  font-family: var(--font-body) !important; font-weight: 700 !important; font-size: 22px !important;
  letter-spacing: -0.04em !important; color: var(--gsb-soil-ink) !important; display: flex; align-items: baseline; gap: 2px; margin: 0;
}
#newstores-screen .nav-bar h2 .gsb-title-dot { color: var(--gsb-leaf); }
#newstores-screen .nav-bar h2 .gsb-kw { background: linear-gradient(transparent 58%, rgba(130, 187, 144, 0.50) 58%) !important; padding: 0 2px; }
#newstores-screen .ns-tagline { font-size: 13px; color: var(--ds-muted); }

#newstores-root { position: relative; padding: 8px 24px 56px; max-width: 1400px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; font-variant-numeric: tabular-nums; }
#newstores-root > * { min-width: 0; }
.ns-panel { background: #fff; padding: 16px; }
.ns-ph { margin: 0 0 10px; }
.ns-ph h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--ds-fg); }
.ns-ph p { margin: 2px 0 0; font-size: 12.5px; color: var(--ds-muted); line-height: 1.45; max-width: 1040px; }
.ns-empty { font-size: 13px; color: var(--ds-muted); margin: 6px 0; }
.ns-stale { background: var(--ds-holiday-bg); color: var(--ds-holiday-fg); font-size: 13px; padding: 10px 14px; }
#newstores-root .up { color: #3E6348; font-weight: 600; }
#newstores-root .dn { color: #9A4423; font-weight: 600; }
#newstores-root .na { color: var(--ds-na-fg); }
.ns-note { margin: 8px 0 0; font-size: 12px; color: var(--ds-muted); line-height: 1.45; }
.ns-lede { margin: 0 0 12px; font-size: 14px; line-height: 1.5; max-width: 1040px; }
.ns-lede b { font-weight: 650; }
.ns-week { margin: -2px 0 10px; font-size: 13px; line-height: 1.45; }
.ns-hint { font-size: 12px; color: var(--ds-muted); }
.ns-btn { border: 0; background: var(--ds-pine); color: #F6F7F3; font: inherit; font-size: 12.5px; padding: 6px 12px; min-height: 34px; cursor: pointer; margin-left: 6px; }
.ns-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: rgba(246, 247, 243, .35); text-underline-offset: 3px; }
.ns-subhead { margin: 16px 0 6px; font-size: 13px; font-weight: 650; color: var(--ds-fg); }
.ns-subhead:first-of-type { margin-top: 8px; }

.ns-loading { display: flex; gap: 6px; padding: 40px 0; justify-content: center; }
.ns-loading span { width: 8px; height: 8px; background: var(--ds-moss); animation: ns-pulse 1s infinite ease-in-out; }
.ns-loading span:nth-child(2) { animation-delay: .15s; } .ns-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes ns-pulse { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* ── hero band ─────────────────────────────────────────────────────────── */
.ns-hero { background: var(--ds-pine); color: #F6F7F3; padding: 20px 24px; display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); gap: 18px 28px; position: relative; overflow: hidden; }
.ns-hero::after { content: ""; position: absolute; left: -80px; top: -120px; width: 420px; height: 320px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(130, 187, 144, .22), transparent); }
.ns-hero > * { position: relative; z-index: 1; min-width: 0; }
.ns-eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ds-muted-pine); display: flex; align-items: center; gap: 8px; }
.ns-dot { width: 8px; height: 8px; background: var(--ds-leaf); flex: none; }
.ns-big { font-size: 52px; font-weight: 650; letter-spacing: -0.035em; line-height: 1.02; margin: 8px 0 4px; }
.ns-big small { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; color: var(--ds-muted-pine); }
.ns-hero-sub { font-size: 13px; color: var(--ds-muted-pine); line-height: 1.45; }
.ns-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: rgba(246, 247, 243, .10); align-self: stretch; }
.ns-kpi { background: rgba(28, 51, 38, 1); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ns-kpi .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ds-muted-pine); }
.ns-kpi .v { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ns-kpi .v small { font-size: 13px; font-weight: 500; color: var(--ds-muted-pine); letter-spacing: 0; }
.ns-kpi .s { font-size: 12px; color: var(--ds-muted-pine); line-height: 1.4; }
.ns-kpi .up { color: #B3DDBE !important; } .ns-kpi .dn { color: #F4B79D !important; }
.ns-kpi .ns-link:focus-visible, .ns-hero :focus-visible { outline: 2px solid var(--ds-leaf); outline-offset: 2px; }

/* ── filter bar: business unit + window ───────────────────────────────── */
.ns-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; background: #fff; padding: 10px 12px; }
.ns-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.ns-chips button { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 0; background: #fff; color: var(--ds-fg); font: inherit; font-size: 12.5px; padding: 6px 11px; min-height: 34px; cursor: pointer; border-radius: 0; box-shadow: inset 0 0 0 1px var(--ds-rule-strong); }
.ns-chips button b { font-weight: 650; color: var(--ds-muted); }
.ns-chips button i { width: 9px; height: 9px; display: inline-block; flex: none; }
.ns-chips button i.sw-d, .ns-table td.nm i.sw-d, .ns-sm i.sw-d { background: none !important; height: 0; border-top: 2px dashed; width: 10px; }
.ns-chips button[aria-pressed="true"] { background: var(--ds-pine); color: #F6F7F3; box-shadow: none; font-weight: 600; }
.ns-chips button[aria-pressed="true"] b { color: var(--ds-muted-pine); }
.ns-chips-sm button { font-size: 12px; padding: 4px 9px; min-height: 30px; }
.ns-seg { display: inline-flex; gap: 0; box-shadow: inset 0 0 0 1px var(--ds-rule-strong); background: #fff; flex: none; }
.ns-seg button { border: 0; background: transparent; color: var(--ds-fg); font: inherit; font-size: 12.5px; padding: 7px 12px; min-height: 34px; cursor: pointer; border-radius: 0; }
.ns-seg button[aria-pressed="true"] { background: var(--ds-pine); color: #F6F7F3; font-weight: 600; }
.ns-seg button:focus-visible, .ns-chips button:focus-visible, .ns-table tr:focus-visible, .ns-table th button:focus-visible, .ns-btn:focus-visible { outline: 2px solid var(--ds-moss); outline-offset: 2px; }

/* ── the newest openings: full-width opening reports ──────────────────── */
.ns-card { background: #fff; padding: 16px; min-width: 0; }
.ns-card-flat { background: var(--ds-snow); }
.ns-report { scroll-margin-top: 64px; }
.ns-report-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 10px 24px; align-items: end; margin-bottom: 12px; }
.ns-report-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 24px; align-items: start; }
.ns-report-body.solo { grid-template-columns: minmax(0, 1fr); }
.ns-card-eyebrow { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ds-muted); }
.ns-card-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 4px 0 0; }
.ns-card-title h3 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.ns-card-title span { font-size: 12.5px; color: var(--ds-muted); }
.ns-card-flat .ns-card-title { margin-bottom: 10px; }
.ns-mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--ds-rule); }
.ns-card-flat .ns-mini-kpis { margin-bottom: 12px; }
.ns-mk { background: var(--ds-frost); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ns-card-flat .ns-mk { background: #fff; }
.ns-mk-k { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ds-muted); line-height: 1.25; }
.ns-mk b { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.ns-mk b small { display: block; font-size: 11px; font-weight: 400; color: var(--ds-muted); letter-spacing: 0; }
.ns-chart-title { font-size: 12.5px; font-weight: 600; color: var(--ds-fg); margin: 0 0 6px; }
.ns-report-side .ns-chart-title { margin-top: 0; }
.ns-chart { position: relative; width: 100%; min-height: 40px; }
.ns-svg { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; }
.ns-svg text { font-family: var(--ds-font); font-variant-numeric: tabular-nums; }
.ns-ax { font-size: 10.5px; fill: rgba(26, 30, 27, .62); }
.ns-ax-strong { font-size: 11px; font-weight: 650; fill: var(--ds-fg); }
.ns-halo { paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.ns-card-flat .ns-halo { stroke: var(--ds-snow); }
.ns-svg .ns-peer { transition: stroke .12s, stroke-width .12s; }
.ns-svg .ns-peer.hi { stroke: #56625A; stroke-width: 2.25; stroke-opacity: 1; }
/* Opening ramp (#ns-ramp): older openings read quieter; a long cohort table scrolls inside the card. */
.ns-mini tr.old td { color: var(--ds-muted); }
.ns-ramp-scroll { max-height: 360px; overflow-y: auto; }
@media (prefers-reduced-motion: reduce) { .ns-svg .ns-peer { transition: none; } }

/* tables: one rule under the header, no grid lines */
.ns-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.ns-mini, .ns-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.ns-mini { font-size: 12px; }
.ns-mini th, .ns-mini td { padding: 4px 6px !important; }
/* The app has global table/td/th rules (style.css: table { min-width: 600px }, td sizes): undo them here. */
#newstores-root table { min-width: 0; }
#newstores-root .ns-mini td { font-size: 12px; }
#newstores-root .ns-table td { font-size: 12.5px; }
#newstores-root .ns-mini th, #newstores-root .ns-table th { font-size: 11px; }
#newstores-root .ns-table tr.grp th { font-size: 12.5px; }
.ns-mini th, .ns-table th { text-align: right; font-weight: 600; font-size: 11px; color: var(--ds-muted); padding: 5px 7px; border-bottom: 1px solid var(--ds-rule-strong); vertical-align: bottom; line-height: 1.25; }
.ns-mini td, .ns-table td { text-align: right; padding: 5px 7px; white-space: nowrap; border: 0; }
.ns-mini th:first-child, .ns-mini td:first-child, .ns-table th:first-child, .ns-table td:first-child { text-align: left; }
.ns-mini th small { display: block; font-size: 10.5px; font-weight: 400; }
.ns-mini td small { font-size: 10.5px; color: var(--ds-muted); margin-left: 4px; }
.ns-mini tr.lead td { background: rgba(79, 122, 90, 0.10); font-weight: 650; }
.ns-mini td.tot, .ns-mini th.tot { font-weight: 650; }
.ns-mini tbody tr:hover td { background: var(--ds-hover); }
.ns-mini td.hol { color: var(--ds-holiday-fg); }
.ns-mini td.hol sup { font-size: 9px; margin-left: 1px; }

.ns-table th { white-space: normal; max-width: 96px; }
.ns-table th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: inherit; line-height: 1.25; }
.ns-table th:first-child button { text-align: left; }
.ns-table th[aria-sort] { color: var(--ds-fg); }
.ns-table th:first-child, .ns-table td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; }
.ns-table tbody tr[data-nsrow] { cursor: pointer; }
.ns-table tbody tr[data-nsrow]:hover td { background: var(--ds-hover); }
.ns-table tbody tr[data-nsrow]:hover td:first-child { background: #F2F6F2; }
.ns-table td.nm { font-weight: 600; }
.ns-table td.nm i { display: inline-block; width: 9px; height: 9px; margin-right: 7px; vertical-align: 1px; }
.ns-table td.nm .ns-chip { margin-left: 4px; vertical-align: 1px; }
.ns-table td small { display: block; font-size: 10.5px; font-weight: 400; color: var(--ds-muted); }
.ns-table td.nm small { padding-left: 16px; }
.ns-table tr.grp th { text-align: left; font-size: 12.5px; font-weight: 650; color: var(--ds-fg); padding: 14px 7px 4px; border-bottom: 0; max-width: none; position: static; background: none; }
.ns-table tr.grp th small { font-weight: 400; color: var(--ds-muted); margin-left: 6px; }
.ns-table tr.sub td { font-weight: 650; border-top: 1px solid var(--ds-rule-strong); }
.ns-table tr.sub td.nm { font-weight: 650; }
.ns-table tr.sub.all td { background: var(--ds-frost); }
.ns-table td.spark { padding-top: 2px; padding-bottom: 2px; }
.ns-table td.spark svg { display: block; margin-left: auto; }
.ns-chip { display: inline-block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; padding: 2px 6px; background: var(--ds-frost); color: var(--ds-fg); }

/* ── rolling chart ─────────────────────────────────────────────────────── */
.ns-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 10px; }
.ns-roll-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 28px; }
@media (min-width: 1100px) { .ns-roll-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ns-roll-panel { min-width: 0; }
.ns-roll-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 6px; }
.ns-roll-head h4 { margin: 0; font-size: 13px; font-weight: 650; }
#ns-roll, #ns-score { scroll-margin-top: 64px; }
.ns-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; font-size: 12px; color: var(--ds-muted); }
.ns-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ns-legend .sw { width: 14px; height: 10px; display: inline-block; }
.ns-legend .sw.dash { height: 0; border-top: 2px dashed; }
.ns-legend .sw.dot { height: 0; border-top: 2px dotted #56625A; }
.ns-bands { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11.5px; color: var(--ds-muted); margin-top: 4px; }
.ns-bands span { display: inline-flex; align-items: center; gap: 4px; }
.ns-bands i { width: 10px; height: 10px; display: inline-block; }
.ns-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 12px; align-items: start; }

/* ── cannibalization impact ────────────────────────────────────────────── */
.ns-cn { margin-top: 14px; }
.ns-cn:first-of-type { margin-top: 4px; }
.ns-cn-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; font-size: 12.5px; color: var(--ds-muted); }
.ns-cn-head b { font-size: 14px; color: var(--ds-fg); font-weight: 650; }
.ns-cn-table th { max-width: 120px; }
.ns-cn-table td.nm .ns-chip { margin-left: 6px; font-weight: 600; }
.ns-chip-other { background: var(--ds-holiday-bg); color: var(--ds-holiday-fg); }

/* ── daily small multiples ─────────────────────────────────────────────── */
.ns-sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px 22px; margin-top: 8px; }
.ns-sm { margin: 0; min-width: 0; scroll-margin-top: 64px; }
.ns-sm figcaption { margin-bottom: 4px; min-width: 0; }
.ns-sm figcaption .l1 { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.ns-sm figcaption .l1 i { width: 9px; height: 9px; display: inline-block; flex: none; }
.ns-sm figcaption .l1 b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.ns-sm figcaption .l2 { font-size: 11.5px; color: var(--ds-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── method ────────────────────────────────────────────────────────────── */
.ns-method { background: #fff; padding: 4px 16px; font-size: 12.5px; color: var(--ds-muted); }
.ns-method summary { cursor: pointer; font-weight: 600; color: var(--ds-fg); padding: 8px 0; min-height: 34px; }
.ns-method ul { margin: 0 0 10px; padding-left: 18px; line-height: 1.5; }
.ns-method code { font-size: 11.5px; background: var(--ds-frost); padding: 0 3px; }

/* ── tooltip ───────────────────────────────────────────────────────────── */
.ns-tip { position: absolute; z-index: 30; display: none; pointer-events: none; background: var(--ds-pine); color: #F6F7F3; padding: 8px 10px; min-width: 170px; max-width: 300px; font-size: 12px; box-shadow: 0 6px 18px rgba(28, 51, 38, .25); }
.ns-tip .h { font-weight: 650; margin-bottom: 4px; }
.ns-tip .r { display: flex; justify-content: space-between; gap: 14px; line-height: 1.55; }
.ns-tip .r span { display: inline-flex; align-items: center; gap: 6px; color: var(--ds-muted-pine); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-tip .r i { width: 8px; height: 8px; display: inline-block; flex: none; }
.ns-tip .r b { font-weight: 600; white-space: nowrap; }

/* ── narrower screens ──────────────────────────────────────────────────── */
@media (max-width: 1099px) {
  .ns-hero { grid-template-columns: minmax(0, 1fr); }
  .ns-report-head, .ns-report-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 719px) {
  #newstores-screen .nav-bar { padding-left: 0 !important; padding-right: 0 !important; }
  #newstores-root { padding: 8px 0 96px; gap: 10px; }   /* main already has the 24px gutter */
  .ns-hero { padding: 16px 14px; gap: 12px; }
  .ns-big { font-size: 36px; }
  .ns-big small { font-size: 16px; }
  .ns-hero-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ns-kpi { padding: 8px 10px; }
  .ns-kpi .k { font-size: 9.5px; letter-spacing: .04em; }
  .ns-kpi .v { font-size: 17px; }
  .ns-kpi .s { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ns-panel, .ns-card { padding: 12px; }
  .ns-filter { padding: 8px; }
  .ns-mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ns-card-title h3 { font-size: 19px; }
  .ns-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 1px; mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .ns-chips::-webkit-scrollbar { display: none; }
  .ns-controls { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ns-controls .ns-seg { justify-self: start; }
  .ns-filter { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ns-filter .ns-seg { justify-self: start; }
  .ns-score-wrap .ns-table td.spark, .ns-score-wrap .ns-table th:last-child { display: none; }
  /* Phone: the store name stays pinned; drop Day 1, Days and the brand tag so the money starts beside it. */
  .ns-score-wrap .ns-table th:nth-child(2), .ns-score-wrap .ns-table td:nth-child(2), .ns-score-wrap .ns-table th:nth-child(3), .ns-score-wrap .ns-table td:nth-child(3) { display: none; }
  .ns-score-wrap .ns-table tr.grp th { display: table-cell; }
  .ns-score-wrap .ns-table td.nm .ns-chip { display: none; }
  .ns-table td.nm { white-space: normal; min-width: 120px; max-width: 160px; }
}

/* ── print / save as PDF ───────────────────────────────────────────────── */
@media print {
  #newstores-root { padding: 0; gap: 8px; }
  .ns-scroll { overflow: visible; }
  .ns-table, .ns-mini { font-size: 9px; }
  .ns-table td, .ns-table th, .ns-mini td, .ns-mini th { padding: 3px 4px; }
  .ns-table th:first-child, .ns-table td:first-child { position: static; }
  .ns-card, .ns-sm, .ns-roll-panel, .ns-panel > .ns-ph, .ns-chart { break-inside: avoid; }
  .ns-filter .ns-seg, .ns-chips-sm, .ns-controls, .ns-btn { display: none !important; }
  .ns-filter .ns-chips button:not([aria-pressed="true"]) { display: none; }
  .ns-svg { max-width: 100%; height: auto; }
  .ns-tip { display: none !important; }
  .ns-method[open] summary, .ns-method { break-inside: avoid; }
}
@media print { .ns-ramp-scroll { max-height: none; overflow: visible; } }
