/*
 * Global Surat brand layer.
 *
 * Loaded after every other stylesheet, so it only has to state what carries the
 * brand: surfaces, chrome and accents. It deliberately leaves the semantic
 * palettes alone — the ROAS bands, the sessions heat scale, delta arrows and
 * notice tones all mean something by their colour, and recolouring them to the
 * brand would destroy the meaning and collide with the accent besides.
 */

:root {
    --brand: #e66624;
    --brand-deep: #c4501a;
    --brand-dark: #93380d;
    --brand-mid: #f0864a;
    --brand-soft: #f7b48d;
    --brand-pale: #fdeee5;
    --brand-tint: rgba(230, 102, 36, .1);
    --brand-line: rgba(230, 102, 36, .22);

    /* Warm neutrals, so the orange sits on a surface that belongs with it. */
    --brand-ink: #2c1d15;
    --brand-soft-ink: #7c6a5f;
    --brand-page: #f7f3f0;

    /* Tokens the shared experience layer already reads. */
    --mp-accent: var(--brand-deep);
    --mp-accent-2: var(--brand-soft);
    --mp-warm: #e3a06e;
    --mp-ink: var(--brand-ink);
    --mp-soft-ink: var(--brand-soft-ink);
    --mp-card-shadow: 0 20px 45px rgba(88, 52, 30, .09), 0 3px 10px rgba(88, 52, 30, .05);
}

/* --- page ground -------------------------------------------------------- */

html { background: var(--brand-page); }
body {
    background:
        radial-gradient(circle at var(--mp-pointer-x, 82%) var(--mp-pointer-y, 7%), rgba(247, 200, 170, .6), transparent 30rem),
        radial-gradient(circle at 16% 52%, rgba(238, 228, 220, .58), transparent 26rem),
        radial-gradient(circle at 74% 104%, rgba(250, 214, 186, .5), transparent 30rem),
        var(--brand-page);
}
.ambient-one { background: #e66624; }
.ambient-two { background: #c4501a; }
::selection { color: #fff; background: var(--brand-deep); }
* { scrollbar-color: rgba(230, 102, 36, .34) transparent; }

/* --- sidebar and identity ----------------------------------------------- */

.sidebar {
    border-right-color: rgba(255, 255, 255, .84);
    background: linear-gradient(160deg, rgba(255, 253, 251, .93), rgba(250, 243, 238, .8));
    box-shadow: 14px 0 44px rgba(88, 52, 30, .06);
}
.brand {
    gap: 0;
    padding: 0 4px;
}
.brand-mark {
    background: linear-gradient(145deg, var(--brand-deep), var(--brand) 68%, var(--brand-mid));
    box-shadow: 0 12px 24px rgba(230, 102, 36, .26), inset 0 1px 1px rgba(255, 255, 255, .32);
}
.nav-item.active {
    color: var(--brand-dark);
    background: linear-gradient(90deg, rgba(230, 102, 36, .16), rgba(230, 102, 36, .03));
    border-color: rgba(230, 102, 36, .2);
}
.nav-item.active .nav-icon,
.nav-icon { color: var(--brand-deep); }
.nav-item::after { background: var(--brand); }
.nav-item:hover { color: var(--brand-dark); background: rgba(230, 102, 36, .07); }

/* --- topbar ------------------------------------------------------------- */

.topbar {
    background: linear-gradient(180deg, rgba(247, 243, 240, .92), rgba(247, 243, 240, .72) 72%, transparent);
}
.account-avatar {
    color: #fff;
    background: linear-gradient(140deg, var(--brand-deep), var(--brand-mid));
    box-shadow: 0 9px 20px rgba(230, 102, 36, .24);
}

/* --- controls ----------------------------------------------------------- */

.primary-button {
    border-color: var(--brand-deep);
    background: linear-gradient(140deg, var(--brand-deep), var(--brand-mid));
    box-shadow: 0 10px 22px rgba(230, 102, 36, .24), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.primary-button:hover { filter: brightness(1.06); }
.filter-control select:focus,
.filter-control input:focus,
.dialog-field select:focus,
.pivot-search:focus,
.lb-search:focus {
    border-color: var(--brand-line);
    box-shadow: 0 0 0 3px rgba(230, 102, 36, .12);
}
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
.checkbox-control .switch input:checked + i { background: rgba(230, 102, 36, .26); }
.checkbox-control .switch input:checked + i::after { background: var(--brand-deep); }
.checkbox-control .switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(230, 102, 36, .18); }

/* --- panel headers ------------------------------------------------------ */

.pivot-head,
.traffic-pivot .pivot-head {
    background: linear-gradient(120deg, var(--brand-dark), var(--brand-deep) 58%, var(--brand) 130%);
}
.pivot-icon {
    background: rgba(255, 255, 255, .16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
.pivot-head .secondary-button { color: var(--brand-deep); }

/* --- cards and hover ---------------------------------------------------- */

.filter-bar, .panel, .kpi-card, .summary-item,
.podium, .client-card, .admin-card, .sync-card, .admin-summary .stat {
    box-shadow: inset 0 0 0 1px rgba(120, 74, 44, .05), var(--mp-card-shadow);
}
.panel:not(.pivot-panel):not(.monthly-panel):not(.campaign-panel):not(.lb-panel):hover,
.summary-item:hover, .podium:hover,
.client-card:hover, .admin-card:hover, .sync-card:hover, .admin-summary .stat:hover {
    border-color: rgba(230, 102, 36, .3);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .62), 0 24px 50px rgba(88, 52, 30, .13);
}
.summary-item.accent { border-color: var(--brand-line); }
.summary-item.accent strong { color: var(--brand-deep); }

/* --- KPI accents, gauge and chart series -------------------------------- */

/* The card classes are colour labels, not meanings, so they become a warm ramp
   that still tells the five cards apart. Overridden per class rather than by
   redefining --green and --blue, because those tokens also carry the status
   dots and the ROAS bands, which must stay green. */
.kpi-card.purple { --accent: #93380d; }
.kpi-card.blue { --accent: var(--brand-deep); }
.kpi-card.green { --accent: var(--brand); }
.kpi-card.amber { --accent: var(--brand-mid); }
.kpi-card.cyan { --accent: #d98b5e; }
.kpi-card.red { --accent: #b03a1a; }

.gauge { background: conic-gradient(var(--brand) var(--gauge), #ece3dd var(--gauge)); box-shadow: 0 12px 30px rgba(230, 102, 36, .16); }
.gauge-inner { background: #fffaf6; }
.mini-meter { background: #eee5df; }
.mini-meter i { background: var(--brand); }

/* Segmented filters are chrome, not status: the WIN / LOSS / TESTING badges keep
   their own colours, but the selected segment wears the brand. */
.seg { background: #f4ece7; border-color: rgba(120, 92, 70, .1); }
.seg button b { color: var(--brand-dark); background: rgba(230, 102, 36, .1); }
.seg button:hover { color: var(--brand-dark); }
.seg button.active { color: #fff; background: var(--brand-deep); box-shadow: 0 6px 14px rgba(230, 102, 36, .2); }
.seg button.active b { color: #fff; background: rgba(255, 255, 255, .22); }

.legend-spend, .fallback-spend { background: var(--brand); }
.legend-revenue, .fallback-revenue { background: #93380d; }
.fallback-spend { background: linear-gradient(180deg, var(--brand), var(--brand-soft)); }
.fallback-revenue { background: linear-gradient(180deg, #93380d, #c87a55); }
.line-spend { stroke: var(--brand); }
.line-revenue { stroke: #93380d; }
.date-preview strong { color: var(--brand-deep); }
.app-shell .kpi-card:hover { border-color: rgba(230, 102, 36, .22); }

/* --- chrome details ----------------------------------------------------- */

.mp-scroll-progress {
    background: linear-gradient(90deg, var(--brand-dark), var(--brand) 68%, var(--brand-soft));
    box-shadow: 0 2px 10px rgba(230, 102, 36, .24);
}
.mp-scroll-hint {
    color: var(--brand-dark);
    background: rgba(253, 238, 229, .9);
    border-top-color: rgba(230, 102, 36, .1);
}
.mp-sidebar-scrim { background: rgba(58, 34, 20, .26); }
.live-pill {
    color: var(--brand-dark);
    background: rgba(253, 238, 229, .86);
    border-color: rgba(230, 102, 36, .18);
}
.metric-note.warn { color: var(--brand-deep); }

/* --- Meta data-source identity ----------------------------------------- */

/* Official source artwork is rendered without the screenshot preview canvas.
   Never recolor, stretch, fade, shadow, or otherwise restyle either logo. */
.meta-mark { display: block; width: 29px; height: 19px; object-fit: contain; }
.meta-status-heading { gap: 7px; }
.meta-status-heading .meta-mark { width: 25px; height: 16px; }
.meta-status-heading .status-dot { margin-left: auto; }
.meta-live-pill { gap: 7px; }
.meta-live-pill .meta-mark { width: 25px; height: 16px; }
.meta-avatar {
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(8,102,255,.13);
    box-shadow: 0 9px 20px rgba(8,102,255,.12), inset 0 1px 0 rgba(255,255,255,.8);
}
.meta-avatar .meta-mark { width: 29px; height: 18px; }
.kpi-source-mark {
    position: absolute; z-index: 2; top: 18px; right: 17px;
    width: 29px; height: 18px; object-fit: contain;
}
.kpi-source-mark + .kpi-label { padding-right: 36px; }
.meta-source-tag { display: inline-flex; align-items: center; gap: 4px; color: #0866ff; border-color: rgba(8,102,255,.16); background: rgba(8,102,255,.045); }
.meta-source-tag img { width: 16px; height: 10px; }
.meta-eyebrow, .meta-inline-source { display: flex; align-items: center; gap: 6px; }
.meta-eyebrow img { width: 20px; height: 13px; }
.meta-inline-source img { width: 18px; height: 12px; }
.meta-notice-source { display: flex; align-items: flex-start; gap: 10px; line-height: 1.45; }
.meta-notice-source img { flex: none; width: 25px; height: 16px; margin-top: 1px; }

/* --- Shopify data-source identity -------------------------------------- */

/* The supplied Shopify asset is the official full-color primary lockup. */
.shopify-mark { display: block; width: 64px; height: 18px; object-fit: contain; }
.shopify-status-heading { gap: 7px; }
.shopify-status-heading .shopify-mark { width: 58px; height: 17px; }
.shopify-status-heading .status-dot { margin-left: auto; }
.shopify-live-pill { gap: 7px; }
.shopify-live-pill .shopify-mark { width: 54px; height: 16px; }
.shopify-avatar {
    width: 76px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(94,142,62,.16);
    box-shadow: 0 9px 20px rgba(94,142,62,.13), inset 0 1px 0 rgba(255,255,255,.82);
}
.shopify-avatar .shopify-mark { width: 62px; height: 18px; }
.shopify-eyebrow,
.shopify-inline-source,
.shopify-footer-source { display: flex; align-items: center; gap: 6px; }
.shopify-eyebrow img { width: 58px; height: 17px; }
.shopify-inline-source img { flex: none; width: 64px; height: 18px; }
.shopify-footer-source { align-items: flex-start; }
.shopify-footer-source img { flex: none; width: 80px; height: 23px; margin-top: -3px; }
.summary-item { position: relative; }
.summary-source-mark,
.city-source-mark {
    position: absolute; z-index: 2; top: 13px; right: 14px;
    width: 58px; height: 17px; object-fit: contain;
}
.summary-source-mark + span,
.city-source-mark + span { display: block; padding-right: 66px; }
.city-source-mark { top: 14px; right: 16px; }
.loading-source-mark {
    display: block; width: 124px; height: 36px; margin-bottom: 12px;
    animation: mp-source-float 1.8s ease-in-out infinite;
}

/* --- mixed Meta + Shopify integration surfaces ------------------------- */

.integration-status-heading,
.integration-eyebrow,
.source-heading,
.source-pill,
.meta-row-source { display: flex; align-items: center; gap: 6px; }
.integration-status-heading .status-dot { margin-left: auto; }
.integration-source-pair { display: inline-flex; align-items: center; gap: 5px; min-width: 87px; }
.integration-source-pair .meta-mark { width: 22px; height: 14px; }
.integration-source-pair .shopify-mark { width: 58px; height: 17px; }
.integration-eyebrow .integration-source-pair { margin-right: 1px; }
.source-pill img { flex: none; width: 54px; height: 16px; object-fit: contain; }
.source-pill img.meta-mark { width: 20px; height: 13px; }
.source-heading img { flex: none; width: 58px; height: 17px; object-fit: contain; }
.source-heading img.meta-mark { width: 24px; height: 15px; }

/* The Google marks are square glyphs rather than wordmarks like Shopify's, so they
   are sized on their own rather than inheriting a 58px-wide box. */
.google-ads-mark,
.analytics-mark { display: block; flex: none; width: 18px; height: 18px; object-fit: contain; }
.source-heading img.google-ads-mark,
.source-heading img.analytics-mark { width: 17px; height: 17px; }
.source-pill img.google-ads-mark,
.source-pill img.analytics-mark { width: 14px; height: 14px; }
/* Marks sit in the tile's own mark row (see .stat-mark in admin.css) rather than
   being pinned over the corner, so a long label can never run under one. */
.integration-stat-mark {
    display: block; flex: none;
    width: 58px; height: 17px; object-fit: contain; object-position: left center;
}
.integration-stat-mark.meta-mark { width: 25px; height: 16px; }
.integration-stat-mark.google-ads-mark,
.integration-stat-mark.analytics-mark { width: 17px; height: 17px; }

/* Meta marks inside data generated by the leaderboard are deliberately small:
   they identify provenance without competing with ranks or performance state. */
.table-source-mark { display: inline-block; width: 17px; height: 11px; margin-right: 4px; vertical-align: -1px; }
.card-source-mark {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 23px; height: 15px; object-fit: contain;
}
.podium, .client-card, .sync-card, .kpi-mini { position: relative; }
.podium .card-source-mark { right: 11px; }
.sync-card > .card-source-mark { right: 40px; }
.kpi-mini .card-source-mark { top: 12px; right: 12px; width: 22px; height: 14px; }
.kpi-mini .card-source-mark + span { padding-right: 27px; }
.meta-row-source { color: inherit; }
.meta-row-source .meta-mark { flex: none; width: 19px; height: 12px; }

@keyframes mp-source-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 720px) {
    .kpi-source-mark { top: 17px; right: 15px; width: 26px; }
    .summary-source-mark, .city-source-mark { right: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-source-mark { animation: none; }
}

/* Informational notices were tinted to the old accent; keep them quiet and warm
   so only genuine errors carry colour. */
.notice.info {
    color: #6d5a4d;
    background: rgba(240, 233, 227, .82);
    border-color: rgba(120, 92, 70, .14);
}

/* --- the logo ----------------------------------------------------------- */

.brand {
    display: block;
    min-width: 0;
    /* The sidebar is a column flex container and .brand carries an explicit
       min-height, which lets it compress on a short viewport while the logo keeps
       its natural size and spills over the nav. Pin it instead. */
    flex: none;
}
/* Keep the persistent controls visible. Only the route list scrolls, so the
   connection state, account utilities and sign-out action never fall below the
   viewport on a short laptop screen. */
.sidebar {
    gap: 14px;
    padding: 18px 14px 12px;
    overflow: hidden;
    overscroll-behavior: contain;
}
.sidebar .nav-list {
    flex: 1 1 auto;
    min-height: 0;
    margin-right: -5px;
    padding: 2px 7px 8px 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.sidebar .nav-item { min-height: 33px; }
.sidebar .nav-group + .nav-group { margin-top: 6px; }
.sidebar .nav-group-title { margin-bottom: 2px; }
.sidebar .nav-list::-webkit-scrollbar { width: 6px; }
.sidebar .nav-list::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav-list::-webkit-scrollbar-thumb {
    background: rgba(230, 102, 36, .25);
    border: 1px solid transparent;
    border-radius: 99px;
    background-clip: padding-box;
}
.sidebar-spacer { display: none; }
.sidebar .api-status-card,
.sidebar .nav-utility,
.sidebar .nav-account { flex: none; }
.sidebar .nav-account { margin-top: 0; }
.brand-logo {
    display: block;
    width: 100%;
    max-width: 158px;
    height: auto;
    /* assets/img/logo.png is the export trimmed to its own artwork, so the box it
       reserves is the mark itself rather than a square of empty margin — which is
       what made it collide with the nav underneath. */
    margin: 4px auto 2px;
}
.brand-logo-fallback { display: flex; align-items: center; gap: 11px; }
.brand-wordmark { display: grid; line-height: 1.05; }
.brand-wordmark strong { font-size: 19px; font-weight: 700; letter-spacing: -.4px; color: var(--brand-ink); }
.brand-wordmark span {
    color: var(--brand);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 2.4px;
    text-transform: uppercase;
}
.brand-tagline {
    margin: 6px 8px 0;
    color: var(--brand);
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.35;
}

/* Compact vertical rhythm without removing any information. */
@media (max-height: 780px) {
    .sidebar { gap: 7px; padding-top: 10px; padding-bottom: 8px; }
    .brand-logo { max-width: 126px; margin-top: 0; }
    .sidebar .nav-group + .nav-group { margin-top: 3px; }
    .sidebar .nav-item { min-height: 29px; }
    .sidebar .api-status-card { padding: 10px 11px; }
    .sidebar .status-copy { margin-top: 6px; }
    .sidebar .nav-account { padding-block: 6px; }
}

.mp-sidebar-close { display: none; }

@media (max-width: 980px) {
    .sidebar {
        left: 0;
        width: min(288px, calc(100vw - 44px));
        height: 100vh;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform .25s ease;
    }
    .sidebar.open { left: 0; transform: translateX(0); }
    .brand-logo { max-width: 165px; }
    .mp-sidebar-close {
        position: absolute;
        z-index: 2;
        top: 10px;
        right: 10px;
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        padding: 0;
        color: #7c6a5f;
        background: rgba(255, 255, 255, .78);
        border: 1px solid rgba(120, 92, 70, .14);
        border-radius: 10px;
        font-size: 22px;
        line-height: 1;
        box-shadow: 0 5px 15px rgba(88, 52, 30, .08);
    }
    .mp-sidebar-close:hover { color: var(--brand-dark); background: #fff; }
    body.mp-sidebar-open { overflow: hidden; }
}

@media (max-width: 980px) and (max-height: 780px) {
    .brand-logo { max-width: 126px; }
}
