/* =========================================================================
   Botmust design system
   Soft off-white canvas, white cards, indigo and violet accents.
   ========================================================================= */

/* The hidden attribute must always win. Any element with its own display
   value — flex options, grid rows — otherwise stays visible after script
   hides it, which is how the account search "filtered" without filtering. */
[hidden] { display: none !important; }

:root {
    /* surfaces */
    --canvas:      #F4F5FA;
    --canvas-2:    #EBEEF7;
    --surface:     #FFFFFF;
    --surface-2:   #FAFBFE;
    --surface-3:   #F5F7FC;
    --line:        #E7EAF3;
    --line-2:      #F0F2F9;

    /* type */
    --ink:         #141829;
    --ink-2:       #4C5470;
    --ink-3:       #838CA9;
    --ink-4:       #A9B1C7;

    /* accents */
    --indigo:      #4B47E8;
    --indigo-2:    #6F6AFF;
    --indigo-soft: #EDECFF;
    --violet:      #8B5CF6;
    --violet-soft: #F4EEFF;
    --mint:        #0F9E7B;
    --mint-soft:   #E3F6F0;
    --coral:       #EE5F55;
    --coral-soft:  #FFEBE9;
    --amber:       #DF9722;
    --amber-soft:  #FFF3E0;
    --sky:         #2E7DF0;
    --sky-soft:    #E9F1FE;

    /* radii */
    --r-xs:  8px;
    --r-sm:  11px;
    --r:     14px;
    --r-lg:  20px;
    --r-xl:  26px;
    --r-pill: 999px;

    /* shadows */
    --sh-xs: 0 1px 2px rgba(20, 24, 41, .04);
    --sh-sm: 0 1px 2px rgba(20, 24, 41, .04), 0 4px 14px rgba(20, 24, 41, .045);
    --sh-md: 0 2px 6px rgba(20, 24, 41, .05), 0 12px 32px rgba(20, 24, 41, .07);
    --sh-lg: 0 24px 64px rgba(20, 24, 41, .16);

    /* type families */
    --font-display: 'Familjen Grotesk', 'Segoe UI', system-ui, sans-serif;
    --font-sans:    'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;

    --sidebar-w: 254px;
    --gutter: 26px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--canvas);
    color: var(--ink-2);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.015em;
    font-weight: 600;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection { background: var(--indigo-soft); color: var(--indigo); }

/* thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: #D6DBE8 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #D6DBE8; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #C2C9DC; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   Shell
   ========================================================================= */

.shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 16px; left: 16px; bottom: 16px;
    width: var(--sidebar-w);
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-sm);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 22px 20px 18px;
}

.brand-mark {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--indigo-2), var(--violet) 92%);
    display: grid; place-items: center;
    box-shadow: 0 6px 16px rgba(75, 71, 232, .28);
    flex: none;
}

.brand-name {
    display: block;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: var(--ink-4);
    letter-spacing: .02em;
}

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 12px;
}

.nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: 18px 10px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
    position: relative;
    transition: background .15s ease, color .15s ease;
}

.nav-item svg { flex: none; width: 18px; height: 18px; stroke-width: 1.7; }

.nav-item:hover { background: var(--surface-3); color: var(--ink); }

.nav-item.is-active {
    background: var(--indigo-soft);
    color: var(--indigo);
    font-weight: 600;
}

.nav-item.is-active::before {
    content: '';
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--indigo);
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    background: var(--surface-3);
    border-radius: var(--r-pill);
    padding: 1px 8px;
}

.nav-item.is-active .nav-count { background: #fff; color: var(--indigo); }

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--line-2);
}

.sync-card {
    background: var(--surface-2);
    border-radius: var(--r);
    padding: 12px 13px;
}

.sync-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-2);
    padding: 3px 0;
}

.sync-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 3px var(--mint-soft);
    flex: none;
}
.sync-dot.is-warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.sync-dot.is-off  { background: var(--ink-4); box-shadow: 0 0 0 3px var(--line); }

.sync-time { margin-left: auto; font-size: 11px; color: var(--ink-4); }

/* main column ------------------------------------------------------------ */

.main {
    margin-left: calc(var(--sidebar-w) + 32px);
    padding: 0 var(--gutter) 44px;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 0 14px;
    background: linear-gradient(var(--canvas) 78%, rgba(244, 245, 250, 0));
}

.search {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.search svg {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--ink-4);
    pointer-events: none;
}

.search input {
    width: 100%;
    height: 42px;
    border: 1px solid transparent;
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 0 16px 0 42px;
    font-size: 13.5px;
    box-shadow: var(--sh-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.search input::placeholder { color: var(--ink-4); }
.search input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--indigo-soft);
}

.topbar-spacer { flex: 1; }

.icon-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid transparent;
    box-shadow: var(--sh-xs);
    display: grid; place-items: center;
    color: var(--ink-2);
    cursor: pointer;
    position: relative;
    transition: color .15s ease, box-shadow .15s ease;
}
.icon-btn:hover { color: var(--ink); box-shadow: var(--sh-sm); }

.icon-btn .dot {
    position: absolute; top: 10px; right: 11px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--coral);
    border: 2px solid var(--surface);
}

/*
 * The bell carries both icon-btn (the round 42px button) and filter-btn
 * (which the dropdown JS binds to). filter-btn is a 38px flex box with
 * padding, and being later in this file it was winning — squashing the bell
 * into an off-centre ellipse. This settles it: the round button's geometry,
 * stated once, with enough specificity to end the argument.
 */
.icon-btn.filter-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid transparent;
    display: grid;
    place-items: center;
    gap: 0;
}
.icon-btn.filter-btn:hover { border-color: var(--line); }

/* a search field sitting on a white card head needs a visible boundary —
   surface-on-surface made it read as floating text */
.card-head .search input {
    background: var(--canvas-2);
    border-color: var(--line-2);
    box-shadow: none;
    height: 38px;
}
.card-head .search input:focus {
    background: var(--surface);
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--indigo-soft);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 5px 14px 5px 5px;
    box-shadow: var(--sh-xs);
    cursor: pointer;
    border: 1px solid transparent;
}
.user-chip:hover { box-shadow: var(--sh-sm); }

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex: none;
    letter-spacing: .01em;
}

.user-chip-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.user-chip-role { font-size: 11px; color: var(--ink-4); line-height: 1.2; }

/* page header ------------------------------------------------------------ */

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    margin: 10px 0 20px;
}

.page-title { font-size: 27px; line-height: 1.15; letter-spacing: -0.025em; }
.page-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }
.page-head-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-4);
    display: block;
    margin-bottom: 7px;
}

/* =========================================================================
   Filter bar
   ========================================================================= */

.filterbar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter {
    position: relative;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 13px;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease;
}
.filter-btn:hover { border-color: #D5DAE8; color: var(--ink); }
.filter-btn .caret { color: var(--ink-4); transition: transform .18s ease; }
.filter.is-open .filter-btn { border-color: var(--indigo); color: var(--ink); box-shadow: 0 0 0 3px var(--indigo-soft); }
.filter.is-open .caret { transform: rotate(180deg); }
.filter-btn.is-set { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); }
.filter-btn strong { font-weight: 600; color: var(--ink); }
.filter-btn.is-set strong { color: var(--indigo); }

.filter-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    min-width: 216px;
    background: var(--surface);
    border-radius: var(--r);
    box-shadow: var(--sh-md);
    border: 1px solid var(--line-2);
    padding: 7px;
    z-index: 60;
    display: none;
    max-height: 380px;
    overflow-y: auto;
}
.filter.is-open .filter-menu { display: block; animation: pop .16s ease; }
.filter-menu.align-right { left: auto; right: 0; }

@keyframes pop {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: var(--r-xs);
    font-size: 13px;
    color: var(--ink-2);
    background: none;
    border: 0;
    cursor: pointer;
}
.filter-option:hover { background: var(--surface-3); color: var(--ink); }
.filter-option.is-selected { background: var(--indigo-soft); color: var(--indigo); font-weight: 600; }
.filter-option .tick { margin-left: auto; opacity: 0; }
.filter-option.is-selected .tick { opacity: 1; }

.filter-sep { height: 1px; background: var(--line-2); margin: 6px 4px; }
.filter-note { font-size: 11px; color: var(--ink-4); padding: 4px 10px 8px; }

.custom-range { padding: 8px 10px 4px; display: grid; gap: 8px; }
.custom-range input {
    height: 36px; border: 1px solid var(--line); border-radius: var(--r-xs);
    padding: 0 10px; font-size: 13px; width: 100%; background: var(--surface-2);
}
.custom-range input:focus { outline: none; border-color: var(--indigo); background: #fff; }

/* only present while a filter is narrowing the view, so it should read as
   a real action rather than a faded placeholder */
.chip-clear {
    display: inline-flex; align-items: center; gap: 6px;
    height: 38px; padding: 0 14px;
    border-radius: var(--r-sm);
    background: var(--coral-soft); border: 1px solid transparent;
    color: var(--coral); font-size: 12.5px; font-weight: 600; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.chip-clear:hover {
    border-color: var(--coral);
    box-shadow: 0 6px 16px -10px rgb(238 95 85 / .5);
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: #D5DAE8; box-shadow: var(--sh-xs); }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #fff;
    box-shadow: 0 6px 16px rgba(75, 71, 232, .24);
}
.btn-primary:hover { background: #423ED6; border-color: #423ED6; box-shadow: 0 8px 20px rgba(75, 71, 232, .3); }

.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }

.btn-danger { color: var(--coral); border-color: var(--line); }
.btn-danger:hover { background: var(--coral-soft); border-color: var(--coral); }

.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* =========================================================================
   Cards
   ========================================================================= */

.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    position: relative;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 19px 22px 0;
}
.card-head.bordered { padding-bottom: 16px; border-bottom: 1px solid var(--line-2); }

.card-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 22px 22px; }
.card-body.flush { padding: 0; }
.card-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--line-2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 336px; }
.grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.stack { display: grid; gap: 20px; }

/* =========================================================================
   KPI tiles
   ========================================================================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
/* a fifth card fits on one row where there is room, wraps where not */
.kpi-grid:has(> .kpi:nth-child(5)) { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.kpi {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    padding: 18px 20px 14px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 132px;
}

.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }

.kpi-icon {
    width: 30px; height: 30px;
    border-radius: 9px;
    display: grid; place-items: center;
    background: var(--indigo-soft);
    color: var(--indigo);
    flex: none;
}
.kpi-icon.tone-violet { background: var(--violet-soft); color: var(--violet); }
.kpi-icon.tone-mint   { background: var(--mint-soft);   color: var(--mint); }
.kpi-icon.tone-amber  { background: var(--amber-soft);  color: var(--amber); }
.kpi-icon.tone-sky    { background: var(--sky-soft);    color: var(--sky); }
.kpi-icon.tone-coral  { background: var(--coral-soft);  color: var(--coral); }

.kpi-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }

.kpi-value {
    font-family: var(--font-display);
    font-size: 29px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; }

.delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 7px 2px 5px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-3);
}
.delta.up   { background: var(--mint-soft);  color: var(--mint); }
.delta.down { background: var(--coral-soft); color: var(--coral); }
.delta svg { width: 11px; height: 11px; }

.kpi-compare { font-size: 11.5px; color: var(--ink-4); }

.kpi-spark {
    position: absolute;
    right: 0; bottom: 0; left: 0;
    height: 46px;
    opacity: .9;
    pointer-events: none;
}
.kpi-spark svg { display: block; width: 100%; height: 100%; }

.kpi.has-spark { padding-bottom: 40px; }

/* =========================================================================
   Campaign cards
   ========================================================================= */

.campaign-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.camp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    padding: 16px 18px 15px;
    overflow: hidden;
    transition: transform .16s ease, box-shadow .18s ease, border-color .16s ease;
}

/* a hairline of health colour along the top edge */
.camp-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--indigo);
}
.camp-card.tone-edge-mint::before  { background: var(--mint); }
.camp-card.tone-edge-amber::before { background: var(--amber); }
.camp-card.tone-edge-coral::before { background: var(--coral); }

.camp-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
    border-color: transparent;
}

.camp-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 11px;
}

.camp-open {
    margin-left: auto;
    color: var(--ink-4);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .16s ease, transform .16s ease;
}
.camp-card:hover .camp-open { opacity: 1; transform: none; color: var(--indigo); }

.camp-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.012em;
    margin: 0 0 3px;
}

.camp-meta {
    font-size: 11.5px;
    color: var(--ink-4);
    margin: 0 0 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camp-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.camp-hero-value {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.03em;
    line-height: 1;
}

.camp-hero-unit {
    font-size: 12px;
    color: var(--ink-3);
    margin-left: 4px;
}

.camp-hero-cost { text-align: right; }

.camp-cost-value {
    display: block;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.camp-cost-label {
    display: block;
    font-size: 10.5px;
    color: var(--ink-4);
}

.camp-spark {
    height: 40px;
    margin: 10px -18px 0;
    opacity: .92;
}
.camp-spark svg { display: block; width: 100%; height: 100%; }

.camp-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 13px 0 0;
    margin-top: 4px;
    border-top: 1px solid var(--line-2);
}
.camp-stats .cs-k {
    display: block;
    font-size: 10.5px;
    color: var(--ink-4);
    margin-bottom: 2px;
}
.camp-stats .cs-v {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.camp-foot { margin-top: 14px; }
.camp-pace {
    display: block;
    font-size: 10.5px;
    color: var(--ink-4);
    margin-top: 6px;
}

@media (max-width: 560px) {
    .campaign-grid { grid-template-columns: minmax(0, 1fr); }
    .camp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* =========================================================================
   Creative previews
   ========================================================================= */

.creative {
    position: relative;
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-3);
    display: flex;
}

.creative img { width: 100%; height: 100%; object-fit: cover; display: block; }

.creative.ratio-1-1  { aspect-ratio: 1 / 1; }
.creative.ratio-4-5  { aspect-ratio: 4 / 5; }
.creative.ratio-9-16 { aspect-ratio: 9 / 16; }
.creative-lg.ratio-9-16 { aspect-ratio: 4 / 5; }   /* keep tall video readable in a card */

.creative-drawn {
    background: linear-gradient(150deg, var(--c1), var(--c2));
    color: #fff;
    align-items: flex-end;
}

/* a faint texture so a flat gradient does not read as a broken image */
.creative-grain {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 18%, rgba(255, 255, 255, .28), transparent 46%),
        radial-gradient(circle at 12% 88%, rgba(0, 0, 0, .22), transparent 52%);
}

.creative-stack {
    position: absolute;
    top: 6px; right: -6px; bottom: 6px;
    width: 14px;
    border-radius: var(--r);
    background: rgba(255, 255, 255, .35);
}
.creative-stack.two { right: -12px; top: 12px; bottom: 12px; background: rgba(255, 255, 255, .2); }

.creative-copy {
    position: relative;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.creative-format {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .22);
    backdrop-filter: none;
}

.creative-headline {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.24;
    letter-spacing: -0.015em;
    text-shadow: 0 1px 12px rgba(0, 0, 0, .22);
}

.creative-body {
    font-size: 11.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, .82);
}

.creative-cta {
    align-self: flex-start;
    margin-top: 4px;
    background: #fff;
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 9px;
}

.creative-lg .creative-copy { padding: 20px; gap: 8px; }
.creative-lg .creative-headline { font-size: 21px; }
.creative-lg .creative-body { font-size: 13px; }
.creative-lg .creative-cta { font-size: 13px; padding: 8px 15px; }

.creative-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 46px; height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--ink);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .24);
}
.creative-play svg { margin-left: 3px; }

/* a Google text ad, drawn the way it appears on the results page */
.creative-sERP {
    aspect-ratio: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 14px 15px;
    align-items: stretch;
}
.serp-ad { width: 100%; }
.serp-badge {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink);
}
.serp-top { margin-bottom: 5px; }
.serp-url { font-size: 11.5px; color: var(--ink-2); margin-bottom: 3px; }
.serp-headline {
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1.28;
    color: #1a54c4;
    margin-bottom: 5px;
}
.serp-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.creative-lg .serp-headline { font-size: 20px; }

.creative-note {
    font-size: 11px;
    color: var(--ink-4);
    margin: 10px 0 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.45;
}
.creative-note svg { flex: none; margin-top: 2px; }

/* the gallery of creatives */
.creative-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
}

.creative-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface);
    transition: transform .16s ease, box-shadow .18s ease, border-color .16s ease;
}
.creative-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
    border-color: transparent;
}
.creative-card.is-current { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft); }
.creative-card .creative { border-radius: 0; }

.creative-card-body { padding: 11px 12px 12px; }
.creative-card-name {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 7px;
}
.creative-card-stats {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink);
}
.creative-card-stats .dim { font-weight: 500; }

/* the engine picker in Settings */
.engine-option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.engine-option:hover { border-color: #D5DAE8; }
.engine-option.is-picked {
    border-color: var(--indigo);
    background: var(--indigo-soft);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}
.engine-option input { margin-top: 3px; flex: none; }

.engine-mark {
    width: 30px; height: 30px;
    border-radius: 10px;
    display: grid; place-items: center;
    flex: none;
    background: var(--surface-3);
    color: var(--ink-3);
}
.engine-option.is-picked .engine-mark { background: #fff; color: var(--indigo); }
.engine-mark.tone-violet { background: var(--violet-soft); color: var(--violet); }
.engine-mark.tone-mint { background: var(--mint-soft); color: var(--mint); }

.engine-body { min-width: 0; }
.engine-top {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.engine-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.engine-meta { font-size: 11px; color: var(--ink-4); }
.engine-blurb { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

.engine-panel[hidden] { display: none; }

/* which engine wrote the notes */
.engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--r-pill);
    background: var(--indigo-soft);
    color: var(--indigo);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.engine-badge.is-rules { background: var(--surface-3); color: var(--ink-3); }
.engine-badge.is-cached { background: var(--mint-soft); color: var(--mint); }

/* =========================================================================
   Advisor notes
   ========================================================================= */

.advice-headline {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    margin: 0 0 16px;
    padding-left: 12px;
    border-left: 3px solid var(--indigo);
}

.advice-list { display: grid; gap: 2px; }

.advice {
    display: flex;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line-2);
}
.advice:last-child { border-bottom: 0; padding-bottom: 0; }
.advice:first-child { padding-top: 0; }

.advice-mark {
    width: 30px; height: 30px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: none;
}

.advice-body { min-width: 0; }

.advice-top {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}

.advice-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}

.advice-flag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: var(--r-pill);
    white-space: nowrap;
}

.advice-evidence {
    font-size: 12.5px;
    color: var(--ink-2);
    margin: 0 0 4px;
    line-height: 1.5;
}

.advice-action {
    font-size: 12.5px;
    color: var(--ink-3);
    margin: 0;
    line-height: 1.55;
    padding-left: 11px;
    border-left: 2px solid var(--line);
}

/* =========================================================================
   Badges, pills, platform marks
   ========================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--ink-2);
    white-space: nowrap;
}
.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .85;
}
.badge.no-dot::before { display: none; }
.badge-active    { background: var(--mint-soft);   color: var(--mint); }
.badge-paused    { background: var(--amber-soft);  color: var(--amber); }
.badge-ended     { background: var(--surface-3);   color: var(--ink-3); }
.badge-new       { background: var(--indigo-soft); color: var(--indigo); }
.badge-contacted { background: var(--sky-soft);    color: var(--sky); }
.badge-qualified { background: var(--violet-soft); color: var(--violet); }
.badge-converted { background: var(--mint-soft);   color: var(--mint); }
.badge-lost      { background: var(--coral-soft);  color: var(--coral); }
.badge-replied   { background: var(--sky-soft);    color: var(--sky); }
.badge-active2   { background: var(--indigo-soft); color: var(--indigo); }
.badge-closed    { background: var(--surface-3);   color: var(--ink-3); }

.plat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    white-space: nowrap;
}
.plat-mark {
    width: 22px; height: 22px;
    border-radius: 7px;
    display: grid; place-items: center;
    flex: none;
}
.plat-mark.meta   { background: var(--sky-soft);   color: var(--sky); }
.plat-mark.google { background: var(--amber-soft); color: #C77E14; }
.plat-mark.website { background: var(--mint-soft); color: var(--mint); }
.plat-mark svg { width: 13px; height: 13px; }

.tag {
    display: inline-flex;
    align-items: center;
    height: 21px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.tag-wa { background: var(--mint-soft); color: var(--mint); }
.tag-lead { background: var(--indigo-soft); color: var(--indigo); }

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap { overflow-x: auto; }

table.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.table thead th {
    /* Not sticky: .table-wrap only scrolls sideways, so sticky-to-container
       bought nothing and made some browsers mispaint the rows below it. */
    background: var(--surface);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table thead th.num, .table td.num { text-align: right; }

.table tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-2);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }

.table td.num, .table td.mono { font-variant-numeric: tabular-nums; }
.table td strong, .table td .val { color: var(--ink); font-weight: 600; }

.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
    cursor: pointer;
}
.th-sort:hover { color: var(--ink-2); }
.th-arrow {
    width: 0; height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
}
.th-sort:hover .th-arrow { opacity: .45; }
.th-sort.is-sorted { color: var(--indigo); }
.th-sort.is-sorted .th-arrow { opacity: 1; }
.th-sort.is-sorted.dir-asc .th-arrow { transform: rotate(180deg); }

/* Secondary columns step out of the way before a table starts scrolling. */
@media (max-width: 980px) {
    .table .hide-narrow { display: none; }
    .cell-name .name { max-width: 168px; }
    .table thead th, .table tbody td { padding-left: 11px; padding-right: 11px; }
}
@media (max-width: 760px) {
    .table .hide-tight { display: none; }
    .cell-name .name { max-width: 148px; }
}

/* Inline "mark as" buttons on a lead row. Always visible so the next action
   is one click away, quiet until hovered so the table still reads cleanly. */
/* After a status change the page returns to the row that changed; keep it
   clear of the sticky top bar. */
tr[id^="lead-"] { scroll-margin-top: 96px; }

.status-actions {
    display: flex;
    gap: 3px;
    justify-content: flex-end;
}

.status-btn {
    width: 27px;
    height: 27px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-4);
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    transition: color .14s ease, background .14s ease, border-color .14s ease;
}

.status-btn:hover { border-color: currentColor; }

.status-btn.sa-ink:hover    { color: var(--ink-2);  background: var(--surface-3); }
.status-btn.sa-sky:hover    { color: var(--sky);    background: var(--sky-soft); }
.status-btn.sa-violet:hover { color: var(--violet); background: var(--violet-soft); }
.status-btn.sa-mint:hover   { color: var(--mint);   background: var(--mint-soft); }
.status-btn.sa-coral:hover  { color: var(--coral);  background: var(--coral-soft); }

/* the stage the lead is already at */
.status-btn.is-current {
    cursor: default;
    border-color: transparent;
}
.status-btn.is-current.sa-ink    { color: var(--ink-2);  background: var(--surface-3); }
.status-btn.is-current.sa-sky    { color: var(--sky);    background: var(--sky-soft); }
.status-btn.is-current.sa-violet { color: var(--violet); background: var(--violet-soft); }
.status-btn.is-current.sa-mint   { color: var(--mint);   background: var(--mint-soft); }
.status-btn.is-current.sa-coral  { color: var(--coral);  background: var(--coral-soft); }

/* the thin efficiency ribbon at the start of a campaign row */
.row-rail {
    width: 3px;
    height: 30px;
    border-radius: 3px;
    background: var(--line);
    display: inline-block;
    vertical-align: middle;
}
.rail-good { background: var(--mint); }
.rail-ok   { background: var(--indigo); }
.rail-warn { background: var(--amber); }
.rail-bad  { background: var(--coral); }

.cell-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-name { min-width: 0; }
.cell-name .name {
    color: var(--ink);
    font-weight: 600;
    font-size: 13.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 340px;
}
.cell-name a.name:hover { color: var(--indigo); }
.cell-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--ink-4);
    margin-top: 2px;
}
.cell-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); opacity: .6; }

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.page-link {
    min-width: 32px; height: 32px;
    padding: 0 9px;
    border-radius: var(--r-xs);
    /* icon and label sit side by side — a grid stacked "Prev" under its arrow */
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    white-space: nowrap;
    font-size: 12.5px; font-weight: 600;
    color: var(--ink-3);
    border: 1px solid transparent;
}
.page-link svg { flex: none; }
.page-link:hover { background: var(--surface-3); color: var(--ink); }
.page-link.is-current { background: var(--indigo); color: #fff; }
.page-link.is-disabled { opacity: .35; pointer-events: none; }
.page-info { font-size: 12.5px; color: var(--ink-4); }

/* =========================================================================
   Tabs & segmented controls
   ========================================================================= */

.tabs {
    display: inline-flex;
    gap: 2px;
    background: var(--surface-3);
    padding: 3px;
    border-radius: var(--r-sm);
}
.tab {
    padding: 7px 14px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
    border: 0;
    background: none;
    white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs); }

.underline-tabs {
    display: flex;
    gap: 22px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.underline-tab {
    padding: 0 0 12px;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.underline-tab:hover { color: var(--ink); }
.underline-tab.is-active { color: var(--indigo); border-bottom-color: var(--indigo); }
.underline-tab .count { color: var(--ink-4); font-weight: 500; margin-left: 5px; }

/* =========================================================================
   Charts
   ========================================================================= */

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: default;
}
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-swatch.line { width: 14px; height: 3px; border-radius: 2px; }

.chart-tip {
    position: absolute;
    pointer-events: none;
    background: var(--ink);
    color: #fff;
    border-radius: 11px;
    padding: 9px 12px;
    font-size: 12px;
    box-shadow: 0 10px 26px rgba(20, 24, 41, .28);
    opacity: 0;
    transform: translate(-50%, -118%);
    transition: opacity .12s ease;
    z-index: 20;
    white-space: nowrap;
    min-width: 118px;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip .tip-date {
    font-size: 10.5px;
    color: rgba(255, 255, 255, .58);
    font-family: var(--font-mono);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.chart-tip .tip-row {
    display: flex; align-items: center; gap: 8px;
    padding: 2px 0;
}
.chart-tip .tip-row .sw { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.chart-tip .tip-row .k { color: rgba(255, 255, 255, .66); }
.chart-tip .tip-row .v { margin-left: auto; font-weight: 700; }

.axis-label { font-size: 10.5px; fill: var(--ink-4); font-family: var(--font-sans); }
.grid-line { stroke: var(--line-2); stroke-width: 1; }
.grid-line.zero { stroke: var(--line); }

/* the spend to outcome ribbon */
.flow { position: relative; }
.flow-grid {
    display: grid;
    grid-template-columns: 168px minmax(120px, 1fr) 210px;
    gap: 0;
    align-items: stretch;
}
.flow-col { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.flow-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--r);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
}
.flow-node .n-label { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.flow-node .n-value { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.flow-node .n-figure {
    margin-left: auto; text-align: right;
    font-family: var(--font-display);
    font-size: 16px; font-weight: 600; color: var(--ink);
    letter-spacing: -0.02em;
}
.flow-ribbon { min-height: 190px; }
.flow-ribbon svg { width: 100%; height: 100%; display: block; }
.flow-cost { font-size: 11px; color: var(--ink-4); }

/* the verdict banner on a campaign page */
.verdict {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px 22px;
}
.verdict-mark {
    width: 34px; height: 34px;
    border-radius: 11px;
    display: grid; place-items: center;
    flex: none;
}
.verdict-copy { min-width: 0; }
.verdict-target {
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
    flex: none;
}

@media (max-width: 720px) {
    .verdict { flex-wrap: wrap; }
    .verdict-copy { flex: 1 1 auto; }
    .verdict-target {
        margin-left: 48px;
        text-align: left;
        flex: 1 0 100%;
        padding-top: 10px;
        border-top: 1px solid var(--line-2);
    }
}

/* progress meters */
.meter {
    height: 6px;
    border-radius: var(--r-pill);
    background: var(--line-2);
    overflow: hidden;
    position: relative;
}
.meter span {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--indigo);
    transition: width .5s cubic-bezier(.2, .7, .3, 1);
}
.meter.tone-mint span  { background: var(--mint); }
.meter.tone-coral span { background: var(--coral); }
.meter.tone-amber span { background: var(--amber); }
.meter.tone-violet span { background: var(--violet); }
.meter-row { display: flex; align-items: center; gap: 12px; }
.meter-row .meter { flex: 1; }
.meter-val { font-size: 12px; font-weight: 600; color: var(--ink); min-width: 46px; text-align: right; }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-center { text-align: center; }

/* =========================================================================
   Lists used on the dashboard rails
   ========================================================================= */

.rail-list { display: grid; gap: 2px; }

.rail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--r);
    transition: background .13s ease;
}
.rail-item:hover { background: var(--surface-2); }
.rail-item .r-name {
    font-size: 13px; font-weight: 600; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail-item .r-meta { font-size: 11.5px; color: var(--ink-4); }
.rail-item .r-right { margin-left: auto; text-align: right; flex: none; }
.rail-item .r-value { font-size: 13px; font-weight: 600; color: var(--ink); }

.thumb {
    width: 38px; height: 38px;
    border-radius: 11px;
    flex: none;
    display: grid; place-items: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-2);
    font-size: 13px;
}
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: var(--ink-3); }
.stat-row .v { color: var(--ink); font-weight: 600; }

.definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px 24px;
}
.definition { min-width: 0; }
.definition .dk { font-size: 11.5px; color: var(--ink-4); margin-bottom: 3px; }
/* a long email address breaks rather than running into the next column */
.definition .dv { font-size: 14px; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* what the person typed into the lead form, question by question */
.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 24px; }
.answer { min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--canvas); }
.answer .aq { font-size: 11.5px; color: var(--ink-4); margin-bottom: 4px; }
.answer .aa { font-size: 14px; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }

/* =========================================================================
   Forms
   ========================================================================= */

.field { margin-bottom: 16px; }
.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}
.field-hint { font-size: 11.5px; color: var(--ink-4); margin-top: 6px; }

.input, .select, textarea.input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--r-sm);
    padding: 0 14px;
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { height: auto; padding: 11px 14px; line-height: 1.55; resize: vertical; }
.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, textarea.input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--indigo-soft);
}
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23A9B1C7' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}
.input-error { border-color: var(--coral); }
.input-error:focus { box-shadow: 0 0 0 4px var(--coral-soft); }

.switch {
    position: relative;
    display: inline-block;
    width: 38px; height: 22px;
    flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track {
    position: absolute; inset: 0;
    background: #D8DDEA;
    border-radius: var(--r-pill);
    transition: background .18s ease;
    cursor: pointer;
}
.switch .track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(20, 24, 41, .22);
    transition: transform .18s cubic-bezier(.3, .8, .3, 1);
}
.switch input:checked + .track { background: var(--indigo); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--indigo-soft); }

.toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-2);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .t-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.toggle-row .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.toggle-row .switch { margin-left: auto; }

/* =========================================================================
   Flash messages
   ========================================================================= */

.flash-stack {
    position: fixed;
    top: 18px; right: 18px;
    z-index: 200;
    display: grid;
    gap: 10px;
    max-width: 380px;
}
.flash {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    background: var(--surface);
    border-radius: var(--r);
    box-shadow: var(--sh-md);
    padding: 13px 15px;
    font-size: 13px;
    color: var(--ink-2);
    border-left: 3px solid var(--indigo);
    animation: slide-in .24s cubic-bezier(.2, .8, .3, 1);
}
.flash.success { border-left-color: var(--mint); }
.flash.error   { border-left-color: var(--coral); }
.flash.warning { border-left-color: var(--amber); }
.flash.info    { border-left-color: var(--sky); }
.flash strong { color: var(--ink); font-weight: 600; }
.flash > span > strong:first-child { display: block; font-size: 13px; margin-bottom: 1px; }
.flash .mono { font-size: 11.5px; word-break: break-all; }
.flash-close { margin-left: auto; background: none; border: 0; color: var(--ink-4); cursor: pointer; padding: 0; }

@keyframes slide-in {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: none; }
}

/* =========================================================================
   Empty states
   ========================================================================= */

.empty {
    text-align: center;
    padding: 56px 24px;
    max-width: 420px;
    margin: 0 auto;
}
.empty-mark {
    width: 52px; height: 52px;
    border-radius: 16px;
    background: var(--indigo-soft);
    color: var(--indigo);
    display: grid; place-items: center;
    margin: 0 auto 16px;
}
.empty h3 { font-size: 17px; margin-bottom: 7px; }
.empty p { font-size: 13.5px; color: var(--ink-3); margin: 0 0 18px; }

/* =========================================================================
   Auth & install screens
   ========================================================================= */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}
.auth-box { width: 100%; max-width: 396px; }
.auth-box h1 { font-size: 27px; letter-spacing: -0.03em; margin-bottom: 7px; }
.auth-box .lede { font-size: 14px; color: var(--ink-3); margin: 0 0 28px; }
.auth-alt { font-size: 13px; color: var(--ink-3); margin-top: 22px; text-align: center; }
.auth-alt a { color: var(--indigo); font-weight: 600; }

.auth-aside {
    background: linear-gradient(158deg, #23204D 0%, #312A6B 46%, #4B47E8 130%);
    color: #fff;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-aside::after {
    content: '';
    position: absolute;
    width: 520px; height: 520px;
    right: -180px; bottom: -220px;
    background: radial-gradient(circle, rgba(139, 92, 246, .5), transparent 68%);
    border-radius: 50%;
}
.auth-aside h2 {
    color: #fff;
    font-size: 30px;
    line-height: 1.24;
    letter-spacing: -0.028em;
    max-width: 13ch;
    position: relative;
}
.auth-aside p { color: rgba(255, 255, 255, .68); font-size: 14px; max-width: 40ch; position: relative; }

.auth-proof {
    position: relative;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--r-lg);
    padding: 20px;
    backdrop-filter: blur(8px);
}
.auth-proof .p-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.auth-proof .p-label { font-size: 12.5px; color: rgba(255, 255, 255, .62); }
.auth-proof .p-value { margin-left: auto; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: #fff; }
.auth-proof .p-bar { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-top: 3px; }
.auth-proof .p-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #8B5CF6, #6F6AFF); }

.install-page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 54px 24px 80px;
}
.install-box { width: 100%; max-width: 620px; }
.install-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.install-step {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--ink-4); font-weight: 600;
}
.install-step .n {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface); border: 1px solid var(--line);
    display: grid; place-items: center; font-size: 11px;
}
.install-step.is-current { color: var(--indigo); }
.install-step.is-current .n { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.install-step.is-done .n { background: var(--mint); border-color: var(--mint); color: #fff; }
.install-step-line { flex: 1; height: 1px; background: var(--line); }

.check-list { display: grid; gap: 1px; }
.check-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 0; border-bottom: 1px solid var(--line-2);
    font-size: 13px;
}
.check-item:last-child { border-bottom: 0; }
.check-item .c-name { color: var(--ink); font-weight: 500; }
.check-item .c-detail { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.check-ok   { color: var(--mint); }
.check-fail { color: var(--coral); }

/* =========================================================================
   Misc utilities
   ========================================================================= */

.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.tone-mint { color: var(--mint); }
.tone-coral { color: var(--coral); }
.tone-amber { color: var(--amber); }
.tone-indigo { color: var(--indigo); }
.tone-violet { color: var(--violet); }
.strong { color: var(--ink); font-weight: 600; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-14 { gap: 14px; }
.gap-20 { gap: 20px; }
.mt-0 { margin-top: 0; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-6 { margin-bottom: 6px; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }
.mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }
.ml-auto { margin-left: auto; }
.hr { height: 1px; background: var(--line-2); margin: 18px 0; }

.divider-label {
    display: flex; align-items: center; gap: 12px;
    font-size: 11.5px; color: var(--ink-4); margin: 20px 0;
}
.divider-label::before, .divider-label::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}

.link { color: var(--indigo); font-weight: 600; }
.link:hover { text-decoration: underline; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: var(--ink);
    color: #fff;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    z-index: 300;
}
.skip-link:focus { left: 16px; }

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 1380px) {
    .grid-main { grid-template-columns: minmax(0, 1fr); }
    .kpi { min-height: 124px; padding: 16px 16px 12px; }
    .kpi-value { font-size: 26px; }
}

@media (max-width: 1120px) {
    :root { --gutter: 18px; }
    .grid-2, .grid-3, .grid-4, .grid-7-5 { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-aside { display: none; }
    .flow-grid { grid-template-columns: 152px minmax(90px, 1fr) 190px; }
}

/* ------------------------------------------------------------- the icon rail
   The sidebar can collapse to icons. Two things put it there: a narrow desktop
   or tablet does it by default, and the collapse button does it anywhere
   above phone width — remembered between visits. One class carries the look
   either way, so the two never disagree. */
body.nav-rail { --sidebar-w: 76px; }
@media (min-width: 561px) {
    body.nav-rail .sidebar { align-items: center; }
    body.nav-rail .brand { justify-content: center; padding: 20px 0 12px; gap: 0; }
    body.nav-rail .brand > span:not(.brand-mark):not(.brand-logo):not(.brand-rail-icon) { display: none; }

    body.nav-rail .nav { width: 100%; padding: 4px 12px 12px; }
    body.nav-rail .nav-label { display: none; }
    body.nav-rail .nav-item { justify-content: center; padding: 11px 0; }
    body.nav-rail .nav-item > span:not(.nav-count) { display: none; }
    /* No room for a number on a 40px icon — show an unread dot instead. */
    body.nav-rail .nav-item .nav-count {
        position: absolute;
        top: 7px; right: 15px;
        width: 7px; height: 7px;
        margin: 0;
        padding: 0;
        border-radius: 50%;
        background: var(--indigo);
        border: 2px solid var(--surface);
        font-size: 0;
        color: transparent;
        overflow: hidden;
    }
    body.nav-rail .nav-item.is-active .nav-count { background: var(--indigo); }
    body.nav-rail .sidebar-foot { display: none; }
    body.nav-rail .main { margin-left: calc(var(--sidebar-w) + 28px); }

    /* the collapse / expand handle, on the sidebar's right edge */
    .nav-collapse {
        position: absolute;
        top: 26px; right: -13px;
        width: 26px; height: 26px;
        border-radius: 50%;
        border: 1px solid var(--line);
        background: var(--surface);
        color: var(--ink-3);
        display: grid; place-items: center;
        cursor: pointer;
        box-shadow: var(--sh-xs);
        z-index: 41;
        transition: color .15s ease, border-color .15s ease, transform .2s ease;
    }
    .nav-collapse:hover { color: var(--indigo); border-color: var(--indigo); }
    body.nav-rail .nav-collapse svg { transform: rotate(180deg); }
    .sidebar { transition: width .22s ease; }
    .main { transition: margin-left .22s ease; }
}
@media (max-width: 560px) { .nav-collapse { display: none; } }

/* Phones: the sidebar slides in over the page. */
@media (max-width: 560px) {
    .sidebar {
        transform: translateX(calc(-100% - 20px));
        transition: transform .26s cubic-bezier(.3, .8, .3, 1), visibility 0s linear .26s;
        /* off screen it must not exist to the finger: it sat above the
           top bar (z 40 vs 30) and its brand block was eating every tap on
           the menu button, which is why the menu never opened on a phone */
        visibility: hidden;
        pointer-events: none;
    }
    body.nav-open .sidebar {
        transform: none;
        visibility: visible;
        pointer-events: auto;
        transition: transform .26s cubic-bezier(.3, .8, .3, 1), visibility 0s;
    }
    .main { margin-left: 0; }
    .nav-toggle { display: grid !important; position: relative; z-index: 45; }
    .flow-grid { grid-template-columns: minmax(0, 1fr); }
    .flow-ribbon { display: none; }
}

@media (max-width: 720px) {
    .kpi-grid { grid-template-columns: minmax(0, 1fr); }
    .page-title { font-size: 23px; }
    .topbar { flex-wrap: wrap; row-gap: 10px; }
    .topbar .search { order: 9; flex: 1 0 100%; max-width: none; }
    .topbar-spacer { flex: 1; }
    .user-chip-name, .user-chip-role { display: none; }
    .user-chip { padding: 5px; }
    .page-head-actions { margin-left: 0; width: 100%; }
    .page-head-actions .btn { flex: 1; }
    .card-head { flex-wrap: wrap; }
    .card-head .search { max-width: none; flex: 1 0 100%; }
    .card-actions { margin-left: 0; width: 100%; }
    .tabs { overflow-x: auto; max-width: 100%; }
    .underline-tabs { overflow-x: auto; gap: 16px; }
    .filterbar { gap: 8px; }
}

.nav-toggle { display: none; }
.nav-close { display: none; margin-left: auto; }
@media (max-width: 560px) { .nav-close { display: grid; } .brand { padding-right: 10px; } }

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 41, .34);
    z-index: 39;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}
body.nav-open .scrim {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

@media print {
    .sidebar, .topbar, .filterbar, .page-head-actions { display: none !important; }
    .main { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid var(--line); break-inside: avoid; }
}

/* ---------- next best action ------------------------------------------- */

.action-row {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line-2);
}
.action-row:last-child { border-bottom: 0; }
.action-row:hover { background: var(--surface-2); }

.action-rank {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-main { min-width: 0; flex: 1; }

.action-top {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}
.action-campaign {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    text-decoration: none;
}
.action-campaign:hover { color: var(--indigo); }

.action-title {
    font-size: 15.5px;
    font-weight: 640;
    letter-spacing: -0.011em;
    color: var(--ink-1);
    margin: 0 0 10px;
}

.action-detail {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 5px 16px;
    margin: 0 0 12px;
}
.action-detail dt {
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding-top: 2px;
}
.action-detail dd {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink-2);
}
.action-detail dd.strong { color: var(--ink-1); font-weight: 520; }

.action-foot {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}
.conf {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.01em;
}
.conf::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.conf-high { background: var(--mint-soft);   color: var(--mint); }
.conf-med  { background: var(--indigo-soft); color: var(--indigo); }
.conf-low  { background: var(--surface-2);   color: var(--ink-3); }

.conf-basis { font-size: 11.5px; color: var(--ink-4); }

.action-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--indigo);
    text-decoration: none;
}
.action-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .action-row { padding: 16px 16px; gap: 12px; }
    .action-detail { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .action-detail dt { padding-top: 8px; }
    .action-link { margin-left: 0; }
}

.advice-expect {
    margin: 8px 0 0;
    padding: 8px 11px;
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-2);
}
.advice-expect span {
    display: block;
    font-size: 10px;
    font-weight: 620;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin-bottom: 2px;
}
.advice-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 9px;
}

/* A banner that stays put — unlike .flash, which is a toast and self-dismisses. */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 14px;
    background: var(--amber-soft);
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.55;
}
.notice > svg { flex: 0 0 auto; margin-top: 1px; color: var(--amber); }
.notice strong { display: block; color: var(--ink-1); font-weight: 620; margin-bottom: 1px; }
.notice a { color: var(--indigo); font-weight: 600; text-decoration: none; }
.notice a:hover { text-decoration: underline; }
.notice-info { background: var(--indigo-soft); }
.notice-info > svg { color: var(--indigo); }
.notice-error { background: var(--coral-soft); }
.notice-error > svg { color: var(--coral); }

/* ---------- apply, review and the change log ---------------------------- */

.advice-apply { margin-left: auto; }
.btn-apply {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #fff;
}
.btn-apply:hover { background: var(--indigo-2); border-color: var(--indigo-2); color: #fff; }

.review-wrap { max-width: 620px; margin: 0 auto; }
.review-head { margin-bottom: 18px; }
.review-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 560;
    color: var(--ink-3);
    text-decoration: none;
    margin-bottom: 12px;
}
.review-back:hover { color: var(--indigo); }

.review-target { margin-bottom: 22px; }
.review-kind {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 640;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin-bottom: 5px;
}
.review-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 640;
    letter-spacing: -.022em;
    color: var(--ink);
    margin: 0 0 7px;
}
.review-crumbs {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.review-diff {
    padding: 18px 20px;
    border-radius: var(--r-lg);
    background: var(--surface-3);
}
.review-field { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.review-label {
    font-size: 10.5px;
    font-weight: 640;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.review-field-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.review-values { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.review-val { display: flex; flex-direction: column; gap: 2px; }
.review-val span {
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.review-val strong {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 640;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.review-val.is-old strong { color: var(--ink-3); }
.review-val.is-new strong { color: var(--ink); }
.review-arrow { color: var(--ink-4); display: flex; }
.review-delta {
    padding: 3px 9px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 640;
}
.review-delta.is-down { background: var(--mint-soft); color: var(--mint); }
.review-delta.is-up   { background: var(--indigo-soft); color: var(--indigo); }

.review-aside {
    margin: 12px 0 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-3);
}
.review-aside strong { color: var(--ink-2); font-weight: 620; }

.review-dest {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: var(--r);
    margin: 18px 0;
    font-size: 12.5px;
    line-height: 1.5;
}
.review-dest strong { display: block; font-weight: 620; margin-bottom: 1px; }
.review-dest span { color: var(--ink-3); }
.review-dest > svg { flex: 0 0 auto; margin-top: 1px; }
.review-dest.is-live  { background: var(--indigo-soft); color: var(--ink-2); }
.review-dest.is-live > svg { color: var(--indigo); }
.review-dest.is-local { background: var(--surface-3); color: var(--ink-2); }
.review-dest.is-local > svg { color: var(--ink-3); }

.review-form { margin-top: 4px; }
.review-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 4px; }
.review-undo {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--ink-4);
}

.log-row {
    display: flex;
    gap: 13px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line-2);
}
.log-row:last-child { border-bottom: 0; }
.log-row.is-undone { opacity: .62; }
.log-row.is-failed { background: rgba(238, 95, 85, .035); }
.log-mark {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.log-main { flex: 1; min-width: 0; }
.log-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.log-summary { font-size: 14px; font-weight: 600; color: var(--ink); }
.tag-live { background: var(--indigo-soft); color: var(--indigo); }

.log-change { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12.5px; }
.log-change > svg { color: var(--ink-4); }
.log-old { color: var(--ink-4); text-decoration: line-through; }
.log-new { color: var(--ink); font-weight: 500; }
.log-field { font-family: var(--font-sans); font-size: 11.5px; color: var(--ink-4); }

.log-reason { margin: 7px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.log-error {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 7px 0 0;
    font-size: 12.5px;
    color: var(--coral);
}
.log-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--ink-4);
}
.log-foot a { color: var(--ink-3); text-decoration: none; }
.log-foot a:hover { color: var(--indigo); }
.log-action { flex: 0 0 auto; display: flex; align-items: flex-start; }

@media (max-width: 620px) {
    .log-row { padding: 15px 16px; gap: 11px; }
    .log-action { display: none; }
    .advice-apply { margin-left: 0; width: 100%; }
    .advice-apply .btn { width: 100%; justify-content: center; }
    .review-val strong { font-size: 22px; }
}

/* ---------- first run --------------------------------------------------- */

.welcome { max-width: 640px; margin: 0 auto; }
.welcome-head { text-align: center; margin-bottom: 22px; }
.welcome-step {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin-bottom: 10px;
}
.welcome-head h1 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 640;
    letter-spacing: -.028em;
    color: var(--ink);
    margin: 0 0 9px;
}
.welcome-head p {
    font-size: 14px;
    line-height: 1.62;
    color: var(--ink-2);
    margin: 0 auto;
    max-width: 52ch;
}
.welcome-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }

/* the checklist that keeps setup visible until it is done */
.setup-list { display: grid; gap: 8px; }
.setup-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-radius: var(--r);
    background: var(--surface-2);
    text-decoration: none;
}
.setup-item:hover { background: var(--surface-3); }
.setup-tick {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--line);
    color: var(--surface);
}
.setup-item.is-done .setup-tick { background: var(--mint); color: #fff; }
.setup-body { flex: 1; min-width: 0; }
.setup-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.setup-item.is-done .setup-title { color: var(--ink-3); text-decoration: line-through; }
.setup-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.setup-go { color: var(--ink-4); display: flex; }
.setup-item.is-done .setup-go { visibility: hidden; }

/* ---------- sign in with a provider ------------------------------------- */

.social-auth { display: grid; gap: 9px; margin-bottom: 4px; }
.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 14px;
    font-weight: 580;
    color: var(--ink);
    text-decoration: none;
    transition: background .14s ease, border-color .14s ease;
}
.social-btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.social-btn > svg { flex: 0 0 auto; }

.social-or {
    position: relative;
    text-align: center;
    margin: 18px 0;
}
.social-or::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line);
}
.social-or span {
    position: relative;
    padding: 0 12px;
    background: var(--surface);
    font-size: 12px;
    color: var(--ink-4);
}

/* linked accounts in Settings */
.linked-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--r);
    background: var(--surface-2);
    margin-bottom: 8px;
}
.linked-row:last-child { margin-bottom: 0; }
.linked-mark {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
}
.linked-body { flex: 1; min-width: 0; }
.linked-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.linked-sub {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .linked-row { flex-wrap: wrap; }
    .linked-body { flex: 1 1 60%; }
}

/* ---------- assistant ---------------------------------------------------- */

/* ------------------------------------------------------------- assistant chat
   A full-height conversation, not a card in a page. The thread takes every
   pixel between the top bar and the composer; the composer stays put; the
   empty state is an invitation rather than a shrug. */

.chat {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 148px);
    min-height: 460px;
    margin: -6px auto 0;
}

.chat-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 820px;
    width: 100%;
    margin: 0 auto 6px;
    padding: 0 4px;
}
.chat-topline h1 {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: -.015em;
    margin: 0;
}
.chat-topline .spacer { flex: 1; }

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 18px 4px 26px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}
.chat-thread::-webkit-scrollbar { width: 10px; }
.chat-thread::-webkit-scrollbar-thumb {
    background: var(--canvas-2);
    border-radius: 999px;
    border: 3px solid var(--canvas);
}

/* every turn sits in a centred reading column */
.chat-turn,
.chat-empty,
.chat-error {
    max-width: 780px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* ---- the empty state: a greeting, not a placeholder ---- */
.chat-empty {
    text-align: left;
    padding: 8vh 4px 20px;
}
.chat-empty .chat-hello {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.5vw, 40px);
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin: 0 0 6px;
    background: linear-gradient(92deg, var(--indigo) 0%, #8b5cf6 55%, var(--ink-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.chat-empty h3 {
    font-size: clamp(22px, 3.4vw, 30px);
    font-weight: 600;
    letter-spacing: -.015em;
    color: var(--ink-3);
    margin: 0 0 26px;
}
.chat-empty p { font-size: 13.5px; color: var(--ink-3); margin: 0 0 26px; }
.chat-empty .empty-mark { display: none; }

.chat-starters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}
.chat-starter {
    display: flex;
    flex-direction: column;
    gap: 26px;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 110px;
    padding: 15px 16px;
    text-align: left;
    font: 500 13.5px/1.5 var(--font-sans);
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.chat-starter::after {
    content: "→";
    align-self: flex-end;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--canvas);
    color: var(--indigo);
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
.chat-starter:hover {
    border-color: var(--indigo);
    box-shadow: 0 10px 28px -14px rgb(75 71 232 / .35);
    transform: translateY(-1px);
}
.chat-starter:hover::after { background: var(--indigo); color: #fff; }

/* ---- the turns ---- */
.chat-turn { display: flex; gap: 12px; margin-bottom: 26px; }
.chat-turn.is-you { justify-content: flex-end; }
.chat-turn.is-you .chat-bubble {
    max-width: 78%;
    background: var(--indigo);
    color: #fff;
    padding: 11px 16px;
    border-radius: 18px 18px 4px 18px;
    font-size: 14px;
    line-height: 1.55;
    box-shadow: 0 6px 18px -8px rgb(75 71 232 / .45);
}

.chat-mark {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo) 0%, #8b5cf6 100%);
    color: #fff;
    margin-top: 2px;
}

.chat-body { flex: 1; min-width: 0; }
.chat-answer {
    font-size: 14.5px;
    line-height: 1.72;
    color: var(--ink-2);
}
.chat-answer p { margin: 0 0 12px; }
.chat-answer p:last-child { margin-bottom: 0; }
.chat-answer strong { color: var(--ink); font-weight: 640; }
.chat-answer ul { margin: 0 0 12px; padding-left: 20px; }
.chat-answer li { margin-bottom: 7px; }
.chat-meta { margin-top: 8px; font-size: 11px; color: var(--ink-4); }

.chat-error {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px 15px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: var(--coral-soft);
    color: var(--coral);
    font-size: 13px;
    line-height: 1.5;
}
.chat-error > svg { flex: 0 0 auto; margin-top: 2px; }

.chat-typing { display: inline-flex; gap: 5px; padding: 8px 2px; }
.chat-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--indigo);
    opacity: .35;
    animation: chat-dot 1.2s infinite;
}
.chat-typing i:nth-child(2) { animation-delay: .18s; }
.chat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes chat-dot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-4px); }
}

/* ---- the composer: pinned, elevated, unmistakably the way in ---- */
.chat-foot {
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding-top: 6px;
}
.chat-compose {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 9px 9px 9px 20px;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 14px 40px -18px rgb(24 26 46 / .28);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-compose:focus-within {
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--indigo-soft), 0 14px 40px -18px rgb(24 26 46 / .28);
}
.chat-input {
    flex: 1;
    border: 0;
    outline: none;
    resize: none;
    background: none;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--ink);
    padding: 10px 0;
    max-height: 180px;
}
.chat-input::placeholder { color: var(--ink-4); }
.chat-send {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
}
.chat-send span { display: none; }

.chat-note {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    margin: 10px auto 0;
    max-width: 660px;
    font-size: 11px;
    line-height: 1.55;
    text-align: center;
    color: var(--ink-4);
}
.chat-note > svg { flex: 0 0 auto; margin-top: 1px; }

@media (max-width: 620px) {
    .chat { height: calc(100dvh - 128px); }
    .chat-turn.is-you .chat-bubble { max-width: 90%; }
    .chat-empty { padding-top: 4vh; }
    .chat-starters { grid-template-columns: 1fr; }
    .chat-starter { min-height: 0; gap: 10px; flex-direction: row; align-items: center; }
}

/* An optional block folded away until someone needs it. */
.adv {
    margin: 4px 0 6px;
    padding: 0;
    border-top: 1px solid var(--line-2);
}
.adv > summary {
    padding: 13px 0 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.6px solid var(--ink-4);
    border-bottom: 1.6px solid var(--ink-4);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}
.adv[open] > summary::before { transform: rotate(45deg); }
.adv > summary span {
    font-size: 11px;
    font-weight: 620;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.adv > summary:hover { color: var(--ink); }

/* the assistant thinking, and errors inside the thread */
.chat-thread { max-height: min(62vh, 620px); overflow-y: auto; scroll-behavior: smooth; }

.chat-typing { display: flex; gap: 4px; padding: 9px 2px; }
.chat-typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-4);
    animation: chat-blink 1.3s infinite ease-in-out;
}
.chat-typing i:nth-child(2) { animation-delay: .18s; }
.chat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes chat-blink {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
    .chat-typing i { animation: none; opacity: .5; }
    .chat-thread { scroll-behavior: auto; }
}

.chat-error {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 15px;
    border-radius: var(--r);
    background: var(--coral-soft);
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.55;
}
.chat-error > svg { flex: 0 0 auto; margin-top: 1px; color: var(--coral); }
.chat-error a { color: var(--indigo); }

.chat-send:disabled { opacity: .5; cursor: default; }

/* The real asset sits over the drawn card; onerror removes it and the card shows. */
.creative-asset {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    background: var(--surface-3);
}

/* a credential that is already stored */
.secret-saved {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border-radius: var(--r);
    background: var(--mint-soft);
}
.secret-mark {
    display: inline-flex;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--mint);
    color: #fff;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.secret-value { font-size: 13px; color: var(--ink); letter-spacing: .04em; }
.secret-word { font-size: 12px; color: var(--mint); font-weight: 620; }
.secret-saved .btn { margin-left: auto; }
.secret-remove {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--ink-3);
    cursor: pointer;
}
.secret-remove input { margin: 0; }

/* ---------- team and admin ---------------------------------------------- */

.member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line-2);
}
.member:last-child { border-bottom: 0; }
.member.is-pending { background: var(--surface-2); }
.member-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 640;
    background: var(--surface-3);
    color: var(--ink-3);
}
.member-body { flex: 1; min-width: 0; }
.member-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.member-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.member-role .select { height: 32px; font-size: 12.5px; padding: 0 26px 0 10px; }

.role-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.role-row:last-of-type { border-bottom: 0; }
.role-row .badge { flex: 0 0 auto; }
.role-row p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }

.admin-search .input { width: 260px; }

.admin-alert {
    display: flex;
    gap: 11px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line-2);
}
.admin-alert:last-child { border-bottom: 0; }
.admin-alert-mark {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    background: var(--amber-soft);
    color: var(--amber);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-menu { position: relative; }
.admin-menu > summary { list-style: none; cursor: pointer; display: inline-flex; }
.admin-menu > summary::-webkit-details-marker { display: none; }
.admin-menu-body {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    width: 232px;
    padding: 14px;
    text-align: left;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--sh-md);
}
tr.is-dim td { opacity: .55; }

@media (max-width: 620px) {
    .admin-search .input { width: 100%; }
    .member { flex-wrap: wrap; padding: 13px 16px; }
    .member-body { flex: 1 1 60%; }
}

/* a creative the platform is not actually running */
.creative-card.is-off .creative-preview { opacity: .45; filter: saturate(.4); }
.creative-why {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin: 5px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--amber);
}
.creative-why > svg { flex: 0 0 auto; margin-top: 1px; }

/* why something is not delivering, next to a page title */
.head-why {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    font-size: 12px;
    color: var(--amber);
}
.head-why > svg { flex: 0 0 auto; }

/* the same, inside a table cell where the goal would otherwise sit */
.cell-why { color: var(--amber); }

/* search inside a dropdown */
.filter-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-2);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
}
.filter-search > svg { color: var(--ink-4); flex: 0 0 auto; }
.filter-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink);
}
.filter-search input::placeholder { color: var(--ink-4); }
.filter-menu[data-searchable] { max-height: 340px; overflow-y: auto; }
.tag-observed { background: var(--sky-soft); color: var(--sky); }

/* ---------------------------------------------------------- onboarding wizard */

/* the stage rail: where you are in a five-step flow, without a progress bar
   pretending the stages are equal lengths */
.wiz-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    font-size: 12.5px;
    color: var(--ink-3);
}
.wiz-step { display: flex; align-items: center; gap: 7px; }
.wiz-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1px solid var(--line);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    flex: none;
}
.wiz-step.is-now { color: var(--ink); font-weight: 600; }
.wiz-step.is-now .wiz-mark { border-color: var(--indigo); background: var(--indigo); color: #fff; }
.wiz-step.is-done { color: var(--ink-2); }
.wiz-step.is-done .wiz-mark { border-color: var(--mint); background: var(--mint-soft); color: var(--mint); }

/* picking a business model — the answer that decides every later question, so
   it gets room to be read rather than a dropdown of twelve similar words */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.model-option {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.model-option:hover { border-color: #D5DAE8; }
.model-option.is-picked {
    border-color: var(--indigo);
    background: var(--indigo-soft);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}
.model-option input { position: absolute; opacity: 0; pointer-events: none; }
/* belt and braces: works without JavaScript in any browser that has :has() */
.model-option:has(input:checked) {
    border-color: var(--indigo);
    background: var(--indigo-soft);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}
.model-option:focus-within { outline: 2px solid var(--indigo); outline-offset: 2px; }
.model-name  { display: block; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.model-blurb { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--ink-3); }

/* multi-select goals */
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.chip:hover { border-color: #D5DAE8; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); font-weight: 600; }
.chip:focus-within { outline: 2px solid var(--indigo); outline-offset: 2px; }
.chip.is-on { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); font-weight: 600; }

/* a question that can stay blank, and one Botmust answered for you */
.field-opt {
    margin-left: 6px;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-4);
    text-transform: none;
    letter-spacing: 0;
}
.field-src {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--sky-soft);
    color: var(--sky);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

/* the KPI order this business is judged on, shown in Settings */
.kpi-rank { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.kpi-rank li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line-2);
}
.kpi-rank li:last-child { border-bottom: 0; }
.kpi-rank li.is-lead { color: var(--ink); font-weight: 600; }
.kpi-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    flex: none;
    border-radius: 6px;
    background: var(--canvas-2);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
}
.kpi-rank li.is-lead .kpi-n { background: var(--indigo); color: #fff; }

.gap-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }

/* ------------------------------------------------ campaign intelligence page */

.camp-tabs {
    display: flex; gap: 2px; flex-wrap: wrap;
    margin: 0 0 20px; padding: 3px;
    background: var(--canvas-2); border-radius: 10px;
}
.camp-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 500; color: var(--ink-3);
    text-decoration: none; transition: background .15s ease, color .15s ease;
}
.camp-tab:hover { color: var(--ink); }
.camp-tab.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.tab-count {
    min-width: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--coral-soft); color: var(--coral);
    font-size: 10.5px; font-weight: 600; text-align: center;
}

/* the status block that opens the page */
.intel-status {
    padding: 18px 20px; margin-bottom: 20px;
    border: 1px solid var(--line); border-left: 3px solid currentColor;
    border-radius: var(--r); background: var(--surface);
}
.intel-status.tone-mint  { color: var(--mint); }
.intel-status.tone-amber { color: var(--amber); }
.intel-status.tone-coral { color: var(--coral); }
.intel-status.tone-ink-3 { color: var(--ink-3); }
.intel-status-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.intel-badge { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.intel-conf  { font-size: 11.5px; color: var(--ink-3); }
.intel-narrative { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ink); }
.intel-why { margin-top: 12px; }
.intel-why summary { cursor: pointer; font-size: 12px; color: var(--ink-3); }
.intel-why-body { margin-top: 10px; display: grid; gap: 6px; }
.intel-line { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.intel-line.good > svg { color: var(--mint); flex: none; margin-top: 2px; }
.intel-line.bad  > svg { color: var(--coral); flex: none; margin-top: 2px; }
.intel-line.note > svg { color: var(--ink-4); flex: none; margin-top: 2px; }

/* the diagnosis cards */
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.diag-card { padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--r); background: var(--canvas-2); }
.diag-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); margin-bottom: 5px; }
.diag-title { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.diag-evidence { margin: 7px 0 10px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.diag-problem { border-left: 2px solid var(--coral); }
.diag-driver  { border-left: 2px solid var(--mint); }
.diag-scale   { border-left: 2px solid var(--mint); }
.diag-risk    { border-left: 2px solid var(--amber); }
.diag-waste   { border-left: 2px solid var(--coral); }

.conf { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 500; }
.conf-high         { background: var(--mint-soft);  color: var(--mint); }
.conf-medium       { background: var(--amber-soft); color: var(--amber); }
.conf-low          { background: var(--canvas-2);       color: var(--ink-3); }
.conf-insufficient { background: var(--canvas-2);       color: var(--ink-4); }

.fresh-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 20px; font-size: 11.5px; color: var(--ink-4); }
.fresh-item strong { color: var(--ink-3); font-weight: 500; }

/* creative verdicts */
.verdict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.verdict-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.verdict-card.v-losing   { opacity: .78; }
.verdict-card.v-fatigued { border-color: var(--amber); }
.verdict-card.v-winning  { border-color: var(--mint); }
.verdict-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.verdict-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--canvas-2); }
.verdict-badge.tone-mint  { background: var(--mint-soft);  color: var(--mint); }
.verdict-badge.tone-amber { background: var(--amber-soft); color: var(--amber); }
.verdict-badge.tone-coral { background: var(--coral-soft); color: var(--coral); }
.verdict-badge.tone-sky   { background: var(--sky-soft);   color: var(--sky); }
.verdict-score { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.verdict-score .dim { font-size: 11px; font-weight: 400; }
.verdict-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; }
.verdict-name:hover { color: var(--indigo); }
.verdict-hook { margin: 8px 0; font-size: 11.5px; line-height: 1.5; }
.hook-tag { display: inline-block; padding: 1px 7px; margin-right: 6px; border-radius: 4px; background: var(--indigo-soft); color: var(--indigo); font-size: 10.5px; }
.hook-text { color: var(--ink-3); }
.verdict-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 9px; font-size: 11.5px; color: var(--ink-3); }
.verdict-why { margin-top: 9px; }
.verdict-why summary { cursor: pointer; font-size: 11.5px; color: var(--ink-4); }
.verdict-why ul { margin: 7px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }

/* the production brief */
.brief-block { margin-bottom: 18px; }
.brief-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.brief-item { padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--r); }
.brief-what { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.brief-why  { margin: 5px 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.brief-how  { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); display: flex; gap: 5px; align-items: flex-start; }
.brief-how > svg { flex: none; margin-top: 3px; }

/* recommendations */
.p-code { padding: 4px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--canvas-2); }
.p-code.tone-coral { background: var(--coral-soft); color: var(--coral); }
.p-code.tone-mint  { background: var(--mint-soft);  color: var(--mint); }
.p-code.tone-amber { background: var(--amber-soft); color: var(--amber); }
.rec-card { padding: 14px 15px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--r); }
.rec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rec-mark { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 7px; background: var(--canvas-2); flex: none; }
.rec-title { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rec-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; margin-bottom: 6px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.rec-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); padding-top: 2px; }
.rec-apply { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* competitors */
.rival-row { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.rival-row:last-child { border-bottom: 0; }
.rival-main { flex: 1; min-width: 0; }
.rival-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); flex-wrap: wrap; }
.rival-meta { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.rival-actions { display: inline; }
.learn-block { margin-bottom: 14px; }
.learn-block p { margin: 4px 0 0; font-size: 13px; line-height: 1.65; color: var(--ink-2); }
.learn-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); }
.learn-lead { padding: 12px 14px; border-radius: var(--r); background: var(--indigo-soft); }
.learn-lead p { color: var(--ink); font-weight: 500; }

/* learnings and timeline */
.learn-item { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.learn-item:last-child { border-bottom: 0; }
.learn-statement { font-size: 13px; color: var(--ink); line-height: 1.55; }
.learn-evidence { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.tl-item:last-child { border-bottom: 0; }
.tl-mark { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 7px; background: var(--canvas-2); flex: none; }
.tl-when { font-size: 11px; color: var(--ink-4); }
.tl-what { font-size: 13px; color: var(--ink); line-height: 1.5; }
.tl-why  { margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }

/* a plain-text button, for the way out of a flow */
.btn-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12.5px;
    color: var(--ink-3);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.btn-link:hover { color: var(--ink); }
.wiz-skip { margin-left: auto; }

/* a competitor the AI suggested but nobody has confirmed yet */
.rival-row.is-suggested { background: var(--sky-soft); }

/* ------------------------------------------------------------ the assistant, everywhere
   A floating button on every signed-in screen; the panel slides in from the
   right and borrows the chat components wholesale, so a conversation looks
   the same in the slide-over as on the full Assistant page. */

.ai-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 60;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo) 0%, #8b5cf6 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 30px -8px rgb(75 71 232 / .55);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.ai-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 16px 38px -10px rgb(75 71 232 / .6);
}
.ai-fab.is-hidden { opacity: 0; pointer-events: none; }

.ai-scrim {
    position: fixed;
    inset: 0;
    z-index: 61;
    background: rgb(15 17 34 / .32);
    backdrop-filter: blur(1px);
}

.ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 62;
    width: min(430px, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--canvas);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px -30px rgb(15 17 34 / .35);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .24s cubic-bezier(.4, 0, .2, 1), visibility .24s;
}
.ai-panel.is-open { transform: translateX(0); visibility: visible; }

.ai-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-2);
    background: var(--surface);
}
.ai-head-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ai-head-text strong { font-size: 14px; letter-spacing: -.01em; }
.ai-scope {
    font-size: 11.5px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 20px;
    overscroll-behavior: contain;
}
.ai-thread .chat-turn { margin-bottom: 18px; }
.ai-thread .chat-turn.is-you .chat-bubble { max-width: 88%; font-size: 13.5px; }
.ai-thread .chat-answer { font-size: 13.5px; line-height: 1.65; }
.ai-thread .chat-error { margin: 0 0 14px; }

.ai-hello {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink-2);
    padding: 6px 2px 0;
}
.ai-hello p { margin: 0 0 14px; }
.ai-hello strong { color: var(--ink); }

.ai-quick { display: flex; flex-direction: column; gap: 8px; }
.ai-chip {
    text-align: left;
    padding: 10px 13px;
    font: 500 13px/1.45 var(--font-sans);
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ai-chip:hover {
    border-color: var(--indigo);
    color: var(--ink);
    box-shadow: 0 8px 22px -12px rgb(75 71 232 / .35);
}

.ai-compose {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin: 0 12px 12px;
    padding: 7px 7px 7px 15px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px -16px rgb(24 26 46 / .3);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ai-compose:focus-within {
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--indigo-soft);
}
.ai-compose .chat-input { font-size: 13.5px; padding: 8px 0; max-height: 120px; }
.ai-compose .chat-send { width: 38px; height: 38px; }

/* a change the assistant proposed: a doorway to the apply screen, never a lever */
.ai-act { display: flex; flex-direction: column; gap: 5px; margin: 12px 0 0; }
.ai-act .btn { align-self: flex-start; }
.ai-act span { font-size: 11px; color: var(--ink-4); }

@media (max-width: 640px) {
    .ai-panel { width: 100vw; border-left: 0; }
    .ai-fab { right: 16px; bottom: 16px; }
}
@media print { .ai-fab, .ai-panel, .ai-scrim { display: none; } }

/* ------------------------------------------------- account switcher strip
   One chip per ad account on the campaigns page. Scrolls sideways instead
   of wrapping, so thirty-five accounts cost one row, not a wall. */
.acct-strip {
    display: flex;
    gap: 8px;
    margin: 14px 0 16px;
    overflow-x: auto;
    padding-bottom: 2px;
    /* scrolls sideways by wheel, trackpad or swipe — without showing a bar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.acct-strip::-webkit-scrollbar { display: none; }

.acct-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 230px;
    padding: 7px 13px;
    font: 500 12.5px/1.3 var(--font-sans);
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.acct-chip:hover {
    border-color: var(--indigo);
    box-shadow: 0 6px 18px -10px rgb(75 71 232 / .35);
}
.acct-chip.is-active {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #fff;
}
.acct-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.acct-chip-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-4);
    background: var(--canvas);
    border-radius: 999px;
    padding: 1px 7px;
}
.acct-chip.is-active .acct-chip-count { background: rgb(255 255 255 / .18); color: #fff; }
.acct-chip svg { flex: 0 0 auto; }

/* the fold on the account strip */
.acct-chip-more {
    cursor: pointer;
    color: var(--indigo);
    border-style: dashed;
    background: var(--surface);
    font: 600 12.5px/1.3 var(--font-sans);
}
.acct-chip-more:hover { border-style: solid; }

/* --------------------------------------------- creatives peek in ad-set rows
   A stack of thumbnails and a count; click and the row beneath opens with
   every ad in that ad set, each a link to the ad page. */
.creative-peek {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    font: 500 12px/1 var(--font-sans);
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.creative-peek:hover { border-color: var(--indigo); box-shadow: 0 6px 16px -10px rgb(75 71 232 / .4); }
.creative-peek[aria-expanded="true"] { border-color: var(--indigo); color: var(--indigo); }
.creative-peek[aria-expanded="true"] svg { transform: rotate(180deg); }
.creative-peek svg { transition: transform .15s ease; color: var(--ink-4); }
.peek-stack { display: inline-flex; }
.peek-stack img, .peek-stack i {
    width: 26px; height: 26px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--surface); display: block;
}
.peek-stack img + img, .peek-stack * + * { margin-left: -9px; }
/* a picture that would not load: the platform mark on a tint, same box as the
   photo it replaces, so the row's height never moves */
img.is-fallback {
    object-fit: contain;
    background: var(--indigo-soft);
    padding: 4px;
}
.peek-stack img.is-fallback { padding: 5px; }
/* the pill never wraps, so the column keeps one clean left edge */
.creative-peek { vertical-align: middle; }

.peek-row > td { padding: 0 !important; background: var(--canvas); }
.peek-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    padding: 12px 16px 14px;
}
.peek-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    text-decoration: none; color: inherit;
    min-width: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.peek-card:hover { border-color: var(--indigo); box-shadow: 0 8px 20px -12px rgb(75 71 232 / .35); }
.peek-thumb {
    width: 52px; height: 52px; border-radius: 10px; flex: none;
    object-fit: cover; display: grid; place-items: center; color: #fff;
}
.peek-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.peek-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek-headline { font-size: 12px; color: var(--ink-2); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek-meta { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.peek-go { color: var(--ink-4); flex: none; }

/* the real video inside a creative card sits above the drawn copy, and the
   copy overlay steps aside so the controls are reachable */
.creative-video { object-fit: contain; background: #000; z-index: 2; }
.creative-drawn:has(.creative-video) .creative-copy { display: none; }
.creative-drawn:has(.creative-video) .creative-grain { display: none; }

/* --------------------------------------------------- inside this campaign */
.inside-grid { display: grid; gap: 22px; }
.inside-block .eyebrow { margin-bottom: 10px; }
.inside-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.inside-stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--canvas); }
.inside-stat .k { font-size: 11.5px; color: var(--ink-4); }
.inside-stat .v { font-size: 15px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.inside-stat .arrow { color: var(--ink-4); font-weight: 400; margin: 0 2px; }
.inside-stat .d { font-size: 12px; color: var(--ink-3); }

.share-row { display: grid; grid-template-columns: 150px 1fr 150px; gap: 12px; align-items: center; padding: 6px 0; }
.share-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-bars { display: flex; flex-direction: column; gap: 3px; }
.share-bar { height: 7px; border-radius: 999px; background: var(--canvas-2); overflow: hidden; }
.share-bar span { display: block; height: 100%; border-radius: 999px; }
.share-nums { display: flex; flex-direction: column; align-items: flex-end; font-size: 11.5px; color: var(--ink-3); }
.share-nums .strong { font-size: 13px; color: var(--ink); }
@media (max-width: 640px) { .share-row { grid-template-columns: 1fr; gap: 4px; } .share-nums { flex-direction: row; gap: 10px; align-items: center; } }

/* ------------------------------------------------ ad-account access picker */
.scope-picker { display: flex; flex-direction: column; gap: 8px; }
.scope-opt { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; cursor: pointer; }
.scope-opt input { margin-top: 3px; }
.scope-list {
    margin: 4px 0 0 24px;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--canvas);
    max-height: 260px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.scope-search { height: 36px; margin-bottom: 6px; }
.scope-acct { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.scope-acct:hover { background: var(--surface); }
.scope-acct-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-editor { padding: 14px 22px 18px 74px; background: var(--canvas); border-bottom: 1px solid var(--line-2); }

/* ------------------------------------------ per-account alerts & connections */
.notify-panel { padding: 14px 16px 16px; border-radius: 12px; background: var(--canvas); margin-bottom: 14px; }
.notify-panel .eyebrow { margin-bottom: 8px; }
.notify-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; margin: 4px 0 4px; }
.notify-checks label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }

/* ------------------------------------------------- platform toggle (filter bar)
   Meta and Google as two buttons in one pill, not a dropdown. */
.plat-toggle {
    display: inline-flex;
    align-items: stretch;
    height: 38px;
    padding: 3px;
    gap: 2px;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--line);
}
.plat-seg {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border-radius: calc(var(--r-sm) - 3px);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-3);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.plat-seg:hover { color: var(--ink); background: var(--canvas); }
.plat-seg.is-on { background: var(--indigo-soft); color: var(--indigo); font-weight: 600; }
.plat-seg .plat-mark { width: 18px; height: 18px; }
.plat-seg .plat-mark svg { width: 11px; height: 11px; }

/* ------------------------------------------------------ notification templates */
.tpl-group { padding: 12px 18px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); display: flex; align-items: center; gap: 6px; }
.tpl-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 18px; text-decoration: none; color: inherit; border-left: 3px solid transparent; transition: background .15s ease; }
.tpl-item:hover { background: var(--canvas); }
.tpl-item.is-active { background: var(--indigo-soft); border-left-color: var(--indigo); }
.tpl-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.tpl-meta { font-size: 11.5px; color: var(--ink-3); }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 8px; }
.tpl-var { font: 500 11.5px/1 var(--font-mono); padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--indigo); cursor: pointer; }
.tpl-var:hover { border-color: var(--indigo); background: var(--indigo-soft); }

/* a WhatsApp bubble, so the preview looks like the phone will */
.wa-preview {
    max-width: 420px; padding: 12px 14px; border-radius: 4px 14px 14px 14px;
    background: #DCF8C6; color: #111b21; font-size: 13.5px; line-height: 1.5;
    box-shadow: 0 1px 1px rgb(0 0 0 / .1); white-space: normal; word-break: break-word;
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
.mail-preview { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #f4f5fa; }
.mail-preview-subject { padding: 10px 16px; font-weight: 600; font-size: 13.5px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.mail-preview-body { padding: 20px; background: #fff; margin: 16px; border-radius: 10px; border: 1px solid #e6e8f0; font: 14px/1.65 -apple-system, "Segoe UI", Arial, sans-serif; color: #3c4152; }
.mail-preview-body table td { padding: 6px 4px; border-bottom: 1px solid #eef0f6; }
.tone-indigo { color: var(--indigo); }

/* a locked feature says which plan unlocks it, quietly */
.plan-nudge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.plan-nudge a { color: var(--indigo); font-weight: 600; }

/* an uploaded logo replaces the drawn mark; it keeps the same footprint */
.brand-mark.has-logo { background: transparent; box-shadow: none; overflow: hidden; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* an uploaded logo in the brand block: the wordmark at its own proportions,
   capped in height, no text name beside it */
.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-logo { display: block; max-width: 100%; }
.brand-logo img { display: block; height: 40px; max-width: 190px; width: auto; object-fit: contain; }
.brand-logo-sub { font-size: 11.5px; color: var(--ink-3); }
.sidebar .brand.has-logo { padding: 22px 20px 26px; }
.pub-bar .brand.has-logo { flex-direction: row; }
.pub-bar .brand-logo img { height: 34px; max-width: 170px; }
/* in the icon rail the wordmark gives way to the favicon (a square), or,
   without one, to a square crop of the wordmark */
.brand-rail-icon { display: none; }
.brand-rail-icon img { width: 36px; height: 36px; object-fit: contain; border-radius: 10px; display: block; }
body.nav-rail .brand.has-logo { align-items: center; }
body.nav-rail .brand.has-logo:has(.brand-rail-icon) .brand-logo { display: none; }
body.nav-rail .brand-rail-icon { display: block; }
body.nav-rail .brand-logo img { height: 34px; max-width: 44px; object-fit: contain; }
body.nav-rail .brand-logo-sub { display: none; }
.sidebar .brand.has-logo .nav-close { position: absolute; right: 14px; top: 18px; }

/* links out to the platform on a creative card */
.verdict-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }
.verdict-links a { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--indigo); text-decoration: none; font-weight: 500; }
.verdict-links a:hover { text-decoration: underline; }
.wear-meter { height: 7px; border-radius: 999px; background: var(--canvas-2); overflow: hidden; margin-bottom: 3px; }
.wear-meter span { display: block; height: 100%; border-radius: 999px; }

/* plan editor on the admin page */
.plan-edit { padding: 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--canvas); }
.plan-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.plan-edit .field { margin-bottom: 10px; }
.plan-edit textarea { font-size: 13px; line-height: 1.5; }


/* a connected-state button (e.g. "Google Sheet connected") reads as done */
.btn.is-set { border-color: var(--mint); color: var(--mint); background: var(--mint-soft); }

/* ----------------------------------------------------------------- modal
   A centred dialog over a dimmed page. Opened by [data-modal-open="id"],
   closed by [data-modal-close], the scrim, or Escape. */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgb(15 17 34 / .42); backdrop-filter: blur(2px); animation: modal-fade .18s ease; }
.modal-box {
    position: relative; width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto;
    background: var(--surface); border-radius: 18px; box-shadow: 0 30px 80px -24px rgb(15 17 34 / .45);
    animation: modal-rise .2s cubic-bezier(.3, .8, .3, 1);
}
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-2); }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head .card-title { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 18px 22px 22px; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .modal { padding: 0; align-items: end; } .modal-box { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; } }

/* ---- "Today as of … · Refresh" stamp under the date line ---- */
.live-stamp {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 0 14px;
    vertical-align: middle;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 18%, transparent);
}
.live-refresh {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 999px;
    padding: 2px 9px 2px 7px;
    font: inherit;
    letter-spacing: .06em;
    cursor: pointer;
}
.live-refresh:hover { border-color: var(--indigo); color: var(--indigo); }
.live-refresh[disabled] { opacity: .6; cursor: progress; }
.eyebrow + .live-stamp { margin-left: 10px; }
.page-sub + .live-stamp { display: flex; margin: 6px 0 0; }
@media (max-width: 640px) {
    .live-stamp { display: flex; margin: 4px 0 0; }
}

/* ---- Leads → Google Sheets dialog ---- */
.steps { list-style: none; counter-reset: step; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding-left: 36px; display: grid; gap: 3px; font-size: 13px; color: var(--ink-2); }
.steps li > strong { color: var(--ink); font-size: 13.5px; }
.steps li > strong em { font-style: normal; color: var(--indigo); }
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: 0;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--indigo-soft); color: var(--indigo);
    font: 600 12px/24px var(--font-mono); text-align: center;
}
.sheet-scope { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-3); margin: 0 0 14px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.sheet-scope strong { color: var(--ink); }
.sheet-scope svg { flex: none; margin-top: 2px; }
.steps .alt-way { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); display: grid; gap: 6px; }
.steps .alt-way summary { cursor: pointer; color: var(--indigo); font-weight: 500; list-style: none; width: fit-content; }
.steps .alt-way summary::-webkit-details-marker { display: none; }
.steps .alt-way summary::after { content: " ▾"; font-size: 11px; }
.steps .alt-way[open] summary::after { content: " ▴"; }
.copy-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--ink);
    border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; justify-self: start;
}
.copy-chip .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-chip:hover { border-color: var(--indigo); }
.sheet-status {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--mint-soft); border: 1px solid color-mix(in srgb, var(--mint) 35%, transparent);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: 13px; color: var(--ink);
}
.sheet-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); flex: none; }
.sheet-status > div { flex: 1; min-width: 200px; }
.sheet-status a { color: var(--indigo); font-weight: 500; margin-left: 4px; }
.sheet-disconnect { margin: 0; }
.switch-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); min-height: 38px; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-row .switch {
    width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; transition: background .15s;
}
.switch-row .switch::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s;
}
.switch-row input:checked + .switch { background: var(--indigo); }
.switch-row input:checked + .switch::after { left: 18px; }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---- a stored credential the operator can read back ---- */
.secret-line { display: flex; align-items: center; gap: 8px; }
.secret-line.is-block { display: block; }
.secret-line > .input { flex: 1; min-width: 0; }
.secret-tools { display: flex; gap: 6px; flex: none; }
.secret-line.is-block .secret-tools { margin-top: 8px; }
/* a key in a textarea cannot be a password field, so it is blurred instead */
textarea.input.is-masked {
    filter: blur(4.5px);
    user-select: none;
}
.secret-value[data-secret-full] { word-break: break-all; }
@media (max-width: 560px) {
    .secret-line { flex-wrap: wrap; }
    .secret-line > .input { flex: 1 1 100%; }
}

/* ---- the first pull, watched live ---- */
.fill-panel {
    background: var(--indigo-soft);
    border: 1px solid color-mix(in srgb, var(--indigo) 22%, transparent);
    border-radius: 12px;
    padding: 13px 15px 14px;
}
.fill-head { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink); }
.fill-head strong { font-weight: 600; }
.fill-pct { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--indigo); }
.fill-spin {
    width: 13px; height: 13px; flex: none; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--indigo) 30%, transparent);
    border-top-color: var(--indigo);
    animation: fill-spin .8s linear infinite;
}
@keyframes fill-spin { to { transform: rotate(360deg); } }
.fill-bar {
    height: 6px; border-radius: 999px; margin: 10px 0 9px;
    background: color-mix(in srgb, var(--indigo) 15%, transparent);
    overflow: hidden;
}
.fill-bar i {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--indigo), var(--indigo-2));
    transition: width .6s ease;
}
.fill-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.fill-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.fill-note { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }
.fill-panel.is-done { background: var(--mint-soft); border-color: color-mix(in srgb, var(--mint) 30%, transparent); }
.fill-panel.is-done .fill-spin { border-color: color-mix(in srgb, var(--mint) 35%, transparent); border-top-color: var(--mint); animation: none; }
.fill-panel.is-done .fill-pct { color: var(--mint); }
.fill-panel.is-done .fill-bar i { background: var(--mint); }
@media (prefers-reduced-motion: reduce) { .fill-spin { animation: none; } .fill-bar i { transition: none; } }

/* the cron's pulse, shown next to the connection's own figures */
.cron-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.cron-dot.ok  { background: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 20%, transparent); }
.cron-dot.bad { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 20%, transparent); }
/* ---- pagination that cannot push the card out of shape ---- */
.card-foot { flex-wrap: wrap; gap: 10px; }
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.page-gap { padding: 0 2px; color: var(--ink-4); }
.pagination .page-link { white-space: nowrap; }
@media (max-width: 700px) {
    /* on a phone the numbers give way; Prev and Next are what get used */
    .pagination .page-link:not(:first-child):not(:last-child):not(.is-current) { display: none; }
    .page-gap { display: none; }
}
