/* ============================================================
   Know First — design tokens (from dataviz skill reference palette)
   ============================================================ */
:root {
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --surface-raised: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: #c3c2b7;

  --accent: #2a78d6;         /* categorical slot 1 / sequential hue */
  --accent-100: #cde2fb;
  --accent-250: #86b6ef;
  --accent-450: #2a78d6;
  --accent-600: #184f95;

  --good: #0ca30c;
  --good-bg: #e7f6e7;
  --warning: #fab219;
  --warning-bg: #fff6e2;
  --critical: #d03b3b;
  --critical-bg: #fbe9e9;

  /* Six-block accordion — one categorical hue per verification direction
     (2026-08-06, user request: the six blocks blended together with no way
     to tell them apart). Deliberately distinct from --good/--warning/
     --critical above — those are STATUS colors used elsewhere on this same
     page (confirmed/missing evidence rows); these are pure category labels,
     never meant to read as "this direction is good/bad". */
  --block-attribution: #2a78d6;
  --block-attribution-bg: #eaf2fc;
  --block-provenance: #7a5cc4;
  --block-provenance-bg: #f1ecfa;
  --block-condition: #1f9e8a;
  --block-condition-bg: #e6f5f3;
  --block-legal-risk: #c9701a;
  --block-legal-risk-bg: #fbeee0;
  --block-art-historical: #b3477e;
  --block-art-historical-bg: #fbeaf2;
  --block-market: #3f9142;
  --block-market-bg: #eaf5ea;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(11,11,11,0.04), 0 4px 16px rgba(11,11,11,0.05);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --surface-raised: #222221;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --border: rgba(255,255,255,0.10);
    --border-strong: #383835;

    --accent: #3987e5;
    --accent-100: #184f95;
    --accent-250: #256abf;
    --accent-450: #3987e5;
    --accent-600: #86b6ef;

    --good: #0ca30c;
    --good-bg: rgba(12,163,12,0.14);
    --warning: #fab219;
    --warning-bg: rgba(250,178,25,0.14);
    --critical: #e66767;
    --critical-bg: rgba(224,90,90,0.14);

    --block-attribution: #5a9ee8;
    --block-attribution-bg: rgba(90,158,232,0.14);
    --block-provenance: #a68ce0;
    --block-provenance-bg: rgba(166,140,224,0.14);
    --block-condition: #3fc7b0;
    --block-condition-bg: rgba(63,199,176,0.14);
    --block-legal-risk: #e0954f;
    --block-legal-risk-bg: rgba(224,149,79,0.14);
    --block-art-historical: #e07db3;
    --block-art-historical-bg: rgba(224,125,179,0.14);
    --block-market: #6cbf70;
    --block-market-bg: rgba(108,191,112,0.14);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* ---------------- Layout shell ---------------- */
.shell {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 80px;
  flex: 1;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 22px 20px;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  max-width: 780px;
  margin: 40px auto 0;
  padding: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--text-primary); }

.about-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px;
}
.about-page h1 { font-size: 24px; margin-bottom: 20px; }
.about-page h2 { font-size: 17px; margin: 28px 0 12px; }
.about-page p { margin-bottom: 14px; line-height: 1.6; color: var(--text-secondary); }
.about-requisites {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.8;
}
.about-back { display: inline-block; margin-top: 24px; font-size: 14px; }

/* nav-links + account-area share this so they stay pinned to the
   top-right corner as a unit, even when they wrap onto their own row on a
   narrow viewport — see app.js's headerRight comment. */
.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* PRODUCT_PLATFORM_ROADMAP.md, Этап 2 — account area (avatar + name) */
#nav-account {
  align-items: center;
  position: relative; /* anchors .account-menu below the trigger */
}
#nav-account .hc-date {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Account menu — avatar+name trigger opens a dropdown (язык, план,
   выйти), same pattern as Claude's own account menu. */
.account-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  padding-left: 6px;
}
.account-menu-trigger > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
}
.account-menu-caret {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.account-menu {
  /* position/top/left are set inline in app.js from the trigger's actual
     viewport rect, clamped to stay on-screen — see openAccountMenu. */
  min-width: 240px;
  max-width: calc(100vw - 16px);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 150;
}
.account-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--gridline);
  margin-bottom: 4px;
}
.account-menu-header .account-avatar {
  width: 34px;
  height: 34px;
  font-size: 13.5px;
}
.account-menu-header > div {
  min-width: 0;
}
.account-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-email {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  text-align: left;
}
.account-menu-action:hover { background: var(--border); }
/* Notification-category checklist inside the card menu (2026-07-29) — a
   lighter-weight label than the page-level .section-title, which is sized
   for full page sections, not a 240px dropdown. */
.account-menu-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 10px 2px;
}
.account-menu-item--disabled { color: var(--text-muted); cursor: default; opacity: 0.75; }
.account-menu-select {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
}
.account-menu-divider {
  height: 1px;
  background: var(--gridline);
  margin: 4px 2px;
}
.account-menu-action--danger { color: var(--critical); }

/* iOS-style toggle switch (2026-07-24) — purely visual, the enclosing
   .account-menu-item button already owns the click handler, so this has
   no interactive role of its own. */
.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s ease;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.25);
  transition: left 0.15s ease;
}
.toggle-switch--on {
  background: var(--good);
}
.toggle-switch--on::after {
  left: 20px;
}
.account-menu-action--danger:hover { background: var(--critical-bg); }

.hc-menu-trigger {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.hc-menu-trigger:hover { background: var(--border); color: var(--text-primary); }

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.brand-mark { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
}
.nav-link {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { background: var(--border); }
.nav-link.active { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-card); }

.header-lang-select {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.header-lang-select:hover { background: var(--border); }

/* ---------------- Entry view ---------------- */
.entry-hero {
  text-align: center;
  padding: 40px 0 28px;
}
.entry-hero h1 {
  font-size: 30px;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.entry-hero p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.5;
}
.entry-hero p + p { margin-top: 10px; }

.museums-marquee {
  text-align: center;
  padding: 40px 0 40px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  /* 2026-07-28, real user report (mobile) — .museums-marquee__track below
     is deliberately sized to its natural width (~3000px, two duplicated
     logo groups) so the translateX scroll animation has room to run; with
     no clipping here, that width blew out the WHOLE page's scrollWidth on
     any viewport narrower than ~3000px, squeezing every section above it
     into a fraction of the screen. This is the standard marquee pattern:
     clip to the container here, let the child animate past its own edge. */
  overflow: hidden;
}
.museums-marquee__label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 18px;
}
.museums-marquee__track {
  display: flex;
  width: max-content;
  animation: museums-marquee-scroll 34s linear infinite;
}
.museums-marquee__track:hover { animation-play-state: paused; }
.museums-marquee__group {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-right: 20px;
}
/* Logos are raster images baked for a light background (some — e.g. Art
   Institute of Chicago — are solid dark colour, not transparent), so a
   fixed light card behind every logo keeps them legible in dark mode too,
   instead of trying to filter/invert arbitrary source images. */
.museums-marquee__logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  width: 130px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px 14px;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}
.museums-marquee__logo-card:hover { opacity: 1; }
.museums-marquee__logo {
  height: 100%;
  width: 100%;
  object-fit: contain;
}
@keyframes museums-marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------------- Entry view: homepage sections (2026-07-28) ---------------- */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 28px;
}
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.step-eyebrow {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 8px 2px;
}

.how-it-works { margin: 40px 0; }
.how-it-works__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 560px) {
  .how-it-works__grid { grid-template-columns: 1fr; }
}
.how-it-works__step {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}
.how-it-works__step-num {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.how-it-works__step-icon { font-size: 22px; margin-bottom: 8px; }
.how-it-works__step-title { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.how-it-works__step-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.who-for { margin: 40px 0; }
.who-for__panel {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
}
.who-for__panel-title { font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.who-for__lede { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.who-for__body { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 18px; }
.who-for__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 10px;
}
.who-for__cap { margin-bottom: 14px; }
.who-for__cap:last-of-type { margin-bottom: 0; }
.who-for__cap-title { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.who-for__cap-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.who-for__result {
  margin: 18px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.who-for__result-body { font-size: 13.5px; font-weight: 600; margin: 0; }

.demo-report { margin: 40px 0; }
.demo-report__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-report__badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}
.demo-report__tabs { display: flex; gap: 8px; margin: 10px 0 14px; }
.demo-report__tabs .secondary-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.demo-report__confidence {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 10px 0 12px;
}
.demo-report__signal {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 12px 0;
}
.demo-report__signal p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.demo-report__sources {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}
.demo-report__expert-note {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  padding: 24px;
}

/* 2026-07-28 (user request — "Исследовать дальше" split into 4 per-
   category mini-cards) — .card itself has no margin, so consecutive cards
   pushed back-to-back with no .section-title between them would otherwise
   touch with no gap. */
.deep-research-categories {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* PRODUCT_PLATFORM_ROADMAP.md, Этап 2 — минимальная форма входа/регистрации */
.card input[type="text"],
.card input[type="email"],
.card input[type="password"],
.card textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.card input[type="text"]:focus,
.card input[type="email"]:focus,
.card input[type="password"]:focus,
.card textarea:focus {
  outline: none;
  border-color: var(--text-primary);
}
/* B2B_PLATFORM_ROADMAP.md, Этап 2 — <select> had no generic styling
   anywhere (only the header language switcher's own dedicated class) —
   the new org/role/case pickers in workspace.js needed one; scoped to
   .card like the input rule above rather than a bare `select` so it
   doesn't also restyle the header language switcher. */
.card select {
  padding: 9px 34px 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-raised);
  color: var(--text-primary);
  /* 2026-08-22, real user report — the "attach existing object" picker
     (workspace.js) is the first .card select whose <option> text is
     arbitrary length (an object title or AI conclusion sentence, not a
     short fixed label like the org/role/assignee pickers), so it stretched
     to its intrinsic content width and overflowed the card. */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* 2026-08-25, user report — the browser's own native dropdown arrow sat
     flush against the box's right border, reading as glued to the edge.
     Swapped for a custom chevron with an explicit gap from the edge —
     appearance:none is required to suppress the native one everywhere,
     otherwise Firefox/Chrome would draw both on top of each other. */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2352514e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 13px;
}

/* 2026-07-28 (user request) — Artist Reference Library gallery, grouped by
   artist via .tag-row pills (myCollection.js's own collection-pill pattern). */
.reference-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
/* 2026-08-11, user request — "кнопка удалить должна быть на одном уровне
   во всех карточках" (notes/document text of differing lengths was pushing
   the delete button to a different height per card). display:flex column
   + margin-top:auto on the button (see .reference-card__delete below)
   pins it to the card's bottom edge regardless of how much text is above it. */
.reference-card { padding: 10px; display: flex; flex-direction: column; }
/* 2026-08-12, user request — cropping applies to every card via this rule
   (not per-object data), so switching cover→contain here fixes it for
   already-uploaded works too, no backfill needed. background fills the
   letterboxed space around non-square photos inside the still-square box. */
.reference-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--page); border-radius: var(--radius-sm); display: block; }
/* 2026-08-12, user request — "не только кнопка удалить... но так же
   верхний блок текста, далее фото и документы" на одном уровне во всех
   карточках. min-height (matching line-clamp's own max line count ×
   line-height) reserves the SAME vertical space regardless of how much
   actual text a card has, so every card's photo/documents lines start at
   the same Y — the button's margin-top:auto (below) then still pins it to
   the bottom on top of that. */
.reference-card__artist {
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 2026-08-12, user request — renamed from .reference-card__notes now that
   it shows the work's title (see referenceLibrary.js's renderGallery),
   not a notes/expertise excerpt — a title is typically 1-2 short lines,
   not 3, so the reserved height/line-clamp shrank to match. */
.reference-card__title {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 2026-08-12, user request — "когда нет текста после автора гораздо хуже
   смотрится... дальше может быть короткое описание как это раньше было
   реализовано". Brings back a short notes excerpt as a THIRD line below
   the title (not a replacement for it) — fills the empty gap on cards
   that predate the title field, and adds context on cards that have one. */
.reference-card__notes {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-top: 2px;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* An empty .hint-text (photo/document count line when a card has neither)
   forms no line box at all in some engines — collapses to just its
   margin, breaking the alignment min-height above was meant to guarantee.
   min-height pinned to the class's own line-height keeps it reserved. */
.reference-card .hint-text { min-height: 1.5em; }
.reference-card__delete { margin-top: auto; }

/* 2026-08-12, user request — "+Добавить ещё работу" replaces the separate
   bulk-upload section; extra work slots need a visual break from the base
   form and from each other, without the heavier nested-.card look. */
.reference-work-entry--extra {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 6px;
}

.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  margin-bottom: 18px;
}
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-100);
}
.upload-zone .upload-icon { font-size: 34px; margin-bottom: 8px; }
.upload-zone .upload-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 14px; }

.photo-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.photo-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--page);
  border: 1px solid var(--border);
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 2026-08-04 — honest fallback for photo formats the browser can't decode
   into an <img> preview (HEIC/HEIF from iPhone cameras, most commonly),
   swapped in on the img's own error event — see entry.js/batchEntry.js. */
.photo-slot__fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 6px;
  font-size: 22px; text-align: center;
}
.photo-slot__filename {
  font-size: 11px; color: var(--text-muted); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
/* 2026-08-04, user request — a green "uploaded" badge on the fallback
   above, opposite corner from .remove-btn, so a missing preview never
   reads as a failed upload. */
.photo-slot__uploaded-check {
  position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--good); color: white;
  font-size: 12px; line-height: 20px; text-align: center;
}
/* 2026-08-04, user request — covers the slot while the img decodes from
   its blob: URL, so the browser's own loading/broken glyph never flashes
   on screen; removed on the img's load or error event. */
.photo-slot__spinner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--page);
}
.photo-slot .remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(11,11,11,0.6); color: white; border: none;
  font-size: 12px; line-height: 20px; padding: 0;
}

.hint-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.5;
}

.metadata-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 14px 2px;
  font-weight: 500;
}
.metadata-toggle:hover { color: var(--text-primary); }

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 6px;
}
.metadata-grid label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.metadata-grid input, .metadata-grid textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}
.metadata-grid .full-span { grid-column: 1 / -1; }

.notes-textarea,
.card textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  margin-top: 18px;
  transition: opacity .15s ease, transform .05s ease;
}
.primary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.primary-button:not(:disabled):hover { opacity: 0.92; }
.primary-button:not(:disabled):active { transform: scale(0.99); }

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.secondary-button:hover { background: var(--border); }

.entry-mode-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 22px;
}
.demo-pill {
  display: inline-block;
  background: var(--warning-bg);
  color: #8a5a00;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) { .demo-pill { color: var(--warning); } }

/* ---------------- Progress view ---------------- */
.progress-view { padding-top: 50px; text-align: center; }
.progress-view h2 { font-size: 21px; margin-bottom: 4px; }
.progress-view .sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 30px; }

.progress-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 380px;
  text-align: left;
}
.progress-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  font-size: 15px;
  color: var(--text-muted);
  transition: color .2s ease;
}
.progress-list li.active { color: var(--text-primary); font-weight: 500; }
.progress-list li.done { color: var(--text-primary); }
.step-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: transparent;
}
.progress-list li.active .step-icon {
  border-color: var(--accent);
  background: conic-gradient(var(--accent) 0turn, var(--border) 0turn);
  animation: spin 1s linear infinite;
  border-top-color: transparent;
}
.progress-list li.done .step-icon {
  border-color: var(--good);
  background: var(--good);
  color: white;
}
@keyframes spin { to { transform: rotate(360deg); } }

.po-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.po-icon { font-size: 16px; }
.po-row.po-active { font-weight: 500; color: var(--text-primary); }
.po-row.po-done { color: var(--text-primary); }
.po-row.po-waiting { color: var(--text-muted); }

/* ---------------- Report view ---------------- */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 22px 0 20px;
  gap: 16px;
}
.status-banner.green { background: var(--good-bg); }
.status-banner.yellow { background: var(--warning-bg); }
.status-banner .status-text { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-banner.green .status-dot { background: var(--good); }
.status-banner.yellow .status-dot { background: var(--warning); }
.completion-mini { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.photo-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
}
.photo-gallery__thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.photo-gallery__thumb:hover { transform: scale(1.03); }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 28px 0 12px;
}

.main-conclusion-card {
  font-size: 19px;
  line-height: 1.5;
  font-weight: 500;
  padding: 22px 24px;
}

/* 2026-07-30 (product repositioning) — confirmed/missing evidence lists,
   report.js's confirmedEvidenceList/missingEvidenceList. */
.evidence-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.evidence-row:last-child { margin-bottom: 0; }
.evidence-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; }
.evidence-row--confirmed .evidence-icon { color: var(--good); }
.evidence-row--missing .evidence-icon { color: var(--warning); }
.evidence-label { font-weight: 500; font-size: 14.5px; }
.evidence-detail { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
/* 2026-08-04, Evidence Engine — per-item "≈+N%" contribution/gain badge,
   see evidenceContributionBadge() in report.js. */
.evidence-contribution { font-size: 12px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }

.prob-bar-row { margin-bottom: 12px; }
.prob-bar-row .prob-label-row {
  display: flex; justify-content: space-between;
  font-size: 13.5px; margin-bottom: 5px;
}
.prob-bar-row .prob-label { color: var(--text-primary); }
.prob-bar-row .prob-value { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.prob-track {
  height: 10px;
  border-radius: 999px;
  background: var(--accent-100);
  overflow: hidden;
}
.prob-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-450);
  transition: width .5s ease;
}
.prob-bar-row:first-child .prob-fill { background: var(--accent-600); }

/* 2026-07-26 (user request — "уберём часы, сделаем что-то более
   современное") — circular progress ring next to the completion
   percentage while an object is "researching" (report.js's
   progressRingIcon/updateProgressRing). The fill's stroke-dashoffset is
   set directly from JS on every percentage tick, so this genuinely tracks
   the same number the text shows, not a decorative loop. A slow pulse on
   the whole ring is the only pure-CSS animation — signals "still alive"
   between percentage ticks without implying a second, different number. */
.progress-ring {
  color: var(--accent-600, #3b6fe0);
  animation: progress-ring-pulse 2s ease-in-out infinite;
}
.progress-ring-fill {
  transition: stroke-dashoffset 1.8s linear;
}
@keyframes progress-ring-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.fact-chip {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
}
.fact-chip-wide { grid-column: 1 / -1; }
.fact-chip .fact-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.fact-chip .fact-value { font-size: 14.5px; font-weight: 500; }

.recommend-card {
  background: var(--warning-bg);
  border-radius: var(--radius-md);
  padding: 20px;
}
.recommend-card .recommend-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.recommend-card .recommend-reason { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 14px; line-height: 1.5; }
.recommend-card--info { background: var(--accent-100); }
.recommend-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.value-signal { margin-bottom: 14px; }
.value-signal:last-child { margin-bottom: 0; }
.value-signal-headline {
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.value-signal-explanation { color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }

.status-dot-inline {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.status-dot-inline.confirmed { background: var(--good); }
.status-dot-inline.needs-confirmation { background: var(--warning); }

.open-questions-list {
  margin: 10px 0 16px;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.open-questions-list li { margin-bottom: 4px; }

.explain-toggle {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 500;
}
.explain-panel {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* 2026-08-03 (six-block verification architecture) — Decision Readiness
   Score badge, report.js's decisionReadinessBlock. Deliberately built from
   the same tokens as everything around it (no new colors), since the
   number itself already carries enough weight without extra styling. */
.decision-score__value { font-size: 26px; font-weight: 700; }
.decision-score__label { font-size: 14px; color: var(--text-secondary); }

/* Progressive-disclosure block accordion, report.js's collapsibleBlock —
   same display:none<->block toggle mechanics as .explain-toggle/.explain-
   panel above, just as a full clickable header row (needs to show a status
   summary while collapsed, not only "show more" text).
   2026-08-06, user request — a colored left border + tinted chevron badge
   per block-card--<key> modifier (set by report.js from EVIDENCE_BLOCKS'
   own key, --block-* tokens above) so the six cards read as distinct
   sections instead of blending into one continuous list; the chevron now
   rotates 180° via .block-header--open instead of swapping ▾/▴ glyphs —
   a standard accordion affordance signaling "this expands on click". */
.block-card {
  padding: 0;
  overflow: hidden;
  border-left: 4px solid var(--block-accent, var(--border));
}
.block-card--attribution { --block-accent: var(--block-attribution); --block-accent-bg: var(--block-attribution-bg); }
.block-card--provenance { --block-accent: var(--block-provenance); --block-accent-bg: var(--block-provenance-bg); }
.block-card--condition { --block-accent: var(--block-condition); --block-accent-bg: var(--block-condition-bg); }
.block-card--legal_risk { --block-accent: var(--block-legal-risk); --block-accent-bg: var(--block-legal-risk-bg); }
.block-card--art_historical_significance { --block-accent: var(--block-art-historical); --block-accent-bg: var(--block-art-historical-bg); }
.block-card--market { --block-accent: var(--block-market); --block-accent-bg: var(--block-market-bg); }
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
}
.block-header:hover { background: var(--block-accent-bg, var(--surface-1)); }
.block-header__label { font-weight: 600; font-size: 15px; }
.block-header__question { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.block-header__status {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.block-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--block-accent-bg, var(--surface-1));
  color: var(--block-accent, var(--text-muted));
  font-size: 11px;
  transition: transform 0.15s ease;
}
.block-header--open .block-chevron { transform: rotate(180deg); }
.block-panel {
  padding: 0 20px 18px;
}

/* Small inline text-style button — report.js's riskScreeningTeaser CTA.
   Not a full .primary-button/.secondary-button (those are block-level,
   built for standalone actions, not a trailing link inside a sentence). */
.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  background: var(--accent-100);
  color: var(--accent-600);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) { .tag { color: #eaf1fb; } }

.sources-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.source-group .source-group-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px;
}
.source-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--gridline);
  font-size: 14px;
}
.source-item:first-child { border-top: none; }
.source-item .source-meta { color: var(--text-muted); font-size: 12.5px; }
.level-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--border);
  color: var(--text-secondary);
  margin-right: 6px;
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
.stat-tile .stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.stat-tile .stat-value { font-size: 20px; font-weight: 600; }
.demo-note {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  line-height: 1.5;
}
/* B2B_PLATFORM_ROADMAP.md, Раздел 10 — a lab-analysis finding that
   CONTRADICTS the object's own claimed attribution must never look like a
   normal confirmed finding (.demo-note's neutral gray) — same --warning
   color .status-chip.yellow/.evidence-row--missing already use elsewhere
   for "needs attention", reused here for consistency. */
.warning-note {
  font-size: 12.5px;
  color: #8a5a00;
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) { .warning-note { color: var(--warning); } }

.actions-row {
  display: flex;
  gap: 10px;
  margin: 30px 0 10px;
  flex-wrap: wrap;
}
.actions-row .primary-button, .actions-row .secondary-button { width: auto; margin-top: 0; flex: 1; min-width: 160px; }

/* ---------------- History view ---------------- */
.history-view { padding-top: 26px; }
.history-empty { text-align: center; color: var(--text-secondary); padding: 60px 20px; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
}
.history-card:hover { border-color: var(--border-strong); }
.history-card .hc-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.hc-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.history-card .hc-title { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Only researchResult.js's objectRow uses .hc-date now — myCollection.js's
   objectCard dropped the added-date entirely (2026-07-30, user request:
   it kept crowding the collection tag on a narrow phone viewport, tried
   restacking it first, removed instead of continuing to fight for space). */
.history-card .hc-date { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; width: 82px; }
.status-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  flex-shrink: 0;
}
.history-card .status-chip { width: 104px; }
.status-chip.green { background: var(--good-bg); color: var(--good); }
.status-chip.yellow { background: var(--warning-bg); color: #8a5a00; }
.status-chip.researching { background: var(--border); color: var(--text-secondary); }
@media (prefers-color-scheme: dark) { .status-chip.yellow { color: var(--warning); } }

/* ---------------- Chat widget ---------------- */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(11,11,11,0.18);
  z-index: 50;
}

.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 440px;
  max-height: calc(100vh - 140px);
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(11,11,11,0.22);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}
.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gridline);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-header .chat-close { background: none; border: none; font-size: 16px; color: var(--text-muted); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.chat-msg.user { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-1); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-msg.typing { color: var(--text-muted); font-style: italic; }
.chat-msg-action-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.chat-msg-action {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
}
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.chat-quick-reply {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  text-align: left;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--gridline);
}
.chat-input-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
}
.chat-input-row button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
}
.chat-attach-btn {
  background: var(--surface-1) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  padding: 0 12px !important;
}
.chat-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 6px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-primary);
}
.chat-attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.chat-attachment-chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

/* ---------------- Auth modal (contextual, not a full-page gate) ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,11,11,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: var(--page);
  border-radius: var(--radius-md);
  /* 2026-08-11, user-reported bug — a reference's detail modal (long
     expertise summary text + photos) could grow taller than the viewport;
     .modal-overlay centers it with no scroll of its own, so the overflow
     just pushed the top (photos, close button) off-screen with no way to
     reach it. max-height + overflow-y keeps the whole card reachable via
     an internal scrollbar instead. */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
/* 2026-07-29 (user-reported bug) — 640px fit 4 plan cards but not 5 once
   Collector was added; the 5th column overflowed the modal's white card and
   spilled onto the dark backdrop. This modal class is only used for the
   plan-picker grid (billing.js), so widening it here is safe. */
.modal-card--wide { max-width: 960px; }

/* 2026-07-26 (B2C tariff-grid update) — flex-wrap let cards reflow onto a
   second row depending on viewport width, which visually separated e.g.
   Pro from the rest even though DOM/price order was always correct (see
   billing.js's showUpgradeModal — one single forEach loop, no duplicate
   markup block for any plan). A grid with an explicit column count per
   breakpoint keeps every card in one price-ordered row down to a real
   phone width, wrapping predictably by whole rows instead of by
   flex-basis quirks. */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .plan-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .plan-cards { grid-template-columns: repeat(2, 1fr); }
}
.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card--current { border-color: var(--accent); background: var(--surface-1); }
.plan-card--highlight { box-shadow: 0 0 0 2px var(--accent) inset; }
.plan-card__label { font-weight: 600; font-size: 15px; }
.plan-card__price { font-size: 20px; font-weight: 700; }
.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.plan-card__features li::before { content: "· "; }
.modal-close {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  color: var(--text-secondary);
}
/* 2026-08-12, user request — "крестик сместить чуть вниз и влево, чтобы он
   не обрезался" — the reference detail modal (tall content, sits close to
   the viewport's top edge) could clip the close button's default -6px/-6px
   offset against the viewport itself. Scoped to this modal only via its own
   id, not the shared .modal-close class other modals (billing.js) still use
   unchanged. */
#reference-detail-modal-overlay .modal-close {
  top: 8px;
  right: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--page);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow-card);
  z-index: 100;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.spinner-inline {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Same spinner, but for use inside light-background elements (e.g.
   .secondary-button) where the white-on-transparent .spinner-inline above
   would be invisible — accent-colored border instead of white. */
.spinner-inline-dark {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--good);
  color: white;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}

/* ---------------- Batch views ---------------- */
.batch-object-card { display: flex; flex-direction: column; }
.batch-object-card .batch-object-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(11,11,11,0.55); color: white;
  font-size: 10.5px; text-align: center; padding: 2px 4px;
}
.batch-banner-count { display: flex; gap: 8px; }
.collection-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 14px; cursor: pointer;
}
.collection-row input { width: 16px; height: 16px; }
.highlight-flash { animation: flash 1.8s ease; }
@keyframes flash {
  0%, 100% { box-shadow: var(--shadow-card); }
  30% { box-shadow: 0 0 0 3px var(--accent-250); }
}

@media (max-width: 520px) {
  .metadata-grid { grid-template-columns: 1fr; }
  .market-stats { grid-template-columns: 1fr 1fr; }
}

