@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/t/static/fonts/golos-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/t/static/fonts/golos-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/t/static/fonts/golos-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================================
   Cabinet v2. Trimmed from own-pwa app/static/cabinet.css to the classes the tracker templates use
   Breakpoints: phone <768, tablet 768-1023 (icon rail), desktop >=1024.
   Motion: 150-240ms, ease-out, transform/opacity only.
   ========================================================================== */

/* Themes: html[data-theme] (cabinet-boot.js sets it before paint; dark is the default).
   The dark palette is also set on the dock (.side) and the phone tab bar, which stay charcoal in both themes. */
:root,
.side,
.tabbar {
  /* surfaces: paper < s1 < s2 < s3 */
  --paper: #050506;
  --s1: #0f0f11;
  --s2: #19191c;
  --s3: #222226;
  --s4: #2a2a2f;

  --ink: #f3f3f4;
  --ink-2: #d2d2d6;
  --ink-3: #a9a9b0;
  --ink-hi: #fff;
  --muted: #8d8d94;
  --placeholder: #7c7c84;
  --line: #26262b;
  --line-strong: #35353b;
  --line-faint: #1d1d21;
  --row-alt: #1d1d20;

  --accent-hi: #ff9c8c;
  --accent-text: #ff9c8c;
  --accent-soft: #4d2622;

  /* text on tinted status backgrounds: -text on plain surfaces, -ink on the tint */
  --ok-text: #3cc165;
  --ok-ink: #8fe0a8;
  --warn-text: #f0b429;
  --warn-ink: #ffd98a;
  --bad-text: #e8434f;
  --bad-ink: #ff9d9d;
  --bad-ink-hi: #ffb4b4;
  --bad-num: #ff7a82;
  --notice-ink: #c2f0d0;

  /* overlays that read on the surface: row hover, chips, hover edges, tree depth, selection, shadows */
  --veil-row: rgba(255, 255, 255, 0.035);
  --veil-chip: rgba(255, 255, 255, 0.12);
  --edge-hover: rgba(255, 255, 255, 0.28);
  --edge-hover-2: rgba(255, 255, 255, 0.4);
  --edge-ctl: rgba(255, 255, 255, 0.34);
  --tree-2: rgba(0, 0, 0, 0.16);
  --tree-3: rgba(0, 0, 0, 0.28);
  --row-sel: #2e1f1e;
  --row-sel-hover: #38241f;
  --shade-pop: rgba(0, 0, 0, 0.5);
  /* a floating panel (menu, popover, list of a select): one step above the page, one shadow */
  --pop-bg: var(--s3);
  --pop-shadow: 0 12px 32px var(--shade-pop);
  --shade-edge: rgba(0, 0, 0, 0.45);
  --scrim: rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(15, 15, 17, 0.82);
  --scroll: #3d3d44;
  --hatch-bg: #303037;
  --hatch-line: #43434c;
  --hatch-neg-bg: #40252a;
  --hatch-neg-line: #64323a;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d8d94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

:root {
  color-scheme: dark;
  --accent: #f46b5e;
  --accent-deep: #de5246;
  --accent-ink: #1c0a08;

  /* status colours: only for status (fills, dots, borders; text uses the -text and -ink tokens) */
  --ok: #3cc165;
  --warn: #f0b429;
  --bad: #e8434f;
  --idle: #8d8d94;


  --mask-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* page widths: one-column forms and their panels, and pages with two panels or a table of rows */
  --w-form: 760px;
  --w-page: 1000px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  /* type scale: 12 table heads, list-table cells, field labels, hints; 13 report cells, fields, buttons, menus; 14 section and panel titles;
     16 page title (and the 16px phone fields); 18 tile numbers. Nothing larger in the cabinet (the sign-in page aside). */
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* sizes: field and button 30, table row 32 (button inside it 24), table head 28, stream row 36, period chip 28.
     Lists follow Voluum: 12px cells, 32px rows, 28px head, striped rows, 1px column lines, 12px grip zone (1px line). */
  --side: 216px;
  --rail: 64px;
  --topbar-h: 56px;
  --tabbar-h: 56px;
  --bar-offset: 0px;
  --ctl-h: 30px;
  --row-h: 32px;
  --row-btn: 24px;
  --head-h: 28px;
  --stream-h: 36px;
  --grip-w: 12px;
  --chip-h: 28px;
  --nav-h: 28px;
  --nav-head-h: 24px;
  --gap-panel: 10px;
  --gap-field: 8px;

  /* aliases for pages not yet moved to v2 */
  --raised: var(--s1);
  --card: var(--s2);
  --nav: var(--s1);
  --nav-ink: var(--ink-2);
  --active: var(--accent-soft);
  --green: var(--accent);
  --green-ink: var(--accent-ink);
  --shadow: none;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 10px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --radius: var(--r-md);
  --topbar: var(--topbar-h);
}

/* Light: ember palette. Text on white: muted 5.8:1, accent-text 6.1:1, status text 5.4-7:1 */
html[data-theme="light"] {
  color-scheme: light;

  --paper: #e6e6e9;
  --s1: #f3f3f4;
  --s2: #ffffff;
  --s3: #ebebed;
  --s4: #e0e0e3;

  --ink: #151515;
  --ink-2: #3b3b3d;
  --ink-3: #5b5b61;
  --ink-hi: #000;
  --muted: #5f5f66;
  --placeholder: #77777e;
  --line: #e3e3e6;
  --line-strong: #cfcfd5;
  --line-faint: #eeeef0;
  --row-alt: #f5f5f7;

  --accent-hi: #ff8576;
  --accent-text: #ab2c20;
  --accent-soft: #fdd9d3;

  --ok-text: #0f6b33;
  --ok-ink: #0f6b33;
  --warn-text: #744a00;
  --warn-ink: #744a00;
  --bad-text: #b01c29;
  --bad-ink: #b01c29;
  --bad-ink-hi: #9d1824;
  --bad-num: #b01c29;
  --notice-ink: #0b5a2a;
  --idle: #8b8b90;

  --veil-row: rgba(21, 21, 21, 0.045);
  --veil-chip: rgba(21, 21, 21, 0.1);
  --edge-hover: rgba(21, 21, 21, 0.3);
  --edge-hover-2: rgba(21, 21, 21, 0.4);
  --edge-ctl: rgba(21, 21, 21, 0.38);
  --tree-2: rgba(21, 21, 40, 0.035);
  --tree-3: rgba(21, 21, 40, 0.07);
  --row-sel: #fdeae6;
  --row-sel-hover: #fbddd7;
  --shade-pop: rgba(30, 30, 50, 0.16);
  --pop-bg: #fff;
  --shade-edge: rgba(30, 30, 50, 0.12);
  --scrim: rgba(20, 20, 28, 0.4);
  --topbar-bg: rgba(243, 243, 244, 0.82);
  --scroll: #c4c4ca;
  --hatch-bg: #e9e9ec;
  --hatch-line: #d6d6db;
  --hatch-neg-bg: #fbe3e5;
  --hatch-neg-line: #f3c3c8;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f5f66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html {
  scrollbar-color: var(--scroll) transparent;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  font-family: "Golos Text", "Segoe UI", system-ui, sans-serif;
  font-size: var(--fs-14);
  font-weight: 450;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  letter-spacing: 0.004em;
  caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
}

::selection { background: rgba(244, 107, 94, 0.4); color: var(--ink-hi); }

a { color: var(--accent-text); }

.work a:not(.button) { text-underline-offset: 0.18em; }

button,
a,
[role="button"],
label,
summary { touch-action: manipulation; }

/* ---------- type ---------- */

h1 {
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
}

h2 {
  font-size: var(--fs-14);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin: 0 0 8px;
}

h3 { font-size: var(--fs-14); font-weight: 600; margin: 12px 0 6px; }

p { margin: 0 0 var(--space-3); }

.muted { color: var(--muted); font-size: var(--fs-12); font-weight: 450; }

/* ---------- skip link ---------- */

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 100;
  transform: translateY(-200%);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus { transform: none; }

/* ==========================================================================
   Shell
   ========================================================================== */

.app-shell { display: flex; min-height: 100dvh; }

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--s1);
  border-radius: var(--r-xl) 0 0 var(--r-xl);
}

.work {
  flex: 1;
  width: 100%;
  max-width: 1800px;
  margin-inline: auto;
  min-width: 0;
  padding: 12px 20px 24px;
}

/* ---------- sidebar ---------- */

.side {
  position: sticky;
  top: 12px;
  flex: none;
  display: flex;
  flex-direction: column;
  width: var(--side);
  height: calc(100dvh - 24px);
  margin: 12px 12px 12px 12px;
  padding: 0 10px 12px;
  background: linear-gradient(180deg, #2a2a30 0%, #1a1a1e 55%, #0c0c0e 100%);
  border-radius: var(--r-xl);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.side::-webkit-scrollbar { display: none; }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding-left: 8px;
}

.brand { display: block; color: var(--ink-hi); font-size: var(--fs-16); font-weight: 700; letter-spacing: 0.02em; text-decoration: none; border-radius: var(--r-sm); }

.side-toggle { margin: 0; }

.side nav { display: flex; flex-direction: column; flex: 1; gap: 0; padding-bottom: 4px; }

/* Accordion group: heading button + a 0fr/1fr grid row that animates the list height. */

.nav-group { margin-top: 6px; }

.side .nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: var(--nav-head-h);
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
}

.nav-heading-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.side .nav-heading svg {
  width: 14px;
  height: 14px;
  transition: transform 200ms var(--ease-out);
}

.nav-heading[aria-expanded="false"] svg { transform: rotate(-90deg); }

.nav-list {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

.nav-list-inner { display: flex; flex-direction: column; gap: 0; min-height: 0; overflow: hidden; }

/* Collapsed: JS state (.is-closed), and before JS runs the boot value in html[data-nav-closed] */

.nav-group.is-closed .nav-list { grid-template-rows: 0fr; opacity: 0; }

.nav-group.is-closed .nav-item { visibility: hidden; transition: visibility 0s 200ms; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--nav-h);
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}

.nav-item svg,
.tab svg,
.more-link svg,
button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item svg { opacity: 0.8; }

.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nav-item:active { transform: scale(0.98); }

.nav-item.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.nav-item.active svg { opacity: 1; }

.account-mail {
  margin: 0;
  padding: 0 8px;
  color: var(--muted);
  font-size: var(--fs-13);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-mail { padding: 0; }

.account-mail a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.account-mail a[aria-current] { background: var(--accent-soft); color: var(--ink-hi); }

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-12);
  font-weight: 700;
}

.account-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .account-mail a:hover { background: var(--s3); color: var(--ink-hi); }
}

/* ---------- page head (desktop top row / phone header) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 24px;
  background: var(--topbar-bg);
  border-radius: var(--r-xl) 0 0 0;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: var(--s1); }
}

.topbar-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.topbar .crumbs { display: flex; gap: 6px; margin: 0; white-space: nowrap; }

.topbar h1,
.topbar-title {
  margin: 0;
  overflow: hidden;
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* the phone header always has a title; on wider screens only pages that set page_title get the row */

.topbar.has-title .topbar-title { display: none; }

.crumbs { margin: 0 0 6px; color: var(--muted); font-size: var(--fs-12); }

.crumbs span + span::before { content: "/"; margin: 0 6px; opacity: 0.6; }

.topbar .crumbs span::after { content: "/"; margin-left: 6px; opacity: 0.6; }

.topbar .crumbs span + span::before { content: none; }

/* ---------- phone tab bar ---------- */

.tabbar { display: none; }

.tab {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tabbar-h);
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  transition: color 150ms ease;
}

.tab svg { width: 22px; height: 22px; transition: transform 150ms var(--ease-out); }

.tab:active svg { transform: scale(0.9); }

.tab.active { color: var(--accent-text); }

.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 20px;
  height: 2px;
  margin-left: -10px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--ctl-h);
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

button:active:not(:disabled),
.button:active { transform: scale(0.97); }

.button svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

button.quiet,
.button.quiet {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

button.ghost,
.button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }

.icon-btn {
  width: var(--ctl-h);
  min-width: var(--ctl-h);
  padding: 0;
  margin-top: 0;
  border-radius: 50%;
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

button.icon-btn.quiet { border-color: transparent; }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(.quiet):not(.ghost):not(.danger):not(.warn):not(.icon-btn):not(.tab):not(.switch-btn):not(.row-act):not(.tree-toggle):not(:disabled),
  .button:hover:not(.quiet):not(.ghost) { background: var(--accent-hi); border-color: var(--accent-hi); }

  button.quiet:hover,
  button.ghost:hover,
  .button.quiet:hover,
  .button.ghost:hover,
  .icon-btn:hover { background: var(--s3); color: var(--ink-hi); }

  .nav-item:hover:not(.active) { background: rgba(255, 255, 255, 0.08); color: var(--ink-hi); }

  .table tbody tr:hover td { background: var(--veil-row); }
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }

.actions button,
.actions form { margin-top: 0; margin-bottom: 0; }

/* ==========================================================================
   Fields
   ========================================================================== */

label { display: block; margin: 8px 0 4px; font-size: var(--fs-12); font-weight: 500; color: var(--ink-2); }

input,
select,
textarea {
  width: 100%;
  max-width: 420px;
  min-height: var(--ctl-h);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--s1);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-13);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

textarea { min-height: 72px; padding: 6px 10px; resize: vertical; }

input[type="file"] { padding: 3px 6px; font-size: var(--fs-13); }

input[type="file"]::file-selector-button {
  margin: 0 10px 0 0;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--s3);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-13);
  cursor: pointer;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

select[multiple] { padding: 6px; background-image: none; min-height: 120px; }

::placeholder { color: var(--placeholder); }

@media (hover: hover) and (pointer: fine) {
  input:hover:not(:focus):not([type="checkbox"]):not([type="radio"]),
  select:hover:not(:focus),
  textarea:hover:not(:focus) { border-color: var(--edge-hover); }
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.28);
}

input:disabled,
select:disabled,
textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.form { display: grid; gap: 12px; max-width: var(--w-form); }

.field { min-width: 0; }

.field > label { margin: 0 0 4px; }

.field input,
.field select,
.field textarea,
.form input,
.form select,
.form textarea { max-width: none; }

.hint { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-12); }

form.stack { display: block; }

/* ==========================================================================
   Surfaces
   ========================================================================== */

.panel {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: var(--gap-panel);
}

code {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--s1);
  border: 1px solid var(--line);
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-12);
}

details { margin: 6px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }

details summary { cursor: pointer; font-weight: 600; font-size: var(--fs-13); margin-bottom: 6px; }

details.panel > summary { font-size: var(--fs-14); }

/* neutral label without a dot (type, scope) */

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--s3);
  color: var(--ink-2);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- alerts ---------- */

.notice,
.error {
  display: block;
  padding: 8px 14px;
  margin: 0 0 var(--space-3);
  border: 1px solid rgba(60, 193, 101, 0.35);
  border-radius: var(--r-sm);
  background: rgba(60, 193, 101, 0.1);
  color: var(--notice-ink);
  font-size: var(--fs-13);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* the message of a redirect ("saved", "copy created") floats under the top bar, so a jump to an anchor below cannot scroll it away;
   it takes no room in the page and fades after a few seconds (cabinet.js) */
.notice-slot {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 8px);
  z-index: 15;
  height: 0;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s 200ms;
}

.notice-slot > .notice { margin: 0; background-color: var(--s2); background-image: linear-gradient(rgba(60, 193, 101, 0.12), rgba(60, 193, 101, 0.12)); box-shadow: var(--pop-shadow); }

.notice-slot.is-gone { opacity: 0; transform: translateY(-6px); visibility: hidden; pointer-events: none; }

.error { border-color: rgba(232, 67, 79, 0.45); background: rgba(232, 67, 79, 0.1); color: var(--bad-ink); }

.section-title {
  grid-column: 1 / -1;
  margin: 6px 0 -2px;
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 600;
}

/* ==========================================================================
   Tables. Desktop: sticky header. Phone: row cards
   ========================================================================== */

table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); line-height: 18px; }

th,
td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }

th {
  color: var(--muted);
  height: var(--head-h);
  overflow: hidden;
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--s2);
}

tbody tr:last-child td { border-bottom: 0; }

.table-wrap { overflow: clip; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: var(--space-4); }

.table thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--line); }

.has-topbar .table thead th { top: var(--topbar-h); }

.table td { height: var(--row-h); }

.table .cell-title { font-weight: 500; min-width: 0; }

.table .cell-title a { color: var(--ink); text-decoration: none; }

.table .cell-title a:hover { text-decoration: underline; }

/* the empty state is one soft card in one compact row: a round icon (when the page has one), text, action.
   There is no column gap: the icon and the button carry their own, so a card without an icon has no empty strip on the left */
.empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  padding: 14px 18px;
  text-align: left;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.empty svg { grid-column: 1; grid-row: 1 / span 2; box-sizing: content-box; width: 20px; height: 20px; margin: 0 14px 0 0; padding: 8px; border-radius: 50%; background: var(--accent-soft); fill: none; stroke: var(--accent-text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.empty-title { grid-column: 2; grid-row: 1; align-self: end; margin: 0; font-size: var(--fs-14); font-weight: 600; }

.empty-text { grid-column: 2; grid-row: 2; align-self: start; margin: 0; max-width: 60ch; color: var(--muted); font-size: var(--fs-12); }

/* ==========================================================================
   Filters
   ========================================================================== */

form.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

form.inline input { width: 160px; max-width: 100%; }

/* ==========================================================================
   Dialog
   ========================================================================== */

dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: min(80dvh, 560px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--pop-bg);
  box-shadow: var(--pop-shadow);
  color: var(--ink);
  padding: 22px 22px 18px;
  opacity: 1;
  transform: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: scale(0.96);
  }
}

dialog::backdrop { background: var(--scrim); }

dialog p { margin: 0 0 18px; font-size: var(--fs-14); font-weight: 500; line-height: 1.45; }

dialog .actions { justify-content: flex-end; }

dialog .actions button { margin-top: 0; }

/* ==========================================================================
   Bottom sheet (phone). Wider screens: .sheet renders inline.
   ========================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out);
}

.scrim.is-on { opacity: 1; pointer-events: auto; }

.sheet-head { display: none; }

.sheet-more { display: none; }

/* ==========================================================================
   Login
   ========================================================================== */

.login {
  max-width: 400px;
  margin: 0 auto;
  padding: calc(12vh + env(safe-area-inset-top, 0px)) 16px calc(32px + env(safe-area-inset-bottom, 0px));
}

.login h1 { margin-bottom: 4px; font-size: 1.5rem; }

.login .muted { margin-bottom: 20px; }

.login form {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 24px;
}

.login label:first-child { margin-top: 0; }

.login input,
.login select,
.login textarea { max-width: none; min-height: 44px; font-size: var(--fs-16); }

.login button { width: 100%; min-height: 44px; margin-top: 20px; }

.tag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-12); font-weight: 600; }

.tag--quiet,
.tag--default { background: var(--s3); color: var(--ink-2); font-weight: 500; }

.tag--forced { background: rgba(240, 180, 41, 0.14); color: var(--warn-ink); }

/* ==========================================================================
   Focus
   ========================================================================== */

button:focus-visible,
a:focus-visible,
summary:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-item:focus-visible,
.tab:focus-visible { outline-offset: -2px; }

/* icon rail: tablet always, desktop when collapsed (JS sets html.rail) */

@media (min-width: 768px) {
  html.rail .side { width: var(--rail); padding: 0 8px 12px; }

  html.rail .nav-label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
    }

  /* rail: headings become thin separators and every group stays open so no icon is lost */

  html.rail .side .nav-heading { display: none; }

  html.rail .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

  html.rail .nav-group .nav-list { grid-template-rows: 1fr !important; opacity: 1 !important; transition: none; }

  html.rail .nav-group .nav-item { visibility: visible !important; }

  html.rail .nav-item { justify-content: center; width: 40px; min-height: 40px; margin-inline: auto; padding: 0; }

  html.rail .side-head { justify-content: center; padding: 0; }

  html.rail .brand { display: none; }
}

@media (max-width: 1023px) {
  .side-toggle { display: none; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .work { padding-left: 16px; padding-right: 16px; }

  .topbar { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 767px), (pointer: coarse) {
  :root { --ctl-h: 40px; --nav-h: 40px; --nav-head-h: 40px; --chip-h: 36px; }

  /* 16px stops iOS from zooming into a focused field */
  input,
  select,
  textarea { font-size: var(--fs-16); }

  .icon-btn { width: 40px; min-width: 40px; height: 40px; }

}

@media (max-width: 767px) {
  :root { --bar-offset: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }

  html { overscroll-behavior-y: none; }

  .side { display: none; }

  .main-col,
  .topbar { border-radius: 0; }

  /* header: page title + main action */

  .topbar,
  .topbar:not(.has-title) {
      display: flex;
      min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
      padding: env(safe-area-inset-top, 0px) 16px 0;
    }

  .topbar-title { display: block; }

  .topbar.has-title .topbar-title { display: none; }

  .topbar .crumbs { display: none; }

  .topbar h1 { font-size: var(--fs-16); }

  .work { padding: 12px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px); }

  /* tab bar */

  .tabbar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 40;
      display: flex;
      padding-bottom: env(safe-area-inset-bottom, 0px);
      background: linear-gradient(180deg, #232328, #0c0c0e);
      border-top: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--r-lg) var(--r-lg) 0 0;
      -webkit-backdrop-filter: blur(14px);
      backdrop-filter: blur(14px);
    }

  .panel { padding: 10px 12px; }

  /* filters in a bottom sheet; the same form, no duplicated fields */

  .sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 60;
      display: block;
      max-height: calc(100dvh - 40px - env(safe-area-inset-top, 0px));
      margin: 0;
      padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
      overflow-y: auto;
      overscroll-behavior: contain;
      background: var(--s2);
      border: 1px solid var(--line-strong);
      border-bottom: 0;
      border-radius: var(--r-lg) var(--r-lg) 0 0;
      transform: translateY(100%);
      visibility: hidden;
      transition: transform 200ms var(--ease-drawer), visibility 0s linear 200ms;
    }

  .sheet.is-open {
      transform: translateY(0);
      visibility: visible;
      transition: transform 240ms var(--ease-drawer), visibility 0s;
    }

  .sheet.is-dragging { transition: none; }

  .sheet-head {
      position: sticky;
      top: 0;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0 -16px 8px;
      padding: 18px 8px 4px 16px;
      background: var(--s2);
      touch-action: none;
    }

  .sheet-head::before {
      content: "";
      position: absolute;
      top: 8px;
      left: 50%;
      width: 36px;
      height: 4px;
      margin-left: -18px;
      border-radius: 2px;
      background: var(--line-strong);
    }

  .sheet-head h2 { margin: 0; font-size: var(--fs-14); }

  .sheet-head .icon-btn { margin: 0; }

  .sheet-more { display: block; }

  html.sheet-lock { overflow: hidden; }

  /* "More" sheet content */

  .more-group { margin: 12px 0 4px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; }

  .more-link {
      display: flex;
      align-items: center;
      gap: 12px;
      min-height: 48px;
      padding: 0 10px;
      margin: 0 -10px;
      border-radius: var(--r-sm);
      color: var(--ink);
      font-size: var(--fs-14);
      text-decoration: none;
      transition: background-color 150ms ease;
    }

  .more-link:active { background: var(--s3); }

  .more-link.active { background: var(--accent-soft); }

  .more-link.active svg { color: var(--accent-text); }

  .more-link svg { color: var(--muted); width: 20px; height: 20px; }

  .more-account { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

  .more-account .account-mail { padding: 0; margin-bottom: 8px; font-size: var(--fs-14); }

  .more-account .account-mail a { padding-left: 0; }

  .more-account form { margin: 0; }

  .more-account button { width: 100%; margin: 0; }

  /* table -> row cards */

  .table-wrap { background: transparent; border: 0; border-radius: 0; overflow: visible; }

  .table thead th { position: static; }

  .table--cards thead { display: none; }

  .table--cards,
  .table--cards tbody { display: block; }

  .table--cards tr {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      column-gap: 12px;
      row-gap: 4px;
      align-items: start;
      margin-bottom: 8px;
      padding: 12px 14px;
      background: var(--s2);
      border: 1px solid var(--line);
      border-radius: var(--r-md);
    }

  .table--cards td {
      display: block;
      height: auto;
      min-width: 0;
      padding: 0;
      border: 0;
      background: transparent;
      overflow-wrap: anywhere;
    }

  .table--cards td::before {
      content: attr(data-label);
      display: block;
      margin-bottom: 1px;
      color: var(--muted);
      font-size: var(--fs-12);
      font-weight: 450;
    }

  .table--cards td:not([data-label])::before,
  .table--cards .cell-title::before,
  .table--cards .cell-status::before { content: none; }

  .table--cards .cell-title { grid-column: 1 / 4; grid-row: 1; font-size: var(--fs-14); font-weight: 600; }

  .table--cards .cell-status { grid-column: 4; grid-row: 1; justify-self: end; }

  .table--cards .cell-metric { grid-column: span 1; margin-top: 4px; font-size: var(--fs-13); font-weight: 500; }

  .table--cards .cell-wide { grid-column: span 2; }

  .table--cards .cell-full { grid-column: 1 / -1; }

  .table--cards .cell-hide { display: none; }

  /* statistics: the Total row reads as a highlighted card */

  .table--cards td:not([class]) { grid-column: 1 / -1; }

  /* legacy stacked tables */

  .panel:has(> table) { padding: 8px 14px; }

  .empty { padding: 32px 16px; }

  dialog { width: min(420px, calc(100vw - 24px)); }
}

/* ==========================================================================
   Reduced motion: no movement, no scaling
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .nav-list,
  .nav-heading svg { transition: none; }

  *,
  *::before,
  *::after {
      transition-duration: 0.01ms !important;
      animation-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }

  button:active,
  .nav-item:active,
  .tab:active svg { transform: none; }
}

/* ==========================================================================
   Tracker screens: forms, lists, campaign page
   ========================================================================== */

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- navigation bits ---------- */

.back { margin: 0 0 6px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--row-btn);
  margin-left: -4px;
  padding-right: 6px;
  color: var(--muted);
  font-size: var(--fs-13);
  text-decoration: none;
}

.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.back-link:hover { color: var(--ink-hi); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 6px; }

.work a.toggle-link:not(.button) { text-decoration: none; }

/* ---------- form controls ---------- */

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 5px;
  border: 1.5px solid var(--edge-ctl);
  background: var(--s1);
  cursor: pointer;
}

input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306101f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

input.switch {
  width: 30px;
  min-width: 30px;
  height: 18px;
  min-height: 18px;
  border-radius: 999px;
  border-width: 1px;
  background: var(--s4);
  transition: background-color 150ms ease, border-color 150ms ease;
}

input.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms var(--ease-out);
}

input.switch:checked { background-image: none; background-color: var(--accent); }

input.switch:checked::before { transform: translateX(12px); }

input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

.check-row,
label.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ctl-h);
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 500;
  cursor: pointer;
}

.mono,
.link-box,
.help code {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: normal;
}

input.mono,
textarea.mono { font-size: var(--fs-13); }

.field:has(:required) > label::after { content: " *"; color: var(--accent-text); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

fieldset > legend { padding: 0; margin: 0 0 4px; color: var(--ink-2); font-size: var(--fs-12); font-weight: 500; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
}

.field-grid + .field-grid { margin-top: 10px; }

.span-2 { grid-column: 1 / -1; }

.field-grid > .section-title {
  margin: 8px 0 -2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 600;
}

.field-grid > .section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.subs-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

.subs-grid .field > label { margin-bottom: 4px; color: var(--muted); font-size: var(--fs-12); }

.form-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.form-bar button,
.form-bar .button { margin: 0; }

.form-block + .form-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

.form-block > .section-title { margin: 0 0 8px; padding: 0; border: 0; }

.form-block > .muted { margin: 0 0 8px; }

.form-block > .field-grid + .field-grid,
.form-block > .field-grid + .field,
.form-block > .field-grid + div { margin-top: 10px; }

.archive-form,
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }

.archive-form button,
.inline-form button { margin: 0; }

.archive-form { margin-top: var(--space-4); }

button.small { min-height: var(--row-btn); padding: 0 8px; font-size: var(--fs-12); }

button.danger { border-color: rgba(232, 67, 79, 0.4); color: var(--bad-text); }

@media (hover: hover) and (pointer: fine) {
  button.danger:hover { background: rgba(232, 67, 79, 0.12); border-color: var(--bad); }
}

/* ---------- list ---------- */

.table .col-actions { width: 1%; }

.table .cell-actions { text-align: right; }

.table .cell-actions form { justify-content: flex-end; margin: 0; }

.table .cell-actions button { margin: 0; }

.empty .button { grid-column: 3; grid-row: 1 / span 2; margin: 0 0 0 14px; }

.empty .button svg { width: 16px; height: 16px; margin: 0; stroke: currentColor; stroke-width: 1.8; }

/* ---------- copyable monospace block ---------- */

.copy-box { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 6px; }

.copy-box button { flex: none; margin: 0; }

.link-box {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 5px 10px;
  line-height: 1.5;
  font-size: var(--fs-12);
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

.panel h2 { margin-bottom: 2px; }

.panel > .muted { margin-bottom: 0; }

.panel .hint { margin-top: 0; }

.panel .inline-form { margin-top: 8px; }

/* ---------- campaign page ---------- */

.fold { margin: 0 0 var(--space-4); padding: 0; border: 0; }

.fold > summary,
.stream > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row-h);
  margin: 0;
  list-style: none;
  cursor: pointer;
}

.fold > summary::-webkit-details-marker,
.stream > summary::-webkit-details-marker,
.help > summary::-webkit-details-marker { display: none; }

.fold > summary { padding: 0 2px; color: var(--ink-2); font-size: var(--fs-13); font-weight: 600; }

.fold > summary svg,
.stream > summary > svg,
.help > summary svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease-out); }

.fold > summary svg { transform: rotate(-90deg); }

.fold[open] > summary svg { transform: none; }

.fold > .panel { margin-bottom: 0; }

.section-head { margin: var(--space-5) 0 8px; }

.section-head h2 { margin: 0 0 2px; font-size: var(--fs-14); letter-spacing: -0.005em; }

.section-head .muted { margin: 0; max-width: 70ch; }

/* streams of the campaign page: see "Campaign page" at the end of the file */

.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }

.dot--ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(60, 193, 101, 0.18); }

.help { margin: 0; padding: 0; border: 0; }

.help > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--row-btn);
  margin: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 500;
}

.help > summary::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform 200ms var(--ease-out); }

.help[open] > summary::before { transform: rotate(90deg); }

.help ul { display: grid; gap: 4px; margin: 4px 0 0; padding: 8px 12px; list-style: none; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--fs-12); }

.help b { color: var(--ink); font-weight: 600; }

.help code { display: inline; margin-right: 4px; padding: 1px 6px; border-radius: 6px; color: var(--ink); font-size: var(--fs-12); }

/* ---------- tablet and phone ---------- */

@media (max-width: 767px) {
  /* short fields (ints, parameter names) pair up; everything else takes the full width */
  .field-grid > .field:not(.field--short) { grid-column: 1 / -1; }

  .field-grid > .section-title { grid-column: 1 / -1; }

  .subs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .panel.form--wide { padding: 16px; }

  .form-bar { flex-direction: column-reverse; align-items: stretch; }

  .form-bar button,
  .form-bar .button { width: 100%; }

  .copy-box { flex-direction: column; align-items: stretch; }

  .copy-box button { width: 100%; }

  .table--cards .cell-actions { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); text-align: left; }

  .table--cards .cell-actions form { justify-content: flex-start; }

  .table--cards .cell-actions button { width: 100%; min-height: 40px; }

  .toolbar { margin-bottom: 12px; }
}

/* ==========================================================================
   Reports and logs (stage 3)
   ========================================================================== */

/* ---------- control panel ---------- */

.controls { display: grid; gap: var(--gap-field); }

.controls .field > label,
.dates .field > label { margin: 0 0 3px; color: var(--muted); font-size: var(--fs-12); }

.period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }

.chips .chip-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  clip: rect(0 0 0 0);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--chip-h);
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.chip:active { transform: scale(0.97); }

.chip-input:checked + .chip { border-color: var(--accent); background: var(--accent-soft); color: var(--ink-hi); }

.chip-input:focus-visible + .chip { box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--edge-hover); color: var(--ink); }
}

.dates { display: grid; grid-template-columns: repeat(2, 132px); gap: 8px; }

.fold--inline { margin: 0; padding: 0; border: 0; }

.fold--inline > summary { margin: 0; min-height: var(--row-btn); }

.fold--inline > summary .muted { font-weight: 450; }

.form-bar { margin-top: 0; }

.controls > .form-bar { padding-top: 8px; }

/* ---------- scrolling table wrapper: vertical and horizontal scroll stay inside it ---------- */

.table-wrap--scroll {
  position: relative; /* contains the absolutely placed sr-only labels, which would otherwise widen the page */
  overflow: auto;
  max-height: calc(100dvh - var(--topbar-h) - 32px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.table-wrap--scroll .table thead th,
.has-topbar .table-wrap--scroll .table thead th { top: 0; }

.table-wrap--scroll .table td { height: var(--row-h); }

.table-wrap--scroll th,
.table-wrap--scroll td { white-space: nowrap; }

.table-wrap--scroll th a { color: inherit; text-decoration: none; }

.table-wrap--scroll th a:hover { color: var(--ink); }

.table-wrap--scroll th[aria-sort] { color: var(--ink); }

.sort-arrow { margin-left: 4px; color: var(--accent-text); }

.cell-metric { text-align: right; font-variant-numeric: tabular-nums; }

th.cell-metric { text-align: right; }

/* first column stays while the rest scrolls sideways */

.table-wrap--scroll .cell-key:first-child { position: sticky; left: 0; z-index: 1; background: var(--s2); box-shadow: 1px 0 0 var(--line); }

.table-wrap--scroll thead th:first-child { left: 0; z-index: 3; box-shadow: 0 1px 0 var(--line), 1px 0 0 var(--line); }

.table--report tfoot th {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  background: var(--s3);
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 600;
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  box-shadow: none;
}

.table--report tfoot th.cell-key:first-child { z-index: 3; left: 0; background: var(--s3); }

.table--report tbody tr:hover td,
.table--report tbody tr:hover td.cell-key:first-child { background: var(--s3); }

.is-pos { color: var(--ok-text); }

.is-neg { color: var(--bad-text); }

.table--report tfoot th.is-pos { color: var(--ok-text); }

.table--report tfoot th.is-neg { color: var(--bad-text); }

/* log tables */

.clip { display: inline-block; max-width: 12ch; overflow: hidden; vertical-align: bottom; text-overflow: ellipsis; font-size: var(--fs-13); }

.cell-time { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.tag--ok,
.tag--sale,
.tag--s2s-sent { background: rgba(60, 193, 101, 0.14); color: var(--ok-ink); }

.tag--lead { background: var(--accent-soft); color: var(--accent-text); }

.tag--rejected,
.tag--s2s-failed { background: rgba(232, 67, 79, 0.14); color: var(--bad-ink); }

.tag--s2s-skipped { background: var(--s3); color: var(--ink-2); }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin: 0 0 var(--space-3); }

.pager .muted { margin: 0; }

.pager-links { display: flex; gap: 8px; }

.pager .button { margin: 0; }

.notice--warn { border-color: rgba(240, 180, 41, 0.4); background: rgba(240, 180, 41, 0.1); color: var(--warn-ink); }

/* ---------- dashboard tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap-panel); margin: 0 0 var(--gap-panel); }

.tile { min-width: 0; padding: 8px 12px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); }

.tile dt { margin: 0 0 2px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.tile dd { margin: 0; overflow: hidden; font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.section-head h2 { font-size: var(--fs-14); }

@media (max-width: 1099px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .period { align-items: stretch; }

  .chip { min-height: 40px; }

  .dates { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }

  .controls > .form-bar { flex-direction: row; }

  .controls > .form-bar button { flex: 2; width: auto; }

  .controls > .form-bar .button { flex: 1; width: auto; }

  /* the phone card styling of .table-wrap does not apply here: the wrapper is the scroll container */

  .table-wrap.table-wrap--scroll {
    overflow: auto;
    max-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
    background: var(--s2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    scrollbar-width: none;
  }

  .table-wrap--scroll::-webkit-scrollbar { display: none; }

  .table-wrap--scroll .table thead th { position: sticky; }

  .table--report tfoot th { position: sticky; }

  .table-wrap--scroll td.cell-time { width: 6.5em; min-width: 6.5em; white-space: normal; font-size: var(--fs-13); line-height: 1.3; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  .tile { padding: 8px 12px; }

  .tile dd { font-size: var(--fs-18); }

  .pager-links { width: 100%; }

  .pager-links .button { flex: 1; min-height: 44px; }
}

/* ==========================================================================
   Local lander (stage 4): files, audit, compression, editor
   ========================================================================== */

:root { --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }

.mono,
.file-path,
code.inline { font-family: var(--mono); font-variant-numeric: normal; }

code.inline { display: inline; padding: 1px 6px; border-radius: 6px; font-size: var(--fs-12); white-space: normal; word-break: normal; overflow-wrap: anywhere; color: var(--ink); }

input.mono { font-size: var(--fs-13); }

.button.small { min-height: var(--row-btn); padding: 0 8px; font-size: var(--fs-12); }

.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: var(--space-3); }

.panel-head h2 { margin: 0 0 2px; }

.panel-head .muted { margin: 0; }

.panel-head .actions form { margin: 0; }

.panel-head + .tiles { margin-top: 0; }

.empty--inline { margin: 0; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: transparent; }

.empty--ok svg { background: rgba(60, 193, 101, 0.14); stroke: var(--ok-text); }

/* ---------- zip drop zone: one dashed row (~64px) ---------- */

.dropzone {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  min-height: 64px;
  margin: 0 0 8px;
  padding: 8px 12px 8px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--s1);
  transition: border-color 150ms ease, background-color 150ms ease;
}

.dropzone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.25); }

.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }

.dropzone.has-file { border-style: solid; border-color: rgba(60, 193, 101, 0.5); }

.drop-area { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-width: 0; padding-left: 36px; }

.drop-icon { position: absolute; left: 16px; top: 12px; width: 20px; height: 20px; fill: none; stroke: var(--accent-text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.drop-title { margin: 0; color: var(--ink); font-size: var(--fs-14); font-weight: 600; }

.drop-text { margin: 0; color: var(--muted); font-size: var(--fs-12); }

.drop-name { margin-left: 4px; color: var(--ink); font-family: var(--mono); font-size: var(--fs-12); overflow-wrap: anywhere; }

.drop-area input[type="file"] { max-width: 100%; margin-top: 4px; }

.dropzone.is-enhanced .drop-area input[type="file"] { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }

/* the whole zone is the click target once the native input is hidden */

.dropzone.is-enhanced .drop-title { cursor: pointer; }

.dropzone.is-enhanced .drop-title::after { content: ""; position: absolute; inset: 0; }

.drop-rules { grid-column: 1; margin: 0; padding-left: 36px; color: var(--muted); font-size: var(--fs-12); }

.dropzone > button { position: relative; z-index: 1; grid-column: 2; grid-row: 1 / span 2; margin: 0; }

/* ---------- add one file ---------- */

.add-file { margin: 0 0 var(--space-3); }

.add-file > summary { display: flex; align-items: center; gap: 6px; min-height: var(--row-h); color: var(--ink-2); font-size: var(--fs-13); }

.add-file-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; gap: 8px; padding: 6px 0 2px; }

.add-file-form input { max-width: none; }

.add-file-form button { margin: 0; }

/* ---------- file list: see "lander card" at the end ---------- */

.job-actions form,
.issue form { margin: 0; }

.job-actions button,
.issue button { margin: 0; }

/* ---------- audit ---------- */

.tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.weight-table td,
.weight-table th { padding: 5px 8px; }

.weight-table .table td { height: auto; }

.weight-share { width: 38%; }

progress.weight-bar,

progress.weight-bar::-webkit-progress-bar,

progress.weight-bar::-webkit-progress-value { background: var(--accent); border-radius: 3px; }

progress.weight-bar::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

.issue-title { display: flex; align-items: center; gap: 8px; margin: var(--space-4) 0 6px; font-size: var(--fs-14); }

.issue-title .muted { font-weight: 450; }

.issue-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }

.issue { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 6px 10px 6px 12px; background: var(--s1); border: 1px solid var(--line); border-left: 3px solid var(--idle); border-radius: var(--r-sm); }

.issue--error { border-left-color: var(--bad); }

.issue--warn { border-left-color: var(--warn); }

.issue--info { border-left-color: var(--accent); }

.issue-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.issue-msg { color: var(--ink-2); }

.tag--error,
.tag--failed { background: rgba(232, 67, 79, 0.14); color: var(--bad-ink); }

.tag--warn { background: rgba(240, 180, 41, 0.14); color: var(--warn-ink); }

.tag--info,
.tag--pending { background: var(--accent-soft); color: var(--accent-text); }

.tag--done,
.tag--confirmed { background: rgba(60, 193, 101, 0.14); color: var(--ok-ink); }

.tag--nogain,
.tag--rolled_back { background: var(--s3); color: var(--ink-2); }

/* ---------- compression jobs ---------- */

.refresh-note { margin: 4px 0 12px; }

.job-list { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }

.job { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 16px; padding: 6px 10px 6px 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-sm); }

.job-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }

.job-error { grid-column: 1 / -1; order: 5; margin: 0; color: var(--bad-ink); font-size: var(--fs-13); }

.job-sizes { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 0 10px; font-size: var(--fs-13); white-space: nowrap; }

.job-size { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.job-saved { color: var(--muted); font-weight: 600; }

.job-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- editor ---------- */

.editor { display: flex; flex-direction: column; gap: 8px; }

.editor-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 8px;
  background: var(--s2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
}

.editor-bar button,
.editor-bar .button { margin: 0; }

.editor-name { flex: 1; min-width: 0; overflow: hidden; color: var(--ink); font-size: var(--fs-13); text-overflow: ellipsis; white-space: nowrap; }

.editor-state { white-space: nowrap; }

.editor-area {
  display: block;
  width: 100%;
  max-width: none;
  height: calc(100dvh - var(--topbar-h) - 200px);
  min-height: 320px;
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--mono);
  font-size: var(--fs-13);
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  resize: none;
}

.editor .hint { margin: 0; }

@media (max-width: 1099px) {
  .add-file-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  .add-file-form button { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
  .editor-bar { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); flex-wrap: wrap; }

  .editor-name { order: -1; flex: 1 1 100%; }

  .editor-bar .button { flex: 1; }

  .editor-bar button { flex: 1; }

  .editor-area { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 220px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 260px; }

  .panel-head .actions { width: 100%; }

  .panel-head .actions .button,
  .panel-head > form,
  .panel-head > form button { flex: 1; width: 100%; }

  .panel-head > form { width: 100%; }

  .add-file-form { grid-template-columns: minmax(0, 1fr); }

  .tiles--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .tiles--3 .tile:first-child { grid-column: 1 / -1; }

  .weight-share { display: none; }

  .issue { flex-direction: column; align-items: stretch; }

  .issue form,
  .issue button { width: 100%; min-height: 40px; }

  .job { grid-template-columns: minmax(0, 1fr); }

  .job-sizes { justify-content: flex-start; }

  .job-actions { display: grid; grid-template-columns: 1fr 1fr; }

  .job-actions form,
  .job-actions button { width: 100%; min-height: 40px; }
}

/* ==========================================================================
   Workspaces and buyer states (stage 5)
   ========================================================================== */

/* ---------- workspace cards ---------- */

.space-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: var(--gap-panel); margin: 0 0 var(--gap-panel); padding: 0; list-style: none; }

.space { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 18px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); }

.space.is-archived { background: transparent; border-style: dashed; border-color: var(--line-strong); }

.space-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

.space-rename { display: flex; flex: 1 1 240px; align-items: center; gap: 6px; min-width: 0; margin: 0; }

/* the name reads as a title and turns into a field on hover and focus */
input.space-name { flex: 1; min-width: 0; max-width: none; margin-left: -9px; border-color: transparent; background: transparent; font-size: var(--fs-14); font-weight: 600; }

.space-archive { margin: 0; }

.space-head button,
.space-add button { margin: 0; }

.space-meta { display: flex; align-items: center; gap: 8px; margin: 0; }

.space-members { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

.member { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; margin: 0; padding: 2px 3px 2px 10px; border-radius: 999px; background: var(--accent-soft); }

.member-email { min-width: 0; overflow: hidden; color: var(--accent-text); font-size: var(--fs-12); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

button.member-x { display: grid; flex: none; place-items: center; width: 26px; height: 26px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent-text); }

button.member-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) and (pointer: fine) {
  input.space-name:hover { border-color: var(--line-strong); background: var(--s1); }

  button.member-x:hover { background: rgba(232, 67, 79, 0.18); color: var(--bad-ink); }
}

.space-add { display: flex; gap: 8px; margin: 0; }

.space-add select { flex: 1; min-width: 0; max-width: 280px; }

/* ---------- users: workspace chips ---------- */

.tags { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }

.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; }

.row-actions form { flex-wrap: nowrap; margin: 0; }

.row-actions input { width: 140px; }

.tags .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

.table .cell-tags,
.table .cell-left { text-align: left; }

.table .cell-tags { max-width: 280px; }

/* ---------- lander quota meters ---------- */

.quota { display: grid; gap: 6px; min-width: 0; }

.quota .muted { margin: 0; }



.quota.is-warn .muted { color: var(--warn-ink); }



.quota.is-full .muted { color: var(--bad-ink); }



/* ---------- read-only record ---------- */

.form-note { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-4); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s1); color: var(--ink-2); font-size: var(--fs-14); }

.form-note svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 767px) {
  .space { padding: 10px 12px; }

  .space-rename { flex-basis: 100%; }

  .space-add select { max-width: none; }

  .table--cards .cell-actions input { width: 100%; max-width: none; }

  .row-actions { flex-direction: column; align-items: stretch; gap: 8px; }

  .row-actions form { flex-wrap: wrap; }

  button.member-x { width: 32px; height: 32px; }

  /* empty action cells would leave a bare divider */
  .table--cards .cell-actions:empty { display: none; }
}

/* ==========================================================================
   Domains (stage 6)
   ========================================================================== */

.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 var(--gap-panel);
  padding: 8px 12px;
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: var(--r-md);
  background: rgba(240, 180, 41, 0.1);
  color: var(--warn-ink);
  font-size: var(--fs-13);
}

.callout svg { flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.callout p { margin: 0; }

.callout-title { color: var(--ink); font-weight: 600; }

.panel.domain-add { max-width: none; }

.dns-hint { margin-top: 16px; }

.dns-hint > p:first-child { margin: 0; font-size: var(--fs-14); }

.dns-hint .hint { margin-top: 6px; }

.copy-box--inline { align-items: center; margin: 8px 0 0; }

.copy-box--inline .link-box { flex: 0 1 auto; padding: 6px 10px; user-select: all; }

.copy-box--inline button { min-height: 32px; }

.copy-box button svg,
.domain-name button svg { width: 16px; height: 16px; margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.link-box--lines { white-space: pre-line; }

.add-results { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); list-style: none; font-size: var(--fs-14); }

.add-results code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-13); overflow-wrap: anywhere; }

/* Buy a domain */

.panel.domain-buy { max-width: none; gap: 12px; }

.buy-head { display: grid; gap: 4px; }

.buy-head > * { margin: 0; }

.buy-lead { color: var(--ink-2); font-size: var(--fs-14); }

.buy-search { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px) auto; gap: 12px; align-items: end; }

.buy-search .buy-go { margin: 0; }

.domain-buy .hint { margin: 0; }

.callout--note { border-color: var(--line-strong); background: var(--s3); color: var(--ink-2); }

.callout--note a { color: var(--accent-text); }

.domain-buy .callout { margin: 0; }

.offers { display: grid; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }

.offer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 14px;
  background: var(--s1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-md);
}

.offer--free { border-left-color: var(--ok); }

.offer--warn { border-left-color: var(--warn); }

.offer--taken .offer-name { color: var(--muted); }

.offer-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }

.offer-name { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-14); font-weight: 600; overflow-wrap: anywhere; }

.offer-why { flex-basis: 100%; margin: 0; color: var(--muted); font-size: var(--fs-13); }

.offer-price { color: var(--ink-2); font-size: var(--fs-14); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

.offer-buy { margin: 0; }

.offer-buy button { margin: 0; border-color: rgba(244, 107, 94, 0.45); background: var(--accent-soft); color: var(--accent-text); }

.buy-empty { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-14); }

@media (hover: hover) and (pointer: fine) {
  .offer-buy button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
}

@media (max-width: 720px) {
  .buy-search { grid-template-columns: minmax(0, 1fr); }

  .buy-search .buy-go { width: 100%; }

  .offer { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }

  .offer-price { text-align: left; }

  .offer-buy button { width: 100%; min-height: 40px; }
}

.domains { display: grid; gap: 6px; margin: 0 0 var(--gap-panel); padding: 0; list-style: none; }

.domain {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 14px;
  background: var(--s2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-md);
}

.domain--ok { border-left-color: var(--ok); }

.domain--warn { border-left-color: var(--warn); }

.domain--bad { border-left-color: var(--bad); }

.domain > * { min-width: 0; margin: 0; }

.domain-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }

.domain-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }

.domain-host { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-14); font-weight: 600; overflow-wrap: anywhere; }

.tag--state { padding: 4px 12px; border-radius: 999px; font-size: var(--fs-14); font-weight: 600; }

.steps { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; }

.step { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-13); }

.step--ok { color: var(--ink-2); }

.step--error { color: var(--bad-ink); }

.step-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
}

.step-mark svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.step--ok .step-mark { border-color: transparent; background: rgba(60, 193, 101, 0.2); color: var(--ok-ink); }

.step--error .step-mark { border-color: transparent; background: rgba(232, 67, 79, 0.2); color: var(--bad-ink); }

.domain-check { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-14); }

.domain-detail { color: var(--ink-2); overflow-wrap: anywhere; }

.domain-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

.tag--pool { background: transparent; border: 1px dashed var(--line-strong); }

.ns-box .muted { margin: 0; }

.domain-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.domain-space select { width: auto; min-width: 0; max-width: 100%; }

.domain-actions { display: flex; gap: 8px; margin-left: auto; }

.domain-actions form { margin: 0; }

.domain-actions button { margin: 0; }

@media (max-width: 720px) {
  .domain { padding: 10px 12px; }

  .domain-name button,
  .copy-box--inline button { min-height: 40px; }

  .copy-box.copy-box--inline button { width: auto; }

  .copy-box--inline { flex-direction: row; flex-wrap: wrap; align-items: center; }

  .domain-foot,
  .domain-space { flex-direction: column; align-items: stretch; }

  .domain-root-row { flex-direction: column; align-items: stretch; }

  .domain-root-row input { width: 100%; max-width: none; min-height: 40px; }

  .domain-root-row button { width: 100%; min-height: 40px; }

  .domain-space select { width: 100%; }

  .domain-space button,
  .domain-actions button { width: 100%; min-height: 40px; }

  .domain-actions { margin-left: 0; }

  .domain-actions form { flex: 1; }

  .step { font-size: var(--fs-13); }
}

/* ==========================================================================
   Settings page
   ========================================================================== */


.settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: var(--space-3); }

.settings-head > div { min-width: 0; }

.settings-head .section-title { margin: 0 0 4px; padding: 0; border: 0; }

.settings-head .hint { margin: 0; }

.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }

.field-label > label { margin: 0; }

label.check-row--help { align-items: flex-start; width: 100%; padding: 4px 0; }

.check-row--help input { margin-top: 2px; flex: none; }

.check-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.check-title { color: var(--ink); font-size: var(--fs-14); font-weight: 600; }

.check-text .muted { display: block; max-width: none; margin: 0; font-size: var(--fs-13); font-weight: 400; }

.settings-note { margin: 16px 0 0; }

.settings-actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

.settings-actions button { margin: 0; }

.settings-fold { margin: 20px 0 0; }

.settings-fold > .field-grid { padding: 4px 14px 16px; }

@media (max-width: 720px) {
  .settings-actions { flex-direction: column; align-items: stretch; }

  .settings-actions button { width: 100%; min-height: 44px; }

  .settings-fold > .field-grid { padding: 4px 12px 14px; }
}

/* ==========================================================================
   Stage 10 screens: simulation, API keys, bot rules, conversion types, metrics
   ========================================================================== */

.chip--link { text-decoration: none; }

.chip.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink-hi); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }

.lead-hint { max-width: 78ch; margin: 0 0 var(--space-4); }

/* revoked and archived rows fade, their actions stay readable */
.table tr.is-revoked td:not(.cell-actions) { opacity: 0.55; }

/* ---------- simulation ---------- */

.sim-form { max-width: none; }

.sim-lead { margin: 0 0 var(--space-4); }

.field-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.field-grid--4 .span-2 { grid-column: span 2; }

.sim-form .fold { margin: var(--space-4) 0 0; }

.sim-form .fold > summary .muted { margin-left: auto; font-size: var(--fs-12); }

.sim-form .fold[open] > summary { margin-bottom: 8px; }

.sim-eyebrow { display: block; margin: 0 0 4px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.sim-result { padding: 12px 16px; border-left-width: 4px; }

.sim-result--hit { border-left-color: var(--ok); background: linear-gradient(90deg, rgba(60, 193, 101, 0.07), transparent 40%), var(--s2); }

.sim-result--miss { border-left-color: var(--bad); background: linear-gradient(90deg, rgba(232, 67, 79, 0.08), transparent 40%), var(--s2); }

.sim-verdict { margin: 0 0 var(--space-4); font-size: var(--fs-16); line-height: 1.3; letter-spacing: -0.01em; }

.sim-verdict b { font-weight: 600; }

.sim-verdict .tag { vertical-align: middle; }

.sim-verdict .muted { font-size: var(--fs-14); }

.sim-verdict--miss { margin: 0; color: var(--bad-ink-hi); }

.sim-next { padding-top: var(--space-3); border-top: 1px solid var(--line); }

.sim-next-title { margin: 0 0 var(--space-3); color: var(--ink-2); font-size: var(--fs-14); font-weight: 600; }

.sim-next h4 { margin: var(--space-3) 0 6px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.sim-next .error { margin: 0; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-14); }

.split li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; row-gap: 4px; }

.split progress { grid-column: 1 / -1; }

.split-share { font-variant-numeric: tabular-nums; font-weight: 600; }

.sim-cand { padding: var(--space-3) 0; border-top: 1px solid var(--line); }

.sim-cand:first-of-type { border-top: 0; padding-top: 0; }

.sim-cand-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }

.sim-cand-share { font-size: var(--fs-18); font-weight: 600; font-variant-numeric: tabular-nums; }

.sim-cand .sim-next { margin-top: var(--space-3); }

.sim-streams { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.sim-stream { margin: 0; padding: 10px 14px; }

.sim-stream-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }

.sim-stream-head h3 { flex: 1 1 200px; margin: 0; min-width: 0; font-size: var(--fs-14); font-weight: 600; overflow-wrap: anywhere; }

.sim-stream .muted { margin: 0; }

.sim-stream--chosen { border-color: rgba(60, 193, 101, 0.5); }

.sim-stream--candidate { border-color: rgba(60, 193, 101, 0.3); }

.sim-stream--inactive,
.sim-stream--not_reached { opacity: 0.7; }

.sim-stream--shadowed .sim-status { background: rgba(240, 180, 41, 0.14); color: var(--warn-ink); }

.checks { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }

.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; font-size: var(--fs-14); }

.check-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: var(--fs-13); font-weight: 700; line-height: 1; }

.check--ok .check-mark { background: rgba(60, 193, 101, 0.18); color: var(--ok-ink); }

.check--no .check-mark { background: rgba(232, 67, 79, 0.16); color: var(--bad-ink); }

.check-kind { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-13); font-weight: 600; }

.check-reason { display: block; margin-top: 1px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- API keys ---------- */

.new-key { border-color: rgba(244, 107, 94, 0.5); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--s2); }

.new-key h2 { margin: 0 0 var(--space-3); font-size: var(--fs-14); letter-spacing: -0.02em; }

.new-key-warn { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 14px; border: 1px solid rgba(240, 180, 41, 0.4); border-radius: var(--r-sm); background: rgba(240, 180, 41, 0.1); color: var(--warn-ink); font-size: var(--fs-14); }

.new-key-warn svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.new-key .copy-box { margin: var(--space-3) 0 0; }

.new-key-value { display: flex; align-items: center; padding: 14px 16px; border-color: rgba(244, 107, 94, 0.4); font-size: var(--fs-14); letter-spacing: 0.01em; }

.key-prefix { color: var(--ink-2); }

/* ---------- bot rules ---------- */

.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tile--link { display: block; color: inherit; text-decoration: none; transition: border-color 150ms ease, background-color 150ms ease, transform 150ms var(--ease-out); }

.tile--link:active { transform: scale(0.98); }

.tile--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tile--link.is-active { border-color: var(--accent); background: var(--accent-soft); }

.tile-label { display: block; margin: 0 0 2px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.tile-value { display: block; font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

.tile--link.is-active .tile-label { color: var(--ink-2); }

.bots-order { max-width: 78ch; margin: 0 0 var(--space-4); }

.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: var(--space-4); padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.verdict--bot { border-color: rgba(232, 67, 79, 0.35); }

.verdict--human { border-color: rgba(60, 193, 101, 0.35); }

.verdict-tag { padding: 6px 16px; border-radius: 999px; font-size: var(--fs-14); font-weight: 700; }

.verdict-source { flex: 1 1 220px; min-width: 0; margin: 0; color: var(--ink-2); font-size: var(--fs-14); }

.verdict-source code { display: inline-block; margin-top: 4px; }

/* ---------- conversion types and metrics ---------- */

.names-fold > .chip-row { padding-bottom: 4px; }

.name-chip { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--s1); color: var(--ink-2); font-size: var(--fs-12); }

.table td input.mono { width: 100%; }

@media (max-width: 1023px) {
  .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .field-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .field-grid--4 .span-2 { grid-column: 1 / -1; }

  .sim-result { padding: 16px; }

  .sim-verdict { font-size: var(--fs-14); }

  .sim-stream { padding: 12px 14px; }

  .sim-stream-head h3 { flex-basis: 100%; }

  .tile-value { font-size: var(--fs-16); }

  .tile--link { min-height: 52px; }

  .new-key-value { font-size: var(--fs-14); }

  .table--cards .cell-actions { display: flex; flex-direction: column; gap: 8px; }

  .table--cards td input,
  .table--cards td select { width: 100%; }

  .chip-row .chip { min-height: 40px; }
}

.table td code { display: inline-block; padding: 3px 8px; }

@media (min-width: 768px) {
  .table td.cell-actions { white-space: nowrap; }

  .table td.cell-actions form.inline { display: inline-flex; margin-left: 4px; }
}

@media (min-width: 768px) {
  .table td[data-label="Формула"] { min-width: 240px; }
}

.empty { margin-bottom: var(--space-4); }

/* ==========================================================================
   Entity lists (campaigns, offers, landers, sources, networks): the working screen
   ========================================================================== */

/* control panel: period on top, search and filters below, one submit */
.list-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }

.list-filters .field--search { flex: 2 1 240px; min-width: 0; }

.list-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

.list-submit { display: flex; gap: 6px; flex: none; }

.list-submit .button, .list-submit button { margin: 0; }

.controls--list > .form-bar { display: none; }

.count-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notice--warn { display: flex; align-items: flex-start; gap: 10px; }

.notice--warn svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* table: sticky checkbox and name columns, quiet settings, numeric metrics */
/* Voluum model: columns keep their natural width, the wrapper scrolls sideways, the name and checkbox stay pinned.
   table-layout: fixed with a 1px table is exactly the sum of the <col> widths; list-table.js changes a single <col> on drag. */
.table--list { table-layout: fixed; width: 1px; border-collapse: separate; border-spacing: 0; }

.table--list col.c-check { width: 32px; }

.table--list col.c-title { width: 480px; }

/* the name column per list: campaigns carry long names, the rest are shorter */
[data-list-table="campaigns"] col.c-title { width: 420px; }

[data-list-table="offers"] col.c-title { width: 320px; }

[data-list-table="landers"] col.c-title,
[data-list-table="sources"] col.c-title,
[data-list-table="networks"] col.c-title { width: 280px; }

.table--list col.c-metric { width: 84px; }

.table--list col.c-set { width: 130px; }

.table--list col.c-actions { width: 36px; }

.table--list td, .table--list th { padding-left: 8px; padding-right: 8px; }

/* numeric columns are 84px: a head such as "Уник. клики" has to fit with its sort arrow */
.table--list th.cell-metric, .table--list td.cell-metric { padding-left: 5px; padding-right: 5px; }

/* Voluum look: 12px cells, striped rows, a faint 1px line between columns (the head has the grip line instead) */
.table--list tbody tr { --cell-bg: var(--s2); }

.table--list tbody tr:nth-child(even) { --cell-bg: var(--row-alt); }

.table--list tbody tr:hover { --cell-bg: var(--s3); }

.table--list tbody td { height: var(--row-h); border-right: 1px solid var(--line-faint); border-bottom: 0; background: var(--cell-bg); font-size: var(--fs-12); }

.table--list tbody td:last-child { border-right: 0; }

.table--list .col-check { position: sticky; left: 0; z-index: 1; padding: 0 0 0 10px; background: var(--cell-bg, var(--s2)); }

.table--list thead .col-check { z-index: 3; }

.table--list .cell-title { position: sticky; left: 32px; z-index: 1; overflow: hidden; background: var(--cell-bg, var(--s2)); border-right: 0; box-shadow: 1px 0 0 var(--line); }

.table--nobulk .cell-title { left: 0; }

.table--list thead .cell-title { z-index: 3; box-shadow: 0 1px 0 var(--line), 1px 0 0 var(--line); }

.table--list tfoot .cell-title { left: 0; z-index: 3; background: var(--s3); }

.table--list tfoot .col-check { z-index: 3; background: var(--s3); }

.table--list tfoot th { bottom: 0; background: var(--s3); font-size: var(--fs-12); }

/* the cells of the lead columns under the pinned total title: plain cells, so they do not count as totals */
.table--list tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--s3); border-top: 1px solid var(--line-strong); }

.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }

.title-link { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table--list .title-link { color: var(--ink); font-weight: 600; text-decoration: none; }

.table--list a.title-link:hover { color: var(--accent-text); text-decoration: underline; }

.table--list td.is-archived .title-link { color: var(--muted); font-weight: 500; }

.table--list .tag { padding: 0 6px; font-size: var(--fs-12); line-height: 16px; }

.cell-set { overflow: hidden; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }

.cell-metric.is-zero { color: var(--muted); }

.table--list thead th a { display: block; overflow: hidden; padding: 0; text-overflow: ellipsis; }

.table--list th[aria-sort] a { color: var(--ink); }

.row-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--row-btn);
  min-width: var(--row-btn);
  height: var(--row-btn);
  min-height: var(--row-btn);
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}

.row-act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.row-act:active { transform: scale(0.94); }

@media (hover: hover) and (pointer: fine) {
  .row-act:hover { background: var(--s4); color: var(--ink-hi); }
}

@media (pointer: coarse) {
  .row-act { width: 36px; min-width: 36px; height: 36px; }
}

.table--list tbody td.col-check input { vertical-align: middle; }

@media (max-width: 767px) {
  .controls--list { gap: 10px; padding: 10px 12px; }

  .controls--list .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; }

  .controls--list .chips::-webkit-scrollbar { display: none; }

  .controls--list .period { gap: 10px; }

  .list-filters { gap: 10px; }

  .list-filters .field--search { flex: 1 1 100%; }

  .list-submit { flex: 1 1 100%; }

  .list-submit button { flex: 2; }

  .list-submit .button { flex: 1; }

  [data-list-table] col.c-title { width: 200px; }

  .table--list col.c-actions { width: 44px; }

  .table--list .col-grip { display: none; }
}

/* heads stay on one line; a caption is cut only when the person drags the column narrower than it */
.table--list thead th { vertical-align: middle; padding-top: 0; padding-bottom: 0; }

.table--list td.cell-actions,
.table--list td.col-check { padding-top: 3px; padding-bottom: 3px; }

/* ==========================================================================
   Form errors: summary on top, message and red border at the field
   ========================================================================== */

.error-summary { margin: 0 0 var(--space-4); border: 1px solid rgba(232, 67, 79, 0.45); border-radius: var(--r-sm); background: rgba(232, 67, 79, 0.09); overflow: hidden; }

.error-summary > .error { margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--bad-ink-hi); font-weight: 600; }

.error-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 14px 12px; list-style: none; }

.error-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(232, 67, 79, 0.4);
  border-radius: 999px;
  color: var(--bad-ink-hi);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
}

.error-links a:hover { background: rgba(232, 67, 79, 0.16); }

/* a lone error line (no summary around it) keeps the amber banner; under a field it is a red note */
.field > .error,
fieldset > .error {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--bad-ink);
  font-size: var(--fs-13);
}

.field > [aria-invalid="true"],
.field > .check-row [aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px rgba(232, 67, 79, 0.35); }

fieldset[aria-invalid="true"] { padding-left: 12px; border-left: 2px solid var(--bad); }

fieldset[aria-invalid="true"] > legend { margin-left: -12px; }

.field > [aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px rgba(232, 67, 79, 0.3); outline: none; }

/* entity page footer: clone and archive side by side */
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: var(--space-5); }

.record-actions form { margin: 0; }

.record-actions .archive-form { margin: 0; }

.record-actions button { margin: 0; }

.record-actions button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.record-actions .muted { margin: 0; flex: 1 1 240px; font-size: var(--fs-13); }

@media (max-width: 767px) {
  .record-actions > form { flex: 1 1 0; }

  .record-actions > form button { width: 100%; }
}

/* ==========================================================================
   Dashboard: tiles with the change against yesterday, bar chart, links into the report
   ========================================================================== */

.tile dd.tile-delta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 4px;
  max-width: 100%;
  margin-top: 8px;
  padding: 2px 9px;
  overflow: visible;
  border-radius: 14px;
  background: var(--s3);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.tile { position: relative; }

.tile-arrow { position: absolute; top: 8px; right: 10px; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--s3); color: var(--muted); }

.tile-arrow.is-pos { background: rgba(60, 193, 101, 0.14); color: var(--ok-text); }

.tile-arrow.is-neg { background: rgba(232, 67, 79, 0.14); color: var(--bad-num); }

.tile-arrow svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.tile dd.tile-delta.is-pos { background: rgba(60, 193, 101, 0.14); color: var(--ok-text); }

.tile dd.tile-delta.is-neg { background: rgba(232, 67, 79, 0.16); color: var(--bad-num); }

.tile-delta .tile-ref { color: var(--ink-3); font-weight: 450; }

.tile dd.is-pos { color: var(--ok-text); }

.tile dd.is-neg { color: var(--bad-num); }

.more-link-row { margin: 0 0 var(--space-4); }

.more-link-row a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; }

.more-link-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* chart */
.chart { display: grid; gap: 8px; padding: 14px 18px 12px; border-radius: var(--r-lg); }

.chart .section-head { margin: 0; }

.chart .section-head h2 { margin: 0; }

/* the metric switch: a pill track, the current one is the light pill */
.chart-tabs { display: flex; gap: 2px; max-width: 100%; padding: 3px; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 999px; background: var(--s1); }

.chart-tabs::-webkit-scrollbar { display: none; }

.chart-tab { display: inline-flex; flex: none; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out); }

.chart-tab:active { transform: scale(0.97); }

.chart-tab[aria-current] { background: var(--ink); color: var(--paper); }

.chart-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (hover: hover) and (pointer: fine) {
  .chart-tab:hover:not([aria-current]) { background: var(--s3); color: var(--ink-hi); }
}

.chart-scroll { overflow-x: auto; scrollbar-width: none; }

.chart-svg { display: block; width: 100%; height: auto; max-height: 340px; }

.chart-grid { stroke: var(--line); stroke-width: 1; stroke-linecap: round; stroke-dasharray: 1 6; vector-effect: non-scaling-stroke; }

.chart-axis { fill: var(--line-strong); }

/* bars are capsules: muted and hatched, the last day of the period solid, a loss red on the same principle */
.chart-hatch-bg { fill: var(--hatch-bg); }

.chart-hatch-line { fill: var(--hatch-line); }

.chart-hatch-bg--neg { fill: var(--hatch-neg-bg); }

.chart-hatch-line--neg { fill: var(--hatch-neg-line); }

.chart-bar { fill: url(#chart-hatch); }

.chart-bar--neg { fill: url(#chart-hatch-neg); }

.chart-bar--now { fill: var(--accent); }

.chart-bar--now.chart-bar--neg { fill: var(--bad); }

.chart-bar:hover { fill: var(--accent); fill-opacity: 0.7; }

.chart-bar--neg:hover { fill: var(--bad); }

.chart-tick,
/* the SVG is scaled to the box: cabinet.js sets --chart-k (drawing units per screen pixel), so the captions stay 10.5px on screen */
.chart-label { fill: var(--muted); font-size: calc(10.5px * var(--chart-k, 1.2)); font-variant-numeric: tabular-nums; }

.chart-tick { text-anchor: end; }

.chart-label--start { text-anchor: start; }

.chart-label--middle { text-anchor: middle; }

.chart-label--end { text-anchor: end; }

.chart .fold { margin: 0; }

.chart .fold > summary { margin: 0; }

@media (max-width: 767px) {
  .chart-svg { min-width: 600px; }

  .chart-tab { min-height: 36px; padding: 0 11px; }
}

/* ==========================================================================
   Report: applied filters, drill-down links
   ========================================================================== */

.crumbs-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 var(--space-3); }

.crumbs-filters::before { content: "Фильтры"; margin-right: 2px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.crumbs-filters .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--chip-h);
  padding: 0 6px 0 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink-hi);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 150ms ease, transform 150ms var(--ease-out);
}

.crumbs-filters .tag:active { transform: scale(0.97); }

.crumbs-filters .tag [aria-hidden] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--veil-chip);
  font-size: var(--fs-14);
  line-height: 1;
}

@media (hover: hover) and (pointer: fine) {
  .crumbs-filters .tag:hover { background: rgba(244, 107, 94, 0.28); }
}

/* a key that goes deeper reads as a link, not as text */
.table--report td.cell-key a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-text) 40%, transparent);
  text-underline-offset: 0.2em;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

.table--report td.cell-key a:hover { color: var(--ink-hi); text-decoration-color: currentColor; }

/* ==========================================================================
   Profile and click card
   ========================================================================== */

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; max-width: var(--w-page); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin: 8px 0 0; }

.kv-grid > div { min-width: 0; }

.kv-grid dt,
.click-facts dt { margin: 0 0 3px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.kv-grid dd,
.click-facts dd { margin: 0; overflow-wrap: anywhere; font-size: var(--fs-13); }

.kv-grid dd.mono { font-size: var(--fs-13); }

.kv-wide { grid-column: 1 / -1; }

.kv-grid--one { grid-template-columns: 1fr; }

.kv-grid .is-empty dd { color: var(--muted); }

.kv-grid--subs { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

.click-head { display: grid; gap: 10px; }

.click-kicker { margin: 0; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.click-head .copy-box { margin: 4px 0 0; max-width: 560px; }

.click-head code { display: flex; align-items: center; font-size: var(--fs-14); }

.click-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }

/* path: campaign -> stream -> lander -> offer */
.path { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: step; }

.path-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-right: 22px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--s1);
}

.path-step:last-child { margin-right: 0; }

.path-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -17px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: rotate(45deg) scale(0.75);
}

.path-kind { color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.path-name { overflow-wrap: anywhere; font-size: var(--fs-14); font-weight: 600; }

.path-note { margin-top: 4px; color: var(--ink-2); font-size: var(--fs-13); }

@media (max-width: 1099px) {
  .kv-grid--subs { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .path { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }

  .path-step { margin-right: 0; }

  .path-step:nth-child(2n)::after,
  .path-step:last-child::after { content: none; }

  .path-step:nth-child(odd):not(:last-child)::after { right: -17px; }
}

@media (max-width: 767px) {
  .profile-grid { grid-template-columns: 1fr; }

  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .kv-grid--subs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .kv-grid--one { grid-template-columns: 1fr; }

  .click-facts { gap: 12px 24px; }

  .path { grid-template-columns: 1fr; gap: 0; }

  .path-step { margin: 0 0 20px; }

  .path-step:last-child { margin-bottom: 0; }

  .path-step:not(:last-child)::after,
  .path-step:nth-child(odd):not(:last-child)::after { top: auto; right: auto; bottom: -17px; left: 50%; margin: 0 0 0 -6px; transform: rotate(135deg) scale(0.75); content: ""; }

  .path-step:nth-child(2n)::after { content: ""; }

  .click-head .copy-box { flex-direction: column; }
}

.controls--list { grid-template-columns: minmax(0, 1fr); }

/* list filters: period, search, selects and the button in one row (~48px), label to the left of its field */
@media (min-width: 768px) {
  /* .list-bar and .list-filters dissolve: period, search, source, submit and "more filters" share one wrapping row */
  .controls--list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; }

  .controls--list .list-bar,
  .controls--list .list-filters { display: contents; }

  .controls--list .period { order: 1; flex: none; align-items: center; gap: 6px 10px; }

  .controls--list .chip { padding: 0 9px; }

  .controls--list .field { display: flex; align-items: center; gap: 6px; min-width: 0; }

  .controls--list .field > label { margin: 0; white-space: nowrap; }

  .controls--list .dates { display: flex; gap: 8px; width: auto; }

  .controls--list .dates input { width: 118px; padding: 0 8px; }

  .controls--list .field--search { order: 2; flex: 1 1 140px; max-width: 280px; }

  /* the placeholder says what the field is for: its caption stays for screen readers only */
  .controls--list .field--search > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .controls--list .field--search input { width: 100%; }

  .controls--list .list-filters > .field:not(.field--search) { order: 3; }

  .controls--list select { width: 130px; }

  .controls--list .list-submit { order: 4; margin-left: auto; }

  .controls--list .filters-more { order: 5; }
}

.controls--list .period,
.controls--list .chips { min-width: 0; max-width: 100%; }

/* row actions stay in view while the metrics scroll; the shadow hints that there is more to the right and goes away at the end */
.table--list .cell-actions,
.table--list .col-actions { position: sticky; right: 0; z-index: 1; border-right: 0; background: var(--cell-bg, var(--s2)); box-shadow: -1px 0 0 var(--line), -10px 0 10px -6px var(--shade-edge); }

.table-wrap--list[data-more]:not([data-more~="right"]) .cell-actions,
.table-wrap--list[data-more]:not([data-more~="right"]) .col-actions { box-shadow: -1px 0 0 var(--line); }

/* the pinned name gets the same shadow once the table is scrolled away from the start */
.table-wrap--list[data-more~="left"] .cell-title { box-shadow: 1px 0 0 var(--line), 10px 0 10px -6px var(--shade-edge); }

/* resize grip on the right edge of a head (list-table.js adds it) */
.col-grip { position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: var(--grip-w); cursor: col-resize; touch-action: none; user-select: none; }

.col-grip::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: var(--line-strong); transition: background-color 150ms ease, width 150ms ease; }

.col-grip:hover::after,
.col-grip:focus-visible::after,
.col-grip.is-drag::after { width: 2px; background: var(--accent); }

.col-grip:focus-visible { outline: none; }

@media (pointer: coarse) {
  .col-grip { width: 14px; }
}

body.is-col-resizing { cursor: col-resize; user-select: none; }

.table--list thead .col-actions,
.table--list tfoot th:last-child { z-index: 3; }

.table--list tfoot th:last-child { right: 0; }

@media (max-width: 767px) {
  /* the row's buttons scroll with it; pinned they would cover most of a 375px table */
  .table--list .cell-actions,
  .table--list .col-actions,
  .table--list tfoot th:last-child { right: auto; box-shadow: none; }

  .table--list td.cell-actions { position: static; }
}

/* ---------- wave B: templates catalog, CAPI, integration, cost, import, postback journal ---------- */

/* a row of buttons and forms that stay on one line while they fit */
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 8px; }

.inline-actions .inline-form,
.inline-actions .button { margin: 0; }

.inline-actions .inline-form { flex: none; }

/* a bordered group of fields inside a form grid (Facebook CAPI) */
.group-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--s1); }

.group-panel > .section-title { margin: 0; padding: 0; border: 0; text-align: left; }

.group-panel .field--short { max-width: none; }

.capi-check { max-width: var(--w-form); }

.capi-check .muted { margin-bottom: 0; }

.capi-check .notice { margin: 12px 0 0; }

.capi-check .hint { margin-top: 0; }

/* templates catalog */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 0 0 var(--space-5); padding: 0; list-style: none; }

.tpl-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--s2);
  transition: border-color 150ms ease, background-color 150ms ease;
}

.tpl-name { margin: 0; font-size: var(--fs-14); font-weight: 600; letter-spacing: -0.01em; }

.tpl-name a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }

.tpl-note { flex: 1; margin: 0; color: var(--ink-2); font-size: var(--fs-13); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.tpl-note.is-empty { color: var(--muted); }

.tpl-card .tags { margin: 0; }

.tpl-use { align-self: flex-start; margin-top: 4px; }

@media (hover: hover) and (pointer: fine) {
  .tpl-card:hover { border-color: var(--line-strong); background: var(--s3); }
  .tpl-name a:hover { text-decoration: underline; }
}

/* campaign: integration cards, one per enabled mode */
.integration-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; margin-top: var(--space-3); }

.integration-list:empty { display: none; }

.integration-card { min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.integration-card h3 { margin: 0 0 4px; font-size: var(--fs-14); }

.integration-card > .muted { margin: 0; }

.integration-card .copy-box { flex-direction: column; align-items: flex-start; margin: 12px 0; }

.integration-card .copy-box .link-box { width: 100%; }

.link-box--code { white-space: pre-wrap; max-height: 220px; overflow: auto; }

.integration-steps { display: grid; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; counter-reset: istep; color: var(--ink-2); font-size: var(--fs-13); }

.integration-steps li { position: relative; padding-left: 28px; line-height: 1.5; counter-increment: istep; }

.integration-steps li::before {
  content: counter(istep);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
}

.integration-card .notice { margin: 0; }

/* heading with actions on the right; the buttons share one look and wrap under the text on a phone */
/* cost update */
.cost-lead { max-width: 70ch; margin-bottom: var(--space-4); }

.form .field-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.cost-scope { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 var(--space-3); }

.cost-compare { display: grid; grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; margin: 0 0 var(--space-3); }

.cost-tile { min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.cost-tile dt { margin: 0 0 2px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.cost-tile dd { margin: 0; }

.cost-big,
.cost-pair { font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }

.cost-big { font-size: var(--fs-18); }

.cost-pair { font-size: var(--fs-18); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }

.cost-from { color: var(--muted); font-weight: 500; }

.cost-arrow { color: var(--muted); font-size: var(--fs-14); }

.cost-to { color: var(--ink); }

.cost-cap { margin-top: 6px !important; color: var(--muted); font-size: var(--fs-12); }

.cost-confirm .form-bar { margin-top: var(--space-4); }

/* conversions import */

.import-result { max-width: none; }

.import-format { display: grid; gap: 4px; margin: var(--space-4) 0; }

.import-format h3 { margin-top: 0; }

.import-cols { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--fs-13); }

.import-cols li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; line-height: 1.5; }

.import-format > div + div { margin-top: 12px; }

.import-cols .mono { color: var(--ink); font-size: var(--fs-13); font-weight: 600; }

.import-sample { margin: 0; padding: 12px 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s1); color: var(--ink-2); font-size: var(--fs-12); line-height: 1.6; white-space: pre; }

.import-send { margin: 8px 0 0; }

.drop-foot { margin: 10px 0 0; }

.import-send .hint { margin-top: 4px; padding-left: 0; }

.import-confirm { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }

.import-confirm h3 { margin-top: 0; }

.import-send-state { margin: 0 0 var(--space-3); }

.import-send-state b { color: var(--ink); font-weight: 600; }

/* the result numbers: a table in the markup, drawn as tiles */
.stat-tiles,
.stat-tiles tbody { display: block; }

.stat-tiles tbody { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 var(--space-3); }

.stat-tiles tr { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.stat-tiles th,
.stat-tiles td { height: auto; border: 0; background: transparent; white-space: normal; overflow: visible; }

.stat-tiles th { padding: 0; color: var(--muted); font-size: var(--fs-12); font-weight: 500; text-align: left; }

.stat-tiles td { padding: 0; font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

.stat-tiles .is-created td { color: var(--ok-ink); }

.stat-tiles .is-updated td { color: var(--accent-text); }

.stat-tiles .is-bad { border-color: rgba(232, 67, 79, 0.4); }

.stat-tiles .is-bad td { color: var(--bad-ink); }

/* postback journal */
.table--log .tag { white-space: nowrap; }

@media (max-width: 1023px) {
  .stat-tiles tbody { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1099px) {
  .cost-compare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-compare .cost-tile:first-child { grid-column: 1 / -1; }
}

@media (min-width: 1100px) {
  .path { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .group-panel { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .form .field-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .import-cols li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .stat-tiles tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-compare { grid-template-columns: minmax(0, 1fr); }
  .cost-big, .cost-pair { font-size: var(--fs-18); }
  .tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .inline-actions { align-items: stretch; }
  .inline-actions .inline-form,
  .inline-actions .button { flex: 1 1 100%; }
  .inline-actions .inline-form button { width: 100%; }
}

.import-result .table td { white-space: normal; }

.back .back-link + .back-link,
.back .tag { margin-left: 16px; }

.import-format { grid-template-columns: minmax(0, 1fr); }

.import-form .dropzone,
.import-confirm .dropzone { grid-template-columns: minmax(0, 1fr); }

/* ==========================================================================
   Wave C: two-factor sign-in, Telegram events, saved reports, domain root
   ========================================================================== */

/* sign-in code: big digits, one field */
.login .code-input {
  min-height: 56px;
  padding: 0 12px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
}

.login .code-input::placeholder { letter-spacing: 0; }

.login .hint { margin: 10px 0 0; }

.login .login-alt { margin: 16px 0 0; text-align: center; font-size: var(--fs-14); }

.login .login-alt a { color: var(--accent-text); }

/* profile: two-factor panel */
.tfa-panel { max-width: var(--w-form); }

.tfa-left { margin: 0; color: var(--ink-2); font-size: var(--fs-14); }

.tfa-panel .settings-fold:first-of-type { margin-top: 16px; }

.tfa-fold-form { max-width: none; padding: 4px 14px 16px; }

.tfa-fold-form .hint { margin: 0; }

.tfa-fold-form .actions button,
.tfa-steps .actions button { margin: 0; }

.tfa-steps { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }

.tfa-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }

.tfa-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-13);
  font-weight: 600;
}

.tfa-body { min-width: 0; }

.tfa-title { margin: 4px 0 12px; color: var(--ink); font-size: var(--fs-14); }

.tfa-setup { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; }

.tfa-setup .qr { flex: none; width: 168px; height: 168px; border-radius: var(--r-sm); background: #fff; }

.tfa-secret { flex: 1 1 240px; min-width: 0; }

.tfa-secret .muted { margin: 0; font-size: var(--fs-13); }

.tfa-secret .copy-box--inline { flex-wrap: wrap; }

.tfa-secret #tfa-secret { min-width: 0; }

.tfa-secret .link-box { font-size: var(--fs-14); letter-spacing: 0.04em; }

.tfa-steps .form { max-width: 520px; }

.tfa-restart { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

.tfa-restart button { margin: 0; }

/* recovery codes: 2 columns x 5 rows */
.recovery-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto);
  gap: 8px 12px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.recovery-grid li { min-width: 0; }

.recovery-grid code {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--s1);
  font-size: var(--fs-14);
  letter-spacing: 0.06em;
  text-align: center;
  user-select: all;
  -webkit-user-select: all;
}

.tfa-panel .callout { margin: 12px 0 16px; }

.tfa-panel .actions + .hint { margin-top: 12px; }

/* Telegram: one row per event, its own setting beside it */
.tg-events { margin: 20px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.tg-events > legend { margin-left: 12px; padding: 0 6px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; }

.tg-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 56px;
  margin: 0;
  padding: 12px 14px;
  cursor: pointer;
}

.tg-event + .tg-event { border-top: 1px solid var(--line); }

div.tg-event { cursor: default; }

.tg-event-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.tg-event-text .muted { margin: 0; font-size: var(--fs-13); font-weight: 400; }

.tg-event-text > label.check-title { margin: 0; }

.tg-event select { flex: none; width: 280px; max-width: 100%; }

.tg-event input.switch { flex: none; }

.tg-event--stack { display: block; padding: 0; }

.tg-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 56px;
  padding: 12px 14px;
  cursor: pointer;
}

.tg-event-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 14px 14px; }

.tg-event-sub[hidden] { display: none; }

.tg-event-sub label { margin: 0; color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; }

.tg-event-sub select { width: 110px; }

.tg-event-sub .muted { font-size: var(--fs-13); }

@media (max-width: 720px) {
  div.tg-event:not(.tg-event--stack) { flex-direction: column; align-items: stretch; }

  .tg-event select { width: 100%; min-height: 44px; }

  .tg-event-sub select { width: 120px; }
}

/* saved reports: pills with their own actions */
.presets-body { display: grid; gap: 10px; padding: 8px 0 4px; }

.presets-body .hint { margin: 0; }

.preset-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }

.preset {
  display: inline-flex;
  align-items: center;
  min-height: var(--chip-h);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.preset form { margin: 0; }

.preset-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 150ms ease, transform 150ms var(--ease-out);
}

.preset-link:active { transform: scale(0.97); }

.preset:has(.preset-act) .preset-link { padding-right: 8px; }

.preset-flag { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-12); font-weight: 600; }

.preset--shared { border-color: rgba(244, 107, 94, 0.4); }

.preset .icon-btn.preset-act { width: 24px; min-width: 24px; height: 24px; min-height: 24px; margin: 0 2px 0 0; border-radius: 50%; }

.preset .icon-btn.preset-act + .icon-btn { margin-left: 0; }

.preset .preset-act svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.preset form + form .preset-act { margin-left: -2px; }

@media (hover: hover) and (pointer: fine) {
  .preset:hover { border-color: var(--edge-hover); }

  .preset-link:hover { color: var(--ink-hi); }

  .preset .icon-btn.preset-act.danger:hover { color: var(--bad-text); background: rgba(232, 67, 79, 0.12); }
}

.preset-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }

.preset-save input[name="name"] { flex: 1 1 200px; width: auto; max-width: 320px; min-width: 0; }

.preset-save .check-row { min-height: 0; flex: none; }

.preset-save button { margin: 0; flex: none; }

@media (max-width: 720px) {
  .preset-save input[name="name"] { flex-basis: 100%; max-width: none; }

  .preset-save button { flex: 1 1 auto; min-height: 44px; }

  .preset .icon-btn.preset-act { width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
}

/* domain root: address and save on one line, the hint under it */
.domain-root { padding-bottom: 12px; }

.domain-root > label { display: block; margin: 0 0 6px; color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; }

.domain-root-row { display: flex; align-items: center; gap: 8px; }

.domain-root-row input { flex: 1 1 auto; width: auto; max-width: 520px; min-width: 0; }

.domain-root-row button { flex: none; margin: 0; }

.domain-root .hint { margin: 6px 0 0; }

.tfa-restart { justify-items: start; }

.tfa-secret .link-box { word-break: normal; overflow-wrap: break-word; }

/* import from Voluum / Keitaro: steps, system cards, type tiles, campaign list, sticky apply bar */
.import-steps { display: flex; align-items: center; gap: 0; min-width: 0; margin: 0 0 var(--space-4); padding: 0; list-style: none; }

.import-step { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); }

.import-step + .import-step::before { content: ""; flex: none; width: clamp(16px, 5vw, 56px); height: 1px; margin: 0 12px; background: var(--line); }

.import-step-num { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: var(--s2); font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums; }

.import-step-num svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.import-step-text { display: grid; min-width: 0; line-height: 1.25; }

.import-step-text b { font-size: var(--fs-13); font-weight: 600; }

.import-step-text span { font-size: var(--fs-12); }

.import-step.is-current { color: var(--ink); }

.import-step.is-current .import-step-num { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

.import-step.is-done .import-step-num { border-color: rgba(60, 193, 101, 0.4); background: rgba(60, 193, 101, 0.14); color: var(--ok-ink); }

.import-step.is-done { color: var(--ink-2); }

.import-step.is-halted { color: var(--ink); }

.import-step.is-halted .import-step-num { border-color: var(--warn); background: rgba(240, 180, 41, 0.14); color: var(--warn-ink); }

.import-halted { margin: 0 0 var(--space-4); }

.import-safe { display: flex; align-items: flex-start; gap: 10px; margin: var(--space-4) 0; padding: 12px 14px; border: 1px solid rgba(60, 193, 101, 0.35); border-radius: var(--r-sm); background: rgba(60, 193, 101, 0.1); color: var(--ink-2); font-size: var(--fs-14); line-height: 1.45; }

.import-safe svg { flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--notice-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.import-safe b { color: var(--ink); font-weight: 600; }

.import-systems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; margin: 0 0 var(--space-3); padding: 0; border: 0; }

.import-systems legend { grid-column: 1 / -1; margin: 0 0 4px; padding: 0; color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; }

.import-system { display: block; position: relative; min-width: 0; margin: 0; cursor: pointer; }

.import-system.is-off { cursor: default; }

.import-system-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }

.import-system-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); transition: border-color 150ms ease, background-color 150ms ease, transform 150ms var(--ease-out); }

.import-system-card::before { content: ""; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 50%; transition: border-color 150ms ease, box-shadow 150ms ease; }

.import-system-name { font-size: var(--fs-14); font-weight: 600; letter-spacing: -0.01em; }

.import-system-note { grid-column: 2 / -1; color: var(--muted); font-size: var(--fs-13); line-height: 1.45; }

.import-system-note a { position: relative; z-index: 1; }

.import-system-input:checked + .import-system-card { border-color: var(--accent); background: var(--accent-soft); }

.import-system-input:checked + .import-system-card::before { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--s1), inset 0 0 0 9px var(--accent); }

.import-system-input:focus-visible + .import-system-card { outline: 2px solid var(--accent); outline-offset: 2px; }

.import-system-input:active:not(:disabled) + .import-system-card { transform: scale(0.99); }

.import-system.is-off .import-system-card { opacity: 0.7; border-style: dashed; }

@media (hover: hover) {
  .import-system:not(.is-off) .import-system-input:not(:checked) + .import-system-card:hover { border-color: var(--edge-hover); }
}

/* type tiles: a table in the markup, drawn as tiles */
.import-kinds,
.import-kinds tbody { display: block; }

.import-kinds tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }

.import-kinds tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; min-width: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); transition: border-color 150ms ease, background-color 150ms ease; }

.import-kinds tr:has(input:checked) { border-color: rgba(244, 107, 94, 0.5); background: var(--accent-soft); }

.import-kinds tr.is-empty { opacity: 0.6; }

.import-kinds td { display: block; height: auto; padding: 0; border: 0; font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }

.import-kinds td:first-child { grid-column: 1 / -1; font-size: var(--fs-14); font-weight: 600; letter-spacing: 0; }

.import-kinds td:first-child .check-row { font-weight: 600; font-size: var(--fs-14); }

.import-kinds td:not(:first-child)::before { display: block; margin: 0 0 4px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; }

.import-kinds td:nth-child(2)::before { content: "Найдено"; }

.import-kinds td:nth-child(3)::before { content: "Уже есть"; }

.import-kinds td:nth-child(4)::before { content: "Создать"; }

.import-kinds td:nth-child(5)::before { content: "Пропустить"; }

.import-kinds td:nth-child(4) { color: var(--ok-ink); }

.import-kinds-note { margin: var(--space-3) 0 0; }

/* campaigns */
.import-camps { margin-top: var(--space-5); }

.import-camps-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 4px; }

.import-camps-head h3 { margin: 0; }

.import-camps-all { margin-left: auto; }

.import-camps .hint { margin: 0 0 var(--space-3); }

.import-camps-list { max-height: min(420px, 55vh); margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); list-style: none; }

.import-camps-list:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.import-camps-list li { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 2px 14px; border-bottom: 1px solid var(--line); }

.import-camps-list li:last-child { border-bottom: 0; }

.import-camps-list .check-row { flex: 1 1 auto; min-width: 0; }

.import-camp-name { min-width: 0; overflow-wrap: anywhere; }

.import-camp-meta { display: flex; flex: none; align-items: center; gap: 8px; white-space: nowrap; }

.import-apply:has(#imp-kind-campaign:not(:checked)) .import-camps { opacity: 0.5; }

/* skipped and warnings */
.import-fold { margin: var(--space-4) 0 0; }

.import-fold > .hint { margin: 0 0 var(--space-3); }

.import-issues,
.import-groups { display: grid; gap: 0; max-height: 420px; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }

.import-issues li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }

.import-issues li:first-child { border-top: 0; }

.import-issues .tag { margin-top: 1px; }

.import-issues li > div { display: grid; min-width: 0; gap: 2px; overflow-wrap: anywhere; }

.import-issues li span:not(.tag) { color: var(--muted); font-size: var(--fs-13); line-height: 1.45; }

.import-groups { gap: 8px; }

.import-group { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s2); }

.import-group-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 6px; overflow-wrap: anywhere; }

.import-group ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: var(--ink-2); font-size: var(--fs-13); line-height: 1.45; overflow-wrap: anywhere; }

/* what to read: one set per system, ticks in a wrapping row, a narrow days field with its unit */
.import-read { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin: 0 0 var(--space-3); }

.import-read > legend { flex: 0 0 100%; margin: 0 0 2px; }

.import-read-item { flex: none; }

.import-read-hint { flex: 0 0 100%; margin: 4px 0 0; }

.import-traffic { display: flex; flex: 0 0 100%; flex-wrap: wrap; align-items: center; gap: 0 10px; min-width: 0; margin-top: 4px; padding-top: var(--space-3); border-top: 1px solid var(--line); }

.import-days-row { display: inline-flex; align-items: center; gap: 8px; }

.import-days { width: 76px; padding: 0 10px; text-align: center; font-variant-numeric: tabular-nums; }

.import-days-unit { color: var(--ink-2); font-size: var(--fs-14); }

.import-traffic .import-read-hint { margin: 2px 0 0; }

.import-resume { margin-left: 6px; font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; vertical-align: middle; }

.import-done-line { margin: 0 0 var(--space-3); }

.import-done-line b { color: var(--ink); font-weight: 600; }

/* the apply bar sticks to the bottom of the screen until the form ends */
.import-bar { position: sticky; bottom: calc(var(--bar-offset) + 12px); z-index: 5; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-top: var(--space-5); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s3); box-shadow: 0 -10px 28px var(--shade-pop); }

.import-bar-space { flex: 1 1 220px; min-width: 0; }

.import-bar-space label { margin: 0 0 4px; }

.import-bar-space select { width: 100%; max-width: none; }

.import-bar-actions { display: flex; flex: none; align-items: center; gap: 8px; }

.import-bar-actions button,
.import-bar-actions .button { margin: 0; }

@media (max-width: 767px) {
  .import-systems { grid-template-columns: minmax(0, 1fr); }
  .import-step:not(.is-current) .import-step-text { display: none; }
  .import-step + .import-step::before { flex: 1 1 12px; width: auto; min-width: 12px; margin: 0 8px; }
  .import-step.is-current { flex: none; }
  .import-system-card { padding: 14px; }
  .import-kinds tbody { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .import-kinds tr { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 6px; }
  .import-kinds td:not(:first-child)::before { font-size: 11px; }
  .import-camps-list li { flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 12px 8px; }
  .import-camp-meta { padding-left: 28px; }
  .import-bar { bottom: calc(var(--bar-offset) + 8px); padding: 10px 12px; }
  .import-bar-space { flex-basis: 100%; }
  .import-bar-actions { flex: 1 1 100%; }
  .import-bar-actions button { flex: 2; min-height: 44px; }
  .import-bar-actions .button { flex: 1; min-height: 44px; }
}

/* ==========================================================================
   Dense lists: status dot, numeric cells, row menu, extra filters, campaign figures
   ========================================================================== */

/* status in front of a name: filled = on, hollow ring = off (not only a colour difference) */
.status-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }

.status-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(60, 193, 101, 0.18); }

.status-dot.is-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--idle); }

/* numeric cell */
.num,
th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

td.num.is-zero { color: var(--muted); }

/* the row menu: a details with a "..." summary; the list opens under it (above it in the last rows of a table) */
details.row-menu { position: relative; margin: 0; padding: 0; border: 0; }

.row-menu summary svg { width: 16px; height: 16px; }

.row-menu > summary::-webkit-details-marker { display: none; }

.row-menu > summary { list-style: none; }

.row-menu[open] > summary { background: var(--s4); color: var(--ink-hi); }

.row-menu > :not(summary) {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0;
  min-width: 176px;
  margin: 0;
  padding: 4px;
  background: var(--pop-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--pop-shadow);
}

tbody tr:nth-last-child(-n + 2) .row-menu > :not(summary) { top: auto; bottom: calc(100% + 2px); }

.row-menu form { display: block; margin: 0; }

.row-menu a,
.row-menu button,
.ctx-menu a,
.ctx-menu button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: var(--nav-h);
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.row-menu button.danger,
.ctx-menu button.danger { color: var(--bad-text); }

.row-menu a:focus-visible,
.row-menu button:focus-visible { outline-offset: -2px; }

@media (hover: hover) and (pointer: fine) {
  .row-menu a:hover,
  .row-menu button:hover { background: var(--s4); color: var(--ink-hi); }
}

@media (pointer: coarse) {
  .row-menu a,
  .row-menu button,
  .ctx-menu a,
  .ctx-menu button { min-height: 40px; }
}

/* "More filters": a quiet toggle in the filter row, the extra fields open on a row of their own */
details.filters-more { flex: none; margin: 0; padding: 0; border: 0; }

details.filters-more[open] { flex: 1 1 100%; }

.filters-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl-h);
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.filters-more > summary::-webkit-details-marker { display: none; }

.filters-more > summary svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.filters-more[open] > summary svg { transform: none; }

.filters-more > :not(summary) { margin-top: 8px; }

.filters-more .list-selects { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }

@media (hover: hover) and (pointer: fine) {
  .filters-more > summary:hover { background: var(--s3); color: var(--ink-hi); }
}

/* campaign page: period form and a strip of figures under the title */

/* a one-line warning: the report covers a shorter period than asked */
.period-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--gap-panel);
  padding: 4px 10px;
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: var(--r-sm);
  background: rgba(240, 180, 41, 0.1);
  color: var(--warn-ink);
  font-size: var(--fs-12);
  line-height: 1.4;
}

.period-note svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 767px) {
  .empty { grid-template-columns: auto minmax(0, 1fr); padding: 10px 12px; }

  .empty .button { grid-column: 1 / -1; grid-row: auto; justify-self: stretch; margin: 8px 0 0; }

  

  

  

  
}

/* ==========================================================================
   Campaign page: header, figures, streams, stream editor, Tom Select
   ========================================================================== */

.work > .back { margin: 0 0 2px; }

.work > .back .back-link { min-height: 22px; }

/* ---------- header: switch, link, actions in one 44px row ---------- */

/* a paused campaign: the link and the figures are muted, the switch says why */

/* ---------- the on/off switch (campaign and stream) ---------- */

.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 600;
}

.switch-track {
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--s4);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: transform 180ms var(--ease-out), background-color 150ms ease;
}

.switch-btn.is-on .switch-track { border-color: var(--accent); background: var(--accent); }

.switch-btn.is-on .switch-track::before { background: #fff; transform: translateX(12px); }

.switch-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

@media (hover: hover) and (pointer: fine) {
  .switch-btn:hover .switch-track { border-color: var(--edge-hover-2); }

  .switch-btn.is-on:hover .switch-track { background: var(--accent-hi); border-color: var(--accent-hi); }
}

/* ---------- theme switch: the on/off pill with a sun and a moon; its state is read from html[data-theme] (no flash on first paint) ---------- */

.theme-switch { min-height: 36px; }

.theme-switch .switch-track { width: 44px; height: 24px; }

.theme-switch .switch-track::before { width: 18px; height: 18px; background: var(--ink-2); }

.theme-ico { position: absolute; top: 5px; left: 5px; width: 12px; height: 12px; color: var(--s1); transition: opacity 150ms ease, transform 180ms var(--ease-out); }

.theme-ico--sun { color: var(--accent-ink); opacity: 0; transform: translateX(20px); }

html[data-theme="light"] .theme-switch .switch-track { border-color: var(--accent); background: var(--accent); }

html[data-theme="light"] .theme-switch .switch-track::before { background: #fff; transform: translateX(20px); }

html[data-theme="light"] .theme-ico--moon { opacity: 0; }

html[data-theme="light"] .theme-ico--sun { opacity: 1; }

@media (pointer: coarse) {
  .theme-switch { min-height: 40px; }
}

/* the phone sheet: a labelled row above the account */
.theme-switch--row { width: 100%; justify-content: space-between; min-height: 44px; padding: 0; font-size: var(--fs-14); font-weight: 500; }

.more-theme { margin-bottom: 4px; }

/* ---------- language switch: RU | EN, two pill segments in one ring (a form of two submit buttons, works without scripts) ---------- */

.lang-form { display: inline-flex; flex: none; align-items: center; margin: 0; }

.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; }

button.lang-btn {
  min-width: 36px;
  min-height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}

button.lang-btn.is-on { background: var(--accent-soft); color: var(--ink-hi); }

button.lang-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

@media (hover: hover) and (pointer: fine) {
  button.lang-btn:not(.is-on):hover { background: var(--s3); color: var(--ink-hi); }

  button.lang-btn.is-on:hover { background: var(--accent-soft); color: var(--ink-hi); }
}

@media (pointer: coarse) {
  button.lang-btn { min-height: 36px; min-width: 44px; }
}

/* the phone sheet: a labelled row above the theme row */
.lang-form--row { display: flex; width: 100%; justify-content: space-between; gap: 12px; min-height: 44px; font-size: var(--fs-14); font-weight: 500; }

.more-account .lang-form--row button { width: auto; }

.more-lang { margin-bottom: 4px; }

.topbar-tools { display: flex; flex: none; align-items: center; gap: 8px; }

@media (max-width: 767px) {
  .topbar-tools { display: none; }
}

/* sign-in pages: a small switch in the corner */
.login-theme { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 16px; display: flex; align-items: center; gap: 8px; }

/* a theme change repaints everything in one frame (set by cabinet-boot.js for two frames) */
html.theme-swap *,
html.theme-swap *::before,
html.theme-swap *::after { transition: none !important; }

/* ---------- figures of the period: one compact strip ---------- */

/* ---------- streams ---------- */

.streams { position: relative; display: flex; flex-direction: column; gap: var(--gap-panel); margin: 0 0 var(--space-4); }

.stream-order-note { position: absolute; top: 3px; right: 0; margin: 0; }

.stream-order-note:empty { display: none; }

.stream-group { --g: var(--accent); --g-line: rgba(244, 107, 94, 0.55); }

.stream-group--forced { --g: var(--warn); --g-line: rgba(240, 180, 41, 0.5); }

.stream-group--default { --g: var(--idle); --g-line: rgba(141, 141, 148, 0.4); }

.stream-group-head { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 0 0 3px; }

.stream-group-head::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--g); opacity: 0.8; }

.stream-group-title { margin: 0; color: var(--ink-2); font-size: var(--fs-13); font-weight: 600; }

details.group-help { position: relative; margin: 0; padding: 0; border: 0; }

.group-help > summary {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
  list-style: none;
  cursor: help;
}

.group-help > summary::-webkit-details-marker { display: none; }

.group-help[open] > summary { background: var(--s4); color: var(--ink-hi); }

.group-help > p {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 25;
  width: min(420px, 80vw);
  margin: 0;
  padding: 8px 10px;
  background: var(--pop-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--pop-shadow);
  color: var(--ink-2);
  font-size: var(--fs-12);
  line-height: 1.45;
}

.stream-list { display: flex; flex-direction: column; gap: 4px; }

.stream-group-empty { margin: 0; padding: 5px 12px; border: 1px dashed var(--line); border-radius: var(--r-md); }

details.stream {
  margin: 0;
  padding: 0;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 3px 0 0 var(--g-line, var(--line-strong));
  transition: border-color 150ms ease, background-color 150ms ease;
}

details.stream[open] { border-color: var(--line-strong); }

details.stream.stream--off { background: transparent; }

details.stream.is-dragging { border-color: var(--accent); background: var(--s3); opacity: 0.6; }

details.stream > summary.stream-line {
  gap: 6px;
  height: var(--stream-h);
  min-height: var(--stream-h);
  padding: 0 8px 0 4px;
  border-radius: var(--r-lg);
  font-size: var(--fs-13);
  font-weight: 450;
}

.stream[open] > summary > svg { transform: rotate(180deg); }

.stream-handle {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: var(--stream-h);
  color: var(--muted);
  font-size: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.stream-handle::before {
  content: "";
  width: 8px;
  height: 14px;
  background: radial-gradient(circle, currentColor 1.1px, transparent 1.5px) 0 0 / 4px 5px;
}

.stream-handle:active { cursor: grabbing; }

.stream-switch { display: flex; flex: none; margin: 0; }

/* the default group has no handle: its switch keeps the column of the others */
.stream-line > .stream-switch:first-child { margin-left: 20px; }

.stream-switch .switch-btn { justify-content: center; width: 40px; height: 28px; padding: 0; }

.stream-text { display: flex; align-items: center; flex: 1 1 auto; gap: 12px; min-width: 0; }

.stream-title,
.stream-conditions,
.stream-route { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stream-title { flex: 0 0 clamp(130px, 22%, 280px); color: var(--ink); font-size: var(--fs-13); font-weight: 600; }

/* weight of a default stream, edited in its row: a compact field (24px in the 36px row, like the fields of a table row),
   its share beside it, muted; a save button only shows without the script. Same width as the read-only tag, so the route column lines up. */
.stream-weight,
.stream-weight-form { flex: 0 0 auto; min-width: 112px; margin: 0; }

.stream-weight-form { display: flex; align-items: center; gap: 8px; }

.stream-weight-form input[type="number"] {
  width: 64px;
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stream-weight-form input[type="number"]::-webkit-inner-spin-button,
.stream-weight-form input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }

.stream-weight-form .quiet { min-height: 24px; padding: 0 8px; font-size: var(--fs-12); }

.stream-share { min-width: 32px; color: var(--muted); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

.stream-conditions { flex: 0 1 auto; max-width: 34%; color: var(--muted); font-size: var(--fs-12); }

.stream-route { flex: 1 1 0; color: var(--ink-2); font-size: var(--fs-12); }

/* the route is cut in the middle of the names by cabinet.js, so the offer stays in view */
.route-part { white-space: pre; }

.stream--off .stream-text { opacity: 0.5; }

.stream-line .row-menu { flex: none; }

@media (hover: hover) and (pointer: fine) {
  details.stream > summary.stream-line:hover { background: var(--s3); }

  .stream-handle:hover { color: var(--ink); }
}

details.stream--new { background: transparent; border-style: dashed; border-color: var(--line-strong); box-shadow: none; }

.stream--new .stream-text { color: var(--ink-2); }

.stream--new .stream-text svg { width: 16px; height: 16px; margin-left: 8px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.stream--new .stream-title { font-size: var(--fs-13); font-weight: 500; }

/* ---------- stream editor: "Куда" left, "Кому" right ---------- */

.stream-body { padding: 10px 14px 0; border-top: 1px solid var(--line); }

.stream-body > .error-summary { margin: 0 0 10px; }

/* name, group and weight are cells of one grid: the weight slot and the grids inside it dissolve into it */
.stream-top { display: grid; grid-template-columns: minmax(0, 1fr) 200px 150px; align-items: start; gap: 6px 12px; }

.stream-top .field-grid,
.stream-top [data-weight-slot]:not([hidden]) { display: contents; }

/* the kind of the stream is explained by the "?" of its group */
.stream-top .field:has(select) > .hint { display: none; }

.stream-top .field { grid-column: auto; min-width: 0; margin: 0; }

.stream-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; margin-top: 12px; }

.stream-cols > .form-block { min-width: 0; margin: 0; padding: 0; border: 0; }

.stream-for { padding-left: 24px; border-left: 1px solid var(--line); }

.stream-to .field-grid { grid-template-columns: minmax(0, 1fr); }

.stream-to [data-for] { margin-top: 10px; }

.stream-for-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; margin: 0 0 8px; }

.stream-for-head .section-title { margin: 0; }

.stream-to > .section-title { margin: 0 0 8px; }

.join-switch { display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--s1); }

.join-option { position: relative; margin: 0; cursor: pointer; }

.join-option input { position: absolute; width: 1px; min-height: 0; height: 1px; margin: 0; opacity: 0; pointer-events: none; }

.join-option span { display: block; padding: 0 10px; border-radius: 6px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; line-height: 22px; transition: background-color 150ms ease, color 150ms ease; }

.join-option input:checked + span { background: var(--accent-soft); color: var(--ink-hi); }

.join-option:has(input:focus-visible) span { box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

.stream-bar { margin: 12px -14px 0; }

.form-bar.form-bar--sticky {
  position: sticky;
  bottom: var(--bar-offset);
  z-index: 5;
  padding: 8px 14px;
  background: var(--s2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* rows "select + weight" */
.pairs { display: flex; flex-direction: column; gap: 6px; }

.pairs + .pairs,
[data-for] + [data-for] { margin-top: 10px; }

.pair-head,
.pair-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px 64px 36px 28px; gap: 6px; align-items: center; }

.pair-head { color: var(--muted); font-size: var(--fs-12); line-height: 14px; }

.pair-head > :first-child { color: var(--ink-2); font-weight: 600; }

.pairs > .hint { margin: 2px 0 0; }

/* one note about weights is enough: the offers block under the landers does not repeat it */
[data-for] + [data-for] .pairs > .hint { display: none; }

.pair-head > :nth-child(2) { grid-column: 3; }

.pair-head > :nth-child(3) { grid-column: 4; text-align: right; }

.pair-rows { display: grid; gap: 4px; }

.pair-row > select,
.pair-row > .ts-wrapper { grid-column: 1; }

.pair-open { grid-column: 2; color: var(--muted); overflow: hidden; font-size: var(--fs-12); text-align: center; text-overflow: ellipsis; white-space: nowrap; }

/* wide: an arrow next to the field, so the field takes the width; a phone has the word in its own row */
.pair-open-word { display: none; }

.pair-row > input { grid-column: 3; text-align: right; }

.pair-share { grid-column: 4; color: var(--muted); font-size: var(--fs-12); text-align: right; }

.pair-row .row-remove { grid-column: 5; }

.row-add { align-self: flex-start; min-height: 26px; margin: 0; padding: 0 8px; color: var(--accent-text); font-size: var(--fs-12); }

.row-add svg { width: 14px; height: 14px; }

.row-remove { width: 28px; min-width: 28px; height: var(--ctl-h); margin: 0; color: var(--muted); font-size: var(--fs-13); line-height: 1; }

/* rows of filters */
.filters { display: flex; flex-direction: column; gap: 6px; }

.filters-empty { margin: 0; padding: 6px 0; }

/* without the script the server draws the empty row, so the "no filters" line would lie */
.filters:has(.filter-row) .filters-empty { display: none; }

.filter-rows { display: grid; gap: 6px; }

.filter-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 100px) minmax(0, 1fr) 28px; gap: 6px; align-items: start; }

.filter-row .row-remove { grid-column: 4; }

.filter-value { min-width: 0; }

.filter-value .hint { margin: 2px 0 0; line-height: 14px; }

.filter-value > input[hidden] ~ .hint { margin-top: 0; }

/* settings folds */
/* settings folds: a closed fold is one 32px row plus its line */

/* ---------- Tom Select (the vendor file stays as it is; `body` outranks it: its css loads later) ---------- */

body .ts-wrapper { min-width: 0; width: 100%; }

body .ts-wrapper .ts-control,
body .ts-wrapper.single.input-active .ts-control {
  align-items: center;
  gap: 4px;
  min-height: var(--ctl-h);
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--s1);
  color: var(--ink);
  font-size: var(--fs-13);
  line-height: 20px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

body .ts-wrapper.single .ts-control { flex-wrap: nowrap; height: var(--ctl-h); padding: 0 26px 0 10px !important; cursor: pointer; }

body .ts-wrapper.single .ts-control::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: var(--chevron) center / contain no-repeat;
  pointer-events: none;
}

body .ts-wrapper.single .ts-control > .item { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body .ts-wrapper.single .ts-control > input { flex: 0 1 auto; min-width: 0 !important; width: 4px; }

body .ts-wrapper.single:not(.has-items) .ts-control > input { flex: 1 1 auto; }

body .ts-wrapper.multi .ts-control,
body .ts-wrapper.multi.has-items .ts-control { padding: 3px 6px; }

body .ts-wrapper.multi .ts-control > div,
body .ts-wrapper.multi .ts-control > div.active {
  margin: 0;
  padding: 0 0 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 20px;
}

body .ts-wrapper.multi .ts-control > div.active { background: rgba(244, 107, 94, 0.3); color: var(--ink-hi); }

body .ts-wrapper.plugin-remove_button .item .remove { margin-left: 4px; padding: 0 6px; border-left: 0 !important; border-radius: 0 6px 6px 0; }

body .ts-wrapper.plugin-remove_button .item .remove:hover { background: rgba(244, 107, 94, 0.28); }

body .ts-wrapper.multi .ts-control > input { flex: 1 1 40px; width: 40px; min-width: 3rem !important; color: var(--ink); font-size: var(--fs-13); }

body .ts-control input::placeholder { color: var(--placeholder); }

body .ts-wrapper.focus .ts-control { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.28); }

@media (hover: hover) and (pointer: fine) {
  body .ts-wrapper:not(.focus) .ts-control:hover { border-color: var(--edge-hover); }
}

/* the list is drawn in <body> (dropdownParent), so no container can cut it */
body .ts-dropdown {
  z-index: 1000;
  margin: 2px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--pop-bg);
  box-shadow: var(--pop-shadow);
  color: var(--ink);
  font-size: var(--fs-13);
  line-height: 20px;
}

body .ts-dropdown .ts-dropdown-content { max-height: 240px; padding: 4px; overscroll-behavior: contain; scrollbar-color: var(--scroll) transparent; scrollbar-width: thin; }

body .ts-dropdown .option,
body .ts-dropdown .no-results,
body .ts-dropdown .create { padding: 4px 8px; border-radius: 6px; }

/* a long name wraps to two lines in the list, and the list is wider than a narrow field */
body .ts-dropdown { min-width: min(480px, calc(100vw - 16px)); max-width: calc(100vw - 16px); }

body .ts-dropdown .option { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }

body .ts-dropdown .no-results,
body .ts-dropdown .create { color: var(--muted); }

body .ts-dropdown .active,
body .ts-dropdown .active.create { background: var(--s4); color: var(--ink-hi); }

body .ts-dropdown [data-selectable] .highlight { background: rgba(244, 107, 94, 0.4); color: var(--ink-hi); }

@media (max-width: 767px), (pointer: coarse) {
  body .ts-control,
  body .ts-control input,
  body .ts-dropdown { font-size: var(--fs-16); }

  body .ts-dropdown .option { padding: 8px; }
}

/* ---------- phone: the editor goes into one column ---------- */

@media (max-width: 767px) {
  

  

  

  

  .stream-group-head { position: relative; }

  details.group-help { position: static; }

  .group-help > p { right: 0; width: auto; }

  

  

  

  

  

  details.stream > summary.stream-line { height: auto; min-height: 48px; padding: 6px 8px 6px 2px; }

  .stream-text { flex-wrap: wrap; gap: 0 8px; }

  .stream-title,
  .stream-conditions { flex: 1 1 100%; max-width: none; }

  .stream-route { flex: 1 1 100%; max-width: none; }

  /* the weight keeps its own line with the route beside it: neither the field nor the share is lost */
  .stream-weight-form { min-width: 0; margin: 2px 0; }

  .stream-weight-form ~ .stream-route { flex: 1 1 0; min-width: 120px; }

  .stream-handle { height: 36px; }

  .stream--new .stream-text { flex-wrap: nowrap; }

  .stream--new .stream-title { flex: 1 1 auto; }

  .stream-body { padding: 8px 12px 0; }

  .stream-top { grid-template-columns: minmax(0, 1fr); }

  .stream-cols { grid-template-columns: minmax(0, 1fr); gap: 16px 0; }

  .stream-for { padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }

  .stream-bar { margin: 12px -12px 0; padding: 8px 12px; }

  .stream-bar button { width: 100%; }

  .pair-head,
  .pair-row { grid-template-columns: minmax(0, 1fr) 64px 34px 40px; }

  .pair-head > :nth-child(2) { grid-column: 2; }

  .pair-head > :nth-child(3) { grid-column: 3; }

  .pair-open { grid-column: 1; grid-row: 2; text-align: left; }

  .pair-open-word { display: inline; }

  .pair-open-icon { display: none; }

  .pair-row > input { grid-column: 2; }

  .pair-share { grid-column: 3; }

  .pair-row .row-remove { grid-column: 4; width: 40px; }

  .filter-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; padding: 8px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-sm); }

  .filter-value { grid-column: 1 / -1; grid-row: 2; }

  .filter-row .row-remove { grid-column: 3; grid-row: 1; width: 40px; }

  .filter-row [data-filter-type] { grid-column: 1; }
}

/* ---------- compact period: one select instead of the chips (cabinet.js builds it) ---------- */

.period-select { display: none; }

/* campaign figures: always; lists: from a tablet to a medium window (the phone list keeps its scrolling chips) */
.campaign-stats-period .period--js .chips { display: none; }

.campaign-stats-period .period--js .period-select { display: block; flex: 1 1 130px; width: 132px; min-width: 0; }

.campaign-stats-period .period--js:not(.is-custom) .dates { display: none; }

@media (min-width: 768px) and (max-width: 1679px) {
  .controls--list .period--js .chips { display: none; }

  .controls--list .period--js .period-select { display: block; width: 132px; flex: none; }

  .controls--list .period--js:not(.is-custom) .dates { display: none; }
}

/* ---------- lists: toolbar row, columns popover, table fills the window ---------- */

.list-head { margin: 0 0 8px; }

.list-head > .controls--list { min-width: 0; margin: 0 0 6px; }

.list-head .button.small { min-height: var(--ctl-h); font-size: var(--fs-13); }

details.list-columns { position: relative; }

.list-columns > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl-h);
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  white-space: nowrap;
}

.list-columns[open] > summary { background: var(--s3); color: var(--ink-hi); }

.list-columns > form,
.list-columns > .pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  width: min(620px, calc(100vw - 32px));
  padding: 10px 12px;
  background: var(--pop-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--pop-shadow);
}

/* "Колонки": one column of 28px rows in a panel with its own scroll; the search sits above, the buttons stay at the bottom */
.list-columns > .col-panel {
  display: flex;
  flex-direction: column;
  width: min(500px, calc(100vw - 32px));
  max-height: 70vh;
  padding: 0;
  overflow: hidden;
}

.col-panel .col-picker { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }

.col-search { flex: none; width: auto; margin: 8px 8px 4px; }

.col-order { flex: 1 1 auto; min-height: 0; padding: 2px 4px 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.col-item { display: flex; align-items: center; gap: 4px; height: 28px; padding: 0 2px; border-radius: 6px; }

.col-item[hidden] { display: none; }

.col-item .check-row { flex: 1 1 auto; min-width: 0; min-height: 28px; height: 28px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.col-item--fixed { padding-left: 24px; color: var(--muted); }

.col-item--fixed .check-row { color: var(--muted); cursor: default; }

.col-handle { flex: none; width: 20px; color: var(--muted); font-size: var(--fs-14); line-height: 28px; text-align: center; cursor: grab; touch-action: none; user-select: none; }

.col-handle[hidden] { display: none; }

.col-moves { display: flex; flex: none; opacity: 0; transition: opacity 120ms ease; }

.col-moves[hidden] { display: none; }

.col-item:hover .col-moves,
.col-item:focus-within .col-moves { opacity: 1; }

@media (hover: none) {
  .col-moves { opacity: 1; }
}

.col-item:hover { background: var(--s4); }

.col-move { width: 24px; min-width: 24px; height: 24px; min-height: 24px; font-size: var(--fs-13); }

.col-empty { margin: 8px 6px; color: var(--muted); font-size: var(--fs-13); }

.col-empty[hidden] { display: none; }

/* the row under the finger / mouse: a copy on the body (Sortable fallback), the original stays as a faint gap */
.col-item-drag { opacity: 0.95; background: var(--s4); border: 1px solid var(--accent); box-shadow: 0 8px 20px var(--shade-pop); z-index: 60; cursor: grabbing; }

.col-item.is-dragging { opacity: 0.35; }

.col-panel .form-bar { flex: none; gap: 6px; margin: 0; padding: 8px; background: var(--s3); border-top: 1px solid var(--line-strong); }

.col-panel .form-bar button { height: var(--ctl-h); min-height: var(--ctl-h); padding: 0 9px; font-size: var(--fs-13); }

/* a list is the main element of its page: the window does not scroll, the table does (head and totals stay in view) */
@media (min-width: 768px) {
  .app-shell:has([data-list-table]) { height: 100dvh; min-height: 0; overflow: hidden; }

  .app-shell:has([data-list-table]) .main-col { min-height: 0; }

  .app-shell:has([data-list-table]) .work { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; padding-bottom: 12px; overflow-y: auto; }

  .app-shell:has([data-list-table]) .work > * { flex: none; }

  .app-shell:has([data-list-table]) .table-wrap--list { flex: 0 1 auto; max-height: none; margin-bottom: 8px; }
}

@media (max-width: 767px) {
  .list-columns > form,
  .list-columns > .pop { position: static; width: auto; margin-top: 6px; }

  .list-columns > .col-panel { width: auto; max-height: 60vh; }
}

/* ==========================================================================
   Wave 3: account menu, report and log rows, dashboard, lander card, editor
   ========================================================================== */

/* ---------- top row: crumbs are links, the account sits at the right ---------- */

.topbar-main { flex: 1 1 auto; }

.topbar .crumbs a { color: inherit; text-decoration: none; }

@media (hover: hover) and (pointer: fine) {
  .topbar .crumbs a:hover { color: var(--ink); text-decoration: underline; }
}

.account-menu { flex: none; }

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ctl-h);
  padding: 0 10px 0 4px;
  border-radius: 999px;
  background: var(--s2);
  color: var(--ink-2);
  font-size: var(--fs-13);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.account-menu .account-text { max-width: 220px; }

.account-menu .account-trigger svg { width: 14px; height: 14px; transition: transform 200ms var(--ease-out); }

.account-menu[open] .account-trigger svg { transform: rotate(180deg); }

@media (hover: hover) and (pointer: fine) {
  .account-trigger:hover { background: var(--s3); color: var(--ink-hi); }
}

@media (max-width: 1023px) {
  .account-menu .account-text,
  .account-menu .account-trigger svg { display: none; }

  .account-trigger { padding: 0 4px; }
}

@media (max-width: 767px) {
  .account-menu { display: none; }
}

/* the crumbs lead to the same place as the "back" link, which stays for the phone (no crumbs there) */
@media (min-width: 768px) {
  .back-link--phone { display: none; }

  .back:not(:has(.tag, .back-link:not(.back-link--phone))) { display: none; }
}

/* ---------- report and log rows: same controls and table as the lists ---------- */

/* "Группировка: [1 Офферы] › [2 Страна] › + Добавить уровень": a chip per level (select + number + remove), the last one adds a level */
.group-set { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }

.group-caption { color: var(--muted); font-size: var(--fs-12); white-space: nowrap; }

.level { display: inline-flex; align-items: center; height: 28px; background: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }

.level:focus-within { border-color: var(--accent); }

.level-n { padding: 0 2px 0 8px; color: var(--muted); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

.group-set .level select { width: auto; min-width: 0; max-width: 150px; height: 26px; min-height: 0; padding-left: 4px; background-color: transparent; border: 0; box-shadow: none; font-size: var(--fs-13); }

.level-x { display: grid; place-items: center; width: 22px; height: 22px; margin-right: 2px; border-radius: 6px; color: var(--muted); transition: background-color 150ms ease, color 150ms ease; }

.level-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

@media (hover: hover) and (pointer: fine) {
  .level-x:hover { background: var(--s4); color: var(--ink-hi); }
}

.level-sep { color: var(--muted); }

.group-set .level-add { width: 172px; height: 28px; min-height: 0; background-color: transparent; border-style: dashed; color: var(--ink-2); font-size: var(--fs-13); }

@media (min-width: 768px) {
  .controls--list .group-set { order: 3; }
}

@media (max-width: 767px) {
  .group-set { gap: 6px; }

  .group-caption { flex: 1 1 100%; }
}

.table--list col.c-key { width: 220px; }

.table--list col.c-key--first { width: 320px; }

.table--list col.c-time { width: 150px; }

.table--list col.c-id { width: 190px; }

.table--list col.c-name { width: 240px; }

.table--list col.c-narrow { width: 96px; }

.table--list col.c-wide { width: 190px; }

.table--list col.c-params { width: 420px; }

/* no actions column: the last total does not stick to the right edge */
.table--bare tfoot th:last-child { right: auto; z-index: 2; }

.table--bare thead .cell-title { box-shadow: 0 1px 0 var(--line), 1px 0 0 var(--line); }

.table--list td a:not(.title-link) { color: var(--accent-text); text-decoration: none; }

.table--list td a:not(.title-link):hover { text-decoration: underline; }

.table-wrap--list .tag { vertical-align: middle; white-space: nowrap; }

/* the result of a report is the page: the window scrolls, the table keeps its own height and the chart follows */
@media (min-width: 768px) {
  .app-shell:has([data-list-table="reports"]) .table-wrap--list { flex: none; max-height: calc(100dvh - var(--topbar-h) - 96px); }
}

.crumbs-filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }

.presets > .pop { width: min(460px, calc(100vw - 32px)); }

.pop .help-list { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: var(--ink-2); font-size: var(--fs-13); }

/* postback parameters: a line with a "..." that opens the full list */
.table--list td.cell-params { overflow: visible; }

.params-line { display: flex; align-items: center; gap: 4px; min-width: 0; }

.params-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.params-pop { max-width: min(520px, 80vw); max-height: 260px; margin: 0; padding: 6px 8px; overflow: auto; font-size: var(--fs-12); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- dashboard: one strip, figures, chart and table on the first screen ---------- */

.dash-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }

/* the period and the saved reports are pill tracks (as the metric switch of the chart); the current period is the light pill */
.dash-period,
.dash-bar .preset-list { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; max-width: 100%; margin: 0; padding: 3px; overflow-x: auto; list-style: none; scrollbar-width: none; border: 1px solid var(--line); border-radius: 999px; background: var(--s2); }

.dash-period::-webkit-scrollbar,
.dash-bar .preset-list::-webkit-scrollbar { display: none; }

.dash-period .chip,
.dash-bar .preset-link { flex: none; min-height: 28px; padding: 0 13px; border: 0; background: transparent; text-decoration: none; white-space: nowrap; }

.dash-bar .preset { flex: none; min-height: 0; border: 0; border-radius: 999px; }

.chip.is-current { background: var(--ink); color: var(--paper); }

@media (hover: hover) and (pointer: fine) {
  .dash-period .chip:hover:not(.is-current) { background: var(--s3); color: var(--ink-hi); }

  .dash-bar .preset:hover { background: var(--s3); }
}

.dash-bar-label { flex: none; padding: 0 6px 0 12px; color: var(--muted); font-size: var(--fs-12); white-space: nowrap; }

/* tiles: roomy cards, the figure large, the change as a soft pill; the profit tile is coral */
.tiles--dash { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }

.tiles--dash .tile { padding: 16px 18px 14px; border-radius: var(--r-lg); }

.tiles--dash .tile dt { margin: 0 0 6px; font-size: var(--fs-13); }

.tiles--dash .tile dd { font-size: 1.5rem; letter-spacing: -0.03em; line-height: 1.15; }

.tiles--dash .tile dd.tile-delta { font-size: var(--fs-12); letter-spacing: 0; line-height: 1.5; }

.tiles--dash .tile-arrow { top: 14px; right: 14px; width: 26px; height: 26px; }

.tiles--dash .tile-arrow svg { width: 14px; height: 14px; }

.tile--accent { background: var(--accent); border-color: var(--accent); }

.tile--accent dt { color: #3a120e; }

.tile.tile--accent .tile-ref { color: var(--accent-ink); }

.tile--accent dd:not(.tile-delta) { color: var(--accent-ink); }

.tile.tile--accent dd.tile-delta { background: rgba(28, 10, 8, 0.14); color: var(--accent-ink); }

.tile--accent .tile-arrow { background: var(--accent-ink); color: var(--accent); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }

.dash-grid .chart { gap: 8px; padding: 16px 18px 12px; margin: 0; border-radius: var(--r-lg); }

.dash-grid .chart-svg { max-height: 220px; margin: 0 auto; }

/* the metric switch wraps onto a second row instead of being cut at a narrow chart */
.dash-grid .chart-head { flex-wrap: wrap; }

.dash-table { padding: 8px 8px 10px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); }

.dash-table .table-wrap { max-height: calc(100dvh - var(--topbar-h) - 150px); margin-bottom: 4px; border: 0; border-radius: var(--r-md); }

.dash-table .table--list { width: 100%; min-width: calc(150px + 5 * 88px); }

/* the name takes what the figures leave */
.dash-table col.c-key { width: auto; }

.dash-table col.c-metric { width: 88px; }

.dash-table th.cell-metric { padding-inline: 6px; } /* "Conversions" fits */

.dash-table .more-link-row { margin: 0; padding: 0 10px; font-size: var(--fs-13); }

/* 1024-1279: six compact tiles in one row and a low chart, so the table starts on the first screen */
@media (min-width: 1024px) and (max-width: 1279px) {
  .tiles--dash { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }

  .tiles--dash .tile { padding: 12px 12px 10px; border-radius: var(--r-md); }

  .tiles--dash .tile dd:not(.tile-delta) { font-size: 1.125rem; }

  .tiles--dash .tile-arrow { display: none; }

  .tiles--dash .tile-ref { flex-basis: 100%; }

  .dash-grid .chart { padding: 12px 16px 8px; }

  .dash-grid .chart-svg { max-height: 150px; }
}

@media (min-width: 1280px) {
  .tiles--dash { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 640px); align-items: stretch; }

  .dash-grid .chart { align-content: start; }
}

/* narrow tiles (six in a row, two on a phone): the reference to the earlier period goes on its own line */
@media (min-width: 1280px), (max-width: 767px) {
  .tiles--dash .tile-ref { flex-basis: 100%; }
}

@media (max-width: 767px) {
  .tiles--dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  .tiles--dash .tile { padding: 14px 14px 12px; }

  .tiles--dash .tile dd { font-size: 1.375rem; }

  .tiles--dash .tile-arrow { top: 10px; right: 10px; }

  .dash-period .chip,
  .dash-bar .preset-link { min-height: 36px; }

  .dash-bar { gap: 8px; }

  .dash-grid { gap: 8px; }
}

.chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }

.chart-head .section-head { flex: none; margin: 0; }

.chart-head .chart-tabs { flex: 0 1 auto; min-width: 0; }

.chart .section-head h2 { white-space: nowrap; }

/* ---------- lander card: tabs, files by folder, audit ---------- */

/* tabs of a record page (campaign, lander): a pill track like the chart switch, the open tab is the soft accent pill */
.tabs { display: flex; gap: 2px; width: fit-content; max-width: 100%; margin: 0 0 12px; padding: 3px; overflow-x: auto; border: 1px solid var(--line); border-radius: 999px; background: var(--s1); scrollbar-width: none; }

.tabs::-webkit-scrollbar { display: none; }

.tab-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.tab-count { padding: 0 6px; border-radius: 999px; background: var(--s3); color: var(--ink-2); font-size: var(--fs-12); line-height: 16px; }

@media (hover: hover) and (pointer: fine) {
  .tab-link:hover { background: var(--s3); color: var(--ink-hi); }
}

.tab-link:focus-visible { outline-offset: -2px; }

.tabs .tab-count { background: rgba(255, 255, 255, 0.1); }

html[data-theme="light"] .tabs .tab-count { background: rgba(21, 21, 21, 0.08); }

.tab-panel { display: none; scroll-margin-top: 120px; animation: tab-in 160ms var(--ease-out); } /* the tab row stays in view when a tab opens */

.tab-panel:target,
.tabs-page:not(:has(.tab-panel:target)) .tab-panel--first { display: block; }

.tabs-page:has(#tab-files:target) a[href="#tab-files"],
.tabs-page:has(#tab-props:target) a[href="#tab-props"],
.tabs-page:has(#tab-audit:target) a[href="#tab-audit"],
.tabs-page:has(#tab-jobs:target) a[href="#tab-jobs"],
.tabs-page:has(#tab-streams:target) a[href="#tab-streams"],
.tabs-page:has(#tab-cloak:target) a[href="#tab-cloak"],
.tabs-page:has(#tab-cost:target) a[href="#tab-cost"],
.tabs-page:has(#tab-tracking:target) a[href="#tab-tracking"],
.tabs-page:has(#tab-integration:target) a[href="#tab-integration"],
.tabs-page:has(#tab-notes:target) a[href="#tab-notes"],
.tabs-page:has(#tab-subs:target) a[href="#tab-subs"],
.tabs-page:has(#tab-macros:target) a[href="#tab-macros"],
.tabs-page:has(#tab-postback:target) a[href="#tab-postback"],
.tabs-page:has(#tab-capi:target) a[href="#tab-capi"],
.tabs-page:has(#tab-status:target) a[href="#tab-status"],
.tabs-page:not(:has(.tab-panel:target)) .tab-link--first { background: var(--accent-soft); color: var(--accent-text); }

.files-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; margin: 0 0 8px; }

.files-head h2 { margin: 0; font-size: var(--fs-14); }

.files-head .muted { margin: 0; font-size: var(--fs-13); }

.files-head .actions { display: flex; gap: 6px; margin: 0 0 0 auto; }

.quota-line.is-warn { color: var(--warn-text); }

.quota-line.is-full { color: var(--bad-text); }

.file-tree { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); }

.tree-bar { margin: 0; padding: 2px 8px; border-bottom: 1px solid var(--line); text-align: right; }

.tree-bar button { margin: 0; }

.file-list { margin: 0; padding: 0; list-style: none; }

.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; align-items: center; gap: 0 12px; min-height: var(--row-h); padding: 0 6px 0 12px; border-bottom: 1px solid var(--line-faint); }

.file-row:nth-child(even) { background: var(--row-alt); }

.file-row.is-current { background: var(--accent-soft); }

.file-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); font-family: var(--mono); font-size: var(--fs-12); text-decoration: none; }

.file-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-name svg { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.file-name.is-plain { color: var(--ink-2); }

a.file-name:hover span { text-decoration: underline; }

.file-row.is-current .file-name { color: var(--ink-hi); }

.file-size { color: var(--muted); font-size: var(--fs-12); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.file-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 96px; }

details.folder,
.issue-fold > details { margin: 0; padding: 0; border: 0; }

details.folder > summary { display: flex; align-items: center; gap: 8px; min-height: var(--row-h); margin: 0; padding: 0 12px; background: var(--s2); border-bottom: 1px solid var(--line-faint); font-size: var(--fs-12); font-weight: 600; list-style: none; cursor: pointer; }

details.folder > summary::-webkit-details-marker { display: none; }

details.folder + details.folder > summary,
.file-list + details.folder > summary { border-top: 1px solid var(--line); }

.folder > summary svg { flex: none; width: 14px; height: 14px; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.folder[open] > summary svg { transform: none; }

.folder-name { font-family: var(--mono); }

.folder-meta { margin-left: auto; color: var(--muted); font-weight: 450; }

.tiles--dense .tile { padding: 6px 12px; }

.issue-fold { background: var(--s1); border: 1px solid var(--line); border-left: 3px solid var(--idle); border-radius: var(--r-sm); }

.issue-fold.issue--warn { border-left-color: var(--warn); }

.issue-fold.issue--error { border-left-color: var(--bad); }

.issue-fold.issue--info { border-left-color: var(--accent); }

.issue-fold > details > summary { display: flex; margin: 0; align-items: center; gap: 8px; min-height: var(--row-h); padding: 0 10px 0 8px; list-style: none; cursor: pointer; }

.issue-fold > details > summary::-webkit-details-marker { display: none; }

.issue-fold summary svg { flex: none; width: 14px; height: 14px; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.issue-fold details[open] > summary svg { transform: none; }

.issue-count { font-weight: 600; }

.issue-fold .hint { margin: 0; padding: 0 12px 4px 32px; }

.issue-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; margin: 0; padding: 4px 12px 8px 32px; list-style: none; }

@media (max-width: 767px) {
  .files-head .actions { width: 100%; margin: 4px 0 0; }

  .files-head .actions .button { flex: 1; min-height: 40px; }

  .dropzone { grid-template-columns: minmax(0, 1fr); row-gap: 8px; padding: 10px 12px; }

  .dropzone > button { grid-column: 1; grid-row: auto; width: 100%; }

  .drop-icon { top: 12px; left: 12px; }

  .drop-area,
  .drop-rules { padding-left: 30px; }

  .file-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 44px; padding-left: 10px; }

  .file-size { display: none; }

  .file-actions { min-width: 0; }

  .file-actions .button { min-height: 36px; }

  details.folder > summary { min-height: 44px; }

  .issue-files { grid-template-columns: minmax(0, 1fr); padding-left: 12px; }

  .issue-fold .hint { padding-left: 12px; }
}

/* ---------- file editor: list on the left, line numbers beside the text ---------- */

.editor-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; align-items: start; }

.editor-tree { position: sticky; top: calc(var(--topbar-h) + 8px); max-height: calc(100dvh - var(--topbar-h) - 24px); overflow: auto; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); }

.editor-tree .file-tree { border: 0; background: transparent; }

.editor-tree .file-row { grid-template-columns: minmax(0, 1fr); padding-left: 8px; }

.editor-tree details.folder > summary { padding-left: 8px; }

.editor-code { display: grid; grid-template-columns: auto minmax(0, 1fr); background: var(--s1); border: 1px solid var(--line-strong); border-radius: var(--r-lg); overflow: hidden; }

.editor-code:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.25); }

.editor-gutter {
  margin: 0;
  padding: 12px 10px 27px 14px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--s2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-13);
  line-height: 1.6;
  text-align: right;
  user-select: none;
}

.editor-code .editor-area { border: 0; border-radius: 0; background: transparent; box-shadow: none; }

@media (max-width: 767px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }

  .editor-tree { position: static; order: 2; max-height: 260px; }

  .editor-gutter { padding-left: 8px; padding-right: 6px; font-size: var(--fs-12); }
}

/* audit lines: path and message share a row */
.tab-panel .issue { padding-block: 4px; }

.tab-panel .issue-body { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }

/* a card of the conversion types: the "send to source" box keeps its size beside its caption */
.table--cards .check-row { width: auto; }

.table--cards .check-row input[type="checkbox"] { flex: none; width: 18px; min-width: 18px; }

.row-menu a svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 768px) {
  .controls--list .filters-more select { width: 200px; }
}

.topbar-tag { flex: none; }

/* ==========================================================================
   Round 2: filter fold on a phone, the cloak block, the simulation verdict
   ========================================================================== */

/* the filter panel of a list on a phone: one "Фильтры" button until it is tapped (cabinet.js adds is-folded) */
.list-fold-toggle { display: none; }

@media (max-width: 767px) {
  .controls--list .list-fold-toggle { display: inline-flex; align-items: center; justify-self: start; gap: 6px; height: var(--ctl-h); margin: 0; padding: 0 10px; color: var(--ink); font-size: var(--fs-13); font-weight: 600; }

  .controls--list .list-fold-toggle[hidden] { display: none; }

  .list-fold-toggle svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease-out); }

  .list-fold-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }

  .controls--list.is-folded { padding: 6px 8px; }

  .controls--list.is-folded > :not(.list-fold-toggle) { display: none; }
}

/* ---------- cloak (settings of a campaign) ---------- */

.cloak .section-title { margin: 0 0 6px; font-size: var(--fs-13); }

.cloak-note { margin: 0; font-size: var(--fs-12); }

/* the ip-api key warning: seen, but a quiet strip rather than an alarm */
.cloak-warnings { align-items: flex-start; margin: 0; padding: 8px 12px; border-width: 0 0 0 3px; border-radius: var(--r-sm); background: rgba(240, 180, 41, 0.07); color: var(--ink-2); font-size: var(--fs-13); }

.cloak-warnings svg { color: var(--warn-text); }

.cloak-warning { margin: 0; }

.cloak-warning + .cloak-warning { margin-top: 4px; }

.cloak-white,
.cloak-filters,
.cloak-demo { padding-top: 10px; border-top: 1px solid var(--line); }

.cloak-white[hidden],
.cloak-filters[hidden],
.cloak-demo[hidden] { display: none; }

/* the four switches in two columns */

.cloak-help-fold { margin-top: 8px; }

.cloak-help-fold > summary { display: flex; align-items: center; gap: 6px; min-height: 24px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; list-style: none; cursor: pointer; }

.cloak-help-fold > summary::-webkit-details-marker { display: none; }

.cloak-help-fold > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.cloak-help-fold[open] > summary svg { transform: none; }

.cloak-help { display: grid; gap: 4px; margin: 4px 0 0; padding: 0 0 0 18px; font-size: var(--fs-12); }

.cloak-help-item { margin: 0; }

/* the demo link in one row with its button */
.cloak-demo > label { display: block; margin: 0 0 4px; color: var(--ink-2); font-size: var(--fs-12); font-weight: 500; }

.cloak-demo .copy-box { align-items: center; margin: 0; }

.cloak-demo .link-box { flex: 1 1 0; padding: 0 10px; overflow: hidden; line-height: calc(var(--ctl-h) - 2px); text-overflow: ellipsis; white-space: nowrap; word-break: normal; background: var(--s1); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }

.cloak-demo .copy-box button { min-height: var(--ctl-h); }

.cloak-demo .hint { margin-top: 4px; }

/* "клоака включена" in the head of a campaign: a small tag next to the switch, not a row of its own */

.cloak-badge { padding: 0 6px; font-size: var(--fs-12); line-height: 18px; white-space: nowrap; }

@media (max-width: 767px) {
  

  

  

  .cloak-demo .copy-box { flex-direction: row; align-items: center; }

  .cloak-demo .copy-box button { width: auto; flex: none; }
}

/* ---------- simulation: the cloak verdict, the jump to the result ---------- */

.sim-result { scroll-margin-top: calc(var(--topbar-h) + 8px); }

.sim-cloak { margin: 0 0 var(--space-3); padding: 8px 12px; border-left: 3px solid var(--line-strong); border-radius: var(--r-sm); background: var(--s1); color: var(--ink-2); font-size: var(--fs-13); }

.sim-cloak .sim-eyebrow { margin: 0 0 2px; }

.sim-cloak--cloaked { border-left-color: var(--bad); background: rgba(232, 67, 79, 0.07); }

.sim-cloak--ipapi { border-left-color: var(--warn); background: rgba(240, 180, 41, 0.07); }

.sim-cloak--passes { border-left-color: var(--ok); background: rgba(60, 193, 101, 0.07); }

/* ---------- tables with fields in the rows (metrics, conversion types, bot rules): 32px rows, 24px fields ---------- */

@media (min-width: 768px) {
  .table--cards td { padding-top: 3px; padding-bottom: 3px; }

  .table--cards td input:not([type="checkbox"]),
  .table--cards td select { height: var(--row-btn); min-height: var(--row-btn); padding-top: 0; padding-bottom: 0; }

  .table--cards td button.small,
  .table--cards td .button.small { height: var(--row-btn); min-height: var(--row-btn); }

  .table--cards td .check-row { min-height: var(--row-btn); }
}

/* ---------- bots: the two forms side by side, the rules list stays near the top ---------- */

.bots-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--gap-panel); align-items: start; }

.bots-forms > .panel { margin-bottom: var(--gap-panel); }

@media (max-width: 899px) {
  .bots-forms { grid-template-columns: minmax(0, 1fr); }
}

/* long explanations before a table: folded, "справка" in the summary */
.help-fold > .lead-hint { margin-bottom: 8px; }

/* ---------- file tree: a folder inside a folder is indented ---------- */

details.folder--d1 > summary,
.folder--d1 .file-row { padding-left: 26px; }

details.folder--d2 > summary,
.folder--d2 .file-row { padding-left: 40px; }

details.folder--d3 > summary,
.folder--d3 .file-row { padding-left: 54px; }

details.folder--d4 > summary,
.folder--d4 .file-row { padding-left: 68px; }

.editor-tree details.folder--d1 > summary,
.editor-tree .folder--d1 .file-row { padding-left: 20px; }

.editor-tree details.folder--d2 > summary,
.editor-tree .folder--d2 .file-row { padding-left: 32px; }

.editor-tree details.folder--d3 > summary,
.editor-tree .folder--d3 .file-row,
.editor-tree details.folder--d4 > summary,
.editor-tree .folder--d4 .file-row { padding-left: 44px; }

/* the "..." of the postback parameters must not stretch the 32px row */
.table--list td.cell-params { padding-top: 0; padding-bottom: 0; }

.params-line .icon-btn { width: var(--row-btn); min-width: var(--row-btn); height: var(--row-btn); min-height: var(--row-btn); }

/* ---------- integration pass: log links in numbers, sorted head, cloak note, bots folds ---------- */

/* the arrow of the sorted numeric column takes the cell's padding, not more width: "Конверсии↓" fits 84px */
.table--list th.cell-metric[aria-sort] { padding-left: 0; padding-right: 2px; }

.table--list th.cell-metric .sort-arrow { margin-left: 0; }

/* a number that opens the conversion log of its row */
.num-link { color: var(--accent-text); text-decoration: none; }

.num-link:hover { text-decoration: underline; }

/* the cloak tag beside a campaign name stays on the 32px row */
.title-line .cloak-badge { flex: none; line-height: 16px; }

/* a calm warning: the cloak does not guard lander addresses */
.cloak-unprotected { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 var(--space-3); padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--s2); color: var(--ink-2); font-size: var(--fs-13); }

.cloak-unprotected svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.cloak-unprotected a { color: var(--accent-text); }

/* bots: both forms are folds above the rules, so the list is on the first screen */
.bots-forms > .fold { margin-bottom: var(--space-3); }

.bots-forms > .fold[open] > .panel { margin-top: 4px; }

/* logs (clicks, conversions, postbacks): the filters and the button stay in one row beside the period */
@media (min-width: 768px) {
  .controls--log select { width: 112px; }

  .controls--log .field input { width: 136px; }

  .controls--log .list-submit { margin-left: 0; }
}

/* ==========================================================================
   Record page: a narrow side with the main facts, a work area with the deep settings in tabs.
   Campaign, source, network, offer and the lander's properties share it: .split > .split-side + .split-main,
   .tabs (the lander card's tab row), .field-grid--rows (label on the left), --stack (one narrow column), --inline.
   ========================================================================== */

@keyframes tab-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tab-panel { animation: none; }
}

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }

.split-side { min-width: 0; margin: 0; padding: 14px 16px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); }

.split-main { min-width: 0; max-width: var(--w-page); }

.split-title { margin: 0 0 8px; font-size: var(--fs-14); font-weight: 600; }

.split-main > .split-title:first-child { margin-top: 10px; }

.split-main > .panel { padding: 14px 16px; }

/* a page of forms stays about 1000px wide in all; the campaign, with its streams, may take more */
.split--form { max-width: var(--w-page); }

@media (min-width: 1100px) {
  .split { grid-template-columns: 348px minmax(0, 1fr); gap: 20px; max-width: 1368px; }

  .split--form { max-width: var(--w-page); }

  .split--form { grid-template-columns: 312px minmax(0, 1fr); }

  /* the side stays in view while the tab scrolls; if it is taller than the window it scrolls by itself */
  .split-side { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100dvh - var(--topbar-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }
}

/* the side of a campaign: blocks one under another, a line between them */
.split-side.split-side--sections > * + * { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.split-side .form-bar { margin-top: 12px; }

/* the page form carries the csrf token and nothing else: its fields stand in the side and the tabs (`form="entity-form"`) */
.split-form { margin: 0; }

.split-form input[type="hidden"] { display: none; }

/* tabs of a record page */
.split-main > .tabs { margin-bottom: 10px; }

.tab-panel--bare { padding: 0; }

.tab-count--ok { background: rgba(60, 193, 101, 0.16); color: var(--ok-text); }

.tab-note { margin: 0 0 12px; }

.tab-panel .capi-check { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

.tab-panel .capi-check .section-title { margin: 0 0 4px; }

.tab-panel .postback-box { margin-bottom: 4px; }

.tab-panel .postback-box > .muted:first-child { margin: 0 0 8px; }

.tab-panel .postback-box .section-title { margin: 12px 0 0; }

.tab-panel .form-bar--sticky { margin: 14px -16px -14px; padding: 8px 16px; border-radius: 0 0 var(--r-md) var(--r-md); }

/* ---------- folds: one card for every foldable block ----------
   a frame, a summary row (chevron, title, a muted note on the right) and a body under it. The chevron of the summary is the
   svg in the markup (.fold) or a drawn one (.settings-fold, .import-fold, same shape), always on the left.
   .fold--inline is not a card: it is a button of a toolbar ("Колонки", "Шаблоны"). */

.fold:not(.fold--inline),
.settings-fold,
.import-fold { padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s2); }

.fold:not(.fold--inline) { margin: 0 0 8px; }

/* inside a panel the card is one step darker, so the two frames do not merge */
.panel .fold:not(.fold--inline),
.panel .settings-fold,
.panel .import-fold { background: var(--s1); }

.fold:not(.fold--inline) > summary,
.settings-fold > summary,
.import-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 0 14px; color: var(--ink-2); font-size: var(--fs-13); font-weight: 600; list-style: none; cursor: pointer; }

.settings-fold > summary::-webkit-details-marker,
.import-fold > summary::-webkit-details-marker { display: none; }

.settings-fold > summary::before,
.import-fold > summary::before { content: ""; flex: none; width: 16px; height: 16px; background: currentColor; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); -webkit-mask: var(--mask-chevron) center / 16px no-repeat; mask: var(--mask-chevron) center / 16px no-repeat; }

.settings-fold[open] > summary::before,
.import-fold[open] > summary::before { transform: none; }

.fold:not(.fold--inline) > summary .muted { margin: 0 0 0 auto; font-size: var(--fs-12); font-weight: 450; }

@media (hover: hover) and (pointer: fine) {
  .fold:not(.fold--inline) > summary:hover,
  .settings-fold > summary:hover,
  .import-fold > summary:hover { color: var(--ink-hi); }
}

/* the body: a block of the page that had a frame of its own gives it up; loose text and grids take the card's side padding */
.fold:not(.fold--inline):not(.fold--card)[open] { padding-bottom: 12px; }

.fold:not(.fold--inline) > :not(summary):not(.fold-body):not(.panel) { margin-right: 16px; margin-left: 16px; }

.fold:not(.fold--inline) > .panel { margin: 0; padding: 2px 16px 0; border: 0; border-radius: 0; background: none; }

.fold:not(.fold--inline) > .fold-body { padding: 2px 16px 14px; }

.import-fold > :not(summary) { margin-right: 14px; margin-left: 14px; }

.import-fold[open] { padding-bottom: 14px; }

.settings-fold--danger > summary { color: var(--bad-text); }

/* ---------- fields: label on the left, a column of at most 640px ---------- */

.field-grid--rows { grid-template-columns: minmax(0, 1fr); gap: 12px 0; max-width: 640px; }

.field-grid--rows > .field { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 12px; align-items: start; }

.field-grid--rows > .field > label:not(.check-row),
.field-grid--rows > .field > .field-label { grid-column: 1; margin: 0; padding-top: 6px; font-size: var(--fs-13); line-height: 18px; }

.field-grid--rows > .field > .field-label { justify-content: flex-start; }

.field-grid--rows > .field > .field-label > label { padding-top: 0; }

.field-grid--rows > .field > :not(label):not(.field-label),
.field-grid--rows > .field > .check-row { grid-column: 2; }

.field-grid--rows > .field > .hint,
.field-grid--rows > .field > .error { margin: 4px 0 0; }

/* the controls keep their natural width; a long value (a link, a list) takes the whole column */
.field-grid--rows .field input:not([type="checkbox"]),
.field-grid--rows .field select { max-width: 360px; }

.field-grid--rows .field.span-2 input:not([type="checkbox"]),
.field-grid--rows .field.span-2 textarea { max-width: none; }

.field-grid--rows .field--short input:not([type="checkbox"]) { max-width: 200px; }

.field-grid--rows > .field:has(> .check-row) { margin-block: -2px; }

.field-grid--rows > .subs { display: block; }

.field-grid--rows > .subs > legend { margin-bottom: 6px; }

.field-grid--rows > p { margin: 0; padding-left: 212px; }

/* several fields in one row: the first names the row, the others bring a short caption */
.field-line-body { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px 12px; }

.field-line-item { display: flex; align-items: center; gap: 8px; min-width: 0; }

.field-line-item > label { max-width: 120px; margin: 0; font-size: var(--fs-13); line-height: 14px; }

.field-line-item select { width: 160px; }

.field-line-item.field--short input { width: 90px; }

.field-line-sub { display: none; }

.field-grid--rows > .field--line > .hint + .hint { margin-top: 2px; }

/* one narrow column (the side panel), the label above the field */
.field-grid--stack { grid-template-columns: minmax(0, 1fr); gap: 10px; }

.field-grid--stack > .field > .hint { margin-top: 4px; }

/* the side stays short: a hint shows while its field is in use (a wrong value shows its error at once) */
.field-grid--stack > .field:not(:focus-within) > .hint { display: none; }

.field-grid--stack .field--line > label { display: none; }

.field-grid--stack .field-line-body { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; align-items: start; }

.field-grid--stack .field-line-item { display: block; }

.field-grid--stack .field-line-item > label,
.field-grid--stack .field-line-sub { display: block; max-width: none; margin: 0 0 4px; color: var(--ink-2); font-size: var(--fs-12); font-weight: 500; line-height: 16px; white-space: normal; }

.field-grid--stack .field-line-item select,
.field-grid--stack .field-line-item.field--short input { width: 100%; }

/* a short row of selects with a button: the label above, the control of its natural width */
.field-grid--inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }

.field-grid--inline > .field { flex: 0 0 auto; }

.field-grid--inline .field select { width: 190px; }

/* a field with a hint takes its own row, so the hint wraps inside the panel instead of running off its edge */
.field-grid--inline > .field:has(> .hint) { flex: 1 1 100%; min-width: 0; }

.field-grid--inline > .field > .hint { max-width: 72ch; }

.streams-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 10px; }

.streams-opts > .form-lock { margin: 0; }

.streams-opts > button { margin: 0; }

/* the one setting left above the streams reads as a line: "Тип редиректа  [302]  Сохранить" */
.streams-opts { align-items: center; }

.streams-opts .field-grid { flex-wrap: nowrap; align-items: center; gap: 0; }

.streams-opts .field { display: flex; align-items: center; gap: 10px; margin: 0; }

.streams-opts .field > label { margin: 0; white-space: nowrap; }

.streams-opts .field select { width: 96px; }

@media (max-width: 767px) {
  .field-grid--rows > .field { grid-template-columns: minmax(0, 1fr); }

  .field-grid--rows > .field > label:not(.check-row),
  .field-grid--rows > .field > .field-label { grid-column: 1; padding-top: 0; margin-bottom: 4px; }

  .field-grid--rows > .field > :not(label):not(.field-label),
  .field-grid--rows > .field > .check-row { grid-column: 1; }

  .field-grid--rows .field input:not([type="checkbox"]),
  .field-grid--rows .field select { max-width: none; }

  .field-grid--rows .field--short input:not([type="checkbox"]) { max-width: 200px; }

  .field-grid--rows > p { padding-left: 0; }

  .field-line-body { flex-wrap: wrap; }

  .field-line-item { flex: 1 1 100%; }

  .field-line-item select,
  .field-line-item.field--short input { width: 100%; }

  .field-line-item.field--short { flex: 1 1 100%; }

  .streams-opts > .form-lock { width: 100%; }

  .field-grid--inline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .field-grid--inline .field select { width: 100%; }

  .streams-opts > .form-lock { width: auto; }

  .streams-opts .field-grid { display: flex; }

  .streams-opts .field select { width: 96px; }
}

/* ---------- the side of a campaign ---------- */

.campaign-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.campaign-state { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }

.campaign-switch { display: flex; align-items: center; margin: 0; color: var(--ink-2); font-size: var(--fs-13); font-weight: 600; }

.campaign-switch .dot { margin-right: 8px; }

.campaign-head.is-off .campaign-switch,
.campaign-head.is-off .link-box { color: var(--muted); }

.campaign-link { flex-direction: row; align-items: center; margin: 0; }

.campaign-link .link-box { flex: 1 1 0; min-width: 0; min-height: var(--ctl-h); padding: 0 10px; overflow: hidden; line-height: calc(var(--ctl-h) - 2px); text-overflow: ellipsis; white-space: nowrap; word-break: normal; }

.campaign-link button { width: auto; min-height: var(--ctl-h); }

.cloak-badge { margin: 0; }

/* "Основное": a title on a wide window, a fold on a phone (cabinet.js closes it there) */
.side-fold { margin: 0; padding: 0; border: 0; }

.side-fold > summary { display: flex; align-items: center; gap: 6px; min-height: var(--row-h); margin: 0; font-size: var(--fs-14); list-style: none; cursor: pointer; }

.side-fold > summary::-webkit-details-marker { display: none; }

.side-fold > summary svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.side-fold[open] > summary svg { transform: none; }

@media (min-width: 1100px) {
  .side-fold > summary { min-height: 0; margin: 0 0 8px; cursor: default; pointer-events: none; }

  .side-fold > summary svg { display: none; }
}

/* figures of the period: the period form, then two columns of figures */
.campaign-stats-period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 8px; }

.campaign-stats-period .period { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 6px 8px; }

.campaign-stats-period .dates { display: grid; flex: 1 1 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.campaign-stats-period .dates .field { display: flex; align-items: center; gap: 6px; }

.campaign-stats-period .dates label { margin: 0; }

.campaign-stats-period .dates input { padding: 0 8px; }

.campaign-stats > .notice,
.campaign-stats > .period-note { margin: 0 0 8px; }

.campaign-stats-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; padding: 0; }

.campaign-stat { min-width: 0; }

.campaign-stat dt { margin: 0; color: var(--muted); font-size: var(--fs-12); font-weight: 500; line-height: 14px; }

.campaign-stat dd { margin: 0; overflow: hidden; color: var(--ink); font-size: var(--fs-16); font-weight: 600; line-height: 20px; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.campaign-stat .num-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }

.campaign-stat .num-link:hover { text-decoration-color: currentColor; }

.campaign-head-actions { display: grid; grid-template-columns: repeat(3, minmax(auto, 1fr)) var(--ctl-h); gap: 6px; align-items: center; }

.campaign-head-actions .button { margin: 0; padding: 0 6px; gap: 4px; font-size: var(--fs-12); }

.campaign-head-actions .row-act { width: var(--ctl-h); min-width: var(--ctl-h); height: var(--ctl-h); min-height: var(--ctl-h); border-color: var(--line-strong); color: var(--ink-2); }

@media (min-width: 560px) and (max-width: 1099px) {
  .campaign-stats-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* the stream list and its editor stay about 1000px wide */
.form.form--wide.stream-form { display: block; max-width: none; }

/* ---------- the cloak tab ---------- */

.cloak { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }

.cloak-white .field-grid + .field-grid,
.cloak-filters .field-grid + .field-grid,
.cloak-filters .field-grid + .cloak-help-fold { margin-top: 12px; }

.cloak-white-url { min-width: 0; }

.cloak-white-404 { margin: 0; }

/* ==========================================================================
   Wave 4: action bar over a table, row selection, context menu, report tabs, splits of a report
   ========================================================================== */

/* the bar: record buttons on the left (active for exactly one selected row), "Действия" for one or more, tools ("Колонки") on the right */
.list-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-height: var(--ctl-h); margin: 0 0 6px; }

.list-actions .toolbar { flex-wrap: nowrap; gap: 6px; margin: 0 0 0 auto; }

.list-actions .button.small { min-height: var(--ctl-h); font-size: var(--fs-13); }

.act { height: var(--ctl-h); border-radius: 999px; min-height: var(--ctl-h); margin: 0; padding: 0 10px; background: transparent; border: 1px solid var(--line-strong); color: var(--ink); font-size: var(--fs-13); font-weight: 500; }

.act svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.act.act--create { padding: 0 12px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.act:disabled,
.act[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }

@media (hover: hover) and (pointer: fine) {
  .act:hover:not(:disabled):not([aria-disabled="true"]):not(.act--create) { background: var(--s3); border-color: var(--line-strong); color: var(--ink-hi); }
}

details.act-menu > summary.act { display: inline-flex; align-items: center; gap: 4px; list-style: none; cursor: pointer; }

.act-menu[open] > summary.act { background: var(--s3); color: var(--ink-hi); }

.act-menu > :not(summary) { right: auto; left: 0; }

/* the counter of ticked rows: a pill with the bare number (the words are in its title and read aloud). Its lane is always there
   (empty = invisible), so the bar neither wraps nor moves when the first row is ticked. */
.act-count {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 28px;
  height: 24px;
  margin: 0 0 0 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: default;
}

.act-count:empty { visibility: hidden; }

/* the bar never wraps and never changes height */
.list-actions:not(.list-actions--report) { flex-wrap: nowrap; }

.list-actions:not(.list-actions--report) > * { flex: none; }

.list-actions:not(.list-actions--report) > .toolbar { flex: none; margin-left: auto; }

.menu-item svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.row-menu .menu-item,
.ctx-menu .menu-item { min-height: 26px; }

@media (pointer: coarse) {
  .row-menu .menu-item,
  .ctx-menu .menu-item { min-height: 40px; }
}

.menu-sep { height: 1px; margin: 4px 2px; border: 0; background: var(--line); }

/* single-record items of the "Действия" menu exist for a phone, where the buttons of the bar do not fit */
.menu-item[data-phone-only] { display: none; }

@media (max-width: 767px) {
  .menu-item[data-phone-only] { display: flex; }

  .act--single { display: none; }

  /* a report has no "Действия" menu: its three buttons stay, icons only */
  .list-actions--report .act--single { display: inline-flex; padding: 0 10px; }

  .list-actions--report .act--single span { display: none; }

  .list-actions .list-columns .muted { display: none; }

  /* a phone: "Создать" keeps its icon only */
  .list-actions .act--create span { display: none; }

  .list-actions .act--create { padding: 0 10px; }
}

@media (min-width: 768px) and (max-width: 1399px) {
  /* a narrow window: the single-record buttons keep only their icon (the name is in the title) */
  .act--single span { display: none; }

  .act--single { padding: 0 8px; }
}

/* the selected row: a blue tint (the pinned cells take it through --cell-bg) and a line at the left edge */
.table--list tbody tr.is-selected { --cell-bg: var(--row-sel); }

.table--list tbody tr.is-selected:hover { --cell-bg: var(--row-sel-hover); }

.table--report.table--list tbody tr.is-selected td,
.table--report.table--list tbody tr.is-selected:hover td { background: var(--cell-bg); }

.table--list tbody tr.is-selected > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.table--list.table--nobulk:not(.table--tree) tbody tr.is-selected > td:first-child { box-shadow: inset 2px 0 0 var(--accent), 1px 0 0 var(--line); }

.table--list td.cell-actions,
.table--list th.col-actions { padding-left: 4px; padding-right: 4px; }

/* the row's "⋯": the details works alone; with the script the same list opens as the context menu */
.row-act[aria-expanded="true"] { background: var(--s4); color: var(--ink-hi); }

/* ---------- report tree: a "+" in the first cell opens the rows one level below (list-table.js) ---------- */

/* the first cell: 10px, the 18px toggle (or an empty spacer of the same size) and 6px; every level below moves 20px right */
.table--tree .cell-title { padding-left: 10px; }

.table--tree .cell-title.level-2 { padding-left: 30px; }

.table--tree .cell-title.level-3 { padding-left: 50px; }

/* the name link is a block elsewhere (it cuts long names); next to the toggle it shares the line */
.table--tree .cell-title { --tree-box: 24px; }

.table--tree .cell-title .title-link { display: inline-block; max-width: calc(100% - var(--tree-box)); vertical-align: middle; }

.tree-toggle,
.tree-spacer { display: inline-block; flex: none; width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 0 6px 0 0; padding: 0; vertical-align: middle; }

.tree-toggle { position: relative; background: transparent; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink-2); transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }

/* plus = two bars; opened, the vertical bar folds away and a minus stays */
.tree-toggle::before,
.tree-toggle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 1.5px; margin: -0.75px 0 0 -4px; border-radius: 1px; background: currentColor; transition: transform 160ms var(--ease-out), opacity 160ms ease; }

.tree-toggle::after { transform: rotate(90deg); }

.tree-toggle[aria-expanded="true"] { border-color: rgba(244, 107, 94, 0.45); color: var(--accent-text); }

.tree-toggle[aria-expanded="true"]::after { transform: rotate(0deg); opacity: 0; }

/* loading: the bars give way to a ring in the same 18px box, so the row keeps its height */
.tree-toggle.is-loading { cursor: progress; }

.tree-toggle.is-loading::before { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%; background: none; animation: tree-spin 700ms linear infinite; }

.tree-toggle.is-loading::after { opacity: 0; }

@keyframes tree-spin { to { transform: rotate(360deg); } }

@media (hover: hover) and (pointer: fine) {
  .table--tree .tree-toggle:hover:not(.is-loading) { background: var(--s4); border-color: var(--line-strong); color: var(--ink-hi); }
}

/* a finger needs more than 18px: the box grows, the indent of the levels stays the same (the spacer follows) */
@media (pointer: coarse) {
  .tree-toggle,
  .tree-spacer { width: 28px; min-width: 28px; height: 28px; min-height: 28px; margin-right: 2px; }

  .tree-toggle { border-radius: 7px; }

  .table--tree .cell-title { --tree-box: 30px; padding-left: 4px; }

  .table--tree .cell-title.level-2 { padding-left: 24px; }

  .table--tree .cell-title.level-3 { padding-left: 44px; }
}

/* nested levels are a shade darker than the first one, so the levels read at a glance (an overlay: the pinned cells stay opaque) */
.table--tree tbody tr[data-level="2"] > td { background-image: linear-gradient(var(--tree-2), var(--tree-2)); }

.table--tree tbody tr[data-level="3"] > td { background-image: linear-gradient(var(--tree-3), var(--tree-3)); }

.table--tree tbody tr[data-level="2"] > .cell-title a,
.table--tree tbody tr[data-level="3"] > .cell-title a { font-weight: 450; }

/* the note under a parent: the cut list of children, or a failed request with "Повторить" */
.table--tree tr.tree-note > td { height: var(--row-h); padding-left: 44px; background: var(--s2); color: var(--muted); font-size: var(--fs-12); white-space: normal; }

.table--tree tr.tree-note[data-level="3"] > td { padding-left: 64px; }

.table--tree tr.tree-note.is-error > td { color: var(--warn-ink); }

.tree-note .tree-retry { min-height: var(--row-btn); margin-left: 8px; padding: 0 8px; font-size: var(--fs-12); }

/* ---------- report head: two rows on a wide window ----------
   row 1: the splits, then the three record buttons and "Дерево / Список";
   row 2: the bar with the period and the levels, then the tools ("Ещё фильтры", "Колонки", "Шаблоны", CSV).
   .list-actions dissolves into the head (display: contents) so its parts can sit in either row; the ::after is the line break.
   Where a row does not fit, its last part wraps under it. */

@media (min-width: 768px) {
  .list-head--report { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: -4px 0 6px; }

  .list-head--report::after { content: ""; order: 3; flex: 0 0 100%; height: 0; }

  .list-head--report > .splits { order: 1; flex: 1 1 auto; margin: 0; }

  .list-head--report > .list-actions--report { display: contents; }

  .list-head--report .act--single,
  .list-head--report .act-count,
  .list-head--report .view-toggle { order: 2; }

  .list-head--report .controls--list .period--js .period-select { width: 104px; }

  .list-head--report .group-set .level-add { width: 164px; }

  .list-head--report .view-toggle { margin-left: 0; }

  .list-head--report > .controls--list { order: 4; flex: 1 1 auto; gap: 4px 6px; margin: 0; padding: 4px 8px; }

  .list-head--report .toolbar { order: 5; flex: none; gap: 4px; margin: 0 0 0 auto; }

  .list-head--report .toolbar summary,
  .list-head--report .toolbar .button { gap: 4px; padding: 0 8px; }

  .list-head--report .list-submit button { padding: 0 12px; }

  .list-head--report .group-set .level-add { flex: none; }

  .list-head--report a.split,
  .list-head--report summary.split { padding: 0 10px; }

  /* the number beside a tool name is the first thing to go when the row is short */
  .list-head--report .list-columns .muted { display: none; }
}

/* the caption "Группировка:" goes: the numbered chips say it; the room is needed for the tools */
@media (min-width: 768px) {
  .list-head--report .group-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* where the splits and the three record buttons do not fit one line, the buttons move together to the next one (not one by one) */
@media (min-width: 768px) and (max-width: 1099px) {
  .list-head--report > .splits { flex-basis: 100%; }
}

/* up to 1799px the three record buttons keep their icon only (the name is in the title), so both rows stay one line each */
@media (min-width: 768px) and (max-width: 1799px) {
  .list-actions--report .act--single span { display: none; }

  .list-actions--report .act--single { padding: 0 9px; }
}

.view-toggle { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--line); }

.filters-more--bar > summary { height: var(--ctl-h); }

/* the extra filters open as a popover under the button, like "Колонки", and do not push the table down */
.filters-more--bar > .list-selects { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; width: min(560px, calc(100vw - 32px)); margin: 0; padding: 10px 12px; background: var(--pop-bg); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--pop-shadow); }

details.filters-more--bar { position: relative; flex: none; }

details.filters-more--bar[open] { flex: none; }

@media (max-width: 767px) {
  .filters-more--bar > .list-selects { position: static; width: auto; margin-top: 6px; box-shadow: none; }

  .list-actions--report .toolbar { flex-wrap: wrap; }
}

/* ---------- the context menu: one floating list for the "⋯" of a row, the right button and Shift+F10 ---------- */

.ctx-menu {
  position: fixed;
  z-index: 70;
  display: grid;
  gap: 0;
  min-width: 176px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 4px;
  background: var(--pop-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--pop-shadow);
  outline: none;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: var(--ox, 0) var(--oy, 0);
  transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
}

.ctx-menu.is-open { opacity: 1; transform: none; }

.ctx-menu form { display: block; margin: 0; }

.ctx-menu .menu-item:focus { background: var(--s4); color: var(--ink-hi); outline: none; }

.ctx-menu .menu-item:disabled,
.ctx-menu .menu-item[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }

.ctx-menu .menu-item:active:not(:disabled) { transform: none; }

@media (hover: hover) and (pointer: fine) {
  .ctx-menu .menu-item:hover:not(:disabled) { background: var(--s4); color: var(--ink-hi); }
}

.ctx-menu .menu-item span { overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  .ctx-menu { transition: none; transform: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  background: var(--s4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: 0 8px 24px var(--shade-edge);
  color: var(--ink);
  font-size: var(--fs-13);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
  pointer-events: none;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 767px) {
  .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ---------- open reports: tabs in the top row (report-tabs.js) ---------- */

.rtabs { display: flex; flex: 1 1 0; align-items: flex-end; align-self: stretch; gap: 2px; min-width: 0; padding: 0 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }

.rtabs::-webkit-scrollbar { display: none; }

.topbar:has(.rtabs) .topbar-main { flex: none; }

/* the tabs name the page: the list tab or the tab of the open report replaces the title (a phone has no strip and keeps the title) */
@media (min-width: 768px) {
  .topbar:has(.rtab.is-active) .topbar-main { display: none; }
}

.rtab { position: relative; display: flex; flex: 0 0 auto; align-items: center; min-width: 112px; max-width: 220px; height: 32px; border-radius: 8px 8px 0 0; color: var(--muted); font-size: var(--fs-13); font-weight: 500; transition: background-color 150ms ease, color 150ms ease; }

.rtab-link { display: block; flex: 1 1 auto; min-width: 0; padding: 0 10px; overflow: hidden; color: inherit; line-height: 32px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }

.rtab--report .rtab-link { padding-right: 2px; }

.rtab.is-active { background: var(--s3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

.rtab-close { display: grid; flex: none; place-items: center; width: 20px; min-width: 20px; height: 20px; min-height: 20px; margin: 0 6px 0 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }

.rtab-close { font-size: var(--fs-16); line-height: 1; }

.rtab-sep { flex: none; align-self: center; width: 1px; height: 16px; margin: 0 4px; background: var(--line-strong); }

@media (hover: hover) and (pointer: fine) {
  .rtab:not(.is-active):hover { background: var(--s2); color: var(--ink); }

  .rtab-close:hover { background: var(--s4); color: var(--ink-hi); }
}

@media (max-width: 767px) {
  .rtabs { display: none; }
}

/* ---------- the splits of a report: first grouping as a row of buttons (a.split / summary.split; the bare .split is the page layout above) ---------- */

.splits { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 0 0 6px; }

a.split,
summary.split { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }

a.split svg,
summary.split svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.split.is-on { background: var(--accent-soft); border-color: rgba(244, 107, 94, 0.35); color: var(--accent-text); }

.split-menu > :not(summary) { right: auto; left: 0; }

.split-menu .menu-item.is-on { color: var(--accent-text); }

@media (hover: hover) and (pointer: fine) {
  .work .split:not(.is-on):hover { background: var(--s3); color: var(--ink-hi); }
}

.split-menu[open] > summary.split:not(.is-on) { background: var(--s3); color: var(--ink-hi); }

@media (max-width: 767px) {
  .splits { flex-wrap: nowrap; margin: 0 -16px 6px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }

  .splits::-webkit-scrollbar { display: none; }
}

/* a phone: the pinned name column leaves room, so the first metric peeks in at the right and shows that the table scrolls */
@media (max-width: 767px) {
  .table--tree col.c-key--first { width: 230px; }
}

/* ---------- several records: chips of a filter, the cost of several campaigns ---------- */

/* the caption of a filter whose field is replaced by chips (same look as a field label) */
.field-caption { display: block; margin: 0 0 4px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.field-picked { margin: 0; min-height: var(--ctl-h); display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: var(--fs-13); }

.field-picked a { color: var(--accent-text); }

/* the caption of the strip of applied filters comes from the page (it is translated), not from the style sheet */
.crumbs-filters[data-caption]::before { content: attr(data-caption); }

.picked { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 100%; max-height: 84px; overflow-y: auto; }

.picked-label { color: var(--muted); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; }

.crumbs-filters .picked-chip { max-width: 260px; }

.picked-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picked-x { flex: none; }

.picked-reset { margin: 0; }

.picked-anchor { display: inline-flex; max-width: 100%; scroll-margin-top: 72px; }

.field--picked { min-width: 0; max-width: 100%; }

.field--picked .picked-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; min-height: var(--row-btn); padding: 0 4px 0 10px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink-hi); font-size: var(--fs-12); text-decoration: none; }

.field--picked .picked-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--veil-chip); line-height: 1; }

.cost-rules { max-width: 70ch; margin: 0 0 var(--space-4); padding-left: 18px; color: var(--muted); font-size: var(--fs-13); }

.cost-rules li + li { margin-top: 2px; }

.cost-head .muted { margin-left: 6px; font-size: var(--fs-13); font-weight: 400; }

.cost-bulk .field-grid--3 { margin-bottom: var(--space-3); }

.table--cost .cost-field { width: 100%; max-width: 160px; text-align: right; font-variant-numeric: tabular-nums; }

.table--cost .cost-field::placeholder { color: var(--muted); opacity: 0.7; }

.table--cost td .error { margin: 2px 0 0; padding: 0; border: 0; background: none; font-size: var(--fs-12); text-align: right; }

.table--cost .cost-field[aria-invalid="true"],
.cost-bulk input[aria-invalid="true"] { border-color: var(--bad); }

.table--cost tr.is-skipped .cell-title { color: var(--ink-2); font-weight: 400; }

.table--cost .cost-skip { text-align: left; }

.cost-reason { color: var(--ink-2); font-size: var(--fs-12); overflow-wrap: anywhere; }

@media (min-width: 768px) {
  .table--cost td.cost-result { white-space: normal; }
}

@media (max-width: 767px) {
  .table--cost .cost-field { max-width: none; text-align: left; }

  .table--cost td.num { text-align: left; }

  .table--cost td .error { text-align: left; }

  .picked { max-height: 120px; }
}

/* the table of the cost of several campaigns takes the width of a two-panel page; its confirmation is a form like the rest */
.cost-bulk { max-width: var(--w-page); }

/* in a journal's filter bar the caption above the chips already names the filter */
.field--picked .picked-label { display: none; }

/* ==========================================================================
   Roles and rights: the page of a user, the list of users, the team page, the team lead's summary
   ========================================================================== */

/* the three roles: filled accent (admin), outlined accent (team lead), neutral (buyer) */
.tag--role-admin { background: var(--accent-soft); color: var(--accent-text); }

.tag--role-teamlead { background: transparent; box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-text); }

.tag--role-buyer { background: var(--s3); color: var(--ink-2); font-weight: 500; }

.user-page { display: grid; gap: var(--gap-panel); max-width: var(--w-page); }

.user-page .panel { margin: 0; }

.user-block { display: grid; gap: 12px; scroll-margin-top: calc(var(--topbar-h) + 12px); }

.user-block .panel-head { margin: 0; }

.user-block .panel-head .muted { max-width: 62ch; }

.user-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }

.user-form { display: grid; gap: 12px; margin: 0; }

.user-form > div > button { margin: 0; }

.user-block .callout { margin: 0; }

/* the warning of a role change shows once another role is chosen */
.user-form:has(.role-opt--current input:checked) > .callout { display: none; }

.user-block .empty { margin: 0; }

/* role cards: a radio button each, the chosen one takes the accent */
.role-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.role-opt {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--s1);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.role-opt input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 13px;
  left: 14px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--edge-ctl);
  border-radius: 50%;
  background: var(--s1);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.role-opt input[type="radio"]:checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3.5px var(--s1); }

.role-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.role-opt:has(input:checked) input[type="radio"] { box-shadow: inset 0 0 0 3.5px var(--accent-soft); }

.role-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.role-opt:active { transform: scale(0.99); }

.role-opt-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink); font-size: var(--fs-14); font-weight: 600; }

.role-opt-text { color: var(--muted); font-size: var(--fs-12); }

.role-opt:has(input:checked) .role-opt-text { color: var(--ink-2); }

@media (hover: hover) and (pointer: fine) {
  .role-opt:hover { border-color: var(--edge-hover); }

  .role-opt:has(input:checked):hover { border-color: var(--accent); }
}

/* workspaces: a quick pick by people, then the ticks */
.quick-pick { display: grid; gap: 8px; max-width: 520px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); }

.quick-pick-title { margin: 0; color: var(--ink); font-size: var(--fs-13); font-weight: 600; }

.quick-pick .hint { margin: 0; }

.quick-pick-search { max-width: none; }

.quick-pick-list { display: grid; gap: 0; max-height: 176px; margin: 0; padding: 0; overflow-y: auto; list-style: none; border-block: 1px solid var(--line); overscroll-behavior: contain; }

.quick-pick-list li { min-width: 0; }

.quick-pick-list li + li { border-top: 1px solid var(--line-faint); }

.quick-pick-list .check-row { min-height: 36px; padding: 0 2px; }

.pick-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-pick > div > button { margin: 0; }

.quick-pick .callout { margin: 0; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px 10px; margin: 0; padding: 0; list-style: none; }

.pick {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--s1);
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.pick:active { transform: scale(0.98); }

.pick.is-off { border-style: dashed; color: var(--muted); cursor: not-allowed; }

.pick-name { min-width: 0; overflow-wrap: anywhere; }

@media (hover: hover) and (pointer: fine) {
  .pick:not(.is-off):hover { border-color: var(--edge-hover); }

  .pick:has(input:checked):hover { border-color: var(--accent); }
}

/* rights: a card per group, a row per right with what it opens */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }

.perm-group { min-width: 0; padding: 12px 14px 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s1); }

.perm-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 4px; color: var(--ink); font-size: var(--fs-14); font-weight: 600; }

.perm-group-n { color: var(--muted); font-size: var(--fs-12); font-weight: 500; font-variant-numeric: tabular-nums; }

.perm {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 10px;
  margin: 0 -14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line-faint);
  box-shadow: inset 3px 0 0 transparent;
  cursor: pointer;
  transition: background-color 600ms ease, box-shadow 150ms ease;
}

.perm input[type="checkbox"] { margin-top: 1px; }

.perm-text { display: grid; gap: 1px; min-width: 0; }

.perm-name { color: var(--ink); font-size: var(--fs-13); font-weight: 500; }

.perm-hint { color: var(--muted); font-size: var(--fs-12); }

.perm-needs { color: var(--ink-3); font-size: var(--fs-12); }

/* "will also switch on": only while the right is off */
.perm:has(input:checked) .perm-needs { display: none; }

.perm-mark { padding-top: 1px; color: var(--muted); font-size: var(--fs-12); text-align: right; white-space: nowrap; }

.perm-mark { display: grid; justify-items: end; gap: 2px; }

.perm-delta { color: var(--muted); font-size: var(--fs-12); }

.perm.is-grant .perm-delta { color: var(--ok-text); }

.perm.is-revoke .perm-delta { color: var(--warn-text); }

.team-members .team-members-head { min-height: 24px; color: var(--muted); font-size: var(--fs-12); }

.perm.is-grant { box-shadow: inset 3px 0 0 var(--ok); }

.perm.is-revoke { box-shadow: inset 3px 0 0 var(--warn); }

.perm.is-auto { background: var(--accent-soft); transition-duration: 0ms; }

@media (hover: hover) and (pointer: fine) {
  .perm:hover { background: var(--veil-row); }
}

.perm-locked { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--muted); font-size: var(--fs-12); }

.perm-locked svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* the save bar stays at the bottom of the screen while the long list is read */
.perm-bar { position: sticky; bottom: 0; z-index: 5; margin: 0 -18px -14px; padding: 10px 18px; border-radius: 0 0 var(--r-lg) var(--r-lg); background: var(--s2); }

.perm-live { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: var(--fs-12); }

.perm-live:empty { display: none; }

/* the users list: a row opens the user; the create form takes the cards */
.table tr[data-href] { cursor: pointer; }

.field-caption + .role-pick { margin-top: 4px; }

/* the team page: a card per workspace, the people in it */
.team-note { margin: 0 0 var(--gap-panel); }

.team-members { display: grid; margin: 0; padding: 0; list-style: none; }

.team-members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; border-top: 1px solid var(--line-faint); font-size: var(--fs-13); }

.team-members li:first-child { border-top: 0; }

.team-email { min-width: 0; overflow-wrap: anywhere; }

.team-list .space .more-link-row { margin: 0; font-size: var(--fs-13); }

.team-list .section-title { margin: 0; overflow-wrap: anywhere; }

/* the team lead's summary of workspaces: the look of the campaign table next to it */
.team-summary { margin: 0 0 12px; }

.team-summary-title { margin: 2px 10px 6px; }

.team-summary .table-wrap { max-height: 300px; margin-bottom: 4px; border: 0; border-radius: var(--r-md); }

.team-summary .more-link-row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0 10px; font-size: var(--fs-13); }

@media (max-width: 767px) {
  .role-pick { grid-template-columns: minmax(0, 1fr); }

  .perm-grid { grid-template-columns: minmax(0, 1fr); }

  .perm { grid-template-columns: 18px minmax(0, 1fr); padding-block: 10px; }

  .perm-mark { grid-column: 2; justify-items: start; padding-top: 0; text-align: left; }

  .perm-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); margin: 0 -12px -10px; padding-inline: 12px; border-radius: 0; box-shadow: 0 -1px 0 var(--line); }

  .perm-bar { flex-direction: row; align-items: center; gap: 6px 8px; }

  .perm-bar button { flex: 1 1 0; width: auto; min-height: 44px; }

  .perm-live { order: -1; flex-basis: 100%; }

  .user-block .panel-head .actions { width: 100%; }

  .user-form > div > button,
  .quick-pick > div > button { width: 100%; min-height: 44px; }

  .quick-pick { max-width: none; }

  .pick { min-height: 44px; }

  .quick-pick-list .check-row { min-height: 44px; }

  .team-members li { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .role-opt,
  .pick { transition: border-color 150ms ease, background-color 150ms ease; }

  .role-opt:active,
  .pick:active { transform: none; }
}

/* "keep the workspaces" makes no sense for a new administrator: they have all of them */
.keep-spaces { width: fit-content; }

.user-form:has(#role-admin:checked) .keep-spaces { display: none; }

.user-form:has(.role-opt--current input:checked) > .keep-spaces { display: none; }

/* ---------- API: documentation and the admin's list of keys ---------- */

.tool-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 var(--space-3); font-size: var(--fs-13); }

.tool-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); text-decoration: none; }

.tool-links a:hover { text-decoration: underline; }

.tool-links svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.docs { display: grid; gap: var(--gap-panel); max-width: 880px; }

.docs .panel { margin: 0; }

.docs h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 6px; }

.docs p { margin: 6px 0; }

.docs .table-wrap { margin: 8px 0; }

.docs .table td.mono { white-space: nowrap; vertical-align: top; }

.doc-list { display: grid; gap: 6px; margin: 6px 0 0; padding-left: 18px; }

.copy-box--code { align-items: stretch; }

.link-box--code { white-space: pre-wrap; padding: 10px 12px; overflow-x: auto; }

.link-box--code code { font: inherit; }

.reauth .section-title { display: flex; align-items: center; gap: 8px; }

.reauth .section-title svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Domains of a campaign: the first chosen item is the primary domain; the other links fold under the main one. */
body .ts-wrapper.multi .ts-control > .item.is-primary::before {
  content: attr(data-primary);
  margin-right: 6px; padding: 0 6px; border-radius: 6px;
  background: rgba(244, 107, 94, 0.3); color: var(--ink-hi); font-size: var(--fs-12, 11px);
}
body .ts-wrapper.multi .ts-control > .item[draggable="true"] { cursor: grab; }
.campaign-links { margin: 4px 0 0; }
.campaign-links > summary { cursor: pointer; color: var(--muted, inherit); font-size: var(--fs-13); }
.vt-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.vt-bar form, .vt-bar p { margin: 0; }
.domain-vt p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--fs-14); }
.vt-detail { margin: 4px 0 0; font-size: var(--fs-13); }
.vt-detail > summary { cursor: pointer; }
.vt-vendors { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }


/* ---------- smart rotation ---------- */

/* the block in the settings of the campaign: the switch, the shared numbers, then the state and the journal */
.rot-fold .check-row--help { margin: 0 0 var(--space-4); }

.rot-fold .field-grid--rows .field select { max-width: 200px; }

.rot-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }

.rot-foot .rot-state { flex: 1 1 200px; margin: 0; font-size: var(--fs-13); }

.rot-foot form { margin: 0; }

/* a default stream row while the automatic weights decide: "авто 25%" over the manual share it replaces */
.rot-share { display: grid; gap: 1px; min-width: 0; line-height: 12px; white-space: nowrap; }

.rot-share b { color: var(--ink); font-size: var(--fs-12); font-weight: 600; font-variant-numeric: tabular-nums; }

.rot-share small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* small marks at the end of a stream row */
.stream-marks { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }

.rot-tag { padding: 0 6px; font-size: var(--fs-12); line-height: 18px; white-space: nowrap; }

.rot-tag--wait { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

.rot-best { display: inline-block; flex: none; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--ok-ink); vertical-align: 1px; }

/* the switch of a list of a stream, with its state beside it */
.rot-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 28px; }

.rot-line .check-row { min-height: 0; flex: none; font-size: var(--fs-13); font-weight: 500; }

/* rows of a list with smart rotation: the automatic percent and the lock ("не оптимизировать") get their columns */
.pair-auto,
.pair-skip { display: none; }

.pairs--rot .pair-row,
.pairs--rot .pair-head { grid-template-columns: minmax(0, 1fr) 20px 56px 32px 44px 26px 24px; }

.pairs--rot .pair-head > :nth-child(4) { grid-column: 5; text-align: right; }

.pairs--rot .pair-auto { display: block; grid-column: 5; color: var(--ink); font-size: var(--fs-12); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }

.pairs--rot .pair-skip { display: inline-flex; grid-column: 6; width: 26px; height: 28px; min-height: 0; padding: 0; align-items: center; justify-content: center; }

.pairs--rot .pair-row .row-remove { grid-column: 7; }

.pair-skip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pair-skip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }

.pair-row.is-skip .pair-auto { visibility: hidden; }

.pair-auto-word { display: none; color: var(--muted); font-weight: 450; }

/* the journal */
.rot-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

.rot-head p { margin: 0; }

.rot-head-text { display: grid; gap: 2px; min-width: 0; }

.rot-head form { margin: 0; }

.rot-log { display: grid; gap: var(--space-4); }

.rot-entry { overflow: clip; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); }

.rot-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 14px; }

.rot-entry-time { color: var(--muted); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

.rot-entry-what { min-width: 0; overflow-wrap: anywhere; }

.rot-entry-what h3 { margin: 0; font-size: var(--fs-14); font-weight: 600; }

.rot-entry-what .muted { font-weight: 450; }

.rot-entry-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }

.rot-winner { margin: 0; padding: 0 14px 10px; color: var(--ink-2); font-size: var(--fs-13); }

.rot-entry .table-wrap { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }

.rot-table td,
.rot-table th { font-variant-numeric: tabular-nums; }

.rot-table thead th:not(.cell-title),
.rot-table .cell-metric { text-align: right; white-space: nowrap; }

/* every entry is its own table: fixed columns keep the numbers of one entry under those of the next */
@media (min-width: 768px) {
  .rot-table { table-layout: fixed; width: 100%; }

  .rot-table thead th:not(.cell-title) { width: 92px; }
}

.rot-from { color: var(--muted); }

.rot-to { color: var(--ink); font-weight: 600; }

.rot-table tr.is-winner td { background: rgba(60, 193, 101, 0.08); }

.rot-table tr.is-winner .cell-title { box-shadow: inset 2px 0 0 var(--ok-ink); }

@media (max-width: 767px) {
  /* the entry is no card of its own: its variants are the cards */
  .rot-entry { overflow: visible; background: none; border: 0; border-radius: 0; }

  .rot-entry-head,
  .rot-winner { padding-right: 2px; padding-left: 2px; }

  .rot-entry .table-wrap { border-top: 0; }

  .rot-table .cell-title { grid-column: 1 / -1; }

  .rot-table tr.is-winner { border-color: rgba(60, 193, 101, 0.45); background: rgba(60, 193, 101, 0.08); }

  .rot-table tr.is-winner td { background: transparent; }

  .rot-table tr.is-winner .cell-title { box-shadow: none; }

  .rot-entry-tags { flex: 1 1 100%; margin-left: 0; }

  .rot-foot > * { flex: 1 1 140px; }

  .rot-foot .rot-state { flex-basis: 100%; }

  .rot-foot .button,
  .rot-foot button { width: 100%; }

  .rot-head form,
  .rot-head button { width: 100%; }

  .stream-marks { flex: 1 1 100%; justify-content: flex-start; }

  /* a phone list keeps its three columns; the automatic percent and the lock take the second line under the select */
  .pairs--rot .pair-row,
  .pairs--rot .pair-head { grid-template-columns: minmax(0, 1fr) 64px 34px 40px; }

  .pairs--rot .pair-head > :nth-child(4) { display: none; }

  .pairs--rot .pair-auto { grid-column: 2 / 4; grid-row: 2; }

  .pairs--rot .pair-skip { grid-column: 4; grid-row: 2; width: 40px; height: 32px; }

  .pairs--rot .pair-row .row-remove { grid-column: 4; }

  .pair-auto-word { display: inline; }

  .rot-table .cell-metric { text-align: left; }
}

/* ==========================================================================
   Passkeys: the button on the sign-in page, the page of the user's keys
   ========================================================================== */

.login-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; color: var(--muted); font-size: var(--fs-12); }

.login-or::before,
.login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.passkey-login .hint { margin-top: 10px; text-align: center; }

.login .passkey-login button { margin-top: 16px; }

[data-passkey-error] {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(232, 67, 79, 0.45);
  border-radius: var(--r-sm);
  background: rgba(232, 67, 79, 0.1);
  color: var(--bad-ink);
  font-size: var(--fs-14);
}

[data-passkey-error][data-tone="calm"] { border-color: var(--line); background: var(--s2); color: var(--ink-2); }

[data-passkey-login-button][aria-busy="true"],
[data-passkey-add][aria-busy="true"] { opacity: 0.65; cursor: progress; }

.passkey-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }

.passkey { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--s2); }

.passkey-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); }

.passkey-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.passkey-main { flex: 1; min-width: 0; }

.passkey-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.passkey-meta { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-12); }

.passkey form { margin: 0; }

.passkey-list + .empty,
.panel > .empty { margin-top: 14px; }

@media (max-width: 560px) {
  .passkey { flex-wrap: wrap; }
  .passkey-main { flex: 1 1 calc(100% - 60px); }
  .passkey form { margin-left: 48px; }
}

/* ---------- campaign check: a quiet line when all is well, a fold with counters and one row per finding otherwise ---------- */
.campaign-check { margin: 0 0 var(--space-4); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--s2); font-size: var(--fs-13); }

.campaign-check--ok { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 4px; border-color: transparent; background: none; color: var(--muted); }

.campaign-check--ok svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ok-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.campaign-check--error { border-color: rgba(232, 67, 79, 0.45); }

.campaign-check--warning { border-color: rgba(240, 180, 41, 0.4); }

.campaign-check > summary { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 44px; padding: 6px 14px; list-style: none; cursor: pointer; }

.campaign-check > summary::-webkit-details-marker,
.campaign-check-info > summary::-webkit-details-marker { display: none; }

.campaign-check svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.campaign-check > summary > svg,
.campaign-check-info > summary > svg { transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }

.campaign-check[open] > summary > svg,
.campaign-check-info[open] > summary > svg { transform: none; }

.campaign-check-title { font-size: var(--fs-14); font-weight: 600; }

.campaign-check-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; }

.campaign-check-count { display: inline-flex; align-items: center; gap: 4px; }

.campaign-check-count b { font-weight: 700; font-variant-numeric: tabular-nums; }

.campaign-check-count--error,
.campaign-check-mark--error { color: var(--bad-ink); }

.campaign-check-count--warning,
.campaign-check-mark--warning { color: var(--warn-ink); }

.campaign-check-count--info,
.campaign-check-mark--info { color: var(--muted); }

.campaign-check-body { display: grid; gap: 6px; padding: 0 10px 10px; }

.campaign-check-list { gap: 4px; }

.campaign-check-list .issue { display: flex; flex-direction: row; justify-content: flex-start; align-items: flex-start; gap: 8px; padding: 6px 10px 6px 12px; }

.campaign-check-mark { display: flex; height: 20px; align-items: center; }

.campaign-check-text { flex: 1 1 0; min-width: 0; color: var(--ink-2); line-height: 20px; overflow-wrap: anywhere; }

.campaign-check-go { flex: none; display: inline-flex; align-items: center; min-height: 28px; margin: -4px 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--ink-hi); font-weight: 500; text-decoration: none; transition: background-color 150ms var(--ease-out), transform 160ms var(--ease-out); }

.campaign-check-go:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .campaign-check-go:hover { background: var(--veil-row); }
}

.campaign-check-info { margin: 0; padding: 0; border: 0; }

.campaign-check-info > summary { margin: 0; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 2px; color: var(--ink-2); font-weight: 600; list-style: none; cursor: pointer; }

.campaign-check-info > summary b { color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 767px), (pointer: coarse) {
  .campaign-check-go { min-height: 36px; margin: -8px 0; }
}

@media (max-width: 480px) {
  .campaign-check-list .issue { flex-wrap: wrap; }
  .campaign-check-text { flex-basis: calc(100% - 32px); }
  .campaign-check-go { min-height: 32px; margin: -4px 0 -2px 28px; padding: 0; border: 0; color: var(--accent-text); }
}

/* Personal Telegram: the profile section, the settings line, the user page line */
.tg-panel { grid-column: 1 / -1; max-width: var(--w-form); scroll-margin-top: calc(var(--topbar-h) + 12px); }

.tg-panel .settings-head { margin-bottom: 12px; }

.tg-who { margin: 0; color: var(--ink-2); font-size: var(--fs-14); }

.tg-who b { color: var(--ink-hi); font-weight: 600; }

.tg-reason { margin: 8px 0 0; color: var(--warn-ink); font-size: var(--fs-13); font-weight: 500; }

.tg-reason + .hint { margin-top: 4px; }

.tg-events-form { max-width: none; margin-top: 16px; padding: 0; border: 0; background: none; }

.tg-events-form fieldset { display: grid; gap: 0; }

.tg-events-form .actions button { margin: 0; }

.tg-actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

.tg-actions form { margin: 0; }

.tg-actions button { margin: 0; }

.tg-steps .button { margin: 0; }

.tg-steps .copy-box--inline .link-box { word-break: break-all; }

.tg-steps .tfa-title { margin-bottom: 8px; }

.tg-refresh { margin-top: 12px; }

.tg-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 16px 0 0; color: var(--ink-2); font-size: var(--fs-13); }

.tg-state > span { min-width: 0; }

.tg-state .tag { flex: 0 1 auto; white-space: normal; }

.tg-state .muted { font-size: var(--fs-12); }

@media (max-width: 480px) {
  .tg-actions > form, .tg-actions > form button { width: 100%; }
}

.tg-reason::first-letter { text-transform: uppercase; }

/* ==========================================================================
   Tasks: the board, the card, "my tasks" on the dashboard, the offer on a new campaign
   Dark dock, coral accent: columns are wells (the page colour), cards the raised surface. Motion: transform and opacity only.
   ========================================================================== */

/* shared bits: a due date (late = the error colour AND an icon), the assignee's initials, the small icons */
.task-due { display: inline-flex; align-items: center; gap: 3px; flex: none; color: var(--ink-3); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; }

.task-due.is-overdue { color: var(--bad-text); font-weight: 600; }

.task-due svg,
.task-bar .chip svg,
.task-moves svg,
.task-archived svg,
.hint--warn svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.task-avatar { display: grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--s4); color: var(--ink-2); font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: 0; }

.task-space,
.task-campaign { min-width: 0; overflow: hidden; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }

.task-campaign { text-decoration: none; }

/* the bar over the board: pill selects, the "overdue" chip, the archive on the right */
.task-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }

.task-bar .chips { margin: 0; }

.task-bar .chip svg { margin-right: 5px; }

.task-filter { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: var(--ctl-h); margin: 0; padding: 0 0 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; transition: border-color 150ms ease; }

.task-filter:focus-within { border-color: var(--accent); }

.task-filter > span { flex: none; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.task-filter select { width: auto; min-width: 0; max-width: 220px; min-height: calc(var(--ctl-h) - 2px); padding-left: 0; border: 0; border-radius: 999px; background-color: transparent; box-shadow: none; }

.task-filter select:focus-visible { box-shadow: none; }

.task-bar-end { margin-left: auto; }

.task-bar[data-live] .task-bar-apply { display: none; }

/* the board: four columns that share the row; when they would be narrower than 232px the board scrolls inside itself */
.task-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(232px, 1fr);
  gap: 10px;
  padding-bottom: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.task-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 160px;
  max-height: calc(100dvh - var(--topbar-h) - 128px);
  padding: 8px;
  border: 1px solid var(--line-faint);
  border-radius: var(--r-md);
  background: var(--paper);
  transition: border-color 150ms ease;
}

/* the column that now holds the dragged card */
.task-column:has(.is-ghost) { border-color: var(--accent); }

.task-column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; }

.task-column-head h2 { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: var(--fs-13); font-weight: 600; letter-spacing: 0; }

.task-column-head h2::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }

.task-column[data-status="doing"] h2::before { background: var(--accent); }

.task-column[data-status="review"] h2::before { background: var(--warn); }

.task-column[data-status="done"] h2::before { background: var(--ok); }

.task-count { flex: none; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--s3); color: var(--ink-3); font-size: var(--fs-12); font-weight: 600; line-height: 20px; text-align: center; }

/* the list is the whole drop zone of the column; it scrolls by itself when the column is capped */
.task-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 56px;
  margin: -2px;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
}

.task-empty { display: grid; place-items: center; min-height: 56px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-12); }

.task-list:has(.task-card) > .task-empty { display: none; }

.task-more { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 8px 4px 0; color: var(--muted); font-size: var(--fs-12); }

.task-more span { min-width: 0; }

.task-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--s2);
  -webkit-touch-callout: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.task-card:focus { outline: none; }

/* the card that a move by a button returned to (the address names it) */
.task-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.25); }

.task-card .task-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  padding-right: 22px;
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 18px;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.task-meta { display: flex; align-items: center; gap: 6px 8px; min-width: 0; min-height: 20px; }

.task-meta .task-campaign { flex: 1 1 0; }

.task-meta .task-avatar { margin-left: auto; }

.task-card.is-ghost { border-style: dashed; border-color: var(--accent); opacity: 0.45; }

.task-card.is-chosen { box-shadow: var(--pop-shadow); }

.task-card.is-drag { opacity: 0.95; box-shadow: var(--pop-shadow); }

/* "move to": a quiet arrow in the corner opens the buttons inside the card (no popup to clip) */
details.task-moves { margin: 0; padding: 0; border: 0; }

.task-moves > summary { list-style: none; }

.task-moves > summary::-webkit-details-marker { display: none; }

.task-moves-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease;
}

.task-moves-toggle svg { width: 14px; height: 14px; stroke-width: 1.8; }

.task-moves[open] > .task-moves-toggle { background: var(--s4); color: var(--ink-hi); }

.task-move { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }

.task-move button { flex: 1 1 auto; justify-content: flex-start; gap: 4px; padding: 0 8px; }

.task-move button svg { width: 12px; height: 12px; }

.task-column[data-status="todo"] [data-to="todo"],
.task-column[data-status="doing"] [data-to="doing"],
.task-column[data-status="review"] [data-to="review"],
.task-column[data-status="done"] [data-to="done"] { display: none; }

@media (hover: hover) and (pointer: fine) {
  .task-card { cursor: grab; }

  .task-card:hover { border-color: var(--edge-hover); }

  .task-card:active { cursor: grabbing; }

  .task-card .task-title:hover { text-decoration: underline; text-underline-offset: 0.18em; }

  .task-moves-toggle { opacity: 0; cursor: pointer; }

  .task-card:hover .task-moves-toggle,
  .task-card:focus-within .task-moves-toggle,
  .task-moves[open] > .task-moves-toggle { opacity: 1; }

  .task-moves-toggle:hover { background: var(--s4); color: var(--ink-hi); }
}

.task-moves-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(244, 107, 94, 0.35); }

/* the archive: a view of its own, cards in a grid, each with its way back */
.task-archive .task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 0; padding: 0; overflow: visible; }

.task-archive .section-title { margin: 0 0 8px; }

.task-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }

.task-card-foot form { margin: 0; }

.task-pages { display: flex; gap: 8px; margin: 12px 0 0; }

/* the card of a task */
.task-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; max-width: 1100px; }

.task-main { display: grid; gap: var(--gap-panel); min-width: 0; }

.task-main > * { margin: 0; }

.task-page .panel { margin-bottom: 0; }

.task-heading { margin: 0; font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.015em; line-height: 1.35; overflow-wrap: anywhere; }

.task-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

.task-status button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink-hi); }

.task-description { max-width: 72ch; margin: 14px 0 0; color: var(--ink-2); font-size: var(--fs-14); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }

.task-fields { margin: 14px 0 0; }

.task-fields > div { display: grid; grid-template-columns: minmax(90px, 200px) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: var(--fs-13); }

.task-fields dt { color: var(--muted); font-size: var(--fs-12); font-weight: 500; line-height: 20px; overflow-wrap: anywhere; }

.task-fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

.task-props { margin: 0; }

.task-props > div { padding: 8px 0; border-top: 1px solid var(--line); }

.task-props > div:first-child { padding-top: 0; border-top: 0; }

.task-props dt { margin: 0 0 2px; color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.task-props dd { margin: 0; font-size: var(--fs-13); overflow-wrap: anywhere; }

.task-props .task-due { font-size: var(--fs-13); }

.task-late { color: var(--bad-text); font-size: var(--fs-12); font-weight: 600; }

.task-props .notice--warn { display: flex; margin: 6px 0 0; padding: 6px 10px; font-size: var(--fs-12); }

.task-archive-form { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

.task-archived { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 14px; border: 1px solid rgba(240, 180, 41, 0.4); border-radius: var(--r-md); background: rgba(240, 180, 41, 0.1); color: var(--warn-ink); font-size: var(--fs-13); }

.task-archived p { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }

.task-archived svg { width: 16px; height: 16px; }

.task-archived form { margin: 0; }

.hint--warn { display: flex; align-items: flex-start; gap: 6px; color: var(--warn-ink); }

.hint--warn svg { margin-top: 3px; }

/* the form (a new task, or the fold "Править") */
.task-new { max-width: var(--w-form); }

.task-form .form-bar { margin-top: 14px; }

.task-pairs { grid-column: 1 / -1; }

.task-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 6px; margin: 0 0 6px; }

.task-pair .icon-btn { align-self: center; margin: 0; }

.task-pairs > button { margin-top: 2px; }

/* "my tasks" on the dashboard: one panel of compact rows, or one quiet line */
.my-tasks { padding: 10px 16px 6px; }

.my-tasks-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 4px; }

.my-tasks-head h2 { margin: 0; }

.my-tasks-head a { font-size: var(--fs-12); font-weight: 500; text-decoration: none; }

.my-tasks-list { display: grid; margin: 0; padding: 0; list-style: none; }

.my-tasks-list li {
  display: grid;
  grid-template-areas: "t s g d";
  grid-template-columns: minmax(0, 1fr) minmax(0, 160px) auto 56px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border-top: 1px solid var(--line);
}

.my-tasks-list li:first-child { border-top: 0; }

a.my-task-title { grid-area: t; overflow: hidden; color: var(--ink); font-size: var(--fs-13); font-weight: 500; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }

.my-tasks-list .task-space { grid-area: s; }

.my-tasks-list .tag { grid-area: g; justify-self: start; }

.my-tasks-list .task-due { grid-area: d; justify-self: end; }

.my-tasks .more-link-row { margin: 0; padding: 6px 0; border-top: 1px solid var(--line); font-size: var(--fs-13); }

.my-tasks-empty { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--fs-13); }

.my-tasks-empty span { margin-right: 6px; color: var(--ink-2); font-weight: 600; }

.my-tasks-empty a { margin-left: 6px; font-weight: 500; text-decoration: none; }

/* the offer after a campaign was created: a task for it, one click */
.task-offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 var(--space-3);
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--s2);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.task-offer-lead { color: var(--muted); font-size: var(--fs-12); font-weight: 500; }

.task-offer .button { margin: 0; }

/* tablet and up to 1100: the board keeps its row and scrolls inside itself; the card goes to one column */
@media (min-width: 1100px) {
  .task-page { grid-template-columns: minmax(0, 1fr) 300px; }

  .task-side { position: sticky; top: calc(var(--topbar-h) + 12px); }
}

@media (max-width: 767px) {
  /* phone: columns are swiped (a snap per column, the next one peeks out), the page scrolls down as a whole */
  .task-board { grid-auto-columns: 84%; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; scroll-snap-type: x mandatory; }

  .task-column { max-height: none; scroll-snap-align: start; }

  .task-list { overflow: visible; }

  .task-filter { flex: 1 1 140px; padding-left: 14px; }

  /* the caption stays for a screen reader; the select's own first line says what it filters */
  .task-filter > span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .task-filter select { flex: 1 1 auto; max-width: none; }

  .my-tasks-list li { grid-template-areas: "t d" "s g"; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 6px 0; }

  .my-tasks-list .tag { justify-self: end; }
}

@media (max-width: 640px) {
  .task-form .field-grid { grid-template-columns: minmax(0, 1fr); }

  .task-form .field-grid > * { grid-column: 1 / -1; }

  .task-fields > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

@media (max-width: 520px) {
  .task-pair { grid-template-columns: minmax(0, 1fr) auto; }

  .task-pair .icon-btn { grid-column: 2; grid-row: 1 / span 2; }
}

/* touch: bigger targets for the corner arrow and the move buttons; a card is picked up by a hold, so it must not select text */
@media (pointer: coarse) {
  .task-moves-toggle { top: 2px; right: 2px; width: 36px; height: 36px; }

  .task-moves-toggle svg { width: 16px; height: 16px; }

  .task-card .task-title { padding-right: 34px; }

  .task-move button,
  .task-status button { min-height: 36px; }

  .task-card.is-chosen,
  .task-card.is-drag { -webkit-user-select: none; user-select: none; }
}
