/* Wygląd panelu revcounter.
   Zasada nadrzędna: kolor ma znaczenie, nie ozdabia. Nasycone barwy dostają wyłącznie
   diagnozy filmów (sześć stałych kolorów, te same w panelu i w nakładce na Studio) oraz
   kwoty. Cała reszta jest cicha, żeby liczby i werdykty były jedyną rzeczą, która krzyczy.
   Domyślnie ciemny; jasny dla tych, którzy wolą (przełącznik w pasku u góry).
   Krój pisma trzymamy u siebie — panel nie łączy się z serwerami Google. */

/* ── Krój pisma ─────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/manrope-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/manrope-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/manrope-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/manrope-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("/static/fonts/manrope-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("/static/fonts/manrope-latin-ext-800-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Kolory ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  --bg: #0e131b;
  --surface: #151c26;
  --raised: #1b2430;
  --line: #232d3b;
  --line-strong: #31405280;

  --text: #e9eef5;
  --muted: #9aa8ba;
  --faint: #6d7b8d;

  --money: #d9a441;          /* kwoty i główne przyciski — mosiądz, nie neon */
  --money-soft: #f0c46a;
  --danger: #f0755c;
  --ok: #3fbf8f;

  /* Sześć diagnoz. Ciepłe = problem ze sprzedażą, zimne = problem z zasięgiem. */
  --d-template: #3fbf8f;
  --d-hidden_gem: #e0a93b;
  --d-weak_cta: #8b97fa;
  --d-promise_gap: #f0755c;
  --d-reach_only: #7fa3c3;
  --d-drop: #8b93a1;
  --d-not_enough: #6d7b8d;

  --radius: 10px;
  --radius-small: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  --page: 76rem;

  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --raised: #ffffff;
  --line: #e4e8ee;
  --line-strong: #cbd3de;

  --text: #101722;
  --muted: #566274;
  --faint: #8090a3;

  --money: #8a6410;
  --money-soft: #6f500b;
  --danger: #bf4430;
  --ok: #0e7a55;

  --d-template: #0e7a55;
  --d-hidden_gem: #96650f;
  --d-weak_cta: #4750c4;
  --d-promise_gap: #bf4430;
  --d-reach_only: #3e6c92;
  --d-drop: #616b7a;
  --d-not_enough: #8090a3;

  --shadow: 0 1px 2px rgb(16 23 34 / 8%);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --raised: #ffffff;
    --line: #e4e8ee;
    --line-strong: #cbd3de;
    --text: #101722;
    --muted: #566274;
    --faint: #8090a3;
    --money: #8a6410;
    --money-soft: #6f500b;
    --danger: #bf4430;
    --ok: #0e7a55;
    --d-template: #0e7a55;
    --d-hidden_gem: #96650f;
    --d-weak_cta: #4750c4;
    --d-promise_gap: #bf4430;
    --d-reach_only: #3e6c92;
    --d-drop: #616b7a;
    --d-not_enough: #8090a3;
    --shadow: 0 1px 2px rgb(16 23 34 / 8%);
  }
}

/* ── Podstawy ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--money); }

h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 .25rem;
}
h2 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 .6rem;
}

p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }

code, .snippet {
  font-family: var(--mono);
  font-size: .85em;
}
code {
  padding: .1rem .35rem;
  border-radius: var(--radius-small);
  background: var(--raised);
  color: var(--money-soft);
}

:focus-visible {
  outline: 2px solid var(--money);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Pasek górny ────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
/* Logo (app/web/templates/_logo.html): obrazek jako maska w kolorze tekstu.
   Wysokość ustawia font-size na .logo. */
.logo {
  display: inline-flex;
  align-items: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { color: var(--text); }
/* Bez obsługi masek przeglądarka pokazuje sam napis — logo nigdy nie znika. */
.logo-img { display: block; }
.logo-text { font-family: var(--sans); font-weight: 800; letter-spacing: -0.03em; }
@supports ((mask-image: url("")) or (-webkit-mask-image: url(""))) {
  .logo-img {
    flex: none;
    width: 6.6375em; /* 531 / 80 — wprost, bo starsze Safari nie liczą szerokości z proporcji */
    height: 1em;
    background-color: currentColor;
    -webkit-mask: url("/static/logo.png?v=2") center / contain no-repeat;
    mask: url("/static/logo.png?v=2") center / contain no-repeat;
  }
  .logo-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
.brand { margin-right: auto; font-size: 20px; }
.auth-logo { font-size: 28px; margin-bottom: 2.25rem; }
.topbar-link, .topbar-user { font-size: .85rem; color: var(--muted); }
.topbar-link { text-decoration: none; }
.topbar-link:hover { color: var(--text); }
.topbar form { margin: 0; }

.theme-toggle {
  padding: .3rem .6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }

/* ── Strona ─────────────────────────────────────────────────────────────── */
.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2rem) 5rem;
}
.page > p:first-child { font-size: .85rem; color: var(--muted); }

section { margin: 0 0 2.5rem; }

/* ── Nawigacja kanału: trzy grupy, bo ekrany nie są równorzędne ─────────── */
.subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem 1.1rem;
  margin: 1.25rem 0 2rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}
.subnav a {
  padding: .15rem 0;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.subnav a:hover { color: var(--text); }
.subnav a.primary { font-weight: 600; color: var(--text); }
.subnav a.active { color: var(--money-soft); border-bottom-color: var(--money); font-weight: 600; }
.subnav .divider { width: 1px; height: 1rem; background: var(--line); }
.subnav .setup { margin-left: auto; font-size: .85rem; }

/* ── Pasek liczb: jedna szuflada z przegródkami, nie stos kartek ────────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  margin: 0 0 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .9rem 1.1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tile-label {
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--faint);
}
.tile-value {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tile-text { font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.tile-change { font-size: .78rem; color: var(--muted); }
.tile-money .tile-value { color: var(--money); }

/* ── Tabele: kreski włosowe zamiast ramek, liczby monospacem ───────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  position: sticky;
  top: 0;
  padding: .6rem .9rem;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  white-space: nowrap;
}
.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.table .num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* ── Listy ──────────────────────────────────────────────────────────────── */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.list li + li { border-top: 1px solid var(--line); }
.list a { display: block; padding: .8rem 1rem; text-decoration: none; font-weight: 600; }
.list a:hover { background: var(--raised); }
.list .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1rem;
}
.list .row form { margin: 0; }

/* ── Diagnozy: jedyne nasycone kolory w panelu ─────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .12rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
}
.badge::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: 2px;
  background: currentcolor;
}
.badge-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge-missing, .badge-wrong { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge-money { color: var(--money); border-color: color-mix(in srgb, var(--money) 40%, transparent); }
.badge-none { color: var(--faint); }

.verdict {
  --verdict-color: var(--d-not_enough);
  border-left: 3px solid var(--verdict-color);
  padding-left: .9rem;
}
.verdict h2 { color: var(--verdict-color); }
.verdict[data-diagnosis="template"] { --verdict-color: var(--d-template); }
.verdict[data-diagnosis="hidden_gem"] { --verdict-color: var(--d-hidden_gem); }
.verdict[data-diagnosis="weak_cta"] { --verdict-color: var(--d-weak_cta); }
.verdict[data-diagnosis="promise_gap"] { --verdict-color: var(--d-promise_gap); }
.verdict[data-diagnosis="reach_only"] { --verdict-color: var(--d-reach_only); }
.verdict[data-diagnosis="drop"] { --verdict-color: var(--d-drop); }
.verdict .advice {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  color: var(--text);
}
.verdict .count {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--faint);
}

/* Kwota szacunkowa nigdy nie udaje pewnej — zawsze z kropkowaną linią. */
.estimate {
  border-bottom: 1px dotted var(--money);
  cursor: help;
}

/* ── Komunikaty ─────────────────────────────────────────────────────────── */
.notice, .flash, .error {
  padding: .7rem .9rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--faint);
  border-radius: var(--radius-small);
  background: var(--surface);
  font-size: .9rem;
}
.flash-ok { border-left-color: var(--ok); }
.flash-error, .error { border-left-color: var(--danger); color: var(--text); }
.notice { border-left-color: var(--money); }

/* ── Formularze ─────────────────────────────────────────────────────────── */
.form { display: grid; gap: .4rem; }
.form label, .form-inline label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
.form label { margin-top: .6rem; }

input, select, textarea {
  padding: .55rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .5rem;
  margin-top: .9rem;
}
.form-inline label { flex-basis: 100%; }
.form-inline input, .form-inline textarea { flex: 1 1 18rem; }
.form-row { display: flex; align-items: center; gap: .4rem; margin: 0; }
.form-row input { width: 6.5rem; text-align: right; font-family: var(--mono); }

.button {
  padding: .55rem 1rem;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--money);
  color: #1a1206;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.button:hover { background: var(--money-soft); }
.form .button { margin-top: 1rem; }
.button-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.button-link:hover { color: var(--danger); }

/* ── Drobiazgi ──────────────────────────────────────────────────────────── */
.snippet {
  overflow-x: auto;
  margin: .6rem 0;
  padding: .8rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--money-soft);
  font-size: .8rem;
}
.bar-cell { width: 34%; }
.bar {
  display: block;
  height: .5rem;
  min-width: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--money) 0%, color-mix(in srgb, var(--money) 45%, transparent) 100%);
}

.auth { max-width: 22rem; margin: 12vh auto; padding: 0 1.5rem; }
.auth h1 { margin-bottom: 1.25rem; }
.placeholder { max-width: 34rem; margin: 18vh auto; padding: 0 1.5rem; }

/* ── Telefon ────────────────────────────────────────────────────────────── */
@media (max-width: 40rem) {
  .page { padding-top: 1.25rem; }
  .subnav .setup { margin-left: 0; }
  .tile { border-right: 0; }
  .table th, .table td { padding: .55rem .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
