/* Lead Source ROI — Sharp Innovations internal tool. Brand tokens, light + navy dark mode. */
:root {
  color-scheme: light;
  /* Brand (sharpinnovations.com) */
  --brand: #1079be;
  --brand-dark: #0c5b8f;
  --navy: #072030;
  --orange: #f39200;
  --logo-blue: #0f79be;
  --logo-gray: #9c9c9a;
  --logo-orange: #f19120;

  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --border: #dbe2e8;
  --text: #17232c;
  --text-2: #475763;
  --muted: #6b7a86;
  --heading: #072030;
  --accent: #1079be;
  --accent-hover: #0c5b8f;
  --accent-ink: #ffffff;
  --accent-soft: #e5f1fa;
  --good: #11743a;
  --good-bg: #e3f4ea;
  --warn: #8a4f00;
  --warn-bg: #fff1d9;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info-bg: #e5f1fa;
  --series-1: #1079be;
  --series-2: #f39200;
  --series-3: #1baf7a;
  --series-1-soft: #9cc7e8;
  --series-none: #b9c3cb;
  --grid: #e6ebef;
  --shadow: 0 1px 2px rgba(7, 32, 48, .05), 0 2px 8px rgba(7, 32, 48, .04);
  --radius: 10px;
  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Oswald", "Arial Narrow", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --logo-blue: #4aa6e6;
    --logo-gray: #b9c0c6;
    --bg: #06141d;
    --surface: #0b1f2c;
    --surface-2: #11293a;
    --border: #1c3a4d;
    --text: #e6edf2;
    --text-2: #b3c2cd;
    --muted: #8a9eac;
    --heading: #ffffff;
    --accent: #4aa6e6;
    --accent-hover: #6cb8ec;
    --accent-ink: #04121b;
    --accent-soft: #12324a;
    --good: #5fd18b;
    --good-bg: #0f2f20;
    --warn: #f6b54a;
    --warn-bg: #33250b;
    --bad: #ff8a80;
    --bad-bg: #3a1714;
    --info-bg: #12324a;
    --series-1: #3a98dc;
    --series-2: #e88a06;
    --series-3: #199e70;
    --series-1-soft: #2d5f82;
    --series-none: #4c6170;
    --grid: #163244;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; color: var(--heading); letter-spacing: .01em; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; }
h2 { font-size: 19px; line-height: 1.25; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.main { padding-top: 26px; padding-bottom: 64px; }
.eyebrow { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); margin: 0 0 2px; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; box-shadow: var(--shadow); }
.topbar::before { content: ""; display: block; height: 3px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--orange) 70% 100%); }
.topbar-inner { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--heading); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--heading); }
.brand .logo { height: 36px; width: auto; display: block; }
.brand .app-name { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: 14px; padding-left: 12px; border-left: 1px solid var(--border); color: var(--text-2); }
.logo .lg-b { fill: var(--logo-blue); }
.logo .lg-g { fill: var(--logo-gray); }
.logo .lg-o { fill: var(--logo-orange); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; overflow-y: hidden; align-self: stretch; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; color: var(--text-2); padding: 0 12px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav a.active { color: var(--heading); border-bottom-color: var(--orange); }
.who { display: flex; gap: 12px; align-items: center; white-space: nowrap; font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 1.6; }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
a.pill:hover { text-decoration: none; filter: brightness(.97); }

/* Banner (e.g. database update needed) */
.banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--border); }
.banner .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.banner form { margin: 0; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin: 0; max-width: 760px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { font-size: 13px; margin-bottom: 6px; display: inline-block; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }
.section-title { font-family: var(--font-display); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 28px 0 10px; font-weight: 400; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.tile .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tile .v { font-family: var(--font-display); font-size: 28px; line-height: 1.25; color: var(--heading); margin: 2px 0; }
.tile .v.neg { color: var(--bad); }
.tile .v.pos { color: var(--good); }
.tile .v .small, .tile .v .muted { font-family: var(--font); }
.tile .s { font-size: 12px; color: var(--text-2); }
.tiles.flat .tile { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.tile.hero { border-top: 3px solid var(--brand); }

/* Source scorecards (dashboard) */
.scorecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-bottom: 18px; }
.scorecard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.scorecard-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px 0; }
.scorecard-head h2 { margin: 0; font-size: 22px; }
.scorecard-head h2 a { color: var(--heading); }
.scorecard-big { padding: 6px 20px 14px; border-bottom: 1px solid var(--border); }
.scorecard-big .v { font-family: var(--font-display); font-size: 38px; line-height: 1.15; color: var(--heading); }
.scorecard-big .v.neg { color: var(--bad); }
.scorecard-big .s { font-size: 12.5px; color: var(--text-2); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat { padding: 11px 14px 11px 20px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 0; }
.stat:nth-child(3n) { border-right: 0; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .v { font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; }
.stat .v small { font-size: 11px; font-weight: 400; color: var(--muted); }
.stat .s { font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.scorecard-foot { padding: 10px 20px; margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; background: var(--surface-2); }

/* Share bar (recurring vs one-time) */
.sharebar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 6px 0 4px; }
.sharebar i { display: block; height: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--surface); text-transform: uppercase; letter-spacing: .04em; }
thead th { position: sticky; top: 0; border-bottom: 2px solid var(--border); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
table.compact th, table.compact td { padding: 8px 8px; }
table.compact th { white-space: normal; vertical-align: bottom; line-height: 1.25; text-transform: none; letter-spacing: 0; font-size: 12px; }
.nowrap { white-space: nowrap; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td { font-weight: 650; border-top: 2px solid var(--border); }
.group-row td { background: var(--surface-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.dim td { color: var(--muted); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=month], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}
input::placeholder { color: var(--muted); opacity: .85; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input.money { text-align: right; max-width: 130px; }
input.int { text-align: right; max-width: 90px; }
input.edited { background: var(--warn-bg); }
textarea { min-height: 70px; }
.field { margin-bottom: 14px; }
.field .help, .help { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; color: var(--text); }
input[type=file] { font: inherit; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; padding: 5px 10px; margin-right: 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.error-message { color: var(--bad); font-size: 12px; margin-top: 3px; }

.btn, button, input[type=submit] {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  line-height: 1.3;
}
.btn:hover, button:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-transform: uppercase; letter-spacing: .05em; font-size: 12.5px; }
.btn-primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger, button.danger { color: var(--bad); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary.btn-sm { font-size: 11px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Messages + flags */
.message { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; background: var(--info-bg); cursor: pointer; border-left: 4px solid var(--accent); }
.message.success { background: var(--good-bg); color: var(--good); border-left-color: var(--good); }
.message.error { background: var(--bad-bg); color: var(--bad); border-left-color: var(--bad); }
.message.warning { background: var(--warn-bg); color: var(--warn); border-left-color: var(--orange); }
.message.hidden { display: none; }
.flags { list-style: none; padding: 0; margin: 0; }
.flags li { padding: 8px 12px 8px 34px; border-radius: 6px; margin-bottom: 6px; position: relative; }
.flags li::before { position: absolute; left: 10px; top: 8px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 11px; line-height: 1; }
.flags li.warn { background: var(--warn-bg); }
.flags li.warn::before { content: "!"; color: var(--surface); background: var(--warn); }
.flags li.info { background: var(--info-bg); }
.flags li.info::before { content: "i"; color: var(--surface); background: var(--accent); }

/* Steps on the monthly page */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 44px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--font-display); font-size: 15px; }
.step.done::before { content: "✓"; background: var(--good-bg); color: var(--good); font-family: var(--font); font-weight: 700; }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.import-box { border: 1px dashed var(--border); border-radius: 8px; padding: 14px; background: var(--surface); }
.import-box.done { border-style: solid; background: var(--good-bg); border-color: transparent; }
.import-box h3 { display: flex; justify-content: space-between; gap: 8px; }

details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }
.lines td { font-size: 12px; padding: 4px 8px; }
.chart-box { position: relative; height: 300px; }
.chart-box.short { height: 240px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Login */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-box { width: 100%; max-width: 400px; margin: 0; padding: 30px 30px 26px; border-top: 4px solid var(--brand); }
.auth-box .logo { width: 210px; height: auto; display: block; margin: 0 auto 6px; }
.auth-box .app-name { text-align: center; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--text-2); margin-bottom: 22px; }
.auth-box button.primary { width: 100%; justify-content: center; padding: 10px; }

@media (max-width: 860px) {
  .brand .app-name { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 6px 12px; }
  .nav { order: 3; width: 100%; flex: none; }
  .nav a { padding: 8px 10px; }
  .who { margin-left: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .scorecards { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3n) { border-right: 1px solid var(--border); }
  .stat:nth-child(2n) { border-right: 0; }
  h1 { font-size: 26px; }
}
