/* Design tokens and global styles for light-DOM pages. The shadow-DOM primitives
   (lk-button, lk-card, lk-badge, lk-dialog, lk-popover, lk-chart) read the same custom properties.

   Colors are OKLCH. Chrome colors (backgrounds, borders, the accent, focus rings, charts) all
   derive from ONE hue + chroma pair, so one choice yields matching light and dark variants:
   hue and chroma stay put and only the --l-* lightness values change per mode.
   --accent-h, --accent-c and --neutral are set on <html> by js/theme-init.js. The default,
   Graphite (chroma 0), is "neutral": near-black in light mode, near-white in dark mode. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

/* Optional typefaces for Settings > Appearance. Self-hosted (nothing is fetched from a font service) and only
   downloaded by the browser when a page actually uses them. All are under the SIL Open Font License. */
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Merriweather"; src: url("/static/fonts/merriweather-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/static/fonts/poppins-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/static/fonts/poppins-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/static/fonts/poppins-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/static/fonts/poppins-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/static/fonts/lato-latin-400-normal.woff2") format("woff2"); font-weight: 100 500; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/static/fonts/lato-latin-700-normal.woff2") format("woff2"); font-weight: 600 900; font-display: swap; }
@font-face { font-family: "Cal Sans"; src: url("/static/fonts/cal-sans-latin-400-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --accent-h: 264;
  --accent-c: 0;
  --neutral: 1;
  --tint: 1; /* how much accent chroma bleeds into backgrounds and borders; dark mode needs more */

  --l-bg: 0.985;
  --l-surface: 1;
  --l-border: 0.915;
  --l-border-strong: 0.85;
  --l-accent-base: 0.55;
  --l-accent-neutral: 0.2; /* a gray accent renders near-black in light mode, near-white in dark */
  --l-accent: calc(var(--l-accent-base) + (var(--l-accent-neutral) - var(--l-accent-base)) * var(--neutral));
  --l-accent-bg: 0.955;
  --l-accent-border: 0.82;
  --l-tag-bg: 0.95;
  --l-tag-fg: 0.45;

  --bg: oklch(var(--l-bg) calc(var(--accent-c) * 0.045 * var(--tint)) var(--accent-h));
  --surface: oklch(var(--l-surface) calc(var(--accent-c) * 0.012 * var(--tint)) var(--accent-h));
  --card: var(--surface);
  --border: oklch(var(--l-border) calc(var(--accent-c) * 0.08 * var(--tint)) var(--accent-h));
  --border-strong: oklch(var(--l-border-strong) calc(var(--accent-c) * 0.11 * var(--tint)) var(--accent-h));
  --hover: color-mix(in oklab, var(--border) 45%, transparent);
  --accent: oklch(var(--l-accent) var(--accent-c) var(--accent-h));
  --accent-bg: oklch(var(--l-accent-bg) calc(var(--accent-c) * 0.22) var(--accent-h));
  --accent-border: oklch(var(--l-accent-border) calc(var(--accent-c) * 0.5) var(--accent-h));
  --accent-ring: color-mix(in oklab, var(--accent) 22%, transparent);
  --accent-text: oklch(1 0 0);
  --primary: var(--accent);
  --primary-soft: var(--accent-bg);
  --on-primary: var(--accent-text);

  --text: oklch(0.21 0.006 285);
  --text-dim: oklch(0.53 0.012 285);   /* secondary text: at least 4.5:1 on the page, on cards and on tinted fills (WCAG AA) */
  --text-faint: oklch(0.66 0.01 285);  /* not for text: icons, dots, strokes (3:1) */
  --muted: var(--text-dim);

  --red: oklch(0.55 0.2 25);
  --red-bg: oklch(0.965 0.025 25);
  --green: oklch(0.5 0.14 152);
  --green-bg: oklch(0.96 0.04 152);
  --amber: oklch(0.55 0.13 70);
  --amber-bg: oklch(0.97 0.05 90);
  --danger: var(--red);
  --danger-text: var(--red);
  --success-text: var(--green);
  --success-bg: var(--green-bg);

  --shadow: 0 1px 2px oklch(0.2 0.01 285 / 0.05), 0 1px 3px oklch(0.2 0.01 285 / 0.04);
  --shadow-lg: 0 20px 50px oklch(0.2 0.02 285 / 0.18), 0 4px 12px oklch(0.2 0.02 285 / 0.08);
  --focus: 0 0 0 3px var(--accent-ring);
  accent-color: var(--accent);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --tint: 2.2;
  --l-bg: 0.15;
  --l-surface: 0.2;
  --l-border: 0.29;
  --l-border-strong: 0.37;
  --l-accent-base: 0.72;
  --l-accent-neutral: 0.985;
  --l-accent-bg: 0.27;
  --l-accent-border: 0.45;
  --l-tag-bg: 0.3;
  --l-tag-fg: 0.82;
  --accent-text: oklch(0.16 calc(var(--accent-c) * 0.15) var(--accent-h));

  --text: oklch(0.97 0.003 285);
  --text-dim: oklch(0.68 0.012 285);
  --text-faint: oklch(0.52 0.012 285);

  --red: oklch(0.72 0.17 25);
  --red-bg: oklch(0.27 0.07 25);
  --green: oklch(0.76 0.16 152);
  --green-bg: oklch(0.26 0.06 152);
  --amber: oklch(0.8 0.14 80);
  --amber-bg: oklch(0.28 0.06 80);

  --shadow: 0 1px 2px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 20px 50px oklch(0 0 0 / 0.5), 0 4px 12px oklch(0 0 0 / 0.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: normal;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; text-underline-offset: 3px; }
p a, .hint a, .alert a { color: var(--text); text-decoration-color: var(--border-strong); }
p a:hover, .hint a:hover, .alert a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 1px 6px; border-radius: 6px; }
::selection { background: var(--accent-bg); }

.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.ti { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.ti.sm { width: 15px; height: 15px; }
.ti.lg { width: 24px; height: 24px; }

/* ---------- sidebar layout ---------- */
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 14px; border-radius: 999px; z-index: 60; }
.skip-link:focus { top: 8px; box-shadow: var(--shadow-lg); }

.app { display: grid; grid-template-columns: 64px minmax(0, 1fr); min-height: 100vh; }
.app.has-panel { grid-template-columns: 64px 240px minmax(0, 1fr); }

/* the rail: one icon per area of the product */
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 16px 0 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.rail-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); margin-bottom: 4px; }
.rail-logo img { display: block; }
.rail-word { display: none; }
.rail-nav, .rail-foot { display: grid; gap: 6px; justify-items: center; }
.rail-foot { margin-top: auto; gap: 10px; }
.rail-btn {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius);
  color: var(--text-dim); transition: color 0.12s, background 0.12s;
}
.rail-btn:hover { color: var(--text); background: var(--hover); }
.rail-btn[aria-current="page"] { background: var(--accent-bg); color: var(--accent); }
.rail-btn:focus-visible, .rail-logo:focus-visible { box-shadow: var(--focus); }

/* the panel: pages of the current area */
.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.panel-title { padding: 8px 12px 4px; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.panel-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-group { display: grid; gap: 2px; }
.site-pick { position: relative; margin-bottom: 8px; }
.site-pick select.input { width: 100%; font-weight: 600; text-overflow: ellipsis; }

.logo { display: flex; align-items: center; border-radius: 6px; padding: 0 8px; }
.logo img { display: block; height: 22px; width: auto; }
.logo .dark, .rail-word .dark { display: none; }
:root[data-theme="dark"] .logo .light, :root[data-theme="dark"] .rail-word .light { display: none; }
:root[data-theme="dark"] .logo .dark, :root[data-theme="dark"] .rail-word .dark { display: block; }

.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--radius);
  color: var(--text-dim); text-decoration: none; font-weight: 550; transition: color 0.12s, background 0.12s;
}
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { background: var(--accent-bg); color: var(--text); }
.nav a[aria-current="page"] .ti { color: var(--accent); }
.nav-label { margin: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--accent); color: var(--accent-text); flex-shrink: 0; }

.content { min-width: 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 36px) 96px; }
.page-header { margin-bottom: 24px; display: grid; gap: 4px; }
.page-header.row { display: flex; align-items: flex-end; }
.page-header p { color: var(--text-dim); }

.banner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 36px); background: var(--accent-bg); border-bottom: 1px solid var(--border);
}

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text-dim); }

/* Tablets and phones: the rail becomes a top bar and the panel a scrolling row of pages. */
@media (max-width: 899px) {
  .app, .app.has-panel { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky; top: 0; z-index: 21; height: auto; flex-direction: row; align-items: center; gap: 8px 10px; padding: 8px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .rail-logo { display: none; }
  .rail-word { display: block; margin-right: 6px; }
  .rail-word img { height: 20px; }
  .rail-nav { display: flex; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .panel {
    position: sticky; top: 56px; z-index: 20; height: auto; overflow: visible; flex-direction: row; align-items: center; gap: 6px 10px;
    padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
  }
  .panel::-webkit-scrollbar { display: none; }
  .panel-title, .nav-label { display: none; }
  .site-pick { margin: 0; min-width: 180px; }
  .nav-group, .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; padding: 7px 14px; border-radius: 999px; }
  .panel-foot { margin: 0; padding: 0; border: 0; }
  .container { padding-top: 20px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.big { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field > .label { font-size: 12.5px; font-weight: 600; }
.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.input::placeholder { color: var(--text-dim); }
.input:hover { border-color: var(--accent-border); }
.input:focus-visible { border-color: var(--accent); box-shadow: var(--focus); }
.input[readonly] { color: var(--text-dim); background: var(--hover); }
textarea.input { height: auto; min-height: 92px; padding: 9px 12px; resize: vertical; font: 12.5px/1.5 ui-monospace, Menlo, monospace; }
select.input {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.hint { color: var(--text-dim); font-size: 12px; }

.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert.error { border-color: color-mix(in oklab, var(--red) 35%, transparent); color: var(--red); background: var(--red-bg); }
.alert.ok { border-color: color-mix(in oklab, var(--green) 35%, transparent); color: var(--green); background: var(--green-bg); }

.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: color-mix(in oklab, var(--text) 4%, var(--surface)); border-radius: 999px; position: relative; }
.segmented input, .swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 550; color: var(--text-dim); transition: color 0.12s, background 0.12s;
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + label { box-shadow: var(--focus); }

.swatches { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; position: relative; }
.swatch {
  --sw-h: 264; --sw-c: 0; --sw-neutral: 1;
  --sw-l: calc(var(--l-accent-base) + (var(--l-accent-neutral) - var(--l-accent-base)) * var(--sw-neutral));
  display: block; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; position: relative;
  background: oklch(var(--sw-l) var(--sw-c) var(--sw-h)); transition: transform 0.12s, box-shadow 0.12s;
}
.swatch:hover { transform: scale(1.1); }
input:checked + .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px oklch(var(--sw-l) var(--sw-c) var(--sw-h)); }
input:focus-visible + .swatch { outline: 2px solid var(--text); outline-offset: 3px; }
.swatch-custom { background: conic-gradient(from 90deg, #f43f5e, #f59e0b, #84cc16, #10b981, #06b6d4, #3b82f6, #8b5cf6, #f43f5e); overflow: hidden; }
.swatch-custom.active { background: oklch(var(--sw-l) var(--sw-c) var(--sw-h)); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px oklch(var(--sw-l) var(--sw-c) var(--sw-h)); }
.swatch-custom input[type="color"] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; display: grid; gap: 22px; }
.auth-box .logo { justify-content: center; }
.auth-box .logo img { height: 28px; }
.auth-box h1 { text-align: center; font-size: 22px; }
.auth-box .card { padding: 24px; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 28px; margin: 0; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; padding: 12px 14px; background: var(--hover); border-radius: var(--radius); font-size: 13px; }
.meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.section-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }

.icon-btn {
  all: unset; box-sizing: border-box; cursor: pointer; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm); color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--accent-bg); color: var(--accent); }
.icon-btn:focus-visible { box-shadow: var(--focus); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.accent { color: var(--accent); }

.chip {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: var(--accent-bg); font-size: 12.5px; font-weight: 550; transition: background 0.12s;
}
.chip:hover { background: var(--border); }
.chip:focus-visible { box-shadow: var(--focus); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* ---------- tags (pastel chips; hue from the same OKLCH wheel as the accents) ---------- */
.tag {
  --th: 264; display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: oklch(var(--l-tag-bg) 0.045 var(--th)); color: oklch(var(--l-tag-fg) 0.16 var(--th));
}
.tag[data-color="red"] { --th: 25; } .tag[data-color="orange"] { --th: 48; } .tag[data-color="amber"] { --th: 75; }
.tag[data-color="green"] { --th: 152; } .tag[data-color="teal"] { --th: 190; } .tag[data-color="blue"] { --th: 264; }
.tag[data-color="violet"] { --th: 300; } .tag[data-color="pink"] { --th: 350; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- links page ---------- */
.create-card { padding: 18px; margin-bottom: 20px; }
.create-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: start; }
@media (max-width: 860px) { .create-grid { grid-template-columns: 1fr 1fr; } .create-grid .url-field { grid-column: 1 / -1; } }
@media (max-width: 520px) { .create-grid { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 0; }
.search { position: relative; flex: 1 1 260px; }
.search .input { width: 100%; padding-left: 38px; border-radius: 999px; }
.search .ti { position: absolute; left: 13px; top: 10px; color: var(--text-faint); pointer-events: none; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim);
  font-weight: 650; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 12px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--hover); }
.table .num { text-align: right; }
.table .sel { width: 40px; padding-right: 0; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.th-sort .ti { width: 13px; height: 13px; opacity: 0.45; }
.th-sort.active .ti { opacity: 1; color: var(--text); }
.clicks-cell { font-variant-numeric: tabular-nums; font-weight: 650; }

.link-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.favicon {
  --fh: 264; width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  background: oklch(var(--l-tag-bg) 0.05 var(--fh)); color: oklch(var(--l-tag-fg) 0.14 var(--fh));
  position: relative; overflow: hidden;
}
/* the real icon sits on top of the letter tile; if it fails to load it is removed and the tile shows through */
.favicon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.link-text { min-width: 0; }
.link-short { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.link-short a { text-decoration: none; }
.link-short a:hover { text-decoration: underline; }
.link-title { font-size: 12.5px; color: var(--text); }
.link-dest { font-size: 12.5px; color: var(--text-dim); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.actions { display: flex; gap: 0; justify-content: flex-end; }

.bulkbar { display: flex; gap: 12px; align-items: center; padding: 8px 14px; margin-bottom: 14px; background: var(--accent-bg); border-radius: var(--radius); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 4px; color: var(--text-dim); font-size: 13px; }
.pager .row { gap: 8px; }
.empty { padding: 64px 24px; text-align: center; display: grid; gap: 6px; justify-items: center; color: var(--text-dim); }
.empty .ti { width: 32px; height: 32px; color: var(--text-faint); margin-bottom: 6px; }
.empty strong { color: var(--text); font-size: 15px; }

/* Columns drop out as the screen narrows, and rows become cards on phones. */
/* the sidebar takes 248px, so the table has less room than the window suggests */
@media (max-width: 1299px) { .col-created { display: none; } }
@media (max-width: 1139px) { .col-tags { display: none; } }
@media (max-width: 1039px) { .link-dest { display: none; } }
@media (max-width: 639px) {
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "sel main" "sel meta" "sel tags" "sel actions"; padding: 14px; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; }
  .table td.sel { grid-area: sel; width: auto; padding-right: 12px; padding-top: 4px; }
  .table td.cell-main { grid-area: main; }
  .table td.num { grid-area: meta; text-align: left; padding-top: 4px; color: var(--text-dim); font-weight: 500; }
  .table td.num::after { content: " clicks"; }
  .table td.col-tags { grid-area: tags; display: block; }
  .table td.col-tags .tags { margin-top: 8px; }
  .table td.col-created { display: none; }
  .table td.cell-actions { grid-area: actions; margin: 6px 0 0 -6px; }
  .actions { justify-content: flex-start; }
}

/* ---------- link form ---------- */
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-grid.two { grid-template-columns: 1fr; } }
details.adv > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 2px;
  font-size: 13px; font-weight: 600; color: var(--text-dim); user-select: none;
}
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary .ti { width: 15px; height: 15px; transition: transform 0.15s; }
details.adv[open] > summary { color: var(--text); }
details.adv[open] > summary .ti { transform: rotate(90deg); }
details.adv > .form-grid { margin-top: 14px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.tag-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-pick label { cursor: pointer; }
.tag-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tag-pick .tag { outline: 2px solid transparent; outline-offset: 1px; opacity: 0.7; transition: opacity 0.1s; }
.tag-pick input:checked + .tag { outline-color: currentColor; opacity: 1; }
.tag-pick input:focus-visible + .tag { box-shadow: var(--focus); }
.preview { padding: 9px 12px; background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font: 12.5px ui-monospace, Menlo, monospace; overflow-wrap: anywhere; color: var(--text-dim); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tag-row { display: grid; grid-template-columns: minmax(0, 1fr) 124px auto; gap: 8px; align-items: center; }
.row .input.grow { width: auto; flex: 1 1 160px; min-width: 0; }

/* ---------- statistics ---------- */
.bd { display: grid; gap: 2px; margin: -4px -8px; }
.bd > [role="listitem"] { display: grid; }
.bd-row {
  all: unset; box-sizing: border-box; position: relative; display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 10px; border-radius: 8px; overflow: hidden; cursor: pointer; font-size: 13.5px;
}
.bd-row { isolation: isolate; }
.bd-row::before { content: ""; position: absolute; z-index: -1; inset: 1.5px 0; width: var(--w); background: var(--accent-bg); border-radius: 7px; } /* the bar sits behind the row's content */
.bd-row > * { position: relative; z-index: 1; }
.bd-row.static { cursor: default; }
button.bd-row:hover::before { background: var(--accent-border); opacity: 0.55; }
button.bd-row:focus-visible { box-shadow: var(--focus); }
.bd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.bd-n { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; max-width: calc(100vw - 40px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 999px; font-weight: 550;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: toast-in 0.2s ease-out;
}
.toast.error { background: var(--red); color: oklch(1 0 0); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

@media (max-width: 719px) { .page-header.row { align-items: flex-start; } }

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

/* ---------- tag manager ---------- */
.tag-item { display: grid; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tag-item:last-child { border-bottom: 0; }
.tag-item .top { display: flex; gap: 8px; align-items: center; }
.tag-swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tag-swatch {
  --th: 264; all: unset; box-sizing: border-box; width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  background: oklch(var(--l-accent-base) 0.17 var(--th)); transition: transform 0.12s, box-shadow 0.12s;
}
.tag-swatch:hover { transform: scale(1.12); }
.tag-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px oklch(var(--l-accent-base) 0.17 var(--th)); }
.tag-swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.tag-swatch[data-color="red"] { --th: 25; } .tag-swatch[data-color="orange"] { --th: 48; } .tag-swatch[data-color="amber"] { --th: 75; }
.tag-swatch[data-color="green"] { --th: 152; } .tag-swatch[data-color="teal"] { --th: 190; } .tag-swatch[data-color="blue"] { --th: 264; }
.tag-swatch[data-color="violet"] { --th: 300; } .tag-swatch[data-color="pink"] { --th: 350; }
.col-created { white-space: nowrap; }

/* ---------- import ---------- */
.dropzone {
  display: grid; gap: 6px; justify-items: center; text-align: center; padding: 36px 20px; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-dim);
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.dropzone:focus-within { box-shadow: var(--focus); border-color: var(--accent); }
.dropzone strong { color: var(--text); }
.dropzone .ti { color: var(--text-faint); margin-bottom: 4px; }
ul.issues { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
ul.issues li { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
ul.issues li:last-child { border-bottom: 0; }

.mini-tabs { display: inline-flex; gap: 2px; padding: 3px; background: color-mix(in oklab, var(--text) 4%, var(--surface)); border-radius: 999px; } /* neutral, not the accent colour */
.mini-tabs button {
  all: unset; cursor: pointer; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-dim);
  transition: color 0.12s, background 0.12s;
}
.mini-tabs button:hover { color: var(--text); }
.mini-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mini-tabs button:focus-visible { box-shadow: var(--focus); }

/* ---------- website dashboard ---------- */
.skeleton { height: 30px; border-radius: 8px; background: linear-gradient(90deg, var(--hover), var(--border), var(--hover)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.dash-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.dash-head .grow { flex: 1 1 0; }
.range-pick select { border-radius: 999px; height: 40px; }
.live-pill {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; box-shadow: var(--shadow);
}
.live-pill:hover { background: var(--accent-bg); border-color: var(--accent-border); }
.live-pill:focus-visible { box-shadow: var(--focus); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 color-mix(in oklab, var(--green) 50%, transparent); animation: pulse 2s infinite; }
.pulse.off { background: var(--text-faint); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.25; margin: 2px 0 4px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; padding: 1px 8px 1px 5px; border-radius: 999px; }
.delta .ti { width: 13px; height: 13px; }
.delta.good { background: var(--green-bg); color: var(--green); }
.delta.bad { background: var(--red-bg); color: var(--red); }
.delta.flat { background: var(--hover); color: var(--text-dim); }
.panels { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-top: 16px; }
.attribution { margin-top: 28px; text-align: center; color: var(--text-dim); font-size: 12px; }
.attribution a { color: var(--text-dim); }
.code { position: relative; }
.code pre { margin: 0; padding: 14px 16px; padding-right: 52px; background: var(--hover); border-radius: var(--radius); font: 12.5px/1.6 ui-monospace, Menlo, monospace; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.code .icon-btn { position: absolute; right: 8px; top: 8px; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--hover); font-weight: 550; }
.status-line.ok { background: var(--green-bg); color: var(--green); }
.site-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.site-row:last-child { border-bottom: 0; }
.site-row h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.feed li { display: flex; gap: 10px; align-items: baseline; padding: 6px 4px; font-size: 13px; }
.feed .when { color: var(--text-dim); min-width: 64px; font-variant-numeric: tabular-nums; }
.mini-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mini-tabs::-webkit-scrollbar { display: none; }
.mini-tabs button { white-space: nowrap; }

/* ---- team ---- */
.team { display: grid; }
.team-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 34px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: 0; }
.team-row .who { display: grid; min-width: 0; }
.team-row .who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.ghost { background: var(--border); color: var(--text-dim); }
.access-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius); }
.access-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.access-row:last-child { border-bottom: 0; }
.access-row .input { height: 34px; }
@media (max-width: 480px) { .access-row { grid-template-columns: 1fr; } }
.site-visit { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.site-visit:last-child { border-bottom: 0; }
.site-visit .who { display: grid; min-width: 0; }
@media (max-width: 480px) { .site-visit { grid-template-columns: 1fr auto; } .site-visit a { grid-column: 1 / -1; } }

/* ---- world map ---- */
.map svg { display: block; width: 100%; height: auto; }
.map .land { fill: color-mix(in oklab, var(--text) 13%, var(--surface)); stroke: var(--surface); stroke-width: 0.6; vector-effect: non-scaling-stroke; transition: opacity 0.1s; }
.map .land.hit { cursor: pointer; }
.map .land.hit:hover { stroke: var(--text); stroke-width: 1; }
.map-tip { position: absolute; transform: translate(12px, -110%); pointer-events: none; z-index: 2; white-space: nowrap; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12.5px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
lk-breakdown[wide] { grid-column: 1 / -1; }
.map svg { max-height: 420px; }

/* ---- sign-in divider ---- */
.or { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---- inline buttons that look like text ---- */
.linklike { all: unset; cursor: pointer; color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.linklike:hover { text-decoration-color: currentColor; }
.linklike:focus-visible { box-shadow: var(--focus); border-radius: 3px; }
th .linklike { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.table.nowrap th, .table.nowrap td { white-space: nowrap; }

/* ---- goals ---- */
.goal-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) minmax(110px, 0.8fr) minmax(70px, 0.4fr) auto; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.goal-row:last-child { border-bottom: 0; }
.goal-row h2, .goal-row h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.goal-bar { height: 8px; border-radius: 999px; background: var(--accent-bg); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.goal-num { display: grid; line-height: 1.3; }
@media (max-width: 760px) { .goal-row { grid-template-columns: 1fr auto; } .goal-bar { grid-column: 1 / -1; order: 5; } }

/* ---- funnels ---- */
.funnel { display: grid; gap: 4px; }
.funnel-step { display: grid; gap: 8px; }
.funnel-head { display: flex; align-items: center; gap: 10px; }
.funnel-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-bg); color: var(--text); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.funnel-bar { height: 34px; border-radius: var(--radius); background: var(--accent-bg); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius); transition: width 0.3s ease; }
.funnel-drop { display: flex; align-items: center; gap: 6px; margin: 2px 0 2px 34px; font-size: 12.5px; color: var(--text-dim); }
.step-edit { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.step-edit .funnel-n { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .funnel-bar span { transition: none; } }

/* ---- journeys ---- */
.journey svg { display: block; overflow: visible; }
.journey .jn.first { cursor: pointer; }
.journey .jl { fill: var(--text); font: 12px var(--font); pointer-events: none; }
.journey .jc { fill: var(--text-faint); }
.journey .jh { fill: var(--text-dim); font: 11px var(--font); text-transform: uppercase; letter-spacing: 0.05em; }

/* round flags, browser and system logos, site icons that lead a row */
.lead-img { width: 18px; height: 18px; flex-shrink: 0; object-fit: contain; }
.lead-img.flag { border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.lead-img.brand { border-radius: 4px; }

/* traffic by weekday and hour */
.tgrid { border-collapse: separate; border-spacing: 0; margin: 0 auto; }
.tgrid th { font-size: 12px; font-weight: 600; color: var(--text-dim); padding: 0 6px 6px; text-align: center; }
.tgrid tbody th { text-align: right; font-weight: 400; padding: 0 12px 0 0; height: 24px; white-space: nowrap; }
.tgrid td { width: 34px; height: 24px; text-align: center; padding: 0; }
.tdot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); transform: scale(var(--s)); vertical-align: middle; }
.tdot.zero { background: var(--border); transform: scale(0.4); opacity: 0.7; }

/* date-range picker */
.rp { position: relative; display: inline-block; }
.rp-trigger { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); }
.rp-trigger:hover { border-color: var(--border-strong, var(--text-dim)); }
.rp-trigger:focus-visible { outline: none; box-shadow: var(--focus); }
.rp-dates { color: var(--text-dim); font-weight: 400; }
.rp-panel { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.rp-presets { list-style: none; margin: 0; padding: 8px; border-right: 1px solid var(--border); min-width: 170px; }
.rp-presets button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.rp-presets button:hover { background: var(--accent-bg); }
.rp-presets button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.rp-presets button:focus-visible, .rp-day:focus-visible { outline: none; box-shadow: var(--focus); }
.rp-cal { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.rp-inputs { display: flex; gap: 12px; }
.rp-inputs label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.rp-inputs .input { width: auto; height: 34px; }
.rp-months { display: flex; gap: 24px; }
.rp-month { width: 252px; }
.rp-mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rp-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; }
.rp-wd { font-size: 11px; color: var(--text-dim); text-align: center; padding-bottom: 4px; }
.rp-day { height: 34px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; border-radius: 0; }
.rp-day:hover:not(:disabled) { background: var(--accent-bg); border-radius: 8px; }
.rp-day:disabled { color: var(--text-dim); opacity: 0.4; cursor: default; }
.rp-day.in { background: var(--accent-bg); }
.rp-day.today { font-weight: 700; }
.rp-day.edge { background: var(--accent); color: var(--accent-text); border-radius: 8px; }
.rp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .rp-panel { flex-direction: column; }
  .rp-presets { order: -1; border-right: 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; max-height: none; }
  .rp-presets li { flex: 0 0 auto; }
  .rp-presets button { white-space: nowrap; }
  .rp-months { flex-direction: column; gap: 12px; }
  .rp-inputs { flex-wrap: wrap; }
}

/* filter dialog */
.count-pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.fd { display: grid; grid-template-columns: 190px 1fr; gap: 16px; min-height: 340px; }
.fd-fields { list-style: none; margin: 0; padding: 0 12px 0 0; border-right: 1px solid var(--border); max-height: 380px; overflow-y: auto; }
.fd-fields button { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.fd-fields button:hover { background: var(--accent-bg); }
.fd-fields button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.fd-fields button:focus-visible, .fd-opt:focus-visible { outline: none; box-shadow: var(--focus); }
.fd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.fd-values { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fd-list { display: flex; flex-direction: column; gap: 2px; max-height: 330px; overflow-y: auto; }
.fd-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.fd-opt:hover { background: var(--accent-bg); }
.fd-opt.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.fd-segs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fd-segs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 640px) { .fd { grid-template-columns: 1fr; } .fd-fields { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; display: flex; flex-wrap: wrap; max-height: none; } .fd-fields li { flex: 0 0 auto; } }
.lead-cell { display: inline-flex; align-items: center; gap: 8px; }
.avatar-face { display: block; }
.lead-img.tile { position: relative; display: inline-grid; place-items: center; border-radius: 5px; background: oklch(0.9 0.05 var(--fh, 250)); color: oklch(0.4 0.1 var(--fh, 250)); font-size: 11px; font-weight: 700; text-transform: uppercase; overflow: hidden; }
.lead-img.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.table.compact td { padding: 9px 12px; } .table.compact th { padding-left: 12px; padding-right: 12px; }

.map-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: 16px; align-items: start; }
@media (max-width: 900px) { .map-row { grid-template-columns: 1fr; } }

main[tabindex="-1"]:focus { outline: none; } /* focused only by the skip link or after a dialog closes: no ring around the whole page */
.bd-n { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.bd-n strong { text-align: right; }
.bd-n .muted { padding-left: 10px; border-left: 1px solid var(--border-strong, var(--border)); min-width: 3.4em; line-height: 1.15; }

/* pagination */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.pager .rows { justify-self: end; display: inline-flex; align-items: center; gap: 8px; }
.pager .rows .input { width: auto; height: 32px; padding: 0 28px 0 10px; }
.pages { display: inline-flex; gap: 4px; align-items: center; }
.pg { min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pg:hover:not(:disabled):not(.on) { background: var(--accent-bg); }
.pg.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.pg:disabled { opacity: 0.35; cursor: default; }
.pg:focus-visible { outline: none; box-shadow: var(--focus); }
.pg svg { margin: 0 -3px; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; justify-items: center; } .pager .rows { justify-self: center; } }

/* compare page */
.vs { font-size: 13px; letter-spacing: 0.04em; color: var(--text-dim); }
.cmp-cols { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .cmp-cols { grid-template-columns: 1fr; } }
.cal { display: inline-flex; align-items: center; gap: 6px; }

.group-by { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.group-by .input { width: auto; height: 32px; padding: 0 26px 0 10px; font-size: 13px; }

/* website switcher */
.ss { position: relative; }
.ss-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.ss-trigger:hover { border-color: var(--border-strong, var(--text-dim)); }
.ss-trigger:focus-visible, .ss-card:focus-visible, .ss-link:focus-visible { outline: none; box-shadow: var(--focus); }
.ss-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ss-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ss-panel { position: fixed; z-index: 60; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 100px); overflow-y: auto; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.ss-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; }
.ss-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ss-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.ss-card:hover { background: var(--accent-bg); }
.ss-card.on { border-color: var(--text-faint); background: color-mix(in oklab, var(--text) 4%, var(--surface)); }
.ss-spark { display: block; width: 100%; height: 26px; }
.ss-spark.empty { border-bottom: 1px dashed var(--border); height: 22px; }
.ss-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.ss-trend { display: inline-flex; align-items: center; gap: 3px; }
.ss-trend.good { color: oklch(0.48 0.13 150); }
.ss-trend.bad { color: oklch(0.5 0.19 25); }
.ss-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.ss-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer; }
.ss-link:hover { background: var(--accent-bg); color: var(--text); }
@media (max-width: 899px) { .ss-panel { left: 16px !important; right: 16px; width: auto; } }

/* the public share page */
.share-head { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; padding: 22px 24px 0; }
.share-head h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.share-head .grow { flex: 1; }
.badge-share { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-dim); font-size: 12.5px; }
.share-main { max-width: 1200px; margin: 0 auto; padding-top: 18px; }
.share-foot { text-align: center; padding: 24px 16px 40px; }

.h-card { margin: 0; } /* a card title that is a heading for assistive tech but looks as before */
:root[data-theme="dark"] .ss-trend.good { color: oklch(0.8 0.15 150); }
:root[data-theme="dark"] .ss-trend.bad { color: oklch(0.78 0.15 25); }

/* Windows high-contrast mode drops shadows and fills: give focus a real outline and keep selected states visible */
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid CanvasText !important; outline-offset: 2px; }
  .rp-day.edge, .fd-opt.on, .rp-presets button.on, .ss-card.on, .pg.on, .mini-tabs button[aria-pressed="true"] { outline: 2px solid Highlight; }
  .bd-row::before { border: 1px solid CanvasText; }
}
@media (max-width: 520px) { /* the top bar must fit a 320-375px phone without sideways scrolling */
  .rail { padding: 8px 10px; gap: 6px; }
  .rail-word { display: none; }
  .rail-logo { display: grid; }
  .rail-foot { gap: 2px; }
}

/* headline numbers: icon and label, the number with its change beside it */
.kpis { gap: 12px; }
.kpi { padding: 12px 16px 14px; }
.kpi .label { font-size: 12.5px; gap: 7px; }
.kpi .label .ti { width: 15px; height: 15px; }
.kpi .value-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.kpi .value { font-size: 24px; margin: 0; line-height: 1.2; }
.kpi .delta { font-size: 11.5px; padding: 0 6px 0 4px; }
.fd-name { display: inline-flex; align-items: center; gap: 9px; }
.fd-name .ti { color: var(--text-dim); }
.bd-search { margin: 4px 0 12px; height: 36px; }

/* ---------- the centred layout: one column of navigation with no chrome of its own, beside the page ---------- */
.side { display: contents; } /* phones: the rail and the panel are the top bars, as above */
.rail-who { display: none; }
@media (min-width: 900px) {
  .app, .app.has-panel { grid-template-columns: 232px minmax(0, 1fr); gap: 0 44px; max-width: 1420px; margin: 0 auto; padding: 0 28px; }
  .side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; padding: 26px 0 18px; overflow-y: auto; scrollbar-width: thin; }
  .rail { display: contents; }
  .rail-logo { display: none; }
  .rail-word { display: block; order: 0; padding: 0 4px; margin: 0; }
  .rail-word img { height: 22px; width: auto; display: block; }
  /* the areas as a strip of tabs above the site switcher */
  .rail-nav { order: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: color-mix(in oklab, var(--text) 5%, transparent); }
  .rail-btn { width: auto; height: 34px; border-radius: 999px; }
  .rail-btn:hover { background: color-mix(in oklab, var(--text) 6%, transparent); }
  .rail-btn[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .panel { order: 2; position: static; height: auto; overflow: visible; padding: 0; background: none; border: 0; flex: 1; }
  .panel-foot { border-top: 0; }
  .rail-foot { order: 3; margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 14px; justify-items: initial; }
  .rail-foot .rail-btn { width: 34px; flex-shrink: 0; }
  .rail-foot .avatar { order: 0; } .rail-who { order: 1; } .rail-foot a.rail-btn { order: 2; } .rail-foot button.rail-btn { order: 3; }
  .rail-who { display: block; flex: 1; min-width: 0; font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .container { max-width: none; padding: 28px 0 96px; }
  .nav a[aria-current="page"] { background: color-mix(in oklab, var(--text) 6%, transparent); }
}

/* tighter card heads, taller tabs, slightly smaller KPI numbers */
[slot="title-extra"].icon-btn.sm { width: 22px; height: 22px; margin: -3px 0; }
.mini-tabs { padding: 4px; border-radius: 10px; }
.mini-tabs button { padding: 6px 14px; border-radius: 7px; }
.kpi .value { font-size: 22px; }

/* ranking cards: equal heights, and an arrange mode */
.dash-cards { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.dash-cards .slot { min-width: 0; position: relative; grid-column: span 6; display: flex; flex-direction: column; }
.dash-cards .slot > lk-card, .dash-cards .slot > lk-breakdown { flex: 1; }
.dash-cards .slot.w12 { grid-column: span 12; }
.dash-cards .slot.w8 { grid-column: span 8; }
.dash-cards .slot.w4 { grid-column: span 4; }
.dash-cards .slot.w6 > lk-breakdown { min-height: 440px; }
@media (max-width: 1100px) { .dash-cards .slot.w6, .dash-cards .slot.w8, .dash-cards .slot.w4 { grid-column: span 12; } }
lk-breakdown { display: block; height: 100%; }
lk-breakdown > lk-card { height: 100%; box-sizing: border-box; }
.arrange-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 10px; margin-top: 24px; min-height: 32px; text-align: center; }
.arrange-bar .muted { font-size: 13px; }
.dash-cards.arranging .slot { cursor: grab; animation: slot-wiggle 0.5s ease-in-out infinite alternate; }
.dash-cards.arranging .slot:nth-child(even) { animation-delay: -0.25s; }
.dash-cards.arranging .slot.lifted { opacity: 0.45; animation: none; }
@keyframes slot-wiggle { from { transform: rotate(-0.25deg); } to { transform: rotate(0.25deg); } }
@media (prefers-reduced-motion: reduce) { .dash-cards.arranging .slot { animation: none; } }
.slot-cover { position: absolute; inset: 0; z-index: 2; border-radius: var(--radius-lg); border: 2px dashed var(--accent); background: color-mix(in oklab, var(--surface) 55%, transparent); backdrop-filter: blur(1.5px);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.slot-name { font-weight: 650; font-size: 15px; }
.slot-moves { display: flex; gap: 8px; }
.slot-moves .icon-btn { background: var(--surface); border: 1px solid var(--border); width: 34px; height: 34px; }
.slot-moves .icon-btn:disabled { opacity: 0.35; cursor: default; }

/* footer, changelog and credits */
.site-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 18px; padding-bottom: 8px; color: var(--text-dim); font-size: 12.5px; }
.site-foot a, .site-foot .linkish { color: var(--text-dim); text-decoration: none; }
.site-foot a:hover, .site-foot .linkish:hover { color: var(--text); text-decoration: underline; }
.linkish { all: unset; cursor: pointer; color: var(--text-dim); font-size: inherit; }
.linkish:focus-visible, .site-foot a:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.prose-log { max-height: min(60vh, 560px); overflow-y: auto; padding: 4px 22px 22px; font-size: 14px; line-height: 1.55; }
.prose-log h3 { font-size: 15px; margin: 18px 0 6px; }
.prose-log h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 14px 0 4px; }
.prose-log ul { margin: 4px 0 8px; padding-left: 20px; }
.prose-log li { margin: 3px 0; }
.prose-log code { font-size: 12.5px; background: var(--surface-2, color-mix(in oklab, var(--text) 6%, var(--surface))); padding: 1px 5px; border-radius: 4px; }
.credit-list { list-style: none; padding: 0 !important; }
.credit-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.credit-list .lic { color: var(--text-dim); font-size: 12.5px; text-align: right; }
.credit-list .what { grid-column: 1 / -1; color: var(--text-dim); font-size: 13px; }

/* busiest times: a pale base circle per slot, tighter rows */
.tgrid th { padding-bottom: 4px; }
.tgrid tbody th { height: 19px; padding-right: 10px; }
.tgrid td { height: 19px; width: 30px; }
.tcell { display: inline-block; position: relative; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; background: color-mix(in oklab, var(--text) 7%, var(--surface)); }
.tcell .tdot { position: absolute; inset: 0; width: auto; height: auto; transform: scale(var(--s)); opacity: var(--o); }
/* top countries under the map */
.map-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: 2px 20px; margin: 14px -8px -8px; }
.map-top > [role="listitem"] { display: grid; }
@media (max-width: 700px) { .map-top { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; } }

/* a small "i" with a tooltip, next to a card title */
.info-tip { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; margin: -3px 0; border-radius: 6px; color: var(--text-dim); cursor: help; }
.info-tip:hover, .info-tip:focus-visible { color: var(--text); background: color-mix(in oklab, var(--text) 6%, transparent); outline: none; }
.info-tip:focus-visible { box-shadow: var(--focus); }
.info-tip::after { content: attr(data-tip); position: absolute; z-index: 30; left: 50%; top: calc(100% + 8px); transform: translateX(-20%); width: max-content; max-width: 240px; padding: 8px 10px; border-radius: 8px;
  background: var(--text); color: var(--surface); font-size: 12.5px; font-weight: 400; line-height: 1.4; text-align: left; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.1s; }
.info-tip:hover::after, .info-tip:focus-visible::after { opacity: 1; }
/* busiest times: our own tooltip, instant and following the pointer */
.tgrid-wrap { position: relative; }
.tgrid-tip { position: absolute; z-index: 20; transform: translate(12px, -120%); pointer-events: none; white-space: nowrap; padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 6px; }
.tgrid-tip .ti { opacity: 0.75; }
@media (min-width: 900px) { .rail-nav { justify-items: stretch; } }

/* latest activity: icon centred on the text, with room on both sides */
.feed li { align-items: center; }
.feed .what { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; min-width: 0; }
.feed .where { display: inline-flex; align-items: center; gap: 8px; }
.feed .where .lead-img { width: 16px; height: 16px; }
.kpi .muted strong { color: var(--text); font-weight: 650; }

/* sidebar sections: more air between them, and a label that reads as a heading (darker than the items) */
.nav-label { margin: 24px 12px 6px; color: color-mix(in oklab, var(--text) 80%, var(--surface)); letter-spacing: 0.06em; }
.nav-group:first-of-type .nav-label { margin-top: 18px; }

.share-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); }
.share-btn:hover { border-color: var(--border-strong, var(--text-dim)); }
.share-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* the bars behind ranking rows: a soft wash of the accent colour, lighter in both themes and for every accent */
.bd-row::before { background: color-mix(in oklab, var(--accent) 9%, var(--surface)); }
button.bd-row:hover::before { background: color-mix(in oklab, var(--accent) 17%, var(--surface)); opacity: 1; }
:root[data-theme="dark"] .bd-row::before { background: color-mix(in oklab, var(--accent) 13%, var(--surface)); }
:root[data-theme="dark"] button.bd-row:hover::before { background: color-mix(in oklab, var(--accent) 22%, var(--surface)); }

/* "Manage websites" sits right under the last section, set apart by a subtle line */
@media (min-width: 900px) {
  .panel-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
}

/* the sidebar (and the website switcher that opens from it) must sit above the page content */
@media (min-width: 900px) { .side { z-index: 30; } .content { position: relative; z-index: 1; } }

/* Inter only: its alternate "1" and tail forms */
:root[data-font="inter"] body { font-feature-settings: "cv11", "ss03"; }

/* account card */
.acct-head { display: flex; align-items: center; gap: 14px; }
.acct-head .avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.acct-name { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.acct-head p { margin: 0; }
.set-blocks { margin-top: 22px; display: grid; }
.set-block { padding: 16px 0; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.set-row h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.set-row p { margin: 0; max-width: 56ch; }
.set-empty { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius); color: var(--text-dim); font-size: 13px; }

/* settings: small facts with icons, and rows of "name … control" */
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--hover); font-size: 12.5px; }
.fact .ti { color: var(--text-dim); }
.fact strong { font-weight: 600; }
.pref-rows { display: grid; margin-top: 4px; }
.pref-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 8px 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.pref-row:first-child { border-top: 0; padding-top: 4px; }
.pref-row > .label { font-size: 14px; font-weight: 600; margin: 0; }
@media (max-width: 560px) { .pref-row { grid-template-columns: 1fr; } }
.check.top { align-items: flex-start; }

/* the comparison line: a darker shade of the accent in light mode, a lighter one in dark mode (so it stays visible) */
:root { --cmp-line: color-mix(in oklab, var(--accent) 60%, black); }
:root[data-theme="dark"] { --cmp-line: color-mix(in oklab, var(--accent) 65%, white); }

.create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
@media (max-width: 520px) { .create-row { grid-template-columns: 1fr; } }

/* pictures */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn { all: unset; position: relative; cursor: pointer; border-radius: 50%; }
.avatar-btn:focus-visible { box-shadow: var(--focus); }
.avatar-btn .avatar-edit { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); }
.avatar-btn .avatar-edit .ti { width: 12px; height: 12px; }
.av-body { padding: 4px 22px 22px; display: grid; gap: 18px; }
.av-section h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.av-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.av-opt { all: unset; flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%; cursor: pointer; scroll-snap-align: start; overflow: hidden; border: 2px solid transparent; box-sizing: border-box; }
.av-opt img { width: 100%; height: 100%; display: block; }
.av-opt:hover { border-color: var(--border-strong, var(--text-dim)); }
.av-opt.on { border-color: var(--accent); }
.av-opt:focus-visible { box-shadow: var(--focus); }
.av-upload { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius); cursor: pointer; font-weight: 550; }
.av-upload:hover { background: var(--hover); }
.av-upload:focus-within { box-shadow: var(--focus); }
.av-upload.busy { opacity: 0.6; pointer-events: none; }
.avatar-face { border-radius: 50%; }

.av-body { grid-template-columns: minmax(0, 1fr); }
.av-section { min-width: 0; }
.av-letter { display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 22px; }

/* colour pickers in the style of the tags: a pastel disc with a stronger dot in the middle, a ring when chosen */
.swatch, .tag-swatch {
  --pick-bg: oklch(var(--l-tag-bg) var(--pick-bgc) var(--pick-h));
  --pick-fg: oklch(var(--l-tag-fg) var(--pick-fgc) var(--pick-h));
  position: relative; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--pick-bg); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--pick-fg) 28%, transparent);
  transition: transform 0.12s, box-shadow 0.12s;
}
.swatch { --pick-h: var(--sw-h); --pick-bgc: calc(0.045 * (1 - var(--sw-neutral))); --pick-fgc: min(0.16, calc(var(--sw-c) * 0.8)); width: 30px; height: 30px; }
.tag-swatch { --pick-h: var(--th); --pick-bgc: 0.045; --pick-fgc: 0.16; width: 26px; height: 26px; }
.swatch::after, .tag-swatch::after { content: ""; width: 38%; height: 38%; border-radius: 50%; background: var(--pick-fg); transition: transform 0.12s; }
.swatch:hover, .tag-swatch:hover { transform: scale(1.08); }
input:checked + .swatch, .tag-swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--pick-fg); background: var(--pick-bg); }
input:checked + .swatch::after, .tag-swatch[aria-pressed="true"]::after { transform: scale(1.3); }
.swatch-custom { background: conic-gradient(from 90deg, oklch(var(--l-tag-bg) 0.06 10), oklch(var(--l-tag-bg) 0.06 70), oklch(var(--l-tag-bg) 0.06 130), oklch(var(--l-tag-bg) 0.06 190), oklch(var(--l-tag-bg) 0.06 250), oklch(var(--l-tag-bg) 0.06 310), oklch(var(--l-tag-bg) 0.06 10)); }
.swatch-custom::after { background: conic-gradient(from 90deg, oklch(var(--l-tag-fg) 0.16 10), oklch(var(--l-tag-fg) 0.16 130), oklch(var(--l-tag-fg) 0.16 250), oklch(var(--l-tag-fg) 0.16 10)); }
.swatch-custom.active { background: var(--pick-bg); box-shadow: inset 0 0 0 2px var(--pick-fg); }
.swatch-custom.active::after { background: var(--pick-fg); transform: scale(1.3); }
.swatches { gap: 10px; }
.swatch::after, .tag-swatch::after { pointer-events: none; }

/* custom accent picker: a colour slider, an intensity slider and a hex box */
button.swatch { border: 0; padding: 0; margin: 0; font: inherit; box-sizing: border-box; width: 30px; height: 30px; appearance: none; -webkit-appearance: none; }
button.swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.cp { display: grid; gap: 14px; width: 250px; padding: 4px 2px; }
.cp-row { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.cp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 999px; margin: 0; cursor: pointer; border: 1px solid var(--border); }
.cp-hue { background: linear-gradient(90deg, oklch(0.75 0.14 0), oklch(0.78 0.14 60), oklch(0.8 0.15 110), oklch(0.78 0.14 160), oklch(0.78 0.12 210), oklch(0.72 0.14 260), oklch(0.7 0.16 310), oklch(0.75 0.14 360)); }
.cp-chroma { background: linear-gradient(90deg, oklch(0.7 0.02 var(--cp-h)), oklch(0.7 0.25 var(--cp-h))); }
.cp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--text); box-shadow: 0 1px 4px oklch(0 0 0 / 0.3); }
.cp-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--text); box-shadow: 0 1px 4px oklch(0 0 0 / 0.3); }
.cp-range:focus-visible { outline: none; box-shadow: var(--focus); }
.cp-hex { height: 34px; font-variant-numeric: tabular-nums; }
/* date range: the calendar on the left, the quick choices on the right */
@media (min-width: 761px) { .rp-presets { border-right: 0; border-left: 1px solid var(--border); } }
/* the picker lives inside .swatches, whose rule hides radio inputs: undo that for its own controls */
.swatches .cp input { position: static; opacity: 1; width: 100%; height: 14px; }
.swatches .cp input.cp-hex { height: 34px; }
/* the count inside a chosen chip keeps the chip's own text colour */
.chip[aria-pressed="true"] .muted, .chip[aria-pressed="true"] .count { color: inherit; opacity: 0.75; }

/* combobox: a text box with narrowing suggestions */
lk-combobox { display: block; }
.cb { position: relative; }
.cb-input { padding-right: 34px; }
.cb-input.has-lead { padding-left: 38px; }
.cb-lead { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: inline-flex; pointer-events: none; }
.cb-chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; display: inline-flex; }
.cb-list { position: fixed; z-index: 100; max-height: 260px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.cb-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; font-size: 14px; }
.cb-opt.on { background: var(--accent-bg); }
.cb-opt[aria-selected="true"] { font-weight: 600; }

/* journeys: one lightness and chroma for every hue (light and dark) */
:root { --j-l: 0.68; --j-c: 0.15; }
:root[data-theme="dark"] { --j-l: 0.76; --j-c: 0.14; }
.howto h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14.5px; font-weight: 650; }
.howto p { margin: 0; } .howto { padding: 4px 22px 22px; max-height: min(70vh, 640px); overflow-y: auto; }

/* ---- motion ---- */
/* sliding highlight (see slide.js): the container's ::before glides to the current item */
[data-slide] { position: relative; }
[data-slide]::before {
  content: ""; position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; opacity: 0;
  width: var(--sw, 0); height: var(--sh, 0); transform: translate(var(--sx, 0), var(--sy, 0));
  border-radius: var(--slide-r, 8px); background: var(--slide-bg, var(--hover)); box-shadow: var(--slide-shadow, none);
}
[data-slide][data-slide-ready]::before { opacity: 1; }
[data-slide][data-slide-anim]::before { transition: transform 0.3s cubic-bezier(0.3, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.3, 0.8, 0.25, 1), height 0.3s cubic-bezier(0.3, 0.8, 0.25, 1); }
[data-slide] :is(a, button) { position: relative; z-index: 1; }
[data-slide][data-slide-ready] [aria-current="page"], [data-slide][data-slide-ready] [aria-pressed="true"] { background: transparent !important; box-shadow: none !important; }
.mini-tabs { --slide-bg: var(--surface); --slide-shadow: var(--shadow); --slide-r: 7px; }
.rail-nav { --slide-bg: var(--accent-bg); --slide-r: var(--radius); }
.panel { --slide-bg: var(--accent-bg); --slide-r: var(--radius); }
@media (min-width: 900px) {
  .rail-nav { --slide-bg: var(--surface); --slide-shadow: var(--shadow); --slide-r: 999px; }
  .panel { --slide-bg: color-mix(in oklab, var(--text) 6%, transparent); }
}
@media (max-width: 899px) { .panel[data-slide]::before { display: none; } .panel[data-slide][data-slide-ready] [aria-current="page"] { background: color-mix(in oklab, var(--text) 6%, transparent) !important; } }
/* a menu item answers a press */
.nav a, .rail-btn, .mini-tabs button, .step-tabs button { transition: transform 0.12s ease, color 0.12s, background 0.12s; }
.nav a:active, .rail-btn:active, .mini-tabs button:active, .step-tabs button:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) {
  [data-slide]::before { transition: none !important; }
  .nav a:active, .rail-btn:active, .mini-tabs button:active, .step-tabs button:active { transform: none; }
}

/* the breakdown bars grow in; the card search slides open; journeys fade in */
.bd-row::before { animation: bd-grow 0.7s cubic-bezier(0.2, 0.75, 0.25, 1) both; }
@keyframes bd-grow { from { width: 0; } }
.bd-search-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.26s cubic-bezier(0.3, 0.8, 0.25, 1); }
.bd-search-wrap.open { grid-template-rows: 1fr; }
.bd-search-wrap > div { overflow: hidden; min-height: 0; }
.bd-search-wrap .bd-search { margin: 4px 3px 12px; width: calc(100% - 6px); }
.journey svg { animation: jfade 0.6s ease both; }
@keyframes jfade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .bd-row::before, .journey svg { animation: none; } .bd-search-wrap { transition: none; } }

/* the same glide for the radio-style theme switch */
.segmented { --slide-bg: var(--surface); --slide-shadow: var(--shadow); --slide-r: 999px; }
[data-slide] label { position: relative; z-index: 1; }
[data-slide][data-slide-ready] input:checked + label { background: transparent !important; box-shadow: none !important; }

/* funnels: the list on the left (a quarter), the chosen funnel on the right */
.funnels-layout { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.funnel-list { padding: 8px; display: grid; gap: 2px; --slide-bg: var(--accent-bg); --slide-r: var(--radius); }
.fl-item { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 1px; padding: 9px 12px; border-radius: var(--radius); }
.fl-item:hover { background: var(--hover); }
.fl-item:focus-visible { box-shadow: var(--focus); }
.fl-item[aria-pressed="true"] { background: var(--accent-bg); }
.fl-name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.fl-name .ti { color: var(--text-dim); flex-shrink: 0; }
.fl-meta { font-size: 12px; color: var(--text-dim); padding-left: 24px; }
@media (max-width: 800px) { .funnels-layout { grid-template-columns: 1fr; } .funnel-list { grid-auto-flow: column; overflow-x: auto; } .fl-item { white-space: nowrap; } }

/* the front page: every website as a card */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.home-card { text-align: left; min-height: 150px; padding: 18px; gap: 6px; box-shadow: var(--shadow); }
.home-card .ss-name { font-size: 15px; }
.who-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

/* cohort retention matrix: the share that came back sets the strength of the accent behind the number */
table.cohorts { border-collapse: separate; border-spacing: 3px; }
table.cohorts th, table.cohorts td { padding: 8px 10px; font-weight: 400; }
table.cohorts thead th { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
table.cohorts tbody th { text-align: left; white-space: nowrap; font-weight: 500; }
table.cohorts td.cell { border-radius: 6px; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums;
  background: color-mix(in oklab, var(--accent) calc(var(--p) * 0.45%), var(--surface)); }
table.cohorts td.cell.none { background: none; }
.stack > lk-card { min-width: 0; max-width: 100%; }

/* removable chips (blocked countries) */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--hover); font-size: 13px; }
.chip-x { all: unset; box-sizing: border-box; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--text-dim); }
.chip-x:hover { background: var(--border); color: var(--text); }
.chip-x:focus-visible { box-shadow: var(--focus); }
.danger-rows { display: grid; gap: 18px; margin-top: 4px; }
.danger-rows .set-row + .set-row { padding-top: 18px; border-top: 1px solid var(--border); }

/* Penalty look: the server adds data-penalty to <html> only for a denylisted (refunded or leaked) license
   key. It beats the user's own font and accent choice on purpose. */
html[data-penalty] {
  --font: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive !important;
  --accent-h: 62 !important;
  --accent-c: 0.085 !important;
  --neutral: 0 !important;
}
