:root {
  --bg: #f3eee6;
  --ink: #1c1612;
  --muted: #6d6258;
  --line: rgba(28, 22, 18, 0.08);
  --card: rgba(255, 252, 247, 0.78);
  --accent: #c4321a;
  --accent-hot: #ff5a36;
  --accent-soft: rgba(255, 90, 54, 0.12);
  --sea: #243e5a;
  --sea-soft: rgba(36, 62, 90, 0.1);
  --twin: #ffe36b;
  --twin-ink: #3d3208;
  --good: #15724c;
  --good-soft: #e5f6ee;
  --rose: #c4273d;
  --leaf: #2f6b3a;
  --leaf-soft: rgba(47, 107, 58, 0.12);
  --shadow: 0 24px 60px rgba(72, 42, 18, 0.08);
  --shadow-soft: 0 10px 30px rgba(72, 42, 18, 0.05);
  --split: 1fr;
  --rest: 1fr;
  --font: "Manrope", "Segoe UI Variable", "Segoe UI", sans-serif;
  --display: "Unbounded", "Manrope", "Segoe UI Variable", sans-serif;
  color-scheme: light;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
:focus-visible {
  outline: 2px solid var(--accent-hot);
  outline-offset: 2px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(rgba(28, 22, 18, 0.035) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.85;
}
.orb-a {
  width: 46vw;
  height: 46vw;
  left: -12vw;
  top: -18vw;
  background: radial-gradient(circle, rgba(255, 90, 54, 0.42), transparent 68%);
  animation: drift 22s ease-in-out infinite;
}
.orb-b {
  width: 40vw;
  height: 40vw;
  right: -10vw;
  top: -14vw;
  background: radial-gradient(circle, rgba(255, 214, 110, 0.55), transparent 70%);
  animation: drift 28s ease-in-out infinite reverse;
}
.orb-c {
  width: 36vw;
  height: 36vw;
  left: 34vw;
  bottom: -20vw;
  background: radial-gradient(circle, rgba(36, 62, 90, 0.16), transparent 70%);
  animation: drift 32s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3%, 4%, 0) scale(1.06); }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px 18px;
  overflow: hidden;
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
  min-height: 72px;
  padding: 10px 12px 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.3);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 32% 30%, #fff4ec 0 18%, transparent 19%),
    conic-gradient(from 210deg, #ffd7c8, #ff5a36 28%, #1c1612 29% 72%, #ffe36b 73%, #ffb199);
  box-shadow: 0 10px 22px rgba(196, 50, 26, 0.28), inset 0 0 0 4px rgba(255, 252, 247, 0.55);
}

.modes {
  display: flex;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(28, 22, 18, 0.05);
}
.mode {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.mode.is-on {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(28, 22, 18, 0.08);
}
.mode[data-mode-btn="draft"].is-on { color: var(--accent); }
.mode[data-mode-btn="base"].is-on { color: var(--sea); }
.mode[data-mode-btn="draft"].is-on[data-right-on="ai"] { color: var(--leaf); }
.right-switch {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(28, 22, 18, 0.05);
}
.right-switch .mode { padding: 7px 12px; font-size: 12px; }
.right-switch .mode[data-right-btn="draft"].is-on { color: var(--accent); }
.right-switch .mode[data-right-btn="ai"].is-on { color: var(--leaf); }
html[data-right="draft"] #pane-ai, html:not([data-right]) #pane-ai { display: none; }
html[data-right="ai"] #pane-draft { display: none; }

.stats {
  margin: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}
.pill b { color: var(--ink); font-weight: 780; font-size: 13px; }
.pill.new { background: var(--accent-soft); color: var(--accent); }
.pill.new b { color: var(--accent); }
.pill.ai { background: var(--leaf-soft); color: var(--leaf); }
.pill.ai b { color: var(--leaf); }
button.pill {
  border: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}
button.pill:hover { background: white; transform: translateY(-1px); }
button.pill.is-on {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(28, 22, 18, 0.08);
}
button.pill.is-on b { color: var(--accent); }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 730;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(196, 50, 26, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost, .btn.mute {
  background: rgba(28, 22, 18, 0.05);
  color: var(--ink);
  box-shadow: none;
}
.btn.mute.is-on {
  background: #efeae3;
  color: #6d6258;
  box-shadow: inset 0 0 0 1px rgba(28, 22, 18, 0.12);
}
.btn.ok { background: var(--good-soft); color: var(--good); box-shadow: none; }
.btn.ok.is-on { background: var(--good); color: white; }
.btn.warn { background: #fff0f2; color: var(--rose); box-shadow: none; }
.btn.small { padding: 7px 11px; font-size: 12px; }
.text-link {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.text-link:hover { color: var(--accent); }

.stage {
  --layout: both;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--split)) 18px minmax(0, var(--rest));
  gap: 0;
  transition: grid-template-columns 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-mode="base"] .stage,
.stage[data-mode="base"] { --layout: base; grid-template-columns: minmax(0, 1fr) 0 0; }
html[data-mode="draft"] .stage,
.stage[data-mode="draft"] { --layout: draft; grid-template-columns: 0 0 minmax(0, 1fr); }
.stage[data-mode="base"] #pane-draft,
.stage[data-mode="base"] #pane-ai,
.stage[data-mode="base"] .splitter,
.stage[data-mode="draft"] #pane-base,
.stage[data-mode="draft"] .splitter {
  visibility: hidden;
  pointer-events: none;
}

.pane {
  container-type: size;
  position: relative;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
}
.pane[data-tree="base"] { box-shadow: inset 0 0 0 1px rgba(36, 62, 90, 0.05), var(--shadow); }
.pane[data-tree="draft"] { box-shadow: inset 0 0 0 1px rgba(255, 90, 54, 0.08), var(--shadow); }
.pane[data-tree="ai"] { box-shadow: inset 0 0 0 1px rgba(47, 107, 58, 0.1), var(--shadow); }
.pane[data-tree="ai"].is-active { box-shadow: 0 0 0 1px rgba(47, 107, 58, 0.35), var(--shadow); }
.pane.is-active { box-shadow: 0 0 0 1px rgba(255, 90, 54, 0.28), var(--shadow); }

.pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  gap: 8px 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.pane-title { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1 1 200px; }
.pane-tools { display: flex; align-items: center; gap: 10px; }
.search-wrap { position: relative; flex: 1 1 220px; min-width: 0; max-width: 360px; margin-left: auto; }
.pane-title h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.pane-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swatch {
  width: 12px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8eabcb, var(--sea));
  box-shadow: 0 6px 14px rgba(36, 62, 90, 0.25);
}
.swatch.draft {
  background: linear-gradient(180deg, #ffb199, var(--accent-hot));
  box-shadow: 0 6px 14px rgba(255, 90, 54, 0.35);
}
.swatch.ai {
  background: linear-gradient(180deg, #9fd3a9, var(--leaf));
  box-shadow: 0 6px 14px rgba(47, 107, 58, 0.3);
}
.back { display: none; }
.hide-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}
.hide-toggle input {
  appearance: none;
  width: 36px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: #e6dfd6;
  position: relative;
  transition: background 0.2s ease;
}
.hide-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(28, 22, 18, 0.2);
  transition: transform 0.2s ease;
}
.hide-toggle input:checked { background: var(--sea); }
.hide-toggle input:checked::after { transform: translateX(14px); }

.search-wrap input,
.field input,
.column-head input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(28, 22, 18, 0.045);
  padding: 11px 12px 11px 36px;
  font-size: 13px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.column-head input, .field input { padding-left: 12px; }
.search-wrap::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1.6px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-70%);
  pointer-events: none;
}
.search-wrap::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 21px;
  top: calc(50% + 3px);
  width: 6px;
  height: 1.6px;
  background: var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.search-wrap input:focus,
.field input:focus,
.column-head input:focus {
  background: white;
  border-color: rgba(255, 90, 54, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 90, 54, 0.12);
  outline: none;
}
.search-pop {
  position: absolute;
  z-index: 6;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 24px 60px rgba(28, 22, 18, 0.16);
  backdrop-filter: blur(16px);
}
.search-pop button, .move-list button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 9px 10px;
  text-align: left;
}
.search-pop button.is-on, .search-pop button:hover,
.move-list button.is-on, .move-list button:hover { background: var(--accent-soft); }
.search-pop small, .move-list small { color: var(--muted); font-size: 11px; }
.search-pop b { font-weight: 750; }
mark { background: #ffe36b; color: inherit; border-radius: 4px; padding: 0 2px; }

.twin-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 12px 12px;
  padding: 10px 12px 10px 14px;
  border-radius: 16px;
  background: rgba(255, 227, 107, 0.94);
  color: var(--twin-ink);
  font-size: 12.5px;
  font-weight: 720;
  box-shadow: 0 14px 34px rgba(120, 86, 10, 0.16);
  animation: hintIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.twin-hint[hidden] { display: none; }
.twin-hint span {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.twin-hint button {
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff8ea;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 760;
}
@keyframes hintIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.pane-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
}
.stage[data-mode="both"] .pane-body,
html[data-mode="both"] .pane-body,
html:not([data-mode]) .stage:not([data-mode]) .pane-body {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
html[data-mode="base"] #pane-base .pane-body,
html[data-mode="draft"] #pane-draft .pane-body,
html[data-mode="draft"] #pane-ai .pane-body,
.stage[data-mode="base"] #pane-base .pane-body,
.stage[data-mode="draft"] #pane-draft .pane-body,
.stage[data-mode="draft"] #pane-ai .pane-body {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 34%);
  grid-template-rows: minmax(0, 1fr);
}

.columns {
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  display: flex;
  overflow: auto;
  scroll-behavior: smooth;
}
.column {
  flex: 1 0 232px;
  max-width: 380px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.column-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
}
.column-head .title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.column-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.column-head .count, .row .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.list { min-height: 0; overflow: auto; padding: 8px; }
.row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 14px;
  margin-bottom: 3px;
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 9px 10px;
  text-align: left;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}
.row:hover .row-main { background: rgba(255, 255, 255, 0.8); }
.row.is-selected .row-main {
  background: linear-gradient(90deg, var(--accent-soft), rgba(255, 90, 54, 0.03));
  box-shadow: inset 3px 0 0 var(--accent-hot);
}
#pane-base .row.is-selected .row-main {
  background: linear-gradient(90deg, var(--sea-soft), transparent);
  box-shadow: inset 3px 0 0 var(--sea);
}
.row.is-checked .row-main { background: rgba(255, 90, 54, 0.06); }
.row.is-twin .row-main {
  background: rgba(255, 227, 107, 0.72);
  box-shadow: inset 0 0 0 1.5px rgba(196, 146, 20, 0.7);
  animation: twinIn 0.55s ease;
}
.row.is-selected.is-twin .row-main {
  background: rgba(255, 227, 107, 0.85);
  box-shadow: inset 3px 0 0 var(--accent-hot), inset 0 0 0 1.5px rgba(196, 146, 20, 0.75);
}
@keyframes twinIn {
  0% { box-shadow: 0 0 0 0 rgba(255, 196, 40, 0); }
  45% { box-shadow: 0 0 0 7px rgba(255, 196, 40, 0.35); }
}
.row.is-hidden .name { color: #9a8f86; text-decoration: line-through; }
.name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.015em;
}
.go {
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 1.7px solid currentColor;
  border-top: 1.7px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.35;
}
.row:hover .go, .row.is-selected .go { opacity: 0.8; }
.badges { display: inline-flex; gap: 4px; align-items: center; }
.badge {
  font-style: normal;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 780;
}
.badge.hide { background: #efeae3; color: #6d6258; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.act { background: var(--accent-soft); color: var(--accent); }
.badge.src-new { background: var(--leaf-soft); color: var(--leaf); }
.badge.src-base { background: var(--sea-soft); color: var(--sea); }
.badge.src-renamed { background: #fff1c2; color: #6b5300; }
.origin { margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; background: var(--leaf-soft); color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.origin b { color: var(--leaf); }
.origin .merged { display: block; margin-top: 4px; color: var(--muted); }
.name.has-path {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  white-space: normal;
}
.name-text,
.row-path {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-path {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
  line-height: 1.25;
}
.row.is-gone .name { color: var(--muted); }
.badge.edit, .badge.dup, .badge.space {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 99px;
}
.badge.edit { background: var(--accent-hot); }
.badge.dup { background: var(--rose); }
.badge.space { background: #e0a106; }
.check { display: grid; place-items: center; padding-left: 6px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.empty { padding: 22px 12px; color: var(--muted); font-size: 13px; }

.detail {
  min-width: 0;
  min-height: 0;
  max-height: 250px;
  overflow: auto;
  padding: 16px 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.2), rgba(243, 238, 230, 0.55));
  border-top: 1px solid var(--line);
}
html[data-mode="base"] #pane-base .detail,
html[data-mode="draft"] #pane-draft .detail,
html[data-mode="draft"] #pane-ai .detail,
.stage[data-mode="base"] #pane-base .detail,
.stage[data-mode="draft"] #pane-draft .detail,
.stage[data-mode="draft"] #pane-ai .detail {
  max-height: none;
  border-top: 0;
  border-left: 1px solid var(--line);
}
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.crumbs button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.crumbs button:hover { color: var(--accent); }
.crumbs .sep { display: none; }
.crumbs button:not(:first-child)::before {
  content: "/";
  margin-right: 6px;
  color: #d5cdc3;
  font-weight: 560;
}
.detail h3, .detail-empty h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.15;
}
.detail:has(.detail-empty) { padding: 14px 16px; }
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}
.detail-empty h3 { margin: 0 0 4px; font-size: 18px; }
.detail-empty .actions { margin: 0; flex: none; }
.detail-empty p, .status, .compare, .note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.status.hot { color: var(--accent); }
.status.done { color: var(--good); }
.compare {
  padding: 10px 12px;
  border-radius: 14px;
  background: white;
  color: #3c342c;
}
.note {
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 227, 107, 0.35);
  color: var(--twin-ink);
}
.actions { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; }
.meta div {
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}
.meta dt { color: var(--muted); font-size: 10px; font-weight: 780; letter-spacing: 0.06em; text-transform: uppercase; }
.meta dd { margin: 2px 0 0; font-size: 14px; font-weight: 760; font-variant-numeric: tabular-nums; }

.bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 8px 8px 8px 14px;
  border-radius: 18px;
  background: rgba(28, 22, 18, 0.94);
  color: #fff8f2;
  box-shadow: 0 16px 40px rgba(28, 22, 18, 0.22);
}
.bulk[hidden] { display: none; }
.bulk strong { font-size: 13px; margin-right: auto; font-weight: 720; }
.bulk .btn.ghost, .bulk .btn.mute { background: rgba(255, 255, 255, 0.1); color: white; }

.splitter { cursor: col-resize; position: relative; }
.splitter::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 99px;
  background: rgba(28, 22, 18, 0.18);
  transition: background 0.2s ease, height 0.2s ease;
}
.splitter:hover::before, .splitter.is-dragging::before {
  background: var(--accent-hot);
  height: 92px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(28, 22, 18, 0.28);
  backdrop-filter: blur(6px);
}
.scrim[hidden] { display: none; }
.journal {
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(480px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 30px 80px rgba(28, 22, 18, 0.22);
  transform: translateX(110%);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal.is-open { transform: translateX(0); }
.journal[hidden] { display: none; }
.journal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.journal-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.journal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.journal-actions { display: flex; gap: 8px; }
.journal-list { overflow: auto; padding: 10px; }
.change {
  width: 100%;
  border: 0;
  border-radius: 16px;
  background: transparent;
  padding: 12px;
  text-align: left;
  display: block;
}
.change:hover { background: rgba(255, 255, 255, 0.8); }
.change.is-batch { box-shadow: inset 2px 0 0 #ffb199; }
.change .when { color: var(--muted); font-size: 11px; font-weight: 680; }
.change .what { display: block; margin-top: 3px; font-size: 14px; font-weight: 760; letter-spacing: -0.02em; }
.change .sum { display: block; margin-top: 4px; color: #4d453d; font-size: 12px; line-height: 1.45; word-break: break-word; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 22, 18, 0.38);
  backdrop-filter: blur(8px);
}
.modal[hidden] { display: none; }
.dialog {
  width: min(500px, 100%);
  border-radius: 28px;
  background: #fffdf9;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(28, 22, 18, 0.28);
  animation: pop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pop {
  from { transform: translateY(10px) scale(0.98); }
  to { transform: none; }
}
.dialog h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.dialog p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 760; color: var(--muted); }
.move-list { max-height: 280px; overflow: auto; margin-top: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.confirm { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; font-weight: 680; }

.toast {
  position: fixed;
  z-index: 50;
  left: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff8f2;
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow);
  animation: hintIn 0.3s ease;
}
.toast[hidden] { display: none; }

@container (max-width: 860px) {
  .pane-title { flex: 0 1 auto; }
  .pane-title p, .pane .text-link { display: none; }
  .hide-toggle span { font-size: 0; }
  .hide-toggle span::after { content: "Скрыть"; font-size: 12px; }
}
@container style(--layout: both) and (max-height: 560px) {
  .pane-head { padding: 8px 10px; gap: 6px 8px; }
  .detail { display: none; }
  .column-head { padding: 8px 10px; gap: 0; }
  .column-head input { display: none; }
  .twin-hint { margin: 0 8px 8px; padding: 6px 8px 6px 12px; }
  .twin-hint span { -webkit-line-clamp: 1; }
}
@media (max-width: 1180px) {
  .pane-title p { display: none; }
  .pill:nth-child(n + 4) { display: none; }
}
@media (max-width: 980px) {
  .splitter { display: none; }
  .stage, html[data-mode="base"] .stage, html[data-mode="draft"] .stage,
  .stage[data-mode="base"], .stage[data-mode="draft"], .stage[data-mode="both"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .stage[data-mode="both"] { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .stage[data-mode="base"] #pane-draft,
  .stage[data-mode="base"] #pane-ai,
  .stage[data-mode="draft"] #pane-base { display: none; }
  .search-wrap { flex: 1 1 100%; max-width: none; margin-left: 0; }
  .detail:has(.detail-empty) { display: none; }
}
@media (max-width: 760px) {
  .app { padding: 8px; gap: 8px; }
  .top { border-radius: 22px; padding: 8px; gap: 8px; }
  .text-link { display: none; }
  .brand { min-width: 0; flex: 1 0 auto; }
  .mark { width: 36px; height: 36px; border-radius: 13px; }
  .mode { padding: 8px 11px; }
  .pill:not(.new) { display: none; }
  .stats { flex: 0 0 auto; }
  .top-actions { flex: 0 0 auto; }
  .back {
    display: inline-flex;
    border: 0;
    background: rgba(28, 22, 18, 0.05);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 780;
  }
  .column { display: none; max-width: none; }
  .columns .column:last-child { display: flex; flex: 1 1 auto; min-width: 0; }
  .stage[data-mode="base"] #pane-base .pane-body,
  .stage[data-mode="draft"] #pane-draft .pane-body,
  .stage[data-mode="draft"] #pane-ai .pane-body,
  html[data-mode="base"] #pane-base .pane-body,
  html[data-mode="draft"] #pane-draft .pane-body,
  html[data-mode="draft"] #pane-ai .pane-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 1fr) minmax(200px, 46%);
  }
  html[data-mode="base"] #pane-base .detail,
  html[data-mode="draft"] #pane-draft .detail,
  html[data-mode="draft"] #pane-ai .detail,
  .stage[data-mode="base"] #pane-base .detail,
  .stage[data-mode="draft"] #pane-draft .detail,
  .stage[data-mode="draft"] #pane-ai .detail {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .detail h3, .detail-empty h3 { font-size: 18px; }
  .row-main { padding: 12px 10px; }
  .journal { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}


/* Поисковые запросы */
.pill.q { background: rgba(36, 62, 90, 0.08); color: var(--sea); }
.pill.q b { color: var(--sea); }
.pill.warn { background: #fff1c2; color: #6b5300; }
.pill.warn b { color: #6b5300; }
.row .qn {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(36, 62, 90, 0.08);
  color: var(--sea);
  font-size: 10.5px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row .qn + .count { margin-left: 6px; }
.qpanel { margin-top: 14px; }
.qpanel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.qpanel-head strong { font-size: 13px; }
.qpanel-head .count { font-size: 11px; color: var(--muted); font-weight: 700; }
.qpanel-stats { font-size: 11.5px; color: var(--muted); }
.qpanel-head input {
  flex: 1 1 160px;
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 12.5px;
}
.qpanel-note { margin: 6px 0; font-size: 12.5px; color: var(--muted); }
.qg-list { display: flex; flex-direction: column; gap: 2px; }
.qg { border-radius: 10px; }
.qg.is-open { background: rgba(255, 255, 255, 0.65); }
.qg-main {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}
.qg-main:hover { background: rgba(255, 255, 255, 0.8); }
.qg-name { flex: 1 1 auto; min-width: 0; }
.qg-badges { display: inline-flex; gap: 4px; align-items: center; }
.qg-size { font-size: 11px; font-weight: 760; color: var(--muted); font-variant-numeric: tabular-nums; }
.qg-sub { display: block; margin: -3px 0 3px 8px; font-size: 11px; color: var(--muted); }
.qg-body { padding: 4px 10px 10px 18px; font-size: 12.5px; }
.qg-src { margin: 2px 0 6px; font-size: 11.5px; color: var(--muted); }
.qbadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 760;
  line-height: 1.4;
  white-space: nowrap;
}
.qbadge.geo { background: var(--sea-soft); color: var(--sea); }
.qbadge.st { background: #efeae3; color: #6d6258; }
.qbadge.nt { background: #fff1c2; color: #6b5300; }
.qbadge.conf { width: 10px; height: 10px; padding: 0; border-radius: 50%; }
.qbadge.conf-3 { background: var(--good); }
.qbadge.conf-2 { background: #e0a106; }
.qbadge.conf-1 { background: var(--rose); }
.qlinks { margin: 0 0 8px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.qlinks li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.qlinks small { color: var(--muted); }
.qlinks button { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: var(--sea); cursor: pointer; text-align: left; }
.qlinks button:hover { color: var(--accent); }
.qlink-tree { padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 760; }
.qlink-tree.base { background: var(--sea-soft); color: var(--sea); }
.qlink-tree.ai { background: var(--leaf-soft); color: var(--leaf); }
.qlink-tree.draft { background: var(--accent-soft); color: var(--accent); }
.qq { margin: 0; padding-left: 20px; columns: 2; column-gap: 18px; font-size: 12px; line-height: 1.5; }
.qq li { break-inside: avoid; }
mark.city { background: var(--twin); color: var(--twin-ink); border-radius: 4px; padding: 0 3px; font-weight: 700; }
.qs-input {
  width: 100%;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 14px;
}
.qs-results { max-height: 60vh; overflow: auto; margin-bottom: 10px; }
.qs-results h4 { margin: 8px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.qs-results h4 .count { font-weight: 700; }
.qs-list { margin: 0; padding: 0; list-style: none; }
.qs-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.qs-item:hover { background: rgba(255, 255, 255, 0.85); }
.qs-item small { color: var(--muted); font-size: 11.5px; }

.dialog:has(.qs-results) { width: min(760px, 100%); }
