/*
 * New Bay ERP case study — page styles.
 *
 * Loaded only by resources/views/web/projects/case-studies/new-bay-erp.blade.php.
 * Every class is prefixed `nb-` and every colour, radius, font and easing comes
 * from the site's own tokens (--c-*, --radius, --font-*, --ease-out), so the
 * page follows the dashboard theme, light/dark mode and RTL without a Tailwind
 * rebuild. Logical properties throughout: the Arabic page mirrors itself.
 */

/* ---------------------------------------------------------------- basics */
.nb-ico    { width: 1.35rem; height: 1.35rem; }
.nb-ico-sm { width: 1rem; height: 1rem; flex: none; }
.nb-ico-xs { width: .8rem; height: .8rem; flex: none; color: var(--c-primary); margin-top: .35em; }

/* The shared hero sizes its h1 for a project name; this one is a sentence
   sharing the row with a screenshot, so it is set a step smaller. */
.page-open h1 { font-size: clamp(2.1rem, 4.6vw, 3.7rem); line-height: 1.06; max-width: 20ch; }
html[dir='rtl'] .page-open h1 { line-height: 1.3; }

.nb-lede { margin-top: 1.75rem; max-width: 46ch; }
.nb-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem; }
.nb-hint {
    font-family: var(--font-mono);
    font-size: .65rem;
    letter-spacing: .12em;
    color: var(--c-text-muted);
    margin-inline-start: .15rem;
}
html[dir='rtl'] .nb-hint { letter-spacing: 0; font-size: .75rem; }

.nb-section { position: relative; }
.nb-band {
    background:
        radial-gradient(60rem 30rem at 85% 0%, color-mix(in srgb, var(--c-primary) 7%, transparent), transparent 70%),
        var(--c-surface);
    border-block: 1px solid var(--c-border);
}
html[dir='rtl'] .nb-band {
    background:
        radial-gradient(60rem 30rem at 15% 0%, color-mix(in srgb, var(--c-primary) 7%, transparent), transparent 70%),
        var(--c-surface);
}

.nb-head { max-width: 46rem; margin-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.nb-head--split { max-width: none; display: grid; gap: 1.25rem; align-items: end; }
@media (min-width: 1024px) {
    .nb-head--split { grid-template-columns: 1.15fr .85fr; gap: 4rem; }
}
.nb-h2 {
    margin-top: 1rem;
    font-size: clamp(1.9rem, 4.4vw, 3.2rem);
    line-height: 1.08;
    max-width: 20ch;
}
.nb-lead { color: var(--c-text-muted); font-size: 1.075rem; line-height: 1.7; max-width: 52ch; }

/* ------------------------------------------------------- framed screens */
.nb-frame {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) * .75);
    border: 1px solid var(--c-border);
    background: var(--c-surface-raised);
    box-shadow:
        0 1px 0 color-mix(in srgb, #fff 6%, transparent) inset,
        0 30px 60px -28px rgba(3, 8, 20, .55),
        0 12px 24px -16px rgba(3, 8, 20, .35);
}
.nb-frame img { display: block; width: 100%; height: auto; background: #f4f4f4; }
.nb-frame-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    height: 2rem;
    padding-inline: .85rem;
    border-bottom: 1px solid var(--c-border);
    background: color-mix(in srgb, var(--c-surface) 85%, var(--c-text) 4%);
    direction: ltr;
}
.nb-frame-bar i {
    width: .55rem; height: .55rem; border-radius: 50%;
    background: color-mix(in srgb, var(--c-text) 22%, transparent);
}
.nb-frame-bar span {
    margin-inline: auto;
    font-family: var(--font-mono);
    font-size: .66rem;
    letter-spacing: .08em;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-inline-end: 2.2rem;
}

/* --------------------------------------------------------------- hero art */
.nb-hero-visual { position: relative; margin: 0; padding-bottom: 2.5rem; }
.nb-frame--hero { transform: perspective(1800px) rotateY(-4deg) rotateX(2deg); transform-origin: 70% 50%; }
html[dir='rtl'] .nb-frame--hero { transform: perspective(1800px) rotateY(4deg) rotateX(2deg); transform-origin: 30% 50%; }
.nb-frame--float {
    position: absolute;
    width: 46%;
    inset-inline-start: -6%;
    bottom: 0;
    border-color: color-mix(in srgb, var(--c-primary) 35%, var(--c-border));
    animation: nb-float 7s ease-in-out infinite;
}
@keyframes nb-float { 50% { transform: translateY(-8px); } }
.nb-note {
    position: absolute;
    inset-inline-end: 0;
    bottom: 0;
    font-size: .75rem;
    color: var(--c-text-muted);
}
@media (max-width: 1023px) {
    .nb-frame--hero, html[dir='rtl'] .nb-frame--hero { transform: none; }
    .nb-frame--float { inset-inline-start: auto; inset-inline-end: 4%; width: 42%; bottom: 1.6rem; }
    .nb-note { position: static; display: block; margin-top: .75rem; }
    .nb-hero-visual { padding-bottom: 0; }
}
@media (max-width: 639px) { .nb-frame--float { display: none; } }

/* ------------------------------------------------------------ facts/stats */
.nb-facts-wrap { padding-block: 0 clamp(3.5rem, 7vw, 5.5rem); }
/* Five facts here, not the shared four: keep them on one row on wide screens. */
@media (min-width: 1024px) {
    .nb-facts-wrap .facts { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 1.75rem; }
}
.nb-credits { margin-top: 1.75rem; }
.nb-stats {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--c-surface);
}
.nb-stat {
    padding: clamp(1.25rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    border-inline-end: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
}
.nb-stat:nth-child(2n) { border-inline-end: 0; }
.nb-stat:nth-last-child(-n+2) { border-bottom: 0; }
@media (min-width: 900px) {
    .nb-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .nb-stat { border-bottom: 0; border-inline-end: 1px solid var(--c-border); }
    .nb-stat:nth-child(2n) { border-inline-end: 1px solid var(--c-border); }
    .nb-stat:last-child { border-inline-end: 0; }
}
.nb-stat-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.1rem, 4.6vw, 3.25rem);
    line-height: 1;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
}
.nb-stat-label { color: var(--c-text-muted); font-size: .92rem; line-height: 1.45; }

/* ------------------------------------------------------------------ story */
.nb-story-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1px;
    background: var(--c-border);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}
@media (min-width: 900px) { .nb-story-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .nb-story-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.nb-story-step { background: var(--c-bg); padding: clamp(1.5rem, 3vw, 2.25rem); }
.nb-story-step:last-child { background: color-mix(in srgb, var(--c-primary) 8%, var(--c-bg)); }
.nb-step-num {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--c-primary);
    letter-spacing: .12em;
}
.nb-story-step h3 { margin-top: .9rem; font-size: 1.25rem; }
.nb-story-step p, .nb-module p, .nb-quality p, .nb-flow-step p {
    margin-top: .7rem;
    color: var(--c-text-muted);
    line-height: 1.7;
    font-size: .975rem;
}

/* ---------------------------------------------------------------- modules */
.nb-modules { display: grid; gap: 1.25rem; }
@media (min-width: 720px)  { .nb-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .nb-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nb-module { padding: clamp(1.5rem, 3vw, 2rem); background: var(--c-bg); }
.nb-module:hover { border-color: color-mix(in srgb, var(--c-primary) 45%, transparent); }
.nb-module-icon {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .85rem;
    color: var(--c-primary);
    background: color-mix(in srgb, var(--c-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c-primary) 25%, transparent);
}
.nb-module h3, .nb-quality h3 { margin-top: 1.1rem; font-size: 1.2rem; }
.nb-module ul { list-style: none; margin: 1.1rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--c-border); display: grid; gap: .5rem; }
.nb-module li { display: flex; gap: .6rem; font-size: .925rem; line-height: 1.5; }

/* --------------------------------------------------------------- lifecycle */
.nb-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; counter-reset: nb; }
@media (min-width: 720px)  { .nb-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .nb-flow { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; } }
.nb-flow-step { position: relative; padding-top: 3.4rem; }
.nb-flow-step::before {
    content: '';
    position: absolute;
    top: 1.15rem;
    inset-inline-start: 2.6rem;
    inset-inline-end: -1rem;
    height: 1px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c-primary) 55%, transparent), var(--c-border));
}
html[dir='rtl'] .nb-flow-step::before { background: linear-gradient(-90deg, color-mix(in srgb, var(--c-primary) 55%, transparent), var(--c-border)); }
.nb-flow-step:last-child::before { display: none; }
@media (max-width: 1099px) { .nb-flow-step::before { display: none; } }
.nb-flow-dot {
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: .85rem;
    font-weight: 700;
    color: var(--c-button-text, #fff);
    background: linear-gradient(140deg, var(--c-primary), var(--c-primary-deep));
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--c-primary) 14%, transparent);
}
.nb-flow-step h3 { font-size: 1.1rem; }
.nb-flow-step p { font-size: .925rem; }

/* -------------------------------------------------------------------- tour */
.nb-tour-tabs {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .35rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: var(--c-bg);
    scrollbar-width: none;
}
.nb-tour-tabs::-webkit-scrollbar { display: none; }
.nb-tour-tabs[hidden] { display: none; }
.nb-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-radius: 999px;
    font-size: .875rem;
    color: var(--c-text-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.nb-tab:hover { color: var(--c-text); }
.nb-tab[aria-selected='true'] { color: var(--c-button-text, #fff); background: var(--c-primary); }
.nb-tab:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.nb-tab-num { font-family: var(--font-mono); font-size: .68rem; opacity: .7; }

.nb-tour-panels { display: grid; gap: 3rem; }
.nb-tour.is-tabbed .nb-tour-panels { display: block; }
.nb-panel { margin: 0; }
.nb-panel[hidden] { display: none; }
.nb-tour.is-tabbed .nb-panel:not([hidden]) { animation: nb-in .45s var(--ease-out) both; }
@keyframes nb-in { from { opacity: 0; transform: translateY(10px); } }
.nb-panel figcaption {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    align-items: baseline;
    margin-top: 1.1rem;
    color: var(--c-text-muted);
    line-height: 1.6;
}
.nb-panel figcaption strong { color: var(--c-text); font-family: var(--font-display); font-size: 1.05rem; }

/* -------------------------------------------------------------- deep dives */
.nb-deep { display: grid; gap: clamp(3.5rem, 8vw, 6rem); }
.nb-deep-item { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 1024px) {
    .nb-deep-item { grid-template-columns: .9fr 1.1fr; gap: 4rem; }
    .nb-deep-item--flip .nb-deep-copy { order: 2; }
}
.nb-deep-copy h3 { font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1.2; }
.nb-deep-copy dl { margin: 1.5rem 0 0; display: grid; gap: 1.15rem; }
.nb-deep-copy dt {
    font-family: var(--font-mono);
    font-size: .7rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--c-primary);
}
html[dir='rtl'] .nb-deep-copy dt { letter-spacing: 0; font-size: .85rem; font-family: var(--font-display); font-weight: 700; }
.nb-deep-copy dd { margin: .35rem 0 0; color: var(--c-text-muted); line-height: 1.7; }
.nb-deep-value {
    padding: 1rem 1.15rem;
    border-radius: calc(var(--radius) * .6);
    border-inline-start: 3px solid var(--c-primary);
    background: color-mix(in srgb, var(--c-primary) 8%, transparent);
}
.nb-deep-value dd { color: var(--c-text); }

/* -------------------------------------------------------------- qualities */
.nb-qualities { display: grid; gap: 2.25rem 2rem; }
@media (min-width: 720px)  { .nb-qualities { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .nb-qualities { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* -------------------------------------------------------------------- tech */
.nb-tech { display: grid; gap: 2.5rem; }
@media (min-width: 1024px) { .nb-tech { grid-template-columns: .9fr 1.1fr; gap: 4rem; align-items: start; } }
.nb-tech .nb-head { margin-bottom: 0; }
.nb-tech .nb-lead { margin-top: 1rem; }
.nb-brochures { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 2rem; }
.nb-alt-link { font-size: .9rem; color: var(--c-text-muted); text-decoration: underline; text-underline-offset: 4px; }
.nb-alt-link:hover { color: var(--c-text); }
.nb-tech-list { margin: 0; border-top: 1px solid var(--c-border); }
.nb-tech-list > div {
    display: grid;
    gap: .25rem 2rem;
    padding-block: 1.1rem;
    border-bottom: 1px solid var(--c-border);
}
@media (min-width: 640px) { .nb-tech-list > div { grid-template-columns: 11rem 1fr; } }
.nb-tech-list dt { color: var(--c-text-muted); font-size: .9rem; }
.nb-tech-list dd { margin: 0; font-weight: 600; text-align: start; }

/* ------------------------------------------------------------------ apps */
.nb-apps { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .nb-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nb-app { padding: clamp(1.5rem, 3vw, 2.1rem); background: var(--c-surface); }
.nb-app-head { display: flex; align-items: center; gap: 1rem; }
.nb-app-head h3 { font-size: 1.35rem; }
.nb-app-audience { margin-top: .2rem; color: var(--c-text-muted); font-size: .9rem; }
.nb-app--staff .nb-module-icon { color: var(--c-secondary); background: color-mix(in srgb, var(--c-secondary) 12%, transparent); border-color: color-mix(in srgb, var(--c-secondary) 28%, transparent); }
.nb-app ul { list-style: none; margin: 1.35rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--c-border); display: grid; gap: .65rem; }
.nb-app li { display: flex; gap: .65rem; line-height: 1.55; }
.nb-limits {
    margin-top: 1.25rem;
    display: grid;
    gap: .9rem 2rem;
    align-items: start;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--c-secondary) 30%, var(--c-border));
    background: color-mix(in srgb, var(--c-secondary) 7%, transparent);
}
@media (min-width: 900px) { .nb-limits { grid-template-columns: 14rem 1fr; } }
.nb-limits h3 { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.nb-limits h3 svg { color: var(--c-secondary); }
.nb-limits ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem 1.75rem; }
@media (min-width: 1100px) { .nb-limits ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nb-limits li { position: relative; padding-inline-start: 1rem; color: var(--c-text-muted); line-height: 1.55; font-size: .95rem; }
.nb-limits li::before { content: ''; position: absolute; inset-inline-start: 0; top: .6em; width: .4rem; height: .4rem; transform: rotate(45deg); background: var(--c-secondary); }

/* -------------------------------------------------------- sample results */
/* Same chart family as the KN Phone case study. Series colours are the first
   three slots of the validated categorical palette, stepped per theme and
   checked against this page's chart surfaces (dark #080E1B, light #F4F6FA)
   for colour-blind and normal-vision separation. */
:root { --nbc-p1: #3987e5; --nbc-p2: #d95926; --nbc-p3: #199e70; }
:root[data-theme='light'] { --nbc-p1: #2a78d6; --nbc-p2: #eb6834; --nbc-p3: #1baf7a; }
@media (prefers-color-scheme: light) {
    :root[data-theme='system'] { --nbc-p1: #2a78d6; --nbc-p2: #eb6834; --nbc-p3: #1baf7a; }
}
.nbc-s1 { --nbc-c: var(--nbc-p1); }
.nbc-s2 { --nbc-c: var(--nbc-p2); }
.nbc-s3 { --nbc-c: var(--nbc-p3); }

.nb-sample {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .85rem;
    max-width: 66rem; margin: 0 0 clamp(2rem, 4vw, 3rem); padding: 1rem 1.15rem;
    border: 1px solid color-mix(in srgb, var(--c-primary) 35%, var(--c-border));
    border-radius: calc(var(--radius) * .6);
    background: color-mix(in srgb, var(--c-primary) 8%, transparent);
    color: var(--c-text-muted); font-size: .95rem; line-height: 1.65;
}
.nb-sample span:last-child { flex: 1 1 22rem; }
.nb-sample-tag {
    flex: none; padding: .2rem .65rem; border-radius: 99px; border: 1px solid var(--c-border);
    background: var(--c-bg); color: var(--c-text);
    font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
}
html[dir='rtl'] .nb-sample-tag { font-family: inherit; letter-spacing: 0; font-size: .8rem; font-weight: 700; }

.nb-results { display: grid; gap: clamp(2.75rem, 5vw, 4rem); }
.nb-result-title { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; font-size: 1.3rem; }
.nb-result-title svg { color: var(--c-primary); }
.nb-charts { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
@media (min-width: 960px) { .nb-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nb-result-note { margin-top: .9rem; color: var(--c-text-muted); font-size: .9rem; line-height: 1.6; }

/* headline figures */
.nbc-tiles {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden;
    border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-border);
}
@media (min-width: 900px) { .nbc-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.nbc-tile { padding: 1.05rem 1.25rem; background: var(--c-bg); }
.nbc-tile dt { color: var(--c-text-muted); font-size: .85rem; line-height: 1.4; }
.nbc-tile dd { margin: .4rem 0 0; }
.nbc-tile-value { display: block; color: var(--c-text); font-family: var(--font-display); font-weight: 700; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.15; text-align: start; }
.nbc-tile-note { display: block; margin-top: .25rem; color: var(--c-text-muted); font-size: .8rem; }

/* chart card */
.nbc {
    --grid: color-mix(in srgb, var(--c-text) 10%, transparent);
    --axis: color-mix(in srgb, var(--c-text) 24%, transparent);
    min-width: 0; margin: 0; padding: 1.25rem 1.25rem 1.05rem;
    border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-bg);
}
.nbc-head { display: flex; flex-direction: column; gap: .2rem; }
.nbc-title { color: var(--c-text); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.nbc-sub { color: var(--c-text-muted); font-size: .82rem; line-height: 1.45; }
.nbc-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .8rem 0 0; padding: 0; list-style: none; color: var(--c-text-muted); font-size: .82rem; }
.nbc-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.nbc-key { width: .7rem; height: .7rem; border-radius: 3px; background: var(--nbc-c); }

/* columns: the plot reads left to right in both languages, like the ERP's own charts */
.nbc-plot { position: relative; height: 13rem; margin-top: 1.35rem; }
.nbc-grid, .nbc-cols { position: absolute; inset: 0 0 0 3.4rem; }
.nbc-grid span { position: absolute; left: 0; right: 0; bottom: var(--y); border-top: 1px solid var(--grid); }
.nbc-grid span:first-child { border-top-color: var(--axis); }
.nbc-grid b {
    position: absolute; right: calc(100% + .55rem); bottom: -.45em;
    color: var(--c-text-muted); font-family: var(--font-mono); font-size: .68rem; font-weight: 400; line-height: 1;
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
html[dir='rtl'] .nbc-grid b { font-family: inherit; font-size: .66rem; }
.nbc-cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.nbc-col { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; border-radius: 8px; outline: none; }
.nbc-col::before { content: ''; position: absolute; inset: -.35rem .1rem 0; border-radius: 8px; background: transparent; transition: background-color .15s ease; }
.nbc-col:hover::before, .nbc-col:focus-visible::before { background: color-mix(in srgb, var(--c-text) 6%, transparent); }
.nbc-col:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }
.nbc-stack { position: relative; display: flex; flex-direction: column-reverse; gap: 2px; width: min(22px, 62%); height: var(--h); }
.nbc-seg { flex: var(--w) 1 0px; min-height: 2px; background: var(--nbc-c); }
.nbc-stack .nbc-seg:last-child { border-radius: 4px 4px 0 0; }
.nbc-group { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.nbc-bar { position: relative; width: 22px; height: var(--h); border-radius: 4px 4px 0 0; background: var(--nbc-c); }
.nbc--grouped .nbc-bar { width: 11px; }
.nbc-val, .nbc-cap {
    position: absolute; left: 50%; transform: translateX(-50%);
    color: var(--c-text); font-size: .74rem; font-weight: 700; line-height: 1; white-space: nowrap;
}
.nbc-val { bottom: calc(var(--h) + .4rem); }
.nbc-cap { bottom: calc(100% + .4rem); }
.nbc-col--last .nbc-val, .nbc-col--last .nbc-cap { left: auto; right: 0; transform: none; }
.nbc-x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: .5rem 0 0 3.4rem; color: var(--c-text-muted); font-size: .66rem; text-align: center; }
.nbc-x span { white-space: nowrap; overflow: hidden; }
@media (max-width: 560px) {
    .nbc { padding-inline: .85rem; }
    .nbc-x { font-size: .55rem; letter-spacing: -.02em; }
    .nbc-grid, .nbc-cols { inset-inline-start: 2.9rem; }
    .nbc-x { margin-left: 2.9rem; }
    .nbc--grouped .nbc-bar { width: 7px; }
    .nbc-stack, .nbc-bar { width: min(16px, 64%); }
}

/* readout on hover and keyboard focus; the same numbers are in the table */
.nbc-tip {
    position: absolute; z-index: 5; bottom: calc(100% + .6rem); left: 50%; min-width: 8.5rem;
    padding: .55rem .7rem; border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-surface-raised); box-shadow: 0 14px 30px -14px rgba(3, 8, 20, .55);
    color: var(--c-text-muted); font-size: .76rem; line-height: 1.45; text-align: start; white-space: nowrap;
    opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity .15s ease;
}
html[dir='rtl'] .nbc-tip { direction: rtl; text-align: right; }
.nbc-col--first .nbc-tip { left: 0; transform: none; }
.nbc-col--last .nbc-tip { left: auto; right: 0; transform: none; }
.nbc-col:hover .nbc-tip, .nbc-col:focus-visible .nbc-tip { opacity: 1; }
.nbc-tip strong { display: block; color: var(--c-text); font-size: .95rem; }
.nbc-tip em { display: block; font-style: normal; }
.nbc-tip-row { display: flex; align-items: center; gap: .45rem; margin-top: .2rem; color: var(--c-text); }
.nbc-tip-row small { color: var(--c-text-muted); font-size: .72rem; }
.nbc-line { width: .8rem; height: 2px; border-radius: 2px; background: var(--nbc-c); }

/* horizontal bars: bars grow from the reading edge */
.nbc-rows { display: grid; gap: .5rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.nbc-rows li { display: grid; grid-template-columns: minmax(6.5rem, 34%) 1fr; align-items: center; gap: .75rem; padding: .15rem .3rem; border-radius: 6px; outline: none; font-size: .86rem; }
.nbc-rows li:hover, .nbc-rows li:focus-visible { background: color-mix(in srgb, var(--c-text) 6%, transparent); }
.nbc-rows li:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.nbc-row-label { overflow: hidden; color: var(--c-text); text-overflow: ellipsis; white-space: nowrap; }
.nbc-track { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.nbc-hbar { flex: none; width: calc(var(--w) * .82); min-width: 2px; height: 14px; border-radius: 0 4px 4px 0; background: var(--nbc-c); }
html[dir='rtl'] .nbc-hbar { border-radius: 4px 0 0 4px; }
.nbc-track b { color: var(--c-text); font-size: .8rem; font-weight: 700; }

/* the numbers behind each chart */
.nbc-data { margin-top: .95rem; font-size: .85rem; }
.nbc-data summary { display: inline-flex; align-items: center; gap: .4rem; color: var(--c-text-muted); cursor: pointer; border-radius: 6px; }
.nbc-data summary:hover { color: var(--c-text); }
.nbc-data summary:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }
.nbc-scroll { margin-top: .6rem; overflow-x: auto; }
.nbc-data table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.nbc-data th, .nbc-data td { padding: .4rem .55rem; border-bottom: 1px solid var(--c-border); text-align: end; white-space: nowrap; }
.nbc-data thead th { color: var(--c-text-muted); font-size: .78rem; font-weight: 600; }
.nbc-data th[scope='row'], .nbc-data thead th:first-child { text-align: start; font-weight: 600; }

/* Chart cards: raised on a plain section, page-coloured on a tinted band.
   The palette is validated against both pairs of surfaces. */
.nbc, .nbc-tile { background: var(--c-surface); }
/* Tooltips rise above the plot but never push the page sideways on a phone. */
.nbc { overflow-x: clip; }
.nb-band .nbc, .nb-band .nbc-tile { background: var(--c-bg); }

/* -------------------------------------------------- grouped tour tabs */
/* Seventeen screens in three rows (one per area) instead of one long strip. */
.nb-tour-tabs {
    display: grid; gap: .75rem; overflow: visible; padding: 0; margin-bottom: 1.75rem;
    border: 0; border-radius: 0; background: none;
}
.nb-tour-tabs[hidden] { display: none; }
.nb-tab-row { display: grid; gap: .5rem; align-items: center; min-width: 0; }
@media (min-width: 900px) { .nb-tab-row { grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; } }
.nb-tab-group {
    font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-text-muted);
}
html[dir='rtl'] .nb-tab-group { font-family: inherit; letter-spacing: 0; font-size: .85rem; font-weight: 700; }
.nb-tab-list { display: flex; flex-wrap: wrap; gap: .4rem; min-width: 0; }
@media (max-width: 899px) {
    .nb-tab-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .nb-tab-list::-webkit-scrollbar { display: none; }
}
.nb-tour-tabs .nb-tab { border: 1px solid var(--c-border); background: var(--c-bg); padding: .5rem .85rem; font-size: .85rem; }
.nb-tour-tabs .nb-tab:hover { border-color: color-mix(in srgb, var(--c-primary) 45%, var(--c-border)); }
.nb-tour-tabs .nb-tab[aria-selected='true'] { border-color: var(--c-primary); background: var(--c-primary); }

/* ---------------------------------------------------- finance in depth */
.nb-fin-flow {
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem); padding: 1.1rem 1.25rem;
    border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-bg);
}
.nb-fin-flow-title { font-size: .8rem; font-weight: 600; color: var(--c-text-muted); font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
html[dir='rtl'] .nb-fin-flow-title { font-family: inherit; letter-spacing: 0; font-size: .9rem; }
.nb-fin-flow ol { list-style: none; margin: .85rem 0 0; padding: 0; display: grid; gap: .55rem; }
@media (min-width: 720px)  { .nb-fin-flow ol { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .nb-fin-flow ol { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.nb-fin-flow li { position: relative; display: flex; align-items: center; gap: .6rem; font-size: .92rem; line-height: 1.35; color: var(--c-text); }
.nb-fin-flow-num {
    flex: none; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
    font-family: var(--font-mono); font-size: .75rem; font-weight: 700; color: var(--c-button-text, #fff);
    background: linear-gradient(140deg, var(--c-primary), var(--c-primary-deep));
}
.nb-fin { display: grid; gap: clamp(3rem, 7vw, 5rem); }
.nb-fin-item { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 1024px) {
    .nb-fin-item { grid-template-columns: .95fr 1.05fr; gap: 3.5rem; }
    .nb-fin-item--flip .nb-fin-copy { order: 2; }
}
.nb-fin-copy h3 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
.nb-fin-copy ul { list-style: none; margin: 1.35rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--c-border); display: grid; gap: .7rem; }
.nb-fin-copy li { display: flex; gap: .65rem; line-height: 1.55; }
.nb-fin-visual { margin: 0; }
.nb-note-inline { margin-top: .6rem; color: var(--c-text-muted); font-size: .78rem; }
.nb-fin-more-title { margin: clamp(3rem, 6vw, 4.5rem) 0 1.5rem; font-size: 1.3rem; }

/* ----------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
    .nb-frame--float, .nb-tour.is-tabbed .nb-panel:not([hidden]) { animation: none; }
    .nbc-tip, .nbc-col::before { transition: none; }
}
