/* ===========================================================
   Pika — design tokens
   Minimal modern, neutral grays + single muted indigo accent.
   =========================================================== */

:root {
  /* Type */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Neutrals — subtly warm to complement mint accent */
  --bg:           oklch(0.985 0.003 50);
  --surface:     #ffffff;
  --surface-2:   oklch(0.975 0.004 50);
  --surface-3:   oklch(0.955 0.005 50);
  --line:        oklch(0.91  0.006 50);
  --line-2:      oklch(0.85  0.008 50);

  --ink:         oklch(0.21  0.012 60);
  --ink-2:       oklch(0.36  0.012 60);
  --ink-3:       oklch(0.53  0.010 60);
  --ink-4:       oklch(0.68  0.008 60);

  /* Single accent — dusty mint #69A18F */
  --accent:      #69A18F;
  --accent-2:    #527F6F;
  --accent-soft: oklch(0.94 0.025 167);
  --accent-line: oklch(0.82 0.045 167);

  /* Primary action color — deep dusty forest, pairs with mint */
  --primary:       #46645A;
  --primary-hover: #36504a;

  /* States */
  --warn:        oklch(0.62  0.14   65);   /* warm amber */
  --warn-soft:   oklch(0.96  0.03   80);
  --ok:          oklch(0.52  0.10  150);
  --ok-soft:     oklch(0.95  0.02  150);
  --danger:      oklch(0.55  0.18   25);

  /* Sizing */
  --r-sm: 4px;
  --r:    6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* Card radius — tweakable */
  --r-card: 6px;

  --sb-w: 240px;
  --topbar-h: 52px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-pop:0 12px 40px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-feature-settings: "ss01"; }

/* ---------- Layout shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  background: var(--bg);
}
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--primary);
  display: grid; place-items: center;
  color: var(--bg);
  font-weight: 700;
  font-size: 13px;
}
.topbar .spacer { flex: 1; }
/* Кликабельная хлебная крошка в топбаре (навигация назад). */
.crumb-link {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 4px;
  transition: color 100ms ease;
}
.crumb-link:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.topbar-meta {
  display: flex; gap: 18px; align-items: center;
  color: var(--ink-3); font-size: 12.5px;
}
.topbar-meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); display: inline-block; margin-right: 6px;
  vertical-align: middle;
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
}
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: white;
  display: grid; place-items: center; font-weight: 600; font-size: 11px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 4px 10px 8px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13.5px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 80ms ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active {
  background: var(--primary);
  color: var(--bg);
}
.nav-item.active .nav-count { color: var(--bg); opacity: 0.7; }
.nav-item .nav-icon { width: 14px; height: 14px; flex: 0 0 14px; opacity: 0.7; }
.nav-item .nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}

/* ---------- Main ---------- */
.main {
  overflow: auto;
  position: relative;
}
.page {
  padding: 28px 36px 60px;
  max-width: 1320px;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
}
.page-sub {
  color: var(--ink-3);
  font-size: 13.5px;
  margin-top: 4px;
}
.page-actions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--ink);
  transition: all 100ms ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--ink-4); }
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11.5px; border-radius: 4px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn .ic { width: 13px; height: 13px; }

/* ---------- Pills / chips / status ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
  line-height: 1.5;
  white-space: nowrap;
}
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.pill.ok    { background: var(--ok-soft);  color: var(--ok);     border-color: color-mix(in oklch, var(--ok) 25%, transparent); }
.pill.ok .pdot { background: var(--ok); }
.pill.warn  { background: var(--warn-soft);color: var(--warn);   border-color: color-mix(in oklch, var(--warn) 25%, transparent); }
.pill.warn .pdot { background: var(--warn); }
.pill.accent{ background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.pill.accent .pdot { background: var(--accent); }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Inputs ---------- */
.input, .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.input:focus, .textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in oklch, var(--accent) 6%, transparent), transparent 50%),
    radial-gradient(circle at 80% 90%, color-mix(in oklch, var(--accent) 4%, transparent), transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.login-brand .brand-mark { width: 28px; height: 28px; font-size: 15px; border-radius: 7px; }
.login-brand .title { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.login-brand .sub { color: var(--ink-3); font-size: 12px; }
.login-h {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.login-p {
  color: var(--ink-3);
  font-size: 13px;
  margin: 0 0 22px;
}
.login-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-4);
  display: flex; justify-content: space-between;
}

/* ---------- Shoots list ---------- */
.shoot-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 100ms ease;
}
.shoot-row:last-child { border-bottom: 0; }
.shoot-row:hover { background: var(--surface-2); }
.shoot-thumb {
  width: 88px; height: 64px;
  border-radius: var(--r);
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
}
.shoot-meta { min-width: 0; }
.shoot-title {
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.shoot-sub {
  color: var(--ink-3);
  font-size: 12.5px;
  display: flex; gap: 10px; align-items: center;
}
.shoot-sub .sep { color: var(--ink-4); }
.shoot-progress {
  margin-top: 6px;
  height: 3px;
  width: 220px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.shoot-progress > div {
  height: 100%;
  background: var(--accent);
  transition: width 300ms ease;
}
.shoot-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Stage pillars (pipeline progress) ---------- */
.stages {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: end;
}
.stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  position: relative;
}
.stage-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.stage-label {
  font-size: 11px;
  letter-spacing: 0;
  text-align: left;
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}
/* done — same hue family as accent, lighter */
.stage.done .stage-bar {
  background: #8EB9AB;
  border-color: #8EB9AB;
}
.stage.done .stage-label { color: var(--ink-4); }
/* current — running (solid + animated stripes overlay) */
.stage.running .stage-bar {
  background: var(--accent);
  border-color: var(--accent);
  height: 8px;
  margin-top: -2px;
  position: relative;
  overflow: hidden;
}
.stage.running .stage-bar::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 4px,
    rgba(255,255,255,0.4) 4px 8px);
  animation: stage-march 0.8s linear infinite;
  background-size: 11.3px 11.3px;
}
.stage.running .stage-label { color: var(--accent); font-weight: 600; }
@keyframes stage-march {
  to { background-position: -11.3px 0; }
}
/* Progress badge — floats above the running bar */
.stage-progress-badge {
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--accent-2);
  background: transparent;
  padding: 0 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}
/* current — waiting for human (solid + soft halo above) */
.stage.waiting .stage-bar {
  background: var(--accent);
  border-color: var(--accent);
  height: 8px;
  margin-top: -2px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.stage.waiting .stage-label { color: var(--accent); font-weight: 600; }
/* pending — outlined */
.stage.pending .stage-bar {
  background: transparent;
  border-color: var(--line);
  border-style: dashed;
}
.stage.pending .stage-label { color: var(--ink-4); opacity: 0.6; }
/* failed */
.stage.failed .stage-bar {
  background: var(--warn-soft);
  border-color: var(--warn);
}
.stage.failed .stage-label { color: var(--warn); font-weight: 600; }

/* New shoot row layout v3: stages on a separate row, aligned across all rows.
   Top: [thumb] [title+meta] [action]  — fixed action width so meta is consistent.
   Bottom: [────────── stages spanning full content width ──────────] */
.shoot-row-v3 {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 100ms ease;
}
.shoot-row-v3:last-child { border-bottom: 0; }
.shoot-row-v3:hover { background: var(--surface-2); }

.shoot-row-v3 .top {
  display: grid;
  grid-template-columns: 88px 1fr 150px;
  gap: 18px;
  align-items: center;
}
.shoot-row-v3 .stages-row {
  margin-top: 22px;
  margin-left: 106px; /* 88 thumb + 18 gap */
}
.shoot-row-v3 .stages {
  width: 100%;
  grid-template-columns: repeat(8, 1fr);
}
.shoot-row-v3 .shoot-actions {
  justify-content: flex-end;
}
.shoot-row-v3 .shoot-actions .btn {
  min-width: 130px;
  justify-content: center;
}
.shoot-row-v3 .top .shoot-meta,
.shoot-row-v3 .top .shoot-thumb {
  cursor: pointer;
}

/* ---------- Series view (read-only) ---------- */
.series-stats {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
}
.series-stat .v { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.1; }
.series-stat .l {
  color: var(--ink-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 2px; font-weight: 500;
}

.series-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.series-layout.has-detail {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.series-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 6px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.series-tile:hover { border-color: var(--line-2); }
.series-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.series-tile-thumb {
  position: relative;
  aspect-ratio: 3/2;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.series-tile-idx {
  position: absolute;
  top: 6px; left: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.85);
  color: var(--ink-2);
  border-radius: 3px;
}
.series-banner-flag {
  position: absolute;
  top: 6px; right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 5px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.series-banner-flag.vertical { background: rgba(0,0,0,0.7); }
.series-tile-status {
  position: absolute;
  bottom: 6px; left: 6px;
}
.series-tile-meta {
  padding: 0 4px 4px;
}
.series-tile-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.series-tile-accent {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 40px);
  overflow-y: auto;
}

/* ---------- Archive ---------- */
.archive-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 4;
}
.archive-filters .chip {
  padding: 3px 9px;
  font-size: 12px;
}

.archive-month {
  margin-bottom: 22px;
}
.archive-month-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.archive-month-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.archive-month-meta {
  color: var(--ink-3);
  font-size: 12px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.archive-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color 100ms ease;
}
.archive-card:hover { border-color: var(--line-2); }
.archive-card-thumb {
  position: relative;
  width: 88px;
  flex: 0 0 88px;
  background: var(--surface-3);
  border-right: 1px solid var(--line);
}
.archive-card-body {
  padding: 8px 10px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.archive-card-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archive-card-sub {
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: 4px;
  align-items: center;
}
.archive-card-sub .archive-sep { color: var(--ink-4); }
.archive-card-keys {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.archive-key {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-3);
}
.archive-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}
.archive-csv {
  font-size: 10px;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-csv:hover { color: var(--accent); }
.archive-purged-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--surface-3);
  color: var(--ink-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
}

.archive-purged {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(135deg,
      var(--surface-2) 0 6px,
      var(--surface-3) 6px 12px);
  text-align: center;
}

.archive-kind-flag {
  position: absolute;
  top: 6px; left: 6px;
  font-size: 9.5px;
  padding: 1px 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.65);
  color: white;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.archive-kind-flag.vector {
  background: oklch(0.55 0.15 320);
}
.archive-kind-flag.editorial {
  background: oklch(0.55 0.15 65);
}
.archive-banner-flag {
  position: absolute;
  bottom: 6px; right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 5px;
  background: var(--accent);
  color: white;
  border-radius: 3px;
}

.archive-restore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  font-size: 10.5px;
  border-radius: 4px;
  color: var(--accent-2);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 100ms ease;
}
.archive-restore:hover {
  background: var(--surface-3);
  color: var(--accent);
  border-color: var(--accent);
}

.archive-delete {
  margin-left: auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 4px;
  color: var(--ink-4);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 100ms ease;
}
.archive-delete:hover {
  background: var(--warn-soft);
  color: var(--danger);
  border-color: var(--warn);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}
.modal-card {
  width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 28px 22px;
  box-shadow: var(--shadow-pop);
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.modal-icon.warn {
  background: var(--warn-soft);
  color: var(--danger);
}
.modal-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.modal-sub {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: oklch(0.45 0.20 25);
  border-color: oklch(0.45 0.20 25);
}

/* ---------- Recognition queue indicator (sidebar) ---------- */
.queue-indicator {
  margin: 16px 0 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  font-size: 11.5px;
}
.queue-indicator .qi-head {
  display: flex; align-items: center; gap: 6px;
  color: var(--accent-2);
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.queue-indicator .qi-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--ink-2);
  border-top: 1px dashed var(--line);
}
.queue-indicator .qi-row:first-of-type { border-top: 0; }
.queue-indicator .qi-row .qi-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
}
.queue-indicator .qi-row .qi-progress {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.queue-indicator .qi-row.queued .qi-name { color: var(--ink-3); }
.queue-indicator .qi-row .qi-bar {
  height: 2px; border-radius: 2px; background: var(--surface-3);
  margin-top: 4px; overflow: hidden;
}
.queue-indicator .qi-row .qi-bar > div {
  height: 100%; background: var(--accent);
}

/* Type filter chip strip */
.chip-row {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 14px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  width: fit-content;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  font-size: 12.5px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.chip:hover { color: var(--ink); }
.chip.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.chip .chip-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
  margin-left: 2px;
}
.chip.active .chip-count { color: var(--ink-3); }

/* Kind pills — single source */
.kind-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  line-height: 1.55;
  font-weight: 500;
}
.kind-pill.video {
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  border-color: var(--accent-line);
  color: var(--accent);
}
.kind-pill.vector {
  background: oklch(0.95 0.04 320);
  border-color: oklch(0.85 0.06 320);
  color: oklch(0.45 0.14 320);
}
.kind-pill.editorial {
  background: oklch(0.95 0.04 65);
  border-color: oklch(0.85 0.06 65);
  color: oklch(0.45 0.14 65);
}

/* ---------- Image placeholder (striped) ---------- */
.ph {
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(
      135deg,
      oklch(0.93 0.006 50) 0 6px,
      oklch(0.96 0.005 50) 6px 12px);
  position: relative;
  display: grid; place-items: center;
}
.ph .ph-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-4);
  background: rgba(255,255,255,0.85);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.ph-banner {
  background:
    repeating-linear-gradient(
      90deg,
      oklch(0.94 0.006 50) 0 8px,
      oklch(0.96 0.005 50) 8px 16px);
}

/* ---------- Ingest screen ---------- */
.ingest-summary {
  display: flex; gap: 24px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 18px;
}
.ingest-stat .v { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.ingest-stat .l { color: var(--ink-3); font-size: 12px; }

.ingest-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  overflow: hidden;
}
.ingest-group-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.ingest-group-title {
  font-weight: 500; font-size: 14px;
}
.ingest-group-title.editable {
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: text;
  transition: border-color 100ms ease, background 100ms ease;
}
.ingest-group-title.editable:hover { background: var(--surface-3); }
.ingest-group-title.editable:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ingest-group-meta { color: var(--ink-3); font-size: 12.5px; }
.ingest-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  padding: 12px 14px;
}
.ingest-thumbs.split-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
}
.ingest-thumbs.split-mode .ingest-thumb {
  width: 96px;
  flex: 0 0 96px;
  margin: 4px 0;
}
.split-gap {
  width: 14px;
  align-self: stretch;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  margin: 4px 0;
}
.split-gap::after {
  content: "";
  position: absolute;
  left: 50%; top: 6px; bottom: 6px;
  transform: translateX(-50%);
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
  opacity: 0.25;
  transition: opacity 100ms, width 100ms, background 100ms;
}
.split-gap:hover::after,
.split-gap:focus-visible::after {
  opacity: 1;
  width: 3px;
  background: var(--primary);
  top: 0; bottom: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.split-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 12px;
  border-bottom: 1px solid var(--accent-line);
}
.ingest-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
}
.ingest-thumb.dup { outline: 2px solid var(--warn); outline-offset: -2px; }
.ingest-thumb .ic-tag {
  position: absolute; top: 4px; left: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(255,255,255,0.9);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-2);
}
.ingest-thumb .dup-tag {
  position: absolute; bottom: 4px; right: 4px;
  font-size: 9.5px; padding: 1px 5px; border-radius: 3px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid var(--warn);
}
/* «Возможный повтор» — более мягкий сигнал, чем точный дубль md5:
   пунктирная рамка и приглушённый фон, чтобы отличался на глаз. */
.ingest-thumb.repeat { outline: 2px dashed var(--warn); outline-offset: -2px; }
.ingest-thumb .dup-tag.repeat-tag {
  background: var(--surface-3);
  border-style: dashed;
}
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; user-select: none;
}
.chk input { accent-color: var(--accent); }

/* ---------- Review 1 ---------- */
.r1-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 12px;
  position: sticky; top: 0; z-index: 4;
}
.r1-toolbar .grow { flex: 1; }
.r1-toolbar .meta {
  font-size: 12.5px; color: var(--ink-3);
  display: flex; gap: 16px;
}

.photo-block {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 120ms ease;
}
.photo-block .photo-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.photo-block .photo-side .field { margin: 0; }
.photo-block .photo-side .field-grow {
  flex: 1 1 0;
  min-height: 60px;
  display: flex;
  flex-direction: column;
}
.photo-block .photo-side .field-grow textarea {
  flex: 1 1 0;
  resize: none;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 12px;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.photo-block .photo-side .field-grow textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.photo-block.attention { border-color: var(--warn); }
.photo-block--failed {
  border-color: var(--warn);
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in oklch, var(--warn-soft) 40%, var(--surface)) 100%);
}
.failed-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    repeating-linear-gradient(135deg,
      transparent 0 14px,
      color-mix(in oklch, var(--warn) 4%, transparent) 14px 28px);
  border: 1px dashed var(--warn);
  border-radius: var(--r);
  padding: 24px;
  min-height: 200px;
}
.btn:disabled, .btn.disabled { opacity: 0.6; cursor: not-allowed; }
@keyframes spin { to { transform: rotate(360deg); } }
.photo-block.attention .photo-side .filename::after {
  content: " · требует внимания";
  color: var(--warn); font-size: 11px; font-family: var(--font-sans);
}

.photo-side .photo-img {
  width: 100%;
  aspect-ratio: 3/2;
  border-radius: var(--r);
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.photo-side .filename {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 10px;
  display: flex; align-items: center; gap: 6px;
}
.photo-side .meta-row {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.photo-side .actions {
  margin-top: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.accent-pick {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  color: var(--accent);
}
.accent-pick .label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }

/* Analysis groups */
.ana-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}
.ana-group {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 6px 8px;
}
.ana-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 5px;
}
.ana-head .hero {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10.5px;
  color: var(--ink-3);
}
.ana-row {
  padding: 3px 6px;
  border-radius: 4px;
  margin: 2px 0;
}
.ana-row.selling {
  background: var(--accent-soft);
}
.ana-row-label { display: none; }
.ana-cards {
  display: flex; flex-wrap: wrap; gap: 4px;
  /* Нижняя полоса — ПОСТОЯННАЯ зона приёма броска «в конец ряда». Она есть
     всегда (а не появляется на старте перетаскивания, как старая flex-зона),
     поэтому: (1) забитый под край ряд всё равно ловит бросок; (2) высота ряда
     НЕ скачет в момент захвата — раньше вставка drag-зоны в полный ряд делала
     перенос строки, ряд синонимов уезжал из-под курсора и браузер обрывал
     захват («нижние слова не хватаются»). Баг 2026-06-23. */
  min-height: 30px;
  padding-bottom: 14px;
  align-content: flex-start;
}
/* Подсветка всего ряда как цели во время перетаскивания — чтобы видно было
   куда упадёт слово, в т.ч. на постоянную нижнюю полосу. */
.ana-cards.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
  background: var(--accent-soft);
}

/* Word card */
.wcard {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--r-card);
  font-size: 12px;
  padding: 3px 8px 4px;
  cursor: grab;
  user-select: none;
  flex-direction: column;
  line-height: 1.1;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 80ms ease;
}
.wcard:active { cursor: grabbing; }
.wcard:hover {
  border-color: var(--ink-3);
  box-shadow: var(--shadow-sm);
}
.wcard .en { font-weight: 500; color: var(--ink); }
.wcard .ru { font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.wcard.selling {
  background: var(--primary);
  border-color: var(--primary);
}
.wcard.selling .en { color: var(--bg); }
.wcard.selling .ru { color: rgba(255,255,255,0.6); }
.wcard.dragging {
  opacity: 0.4;
  transform: rotate(-1deg);
}
/* «Дубликат подсветка» — пульсация мятным когда пытаются добавить такое же
   слово через AddWordRow. Через box-shadow, чтобы работало и на тёмных
   selling-карточках, не ломая их фон. */
.wcard--flash {
  animation: wcard-flash 1.05s ease-in-out;
}
@keyframes wcard-flash {
  0%   { box-shadow: 0 0 0 0   var(--accent); transform: scale(1); }
  30%  { box-shadow: 0 0 0 5px var(--accent-soft); transform: scale(1.06); }
  70%  { box-shadow: 0 0 0 5px var(--accent-soft); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0   transparent; transform: scale(1); }
}
.wcard.add {
  border-style: dashed;
  color: var(--ink-3);
  font-size: 12px;
  padding: 5px 9px;
  flex-direction: row;
  gap: 4px;
  cursor: pointer;
}
.wcard.add:hover { background: var(--surface-2); color: var(--ink); }

/* Grid layout for Review 1 */
.r1-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.r1-grid .photo-block {
  margin-bottom: 0;
  grid-template-columns: 1fr;
}
.r1-grid .photo-block .photo-side .photo-img { aspect-ratio: 4/3; }

/* ---------- Review 2 ---------- */
.r2-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.r2-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}
.r2-top .photo-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.r2-text-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.r2-section { margin-bottom: 14px; }
.r2-section:last-child { margin-bottom: 0; }
.r2-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}
.r2-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.r2-counter.ok { color: var(--ok); }
.r2-counter.warn { color: var(--warn); }
.r2-text {
  font-size: 14.5px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 6px 10px;
  margin: 0 -10px;
  background: transparent;
  cursor: text;
  /* Длинный текст (особенно склеенный без пробелов) не должен растягивать
     родителя и заходить на соседние поля. word-break + overflow-wrap решает
     проблему «правый край залазит на другие поля» (правка 2026-06-03). */
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.r2-text:hover { background: var(--surface-2); }
.r2-text:focus { outline: 0; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Превышение лимита description (правка 2026-06-05): auto-trim убран, но
   стоки требуют ≤200 — UI явно подсвечивает поле красноватой рамкой и фоном
   чтобы Лена не пропустила и сократила перед «Принять серию». */
.r2-text.over-limit {
  border-color: var(--warn);
  background: var(--warn-soft, rgba(220, 100, 50, 0.06));
}
.r2-text.over-limit:focus {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(220, 100, 50, 0.18);
}
/* Placeholder для contentEditable div'ов (правка 2026-06-03). У contentEditable
   нет нативного placeholder; рендерим через ::before когда элемент пустой
   и не в фокусе. */
.r2-text:empty:not(:focus)::before {
  content: attr(data-placeholder);
  color: var(--ink-4);
  font-style: italic;
}
.r2-text.ru { color: var(--ink-3); font-size: 13px; margin-top: 4px; }

.r2-keys {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.kw {
  display: inline-flex; align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--r-card);
  font-size: 12.5px;
  padding: 4px 4px 4px 9px;
  cursor: grab;
}
.kw .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  margin-right: 4px;
}
.kw .kw-stack { display: flex; flex-direction: column; line-height: 1.1; }
.kw .en { font-weight: 500; }
.kw .ru { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.kw .x {
  width: 16px; height: 16px; border-radius: 3px;
  display: grid; place-items: center;
  color: var(--ink-4); margin-left: 2px;
}
.kw .x:hover { background: var(--surface-3); color: var(--danger); }
.kw.top { background: var(--primary); border-color: var(--primary); }
.kw.top .en { color: var(--bg); }
.kw.top .ru { color: rgba(255,255,255,0.6); }
.kw.top .num { color: rgba(255,255,255,0.6); }
/* Selling за пределами топ-10 (правка 2026-06-03 — Лена просила «менее ярко»).
   Светлая палитра того же зелёного что у .kw.top — узнаваемая связка
   «оба тренируются на selling-сигнале», но top темнее, selling светлее. */
.kw.selling {
  background: color-mix(in oklch, var(--primary) 18%, var(--surface));
  border-color: color-mix(in oklch, var(--primary) 45%, var(--line));
}
.kw.selling .en { color: color-mix(in oklch, var(--primary) 75%, var(--ink)); }
.kw.banner {
  background: color-mix(in oklch, var(--accent) 12%, var(--surface));
  border-color: var(--accent-line);
}
.kw.suspect { border-color: var(--warn); background: var(--warn-soft); }

.kw-add {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.kw-add input {
  width: 200px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-size: 12.5px;
  background: var(--surface);
}
.kw-add input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kw-spare-label {
  font-size: 11px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  font-weight: 500;
}
.kw.spare {
  background: transparent;
  border: 1px dashed var(--line-2);
  cursor: pointer;
  color: var(--ink-3);
  padding-left: 9px;
  padding-right: 9px;
}
.kw.spare:hover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  color: var(--ink);
}
.kw.spare .num { display: none; }
.kw.spare .en { color: inherit; }
.kw.spare .ru { color: var(--ink-4); }

.r2-expand {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.r2-expand-inline {
  /* Правка 2026-06-05: column-layout — каждая группа (ОБЪЕКТ / ДЕЙСТВИЕ /
     РОЛЬ / ЭМОЦИЯ / МЕСТО) с новой строки. До этого всё было flex-wrap row
     и Лена не могла визуально отделить группы. */
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.r2-expand-group {
  /* Группа: лейбл + карточки слов в одну строку (с переносом если не
     помещаются). Лейбл слева, остальное справа. */
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.r2-expand-label {
  /* Фиксированная ширина лейбла → колонки слов выровнены по вертикали. */
  flex: 0 0 70px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
/* .r2-expand-sep больше не используется (column-layout). Оставлено на случай
   возврата inline-режима. */
.r2-expand-sep {
  color: var(--ink-4);
  margin: 0 4px;
  font-size: 12px;
}
.wcard-mini {
  cursor: default;
  padding: 2px 6px;
  font-size: 11px;
}
.wcard-mini .en { font-size: 11px; }
.wcard-mini .ru { display: none; }
/* Selling-вариант в expanded блоке Ревью 2 (правка 2026-06-03). Выделяет
   продающие слова неярким мятным фоном — Лена просила «не ярко». Фон
   полупрозрачный от --accent, рамка цвета акцента. Текст остаётся обычным. */
.wcard-mini.selling {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}
.wcard-mini.selling .en {
  color: var(--accent-2);
  font-weight: 500;
}

/* ---------- Settings ---------- */
.set-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 14px;
}
.set-section h3 {
  font-size: 14px; margin: 0 0 4px;
  font-weight: 500; letter-spacing: -0.01em;
}
.set-section .h-sub {
  color: var(--ink-3); font-size: 12.5px; margin-bottom: 16px;
}
.set-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.set-row:first-of-type { border-top: 0; padding-top: 0; }
.set-row .k { font-size: 13px; font-weight: 500; }
.set-row .k-sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.set-row .v { color: var(--ink-2); font-size: 13px; }
.set-row .v.mono { font-family: var(--font-mono); font-size: 12px; }

.device-code {
  display: flex; gap: 12px; align-items: center;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.device-code .code {
  font-family: var(--font-mono);
  font-size: 24px;
  letter-spacing: 0.18em;
  font-weight: 500;
}

/* ---------- Misc ---------- */
.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-4); }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

.archive-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--ink-3);
}
.archive-link:hover { color: var(--ink); }

/* svg icons stroke inheritance */
svg.ic { display: inline-block; vertical-align: middle; }

/* ---------- Tweaks panel overrides ---------- */
.twk-panel { font-family: var(--font-sans) !important; }

/* ---------- Админка · матрица групп (классы из дизайна pika3) ---------- */
.perm-matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); }
.perm-matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
.perm-matrix th, .perm-matrix td { border-bottom: 1px solid var(--line); }
.perm-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--line-2); vertical-align: bottom; padding: 12px 14px; text-align: center; }
.pm-corner { text-align: left !important; position: sticky; left: 0; z-index: 3; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; min-width: 210px; width: 38%; background: var(--surface-2); }
.pm-group-col { min-width: 120px; border-left: 1px solid var(--line); }
.pm-group-name { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); }
.pm-group-meta { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 5px; color: var(--ink-4); font-size: 11px; }
.pm-glimits { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.pm-glimits label { font-size: 10px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 3px; }
.pm-glimits input { width: 34px; padding: 2px 4px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 11px; font-family: var(--font-mono); text-align: center; }
.pm-base { margin-top: 6px; font-size: 11px; max-width: 132px; padding: 3px 4px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.pm-section-row td { background: var(--surface-3); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 6px 14px; position: sticky; left: 0; border-bottom: 1px solid var(--line); }
.pm-row:hover td { background: var(--surface-2); }
.pm-opt { position: sticky; left: 0; z-index: 1; background: var(--surface); padding: 9px 14px; color: var(--ink-2); vertical-align: middle; }
.pm-opt-inner { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; line-height: 1.3; }
.pm-row:hover .pm-opt { background: var(--surface-2); }
.pm-limit-tag { font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 5px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--accent-line); flex: 0 0 auto; }
.pm-cell { border-left: 1px solid var(--line); padding: 6px; vertical-align: middle; text-align: center; }
.pm-cell-inner { display: flex; align-items: center; justify-content: center; min-height: 30px; }
.pm-cell.on { background: color-mix(in oklch, var(--accent) 6%, transparent); }
.pm-row:hover .pm-cell.on { background: color-mix(in oklch, var(--accent) 10%, transparent); }
.pm-check { width: 22px; height: 22px; flex: 0 0 auto; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--surface); display: inline-grid; place-items: center; color: white; cursor: pointer; padding: 0; transition: background 100ms ease, border-color 100ms ease; }
.pm-check:hover { border-color: var(--accent); }
.pm-check.on { background: var(--accent); border-color: var(--accent); }
