:root {
  --bg: #ffffff;
  --ink: #000000;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --line: #e5e5ea;
  --good: #1a7f37;
  --bad: #d70015;
  --series-spend: #2a78d6;
  --series-results: #1baf7a;
  --series-clicks: #6250d6;
  --series-followers: #e87ba4;
  --radius: 18px;
  --tabbar: 58px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --ink: #ffffff;
  --ink-2: #98989d;
  --ink-3: #636366;
  --line: #2c2c2e;
  --good: #30d158;
  --bad: #ff6961;
  --series-spend: #3987e5;
  --series-results: #199e70;
  --series-clicks: #9085e9;
  --series-followers: #d55181;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--series-spend); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* top bar and tabs */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand span { color: var(--ink-3); font-weight: 600; }
.topbar-tools { display: flex; gap: 4px; }
.tool { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.tool.current, .tool:hover { color: var(--ink); }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
}
.tab.current { color: var(--ink); }
.tab.current .icon { stroke-width: 2.1; }
.badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

@media (min-width: 900px) {
  .tabs {
    position: static;
    display: flex;
    gap: 4px;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
  }
  .tab { flex-direction: row; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 15px; color: var(--ink-2); }
  .tab .icon { width: 20px; height: 20px; }
  .tab.current { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
  .badge { position: static; }
}

/* page frame */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 40px);
}
main.page-heute { max-width: 1120px; }
main.page-plain { padding-bottom: 40px; }
@media (min-width: 900px) { main { padding: 32px 24px 64px; } }

.page-title { margin: 4px 0 8px; }
.page-title h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--ink-2); font-size: 14px; }
.page-title .meta a { color: var(--ink); }

.flash { margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--ink); border-radius: 14px; font-size: 15px; }

/* briefing: the one loud element */

.briefing { padding: 4px 0 8px; }
.briefing .meta { margin: 0 0 12px; }
.briefing h1 { max-width: 34em; font-size: 21px; line-height: 1.28; letter-spacing: -0.015em; font-weight: 650; }
.read-more { display: inline-block; margin-top: 12px; font-size: 15px; font-weight: 600; }
@media (min-width: 900px) { .briefing h1 { font-size: 28px; line-height: 1.22; } }

.today-grid { display: grid; grid-template-areas: "goals" "tasks" "stats" "chart"; gap: 0 32px; }
.today-tasks { grid-area: tasks; }
.today-goals { grid-area: goals; }
.today-stats { grid-area: stats; }
.today-chart { grid-area: chart; }
@media (min-width: 980px) {
  .today-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas: "tasks goals" "tasks stats" "tasks chart";
    grid-template-rows: auto auto 1fr;
    align-items: start;
  }
}

/* groups and rows */

.group { margin-top: 30px; }
.group > h2 { margin: 0 4px 10px; font-size: 20px; letter-spacing: -0.015em; font-weight: 700; }
.rows { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: block; padding: 16px; text-decoration: none; overflow-wrap: anywhere; }
.row + .row { border-top: 1px solid var(--line); }
.row h3 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.row p { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.group-footer { margin: 10px 4px 0; font-size: 15px; font-weight: 600; }
.empty { color: var(--ink-2); }
.prose { max-width: 40em; color: var(--ink); font-size: 16px; line-height: 1.55; }
.prose p + p { margin-top: 12px; }
.small { font-size: 14px; }
.muted { color: var(--ink-2); }

/* tasks */

.task.needs-decision { box-shadow: inset 3px 0 0 var(--ink); }
.task-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.task-kind { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.row .task-target { margin-top: 4px; font-size: 14px; }
.row .task-change { margin-top: 10px; color: var(--ink); font-size: 17px; }
.note { margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--bad); color: var(--ink-2); font-size: 14px; }

details.more { margin-top: 10px; }
details.more > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; color: var(--ink); font-size: 15px; font-weight: 600; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
details.more[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.more[open] > summary { margin-bottom: 8px; }

.steps, .evidence { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.steps li, .evidence li { margin-bottom: 5px; }
.facts { display: grid; gap: 8px; margin: 12px 0 0; font-size: 15px; }
.facts div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }

.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions form { flex: 1; margin: 0; }
.actions .button { width: 100%; }
@media (min-width: 600px) { .actions form { flex: 0 0 auto; } .actions .button { width: auto; min-width: 140px; } }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }

.button {
  appearance: none;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button.primary { background: var(--ink); color: var(--bg); }
.button.wide { width: 100%; }
.button:disabled { opacity: 0.5; cursor: progress; }
.link-button { appearance: none; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.chip { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink-2); }
.chip.good { border-color: var(--good); color: var(--good); }
.chip.bad { border-color: var(--bad); color: var(--bad); }
.chip.neutral { border-color: var(--ink); color: var(--ink); }

.dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--ink-3); vertical-align: 1px; flex: none; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }
.dot.neutral { background: var(--ink); }

/* goals and stats: one framed grid each, divided by hairlines */

.goals, .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.goal, .stat { padding: 14px 16px; min-width: 0; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.goal-name, .stat-label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.goal-number { margin-top: 6px; font-size: 16px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; }
.goal-status { display: flex; align-items: center; margin-top: 8px; color: var(--ink-2); font-size: 13px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat-note { color: var(--ink-2); font-size: 13px; }
.up-good { color: var(--good); }
.up-bad { color: var(--bad); }

/* charts */

.switch, .group > .chart { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 12px; }
.segmented { display: flex; gap: 4px; margin-bottom: 14px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { flex: 1 0 auto; min-height: 32px; padding: 4px 12px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.segmented button[aria-selected="true"] { background: var(--ink); color: var(--bg); }

.chart { margin: 0; --series: var(--ink); }
.chart.series-spend { --series: var(--series-spend); }
.chart.series-results { --series: var(--series-results); }
.chart.series-clicks { --series: var(--series-clicks); }
.chart.series-followers { --series: var(--series-followers); }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-total { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.chart-tip { color: var(--ink-2); font-size: 14px; text-align: right; }
.chart svg { display: block; width: 100%; height: 150px; }
.chart .mark { fill: var(--series); transition: opacity 0.12s; }
.chart .hit { fill: transparent; }
.chart svg:hover .bar:not(:hover) .mark,
.chart svg.has-active:not(:hover) .bar:not(.active) .mark { opacity: 0.35; }
.axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--ink-3); font-size: 12px; }

/* creatives */

details.creative > summary {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-areas: "thumb main" "thumb figures";
  gap: 8px 14px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
details.creative > summary::-webkit-details-marker { display: none; }
details.creative img, .thumb-empty { grid-area: thumb; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); align-self: start; }
.creative-main { grid-area: main; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.creative-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.creative-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.creative-figures, .post-figures { grid-area: figures; display: flex; gap: 20px; }
.creative-figures span, .post-figures span { display: flex; flex-direction: column; }
.creative-figures b, .post-figures b { font-size: 16px; font-weight: 650; }
.creative-figures small, .post-figures small { color: var(--ink-2); font-size: 12px; }
@media (min-width: 680px) {
  details.creative > summary { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "thumb main figures"; }
  .creative-figures span { min-width: 64px; align-items: flex-end; }
}
.creative-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.creative-detail > p { margin-top: 8px; color: var(--ink); font-size: 15px; }
.creative-detail > p.muted { color: var(--ink-2); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 12px 0 0; font-size: 14px; }
.metric-grid div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.metric-grid dt { color: var(--ink-2); }
.metric-grid dd { margin: 0; font-weight: 600; }
.idea .hook { color: var(--ink); font-size: 17px; font-weight: 600; }

/* instagram posts */

.post { display: grid; gap: 10px; }
.post-caption { font-size: 15px; font-weight: 500; line-height: 1.35; }
.post-figures b.uncertain { color: var(--ink-3); }
.footnote { color: var(--ink-2); font-size: 14px; font-weight: 400; }

/* tables */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 0 12px 8px 0; color: var(--ink-2); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px 10px 0; white-space: nowrap; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.share { display: inline-flex; align-items: center; gap: 8px; }
.share svg { display: block; width: 44px; height: 8px; }
@media (max-width: 599px) { .wide-only { display: none; } }
.share-track { fill: var(--line); }
.share-fill { fill: var(--series-spend); }

/* status and misc */

.statusbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 32px; padding: 14px 4px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.statusbar.running { justify-content: flex-start; color: var(--ink); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--series-spend); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } details.more > summary::after, .chart .mark { transition: none; } }

.run-row h3 { margin-top: 8px; font-size: 16px; font-weight: 500; }
.run-row .meta { margin-top: 0; }
details pre { white-space: pre-wrap; font-size: 12px; overflow-wrap: anywhere; color: var(--ink-2); }

.login { display: grid; justify-items: center; gap: 10px; max-width: 340px; margin: 14vh auto 0; text-align: center; }
.login img { border-radius: 14px; }
.login h1 { font-size: 26px; letter-spacing: -0.02em; }
.login form { display: grid; gap: 10px; width: 100%; margin-top: 18px; text-align: left; }
.login label { color: var(--ink-2); font-size: 14px; }
.login input { padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); font: inherit; }
.login input:focus { border-color: var(--ink); outline: none; }
.error { color: var(--bad); font-size: 15px; }
