/* Finfluencer Analytics client portal. */

:root {
  color-scheme: dark;
  --bg: #0a1030;
  --sidebar: #111a42;
  --surface: #131c46;
  --surface-2: #0d1538;
  --raised: #1a2456;
  --border: #222d61;
  --text: #f2f4ff;
  --muted: #a3acd6;
  --faint: #6c76a6;
  --label: #7c8fff;
  --accent: #3d5af1;
  --accent-hover: #4f6bff;
  --link: #a9b8ff;
  --good: #6fe3a0;
  --warn: #f5c542;
  --bad: #f28b8b;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Lato", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
strong, .strong { font-weight: 700; color: var(--text); }

.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 0.85rem; }
.empty { color: var(--muted); }
.pad { padding: 1.25rem; margin: 0; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--warn); }
.text-bad, .error { color: var(--bad); }

.eyebrow { margin: 0 0 0.5rem; color: var(--label); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.eyebrow.faint { color: var(--faint); }
.headline { font-size: 1.75rem; font-weight: 900; margin-bottom: 1.25rem; }

/* Logo (placeholder mark until we have the real file) */
.logo { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 900; font-size: 1.1rem; }
.logo-mark { width: 1.5rem; height: 1.5rem; }
.logo-full { font-size: 1.6rem; }
.logo-full .logo-mark { width: 2.25rem; height: 2.25rem; }
.logo-sub { font-weight: 400; color: var(--label); padding-left: 0.6rem; margin-left: 0.1rem; border-left: 1px solid var(--faint); }

/* App shell: sidebar + main */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 0.25rem; padding: 1.5rem 1rem; background: var(--sidebar); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 0 0.5rem; margin-bottom: 1.5rem; }
.sidebar .brand:hover { text-decoration: none; }
.nav-all, .nav-campaigns a { display: block; padding: 0.55rem 0.75rem; border-radius: 10px; color: var(--text); }
.nav-all { display: flex; align-items: center; gap: 0.6rem; }
.nav-icon { flex: none; color: var(--muted); }
.nav-all:hover .nav-icon, .nav-all.active .nav-icon { color: var(--text); }
.nav-all:hover, .nav-campaigns a:hover { background: var(--raised); text-decoration: none; }
.nav-all.active, .nav-campaigns a.active { background: var(--raised); }
.sidebar > .eyebrow { margin: 1.5rem 0.75rem 0.5rem; }
.nav-campaigns { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.nav-campaigns li.muted { padding: 0.5rem 0.75rem; }
.nav-campaigns small { display: block; color: var(--muted); font-size: 0.78rem; }
.nav-campaigns small.phase-live { color: var(--good); }
.who { margin-top: auto; padding: 1.5rem 0.75rem 0; }
.who p { margin: 0; }
.who-name { color: var(--text); }
.who-firm { color: var(--muted); font-size: 0.9rem; }
.who-links { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.75rem; font-size: 0.9rem; }
.who-links form { margin: 0; }

.main { padding: 2rem 2.5rem 3rem; min-width: 0; max-width: 1280px; width: 100%; }

/* Campaign header and tabs */
.campaign-head { margin-bottom: 2rem; }
.campaign-head h1 { font-size: 1.4rem; font-weight: 900; }
.campaign-head .sub { font-size: 0.95rem; font-weight: 400; color: var(--link); }
.tabs { display: flex; gap: 2rem; border-bottom: 1px solid var(--border); margin-top: 1rem; overflow-x: auto; }
.tabs a { padding: 0.6rem 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }

/* Cards, stats, columns */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 1.15rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.stat-value { font-size: 1.9rem; font-weight: 900; margin: 0 0 0.35rem; }
.stat-label { color: var(--muted); font-size: 0.88rem; margin: 0; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 1.25rem; }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; container-type: inline-size; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; white-space: nowrap; padding: 0.75rem 1rem; color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }
table.rows td { padding-top: 1rem; padding-bottom: 1rem; }
table.rows th:first-child, table.rows td:first-child { padding-left: 1.25rem; }
table.rows tr.selected td { background: var(--raised); }
table.rows tr.selected td:first-child a { color: var(--text); font-weight: 700; }
td a { color: var(--text); }
.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Facts as tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.6rem; margin: 0 0 1.5rem; }
.tiles div { background: var(--surface-2); border-radius: 10px; padding: 0.7rem 0.9rem; }
.tiles dt { color: var(--muted); font-size: 0.82rem; }
.tiles dd { margin: 0; }

/* Status: coloured text, as in the wireframe */
.status { font-weight: 700; white-space: nowrap; color: var(--link); }
.status-creative_due { color: var(--warn); }
.status-creative_received { color: var(--good); }
.status-live { color: var(--good); }
.status-ended { color: var(--muted); font-weight: 400; }
.status-overdue { color: var(--bad); }
.pill { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--raised); color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.pill-live { color: var(--good); background: rgba(111, 227, 160, 0.1); }

/* Activation panel */
/* Opened below its row in the table, across the full width: details left, creative right. */
/* The clicked row and its panel read as one block, set apart from the next row. */
table.rows tr.selected td { border-bottom: 0; }
table.rows tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.rows tr.detail-row > td { padding: 0 0.75rem 1.25rem; background: var(--raised); border-bottom: 1rem solid var(--bg); box-shadow: inset 3px 0 0 var(--accent), inset 0 -2px 0 var(--accent); }
table.rows tr.detail-row + tr td { padding-top: 1.25rem; }
.detail-row .panel { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.panel { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 1.5rem; scroll-margin-top: 7rem; }  /* keeps the clicked row in view */
/* On narrow screens the table scrolls sideways; the panel stays the width of the screen and in view. */
.detail-row .panel { width: calc(100cqi - 1.5rem); position: sticky; left: 0.75rem; }
.panel-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.panel-head p { margin: 0; }
.panel-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.close { font-size: 1.6rem; line-height: 1; color: var(--muted); }
.close:hover { color: var(--text); text-decoration: none; }
.uploads { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.5rem; }
.uploads li { background: var(--surface-2); border-radius: 10px; padding: 0.7rem 0.9rem; }

/* Forms */
input, textarea { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input::placeholder { color: var(--faint); }
button, .button { display: inline-block; padding: 0.8rem 1.4rem; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-align: center; }
button:hover, .button:hover { background: var(--accent-hover); text-decoration: none; }
button:disabled { opacity: 0.6; cursor: default; }
button.link { background: none; color: var(--link); padding: 0; font-weight: 400; }
button.link:hover { text-decoration: underline; }
.wide { width: 100%; }
.stack { display: grid; gap: 0.5rem; }
.stack label { margin-top: 0.75rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.stack button { margin-top: 1.25rem; }

.upload { display: grid; gap: 0.6rem; margin-bottom: 1.5rem; }
.dropzone { display: grid; gap: 0.25rem; justify-items: center; padding: 1.25rem; border: 1px dashed var(--label); border-radius: 12px; color: var(--link); text-align: center; cursor: pointer; }
.dropzone input { border: 0; background: none; padding: 0.25rem 0 0; color: var(--muted); font-size: 0.85rem; width: auto; max-width: 100%; }
.upload-row { display: flex; gap: 0.6rem; }
.upload-row button { white-space: nowrap; }

.flash { padding: 0.75rem 1rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.flash-error { border-color: var(--bad); color: var(--bad); }
.flash-success { border-color: var(--good); }
.flash-warning { border-color: var(--warn); }

/* View as client: the sidebar menu, and the banner shown while previewing a firm */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.view-as { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }
.view-as label { color: var(--label); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.view-as select { min-width: 12rem; max-width: 100%; height: 1.75rem; padding: 0 0.5rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.8rem; }
.view-as select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.view-as button, .view-as-banner button { height: 1.75rem; padding: 0 0.65rem; border-radius: 7px; font-size: 0.8rem; font-weight: 600; line-height: 1; }
.view-as-banner { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding: 0.75rem 1rem; border: 1px solid var(--warn); border-radius: 10px; background: var(--surface); color: var(--warn); }
.view-as-banner p, .view-as-banner form { margin: 0; }
.view-as-banner button { background: var(--warn); color: var(--bg); }
.view-as-banner button:hover { background: var(--text); }

details summary { cursor: pointer; color: var(--link); }
pre { overflow-x: auto; background: var(--surface-2); padding: 0.9rem; border-radius: 10px; font-size: 0.8rem; }

/* Results */
.outcome-good { color: var(--good); }
.outcome-bad { color: var(--bad); }
.band { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; white-space: nowrap; background: var(--raised); color: var(--muted); }
.band-below { color: var(--bad); background: rgba(242, 139, 139, 0.12); }
.band-upper, .band-above { color: var(--good); background: rgba(111, 227, 160, 0.1); }

/* Sign-in pages */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 3.5rem 4rem; background: var(--sidebar); border-right: 1px solid var(--border); }
.auth-headline { font-size: 2.4rem; font-weight: 900; margin: 0 0 1.25rem; }
.auth-brand .muted { font-size: 1.05rem; max-width: 34rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 450px; padding: 2.5rem; margin: 0; }
.auth-card h2 { font-size: 1.5rem; }
.auth-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; font-size: 0.85rem; }
.auth-foot a { text-decoration: underline; }

/* Narrow screens */
@media (max-width: 1100px) {
  .panel-body { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 1rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { margin-bottom: 0.75rem; }
  .sidebar > .eyebrow { margin-top: 0.75rem; }
  .who { padding-top: 0.75rem; }
  .main { padding: 1.5rem 1rem 2.5rem; }
  .headline { font-size: 1.4rem; }
  .columns { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 1.5rem 1rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .auth-headline { font-size: 1.5rem; }
  .auth-brand .muted, .auth-brand .faint { display: none; }
  .auth-card { padding: 1.5rem; }
  .upload-row { flex-direction: column; }
}

/* Range-of-outcomes curve (Plan tab) */
.range-curve { display: block; width: 100%; height: auto; margin: 0.75rem 0 0.5rem; overflow: visible; }
.range-curve text { font-family: inherit; font-size: 13px; fill: var(--muted); }
.range-curve .strong { fill: var(--text); font-weight: 700; }
.range-curve .curve-tick { font-size: 11px; fill: var(--faint); }
.curve-area { fill: rgba(61, 90, 241, 0.32); }
.curve-line { fill: none; stroke: #7c8fff; stroke-width: 2; }
.curve-axis { stroke: var(--border); stroke-width: 1; }
.curve-median { stroke: var(--text); stroke-width: 2; }
.curve-quartile { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }

.plain-list { margin: 0 0 1rem; padding-left: 1.1rem; display: grid; gap: 0.5rem; }

/* Results: range bars */
.stat-change { font-size: 1rem; font-weight: 700; }
.text-link { color: var(--link); }
.range-col { width: 26%; min-width: 160px; }
.range-bar { position: relative; height: 10px; margin-top: 0.45rem; border-radius: 999px; background: var(--surface-2); }
.range-band { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: #2a3a8f; }
.range-marker { position: absolute; top: -5px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--muted); }
.range-marker.outcome-good { background: var(--good); }
.range-marker.outcome-bad { background: var(--bad); }

/* Example images for an inventory item, behind "See examples" on the activation page. */
.examples { margin: -0.75rem 0 1.5rem; }
.examples summary { margin-bottom: 0.75rem; }
.carousel-slides { margin: 0; padding: 0; list-style: none; }
.carousel-slides li { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 10px; min-height: 180px; padding: 0.5rem; }
.carousel-slides li[hidden] { display: none; }
.carousel-slides img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 6px; }
.carousel-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.6rem; }
.carousel-button { padding: 0.35rem 0.9rem; background: var(--raised); }
.carousel-button:hover { background: var(--border); }

/* The Plan tab's curves reuse the carousel, without the image frame. */
.carousel-slides.curves li { display: block; background: none; padding: 0; min-height: 0; }
.carousel-slides.curves li[hidden] { display: none; }
.curve-title { font-size: 1rem; margin: 0 0 0.25rem; }

/* Planner tab: the upload box and the plans table */
.plan-upload { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.plan-upload input[type="file"] { width: auto; flex: 1 1 16rem; padding: 0.55rem; }
.plan-upload .errorlist { flex-basis: 100%; }
.small-button { height: 1.75rem; padding: 0 0.65rem; border-radius: 7px; font-size: 0.8rem; font-weight: 600; line-height: 1; }
.errorlist { margin: 0.35rem 0 0; padding: 0; list-style: none; color: var(--bad); font-size: 0.9rem; }
/* A plan's buttons appear in its row once its box is ticked. */
.row-actions { display: none; gap: 0.5rem; justify-content: flex-end; }
.plans tr:has(input[name="selected"]:checked) .row-actions { display: flex; }
.plans tr:has(input[name="selected"]:checked) td { background: var(--raised); }
.plans[data-several-ticked] [data-show-one] { display: none; }
.plans input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.button-danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.button-danger:hover { background: var(--bad); color: var(--bg); }
.stat-value.stat-pair { font-size: 1.35rem; }

/* Sidebar: campaign search and groups */
.nav-search { margin: 0 0.75rem 0.5rem; }
.nav-search input { padding: 0.5rem 0.7rem; border-radius: 8px; font-size: 0.9rem; }
.nav-search p { margin: 0.5rem 0 0; }
.nav-group { margin-bottom: 0.5rem; }
.nav-group[hidden] { display: none; }
.nav-group summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.75rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before { content: "▸"; font-size: 0.7rem; transition: transform 0.15s; }
.nav-group[open] summary::before { transform: rotate(90deg); }
.nav-group summary:hover { color: var(--text); }
.nav-count { margin-left: auto; padding: 0 0.45rem; border-radius: 999px; background: var(--raised); font-size: 0.7rem; letter-spacing: 0; }
.nav-campaigns li[hidden] { display: none; }

/* Product Availability: the heading with its download link on the right */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.page-head .headline { margin-bottom: 0; }
a.small-button { display: inline-flex; align-items: center; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0; }
.filters input[type=search] { flex: 1 1 16rem; min-width: 0; }
.filters select { flex: 0 1 auto; max-width: 100%; }
.filters input[type=search], .filters select { height: 2.25rem; padding: 0 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.875rem; }
.filters select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.filters .small-button { height: 2.25rem; }
.filter-count { flex-basis: 100%; margin: 0; }

/* Plan tab: cost per result under the range curve */
.unit-costs { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.25rem; }
.unit-cost-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.unit-cost { background: var(--surface-2); border-radius: 10px; padding: 0.85rem 1rem; }
.unit-cost-value { font-size: 1.35rem; font-weight: 900; margin: 0 0 0.2rem; }
.unit-cost-label { color: var(--muted); font-size: 0.82rem; margin: 0; }
