:root {
  --bg: #f3efe6;
  --ink: #1c1914;
  --muted: #6b6458;
  --card: #fffcf6;
  --line: #ddd4c4;
  --accent: #1f5c45;
  --warn: #8a4b12;
  --danger: #8b1e1e;
  --ok: #1f5c45;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at top left, #efe6d4 0%, transparent 50%),
    linear-gradient(180deg, #f7f2e8, var(--bg));
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.note {
  background: #fff4e0;
  border: 1px solid #e7c896;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}
.llm-cost-note {
  background: #eef6f1;
  border-color: #b9d4c5;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,252,246,0.9);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 25;
}
.top-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem 0.7rem;
  min-width: 0;
}
.top-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: wrap;
}
.rupor-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
}
.rupor-logo-mark {
  width: 2.1rem;
  height: auto;
  display: block;
}
.top-separator {
  color: var(--muted);
}
.top-date { font-size: 0.9rem; }
.pulse {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.pulse-chip {
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f1e6;
  color: var(--muted);
}
.pulse-chip.ok {
  background: #eef5f1;
  border-color: #c5d9ce;
  color: var(--accent);
}
.pulse-chip.warn {
  background: #f8efe6;
  border-color: #e4c9a8;
  color: #8a5a22;
}
.top-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
}
.channel-select {
  font: inherit;
  max-width: 190px;
  padding: 0.38rem 1.9rem 0.38rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
}
.channel-select-inline {
  margin-left: -0.15rem;
}
.top-menu {
  position: relative;
}
.top-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  list-style-type: none;
  cursor: pointer;
  font: inherit;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}
.top-menu summary::marker {
  content: "";
  font-size: 0;
}
.top-menu summary::-webkit-details-marker { display: none; }
.top-menu summary::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  color: var(--muted);
  opacity: 0.85;
}
.top-menu[open] summary::after { transform: translateY(0.12rem) rotate(225deg); }
.top-menu[open] summary {
  border-color: #d6c8b1;
  background: #fffaf0;
}
.top-menu-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 190px;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 16px 35px -28px rgba(45, 36, 22, 0.55);
  display: grid;
  gap: 0.1rem;
  z-index: 20;
}
.top-menu-list-right {
  left: auto;
  right: 0;
}
.top-menu-list a {
  text-decoration: none;
  color: var(--ink);
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  white-space: nowrap;
}
.top-menu-list a:hover {
  background: #f7f1e6;
}
@media (max-width: 760px) {
  .top {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.55rem;
    padding-top: max(0.7rem, env(safe-area-inset-top, 0px));
  }
  .top-brand,
  .top-actions {
    width: 100%;
  }
  .top-actions {
    justify-content: flex-start;
  }
  .top-title-row {
    flex-wrap: wrap;
    width: 100%;
  }
  .top-separator { display: none; }
  .channel-select,
  .channel-select-inline {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
  }
  .pulse {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pulse::-webkit-scrollbar { display: none; }
  .pulse-chip { flex: 0 0 auto; }
}
.channels-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.1rem 2.5rem;
}
.channels-list {
  display: grid;
  gap: 0.75rem;
}
.channel-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}
.channel-row.is-selected {
  border-color: #b9d4c5;
  box-shadow: inset 3px 0 0 var(--accent);
}
.channel-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.channel-row h2 {
  margin: 0 0 0.15rem;
  font-family: var(--font);
  font-size: 1.35rem;
}
.channel-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.channel-metrics {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.channel-metrics span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: var(--muted);
  background: #f7f1e6;
  font-size: 0.82rem;
}
.channel-next {
  color: var(--muted);
  font-size: 0.9rem;
}
.readiness-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  line-height: 1.45;
}
.readiness-badge.ok {
  color: #155b43;
  border-color: #b7d8cc;
  background: #eef8f3;
}
.readiness-badge.warn {
  color: #7a4b14;
  border-color: #e2c79b;
  background: #fff6e8;
}
.channel-readiness {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.channel-readiness-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.channel-readiness span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  color: var(--muted);
  background: rgba(255,255,255,0.55);
  font-size: 0.84rem;
}
@media (max-width: 760px) {
  .channel-row-main { display: grid; }
  .channel-actions { justify-content: flex-start; }
}

button, .ghost {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.ok { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
button:disabled:hover { border-color: var(--line); }
button.ok:disabled {
  background: #cfc8bb;
  border-color: #cfc8bb;
  color: #7a7368;
  opacity: 1;
}
button.danger { background: #fff; color: var(--danger); border-color: #e2b0b0; }
a.ghost, button.ghost {
  background: transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.setup-panel {
  max-width: 1180px;
  margin: 1rem auto 0;
  padding: 1rem 1.1rem;
  border: 1px solid #e2c79b;
  border-radius: 12px;
  background: #fff8ec;
  display: grid;
  gap: 0.75rem;
}
.setup-panel h1 {
  margin: 0.12rem 0 0;
  font-family: var(--font);
  font-size: 1.25rem;
}
.setup-list,
.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.setup-list span {
  border: 1px solid #e2c79b;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  color: #6f501e;
  background: #fff;
  font-size: 0.86rem;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}
.login-card {
  width: min(360px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  display: grid;
  gap: 0.8rem;
}
.login-card h1 {
  margin: 0;
  font-family: var(--font);
  font-weight: 600;
}
.login-card label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
.login-card input {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.board {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) 1.25rem
    minmax(0, 1fr) 1.25rem
    minmax(0, 1.3fr);
  gap: 0.45rem;
  padding: 1rem;
  align-items: start;
}
.flow-arrow {
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--muted) 55%, transparent);
  font-size: 1.05rem;
  user-select: none;
}
@media (max-width: 960px) {
  .board {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .flow-arrow {
    height: 1.25rem;
  }
  .flow-arrow span { transform: rotate(90deg); }
}
.col {
  background: rgba(255,252,246,0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  min-height: 40vh;
}
/* --- единая шапка колонки --- */
.col-head { margin-bottom: 0.7rem; }
.col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.col-title-row h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.col-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: #eef5f1;
  border: 1px solid #c5d9ce;
  border-radius: 999px;
  padding: 0.02rem 0.5rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.col-count.low {
  color: var(--warn);
  background: #fbf3e8;
  border-color: #e6d3b3;
}
.col-meta {
  flex: none;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.col-link {
  flex: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.col-link:hover { text-decoration: underline; }
.col-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  min-height: 2.3em;
}
.col-hint-meta {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.col-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
  align-items: center;
}
.col-btn {
  flex: 1 1 auto;
  min-width: 6.2rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.col-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.col-btn.primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.col-meta-inline {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
/* В буфере одна кнопка — не растягиваем её на всю ширину колонки. */
.buffer-col .col-actions .col-btn { flex: 0 0 auto; }
.col-btn.is-quiet {
  background: transparent;
  font-weight: 500;
  opacity: 0.72;
}
.air-note {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
}
.air-note.hold {
  color: var(--danger);
}
.air-note.wait { color: var(--muted); }
.air-flag {
  display: inline-block;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  margin-right: 0.2rem;
}
@media (max-width: 960px) {
  .col-hint { min-height: 0; }
  .col { min-height: 0; }
  .col-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .col-btn {
    flex: 1 1 auto;
    width: 100%;
    white-space: normal;
  }
  .col-meta-inline,
  .col-hint-meta {
    white-space: normal;
  }
}

.day {
  border: 1.5px solid #b9d4c5;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.6rem;
  background: #f7fbf8;
}
.day.empty {
  border-style: dashed;
  border-color: #c5d9ce;
  background: #fafcfb;
}
.plan-more {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0.4rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.plan-more:hover {
  color: var(--ink);
  border-color: #b8aa94;
}
.plan-more[hidden] { display: none; }
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #d7e6dd;
}
.day-head .day-label {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.day.empty .day-label {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent);
}
.day-slot + .day-slot {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.day-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.day-label { white-space: nowrap; }
.day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.day-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  min-width: 0;
  font-size: 0.78rem;
}
.day-meta .ptime {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.88rem;
  margin-right: 0.1rem;
}
.day-meta .pid {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.day-meta .pid:hover { color: var(--accent); text-decoration: underline; }
.day-meta .st {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
}
.day-meta .tag {
  margin: 0;
  font-size: 0.68rem;
  padding: 0.22rem 0.4rem;
}
.day-slot .ttl {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.98rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
  font-weight: 600;
}
.day-slot .ttl:hover { text-decoration: underline; color: var(--accent); }
.editor input[type="date"] {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  width: 100%;
}
.time-selects {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: none;
  background: transparent;
}
.time-selects select {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.65rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  height: 2.65rem;
  box-sizing: border-box;
}
.time-sep {
  color: var(--muted);
  font-weight: 600;
  flex: 0 0 auto;
}
.time-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.tag {
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f1e6;
  color: var(--muted);
}
.tag-geo {
  background: #eef5f1;
  border-color: #c5d9ce;
  color: var(--accent);
}
.readonly-title {
  margin: 0;
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
}
.readonly-body {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.45;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.hole { color: var(--warn); font-weight: 600; }
button.compact, a.compact {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
}
.day-row-actions button.compact,
.day-top button.compact {
  margin-left: auto;
}
.idea-actions button.compact {
  margin-left: 0;
}
.idea-actions button#add-idea {
  position: relative;
  z-index: 2;
  cursor: pointer;
}
button.to-buf {
  border-color: #d2c7b4;
  color: var(--muted);
  background: transparent;
}
button.to-buf:hover { color: var(--ink); border-color: var(--accent); }

.buf-card, .idea-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  display: grid;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.idea-card { cursor: pointer; }
button.idea-trash {
  margin-left: auto;
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
button.idea-trash:hover,
button.idea-trash:focus-visible {
  border-color: #e2b0b0;
  background: #faf0f0;
  color: var(--danger);
  outline: none;
}
.buf-card { cursor: default; }
.buf-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  min-width: 0;
}
.buf-card-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}
.buf-card .buf-id {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  flex: 0 0 auto;
}
.buf-card .buf-id:hover { color: var(--accent); text-decoration: underline; }
.buf-card .tags { margin-top: 0; }
.buf-card > a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}
.buf-card > a:hover { color: var(--accent); text-decoration: underline; }
.buf-actions, .trash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.buf-card .place-buf.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.buf-card .place-buf.primary:hover { filter: brightness(1.06); }
.buf-card .place-now {
  padding: 0.22rem 0.5rem;
  font-size: 0.75rem;
  white-space: nowrap;
  font-weight: 600;
}
.buf-card button.idea-trash {
  margin-left: auto;
  width: 1.7rem;
  height: 1.7rem;
}
.card-menu {
  position: relative;
  flex: 0 0 auto;
}
.card-menu-toggle {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.card-menu-toggle:hover,
.card-menu.is-open .card-menu-toggle {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}
.card-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.2rem);
  z-index: 8;
  min-width: 8.5rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 10px 24px -14px rgba(0,0,0,0.35);
  display: grid;
  gap: 0.15rem;
}
.card-menu-pop[hidden] { display: none; }
.card-menu-pop button {
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}
.card-menu-pop button:hover { background: #f3efe6; }
.card-menu-pop .trash-buf { color: var(--danger); }
.card-menu-pop .to-buf {
  border: 0;
  background: transparent;
  color: var(--ink);
}
.trash-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  align-items: start;
}
@media (max-width: 860px) {
  .trash-page { grid-template-columns: 1fr; }
}
.trash-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  display: grid;
  gap: 0.35rem;
}
.trash-card .ttl {
  font-size: 0.92rem;
  line-height: 1.3;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}
.trash-card .ttl:hover { text-decoration: underline; }
.trash-actions a {
  font-size: 0.85rem;
  color: var(--accent);
}
.history-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
}
.history-lead {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
}
.history-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.85rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.history-row.is-archived .history-title {
  color: var(--muted);
  font-weight: 500;
}
.history-when {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.15rem;
}
.history-date {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.history-time {
  font-size: 0.78rem;
  color: var(--muted);
}
.history-body {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}
.history-title {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
}
.history-title:hover {
  color: var(--accent);
  text-decoration: underline;
}
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.history-meta span:not(:last-child)::after {
  content: "";
}
.history-badge {
  color: var(--warn);
}
.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.82rem;
}
.history-actions a {
  color: var(--accent);
  text-decoration: none;
}
.history-actions a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .history-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .history-when {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
  }
}
/* Опубликованный слот: спокойный «готово», без пунктирной/траурной рамки */
.day-slot.is-published {
  margin: 0 -0.35rem;
  padding: 0.45rem 0.55rem 0.5rem;
  border-radius: 10px;
  border: none;
  border-left: 3px solid #7da892;
  background: #f3f7f4;
  opacity: 1;
}
.day-slot.is-published .ttl {
  font-weight: 600;
  color: #3d4a42;
}
.day-slot.is-published .ttl:hover {
  color: var(--accent);
}
.day-slot.is-published .st {
  color: var(--accent) !important;
  font-weight: 600;
}
.day-slot.is-published .ptime,
.day-slot.is-published .day-label {
  color: #6a7a70;
}
.st-published .day-meta .st { color: var(--accent); }
.idea-card:hover {
  border-color: var(--accent);
  background: #faf6ee;
}
.buf-card .ttl, .idea-card .ttl {
  font-size: 0.92rem;
  line-height: 1.3;
  font-weight: 600;
}
.idea-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.idea-src { color: var(--accent); font-weight: 600; }
.idea-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.idea-badge {
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #c5d9ce;
  background: #eef5f1;
  color: var(--accent);
  font-weight: 600;
}
.idea-badge.transfer {
  border-color: #d9c9a8;
  background: #faf6ee;
  color: #8a6a2f;
}
.idea-badge.type {
  border-color: #cfc7bc;
  background: #f6f2eb;
  color: var(--muted);
}
.idea-badge.llm {
  border-color: #c3cbe0;
  background: #eef1f8;
  color: #3a4a7a;
}
.idea-badge.llm.hot {
  border-color: #b9a0d6;
  background: #f3edfa;
  color: #5a3a86;
}
.idea-llm-note {
  margin-top: 0.3rem;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #4a4a68;
}
.idea-why {
  margin-top: 0.3rem;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--accent);
}
.idea-preview {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.idea-brief-meta {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.idea-dlg-brief-meta {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}
.idea-dlg-brief {
  margin: 0.35rem 0 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbf8;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 14rem;
  overflow: auto;
}
.idea-char-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.idea-char-row .field-help { flex: 1; }
.idea-char-count {
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.05rem;
}
.idea-char-count.warn { color: #9a6b1f; }
.idea-char-count.full { color: #8a2f2f; font-weight: 600; }
.idea-char-hint { margin-top: 0.15rem; }
.idea-card.is-manual {
  border-color: #c5d9ce;
  background: #f7fbf8;
}
.idea-card.is-transfer {
  border-color: #e2d5b8;
  background: #fcfaf5;
}
.idea-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}
.idea-date { white-space: nowrap; }
.idea-score {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}
.manual-idea-form {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}
.manual-idea-form h3 { margin: 0; }
.manual-idea-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.manual-idea-head p { margin: 0.25rem 0 0; font-size: 0.86rem; }
.dialog-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.7rem;
  line-height: 1;
  padding: 0.1rem 0.2rem;
}
.idea-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: #f0efe9;
}
.idea-mode-tab {
  border: 0;
  border-radius: 9px;
  padding: 0.55rem 0.75rem;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
}
.idea-mode-tab.active {
  color: var(--text);
  background: var(--card);
  box-shadow: 0 1px 4px rgba(28, 25, 20, 0.1);
}
.idea-mode-panel {
  display: grid;
  gap: 0.55rem;
}
.idea-mode-panel[hidden] { display: none; }
.idea-main-label { font-weight: 650; }
.manual-idea-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
}
.manual-idea-form input,
.manual-idea-form textarea {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}
.manual-idea-form textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.45;
}
#own-text-body {
  min-height: 14rem;
}
.manual-idea-form input:focus,
.manual-idea-form textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
}
.field-help {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
}
#manual-idea-dialog,
#own-text-dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  width: min(560px, calc(100vw - 1.5rem));
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(28, 25, 20, 0.18);
}
#manual-idea-dialog::backdrop,
#own-text-dialog::backdrop { background: rgba(28,25,20,0.42); }
#manual-idea-dialog menu,
#own-text-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.1rem 0 0;
  padding: 0;
}
@media (max-width: 520px) {
  #manual-idea-dialog,
  #own-text-dialog { padding: 1rem; }
  #manual-idea-dialog menu button,
  #own-text-dialog menu button { flex: 1; }
}
.idea-angle {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.idea-draft-mode {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.idea-draft-mode select {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0.45rem 0.55rem;
}
.draft-contract-note {
  border-color: #c5d9ce;
  background: #eef5f1;
}
#idea-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  max-width: 520px;
  width: 92vw;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--card);
}
#idea-dialog::backdrop { background: rgba(28,25,20,0.35); }
.idea-dialog-body { display: grid; gap: 0.55rem; position: relative; }
.idea-dialog-body h3 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.15rem;
  line-height: 1.3;
}
.idea-dialog-body .dialog-x {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
}
.idea-dlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding-right: 1.4rem;
}
.idea-dlg-head h3 { flex: 1; }
.idea-dlg-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f1e6;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.idea-dlg-badge.high {
  background: #eef5f1;
  border-color: #c5d9ce;
  color: var(--accent);
}
.idea-dlg-source {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.idea-src-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.idea-src-link:hover { text-decoration: underline; }
.idea-meta-sep { color: var(--line); }
.idea-dlg-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.idea-chip {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f1e6;
  color: var(--muted);
}
.idea-dlg-angle {
  margin: 0.15rem 0 0;
  padding: 0.55rem 0.75rem 0.6rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: #f7fbf8;
}
.idea-dlg-angle .callout-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.idea-dlg-angle p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--ink);
}
.idea-dlg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.2rem 0 0;
  padding: 0;
  align-items: center;
}
.idea-dlg-spacer { flex: 1; }

/* --- модалка результата охоты --- */
#hunt-result-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  max-width: 560px;
  width: 92vw;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--card);
}
#hunt-result-dialog::backdrop { background: rgba(28,25,20,0.42); }
.hunt-result-body { display: grid; gap: 0.7rem; }
.hunt-result-body h3 { margin: 0; font-size: 1.22rem; line-height: 1.25; }
.hunt-res-headline { margin: 0; font-size: 0.92rem; line-height: 1.4; font-weight: 500; }
.hunt-res-headline.good { color: var(--ink); }
.hunt-res-headline.flat { color: var(--muted); }
.hunt-res-mix {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.hunt-res-top { font-size: 0.86rem; }
.hunt-res-top-title {
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}
.hunt-res-top ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.hr-top-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f6;
}
.hr-top-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: start;
  text-align: left;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: inherit;
  min-width: 0;
}
button.hr-top-main { cursor: pointer; }
button.hr-top-main:hover .hr-top-title { text-decoration: underline; }
.hr-top-copy { display: grid; gap: 0.15rem; min-width: 0; }
.hr-top-title { font-weight: 600; line-height: 1.3; }
.hr-top-why {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}
.hr-top-src { font-size: 0.75rem; color: var(--muted); }
.hr-top-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1f5c45;
  background: #eef6f1;
  border: 1px solid #b9d4c5;
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
  margin-top: 0.1rem;
  white-space: nowrap;
}
.hr-top-badge.high { background: #1f5c45; color: #fff; border-color: #1f5c45; }
.hr-top-link {
  font-size: 0.75rem;
  color: var(--accent);
  white-space: nowrap;
  margin-top: 0.15rem;
}
.hunt-res-errors {
  font-size: 0.82rem;
  color: #9a3b3b;
  background: #faf0f0;
  border: 1px solid #e2b8b8;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}
.hunt-result-body menu {
  display: flex; gap: 0.5rem; margin: 0; padding: 0; justify-content: flex-end;
}

.editor {
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}
.editor label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
.editor input[type="text"],
.editor input[type="date"],
.editor textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  width: 100%;
}
.editor textarea {
  font-family: var(--font);
  line-height: 1.45;
  min-height: 55vh;
  resize: vertical;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  align-items: center;
}
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  align-items: start;
}
@media (max-width: 640px) {
  .meta-grid { grid-template-columns: 1fr; }
}
.meta-field {
  display: grid;
  grid-template-rows: auto auto minmax(1.15rem, auto);
  gap: 0.35rem;
  min-width: 0;
}
.meta-label {
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--ink);
}
.meta-hint {
  font-size: 0.78rem;
  line-height: 1.25;
  min-height: 1.15rem;
}
.meta-field input[type="date"],
.meta-field select,
.meta-field .time-selects {
  width: 100%;
  min-height: 2.65rem;
  box-sizing: border-box;
}
.meta-row label { flex: 1 1 200px; }
.rework-box, .place-box {
  display: grid;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  max-width: 420px;
  width: 92vw;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--card);
}
dialog::backdrop { background: rgba(28,25,20,0.35); }

#fill-dialog {
  padding: 0.85rem 1.05rem 1.15rem;
  max-width: 440px;
}
.fill-handle {
  display: none;
}
.fill-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.fill-head h3 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.22rem;
  line-height: 1.25;
}
.fill-sub {
  margin: 0.22rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.fill-head .dialog-x {
  flex: 0 0 auto;
  margin-top: -0.15rem;
}
#fill-options {
  display: grid;
  gap: 1rem;
  margin: 0;
}
.fill-sec {
  display: grid;
  gap: 0.4rem;
}
.fill-sec-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.fill-pick {
  display: grid;
  gap: 0.22rem;
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.fill-pick:hover,
.fill-pick:focus-visible {
  border-color: var(--accent);
  background: #f7fbf8;
  outline: none;
}
.fill-pick-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}
.fill-pick-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.fill-pick-secondary {
  background: transparent;
}
.fill-empty {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: #f7f1e6;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.fill-quiet {
  justify-self: start;
  width: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0.15rem 0;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 0;
}
.fill-quiet:hover {
  border-color: transparent;
  text-decoration: underline;
  background: transparent;
}

#toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  max-width: min(420px, 90vw);
  z-index: 50;
}
#busy {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 20, 0.45);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
#busy[hidden] { display: none !important; }
.busy-card {
  width: min(440px, 92vw);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem 1.2rem;
  display: grid;
  gap: 0.75rem;
  justify-items: stretch;
  text-align: left;
}
.busy-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.busy-card-head .busy-spinner {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}
.busy-card-copy { min-width: 0; flex: 1; }
#busy-title {
  font-family: var(--font);
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
}
#busy-status {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--muted);
}
.busy-stages {
  list-style: none;
  margin: 0.1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.busy-stages[hidden],
.busy-meter[hidden] {
  display: none !important;
}
.busy-stage {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 0.45rem;
  align-items: start;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.86rem;
  line-height: 1.3;
}
.busy-stage .mark {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1.5px solid #d2c7b4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: transparent;
  margin-top: 0.1rem;
  background: #fff;
}
.busy-stage .label { font-weight: 600; color: var(--ink); }
.busy-stage .hint {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}
.busy-stage.is-done { opacity: 0.72; }
.busy-stage.is-done .mark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.busy-stage.is-done .mark::before { content: "✓"; }
.busy-stage.is-active {
  background: #eef6f1;
  border-color: #b9d4c5;
}
.busy-stage.is-active .mark {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px #eef6f1, inset 0 0 0 5px var(--accent);
}
.busy-stage.is-todo .label {
  color: var(--muted);
  font-weight: 500;
}
.busy-stage.is-todo .hint { display: none; }
.busy-meter { display: grid; gap: 0.35rem; margin-top: 0.1rem; }
.busy-meter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
#busy-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
}
#busy-eta { font-size: 0.78rem; color: var(--muted); }
.busy-progress {
  height: 10px;
  border-radius: 999px;
  background: #e9e1d0;
  overflow: hidden;
}
.busy-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2a7a58, #1f5c45);
  transition: width 0.25s ease-out;
}
.busy-progress.slow .busy-progress-fill {
  animation: busyPulse 1.1s ease-in-out infinite;
}
@keyframes busyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
#busy-sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: left;
}
.busy-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.readonly-title {
  margin: 0;
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
}
.readonly-body {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.45;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.editor select {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  width: 100%;
}

.dm-link-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem auto 0;
  max-width: 1280px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dm-link-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* --- Источники --- */
.sources-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2.5rem;
  display: grid;
  gap: 1.4rem;
}
.sources-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: -0.7rem;
}
.sources-toolbar-actions {
  display: flex;
  gap: 0.5rem;
}

.source-decisionbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem;
}
.source-tile {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: var(--card);
  display: grid;
  gap: 0.18rem;
}
.source-tile span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.source-tile strong {
  font-size: 1.35rem;
  line-height: 1.15;
}
.source-tile.good {
  border-color: #c5d9ce;
  background: #eef5f1;
}
.source-tile.warn,
.source-tile.telegram.warn {
  border-color: #e4c9a8;
  background: #fbf3e8;
}
.source-tile.telegram strong {
  font-size: 0.95rem;
}
.system-check {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: var(--card);
  display: grid;
  gap: 0.45rem;
}
.system-check.ok {
  border-color: #c5d9ce;
  background: #eef5f1;
}
.system-check.warn {
  border-color: #e4c9a8;
  background: #fbf3e8;
}
.system-check > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}
.system-check ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}
.system-check li {
  font-size: 0.82rem;
  line-height: 1.35;
}
.system-check li.error { color: var(--danger); }
.system-check li.warn { color: var(--warn); }
.system-check li span {
  color: var(--muted);
  font-size: 0.74rem;
  margin-right: 0.3rem;
}
.system-check li em {
  color: var(--muted);
  font-style: normal;
}
.sources-lead { margin: 0; line-height: 1.45; font-size: 0.92rem; }
.telegram-diagnostic {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: var(--card);
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.telegram-diagnostic.warn {
  border-color: #e4c9a8;
  background: #fbf3e8;
}
.telegram-diagnostic.ok {
  border-color: #c5d9ce;
  background: #eef5f1;
}
.telegram-flags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.telegram-flags span {
  font-size: 0.72rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  color: var(--muted);
}
.telegram-flags span.ok {
  border-color: #c5d9ce;
  color: var(--accent);
}
.telegram-flags span.warn {
  border-color: #e4c9a8;
  color: var(--warn);
}
.source-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.source-filters button {
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  background: var(--card);
}
.source-filters button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sources-group h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 650;
}
.sources-table {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.45rem;
  background: var(--card);
}
.sources-cards {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 0.55rem;
}
.sources-head,
.sources-row {
  display: grid;
  grid-template-columns: minmax(220px, 2.4fr) minmax(120px, 1.2fr) 0.55fr 0.55fr 0.55fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
}
.sources-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
}
.sources-row {
  border-radius: 10px;
}
.sources-row:hover { background: #f7f7f4; }
.sources-cards .sources-row {
  grid-template-columns: minmax(260px, 1.8fr) minmax(170px, 0.95fr) minmax(260px, 1.15fr);
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}
.sources-cards .sources-row:hover { background: #fffefa; }
.sources-main {
  display: grid;
  gap: 0.2rem;
}
.sources-main strong { font-size: 0.95rem; }
.sources-url, .sources-query {
  font-size: 0.72rem;
  word-break: break-word;
  line-height: 1.35;
}
.sources-query {
  display: block;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}
.sources-stat {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  padding-top: 0.1rem;
}
.sources-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.src-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f3f3ef;
  color: var(--muted);
}
.src-pill.ok {
  border-color: #c5d9ce;
  background: #eef5f1;
  color: var(--accent);
}
.src-pill.fail {
  border-color: #e2b8b8;
  background: #faf0f0;
  color: #9a3b3b;
}
.src-pill.pending { font-weight: 500; }
.src-pill.state-has_topics,
.src-pill.state-working,
.src-pill.quality-strong {
  border-color: #c5d9ce;
  background: #eef5f1;
  color: var(--accent);
}
.src-pill.state-broken,
.src-pill.quality-broken {
  border-color: #e2b8b8;
  background: #faf0f0;
  color: #9a3b3b;
}
.src-pill.state-silent,
.src-pill.quality-silent,
.src-pill.quality-noisy {
  border-color: #e4c9a8;
  background: #fbf3e8;
  color: var(--warn);
}
.src-pill.state-disabled {
  color: var(--muted);
  background: #f3f3ef;
}
.src-probe {
  border-radius: 8px;
  background: transparent;
}
.source-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}
.source-metrics div {
  border-left: 1px solid var(--line);
  padding-left: 0.5rem;
  min-width: 0;
}
.source-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}
.source-metrics strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.source-preview {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
  display: grid;
  gap: 0.4rem;
}
.source-preview[hidden] { display: none; }
.source-preview-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #f8f5ee;
}
.source-preview-item:hover {
  background: #f1eadf;
}
.source-preview a {
  display: grid;
  gap: 0.12rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
  min-width: 0;
}
.source-preview a:hover {
  text-decoration: none;
  background: transparent;
}
.source-preview a span,
.source-preview a em {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  line-height: 1.3;
}
.src-to-idea {
  min-height: 26px;
  padding: 0.16rem 0.42rem;
  font-size: 0.72rem;
  white-space: nowrap;
}
.source-preview-bar {
  display: flex;
  justify-content: flex-end;
}
.src-translate {
  min-height: 26px;
  padding: 0.16rem 0.42rem;
  font-size: 0.72rem;
}
@media (max-width: 760px) {
  .sources-head { display: none; }
  .sources-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.7rem;
  }
  .sources-main { grid-column: 1 / -1; }
  .sources-status { grid-column: 1 / -1; }
  .sources-cards .sources-row {
    grid-template-columns: 1fr;
  }
  .source-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.channel-total {
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

/* --- управление источниками --- */
.sources-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sources-row.is-off { opacity: 0.5; }
.sources-row.is-off .sources-main strong { text-decoration: line-through; }

.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 30px; height: 17px; border-radius: 999px;
  background: #d0d0c8; border: 1px solid var(--line);
  position: relative; transition: background 0.15s;
  flex: 0 0 auto;
}
.switch-track::after {
  content: ""; position: absolute; top: 1px; left: 1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(13px); }

.src-weight {
  font-size: 0.7rem; color: var(--muted);
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.src-weight-input {
  width: 3rem; font-size: 0.78rem; padding: 0.1rem 0.25rem;
  border: 1px solid var(--line); border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.src-group-input {
  max-width: 10.5rem;
  font-size: 0.72rem;
  padding: 0.16rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}
.src-note-input {
  margin-top: 0.25rem;
  font: inherit;
  font-size: 0.76rem;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f8f5ee;
  padding: 0.35rem 0.45rem;
}
.src-note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.src-del {
  margin-left: auto;
  border: 1px solid var(--line); background: #f3f3ef;
  color: var(--muted); border-radius: 6px;
  width: 22px; height: 22px; line-height: 1; cursor: pointer;
  font-size: 1rem; padding: 0;
}
.src-del:hover { border-color: #e2b8b8; background: #faf0f0; color: #9a3b3b; }

.add-source {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 0.9rem 1rem; background: var(--card);
  display: grid; gap: 0.7rem;
}
.add-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}
.add-source label {
  display: grid; gap: 0.25rem;
  font-size: 0.78rem; color: var(--muted);
}
.add-source input, .add-source select {
  font-size: 0.85rem; padding: 0.35rem 0.45rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}
.add-source-actions { display: flex; gap: 0.5rem; }

.src-health {
  font-size: 0.72rem; line-height: 1.35; margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.src-health.bad { color: #9a3b3b; }
.src-health span[title] { text-decoration: underline dotted; cursor: help; }

.sources-table.editions .sources-head,
.sources-table.editions .sources-row {
  grid-template-columns: minmax(200px, 2.2fr) 0.8fr 0.5fr 0.5fr 0.5fr 0.6fr;
}
@media (max-width: 760px) {
  .sources-table.editions .sources-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* --- компактное управление источниками --- */
.sources-page {
  max-width: 820px;
  gap: 0.85rem;
}
.sources-alert {
  margin: 0;
  font-size: 0.88rem;
  color: var(--warn);
}
.sources-empty {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}
.src-fresh {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.src-ref {
  color: var(--muted);
}
.src-noise {
  color: var(--warn);
}
.sources-body .top .pulse {
  display: none;
}
.sources-body .top {
  padding-bottom: 0.6rem;
}
.sources-statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  font-size: 0.82rem;
}
.sources-statusbar strong { font-size: 0.9rem; }
.sources-statusbar .ok { color: var(--accent); }
.sources-statusbar .warn { color: var(--warn); }
.status-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
}
.sources-diagnostics {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
}
.sources-diagnostics.warn {
  border-color: #e4c9a8;
  background: #fbf3e8;
}
.sources-diagnostics.ok {
  border-color: #c5d9ce;
  background: #eef5f1;
}
.sources-diagnostics summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.diagnostics-body {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.45rem;
}
.diagnostics-body ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.22rem;
}
.diagnostics-body li.error { color: var(--danger); }
.diagnostics-body li.warn { color: var(--warn); }
.diagnostics-body li span,
.diagnostics-body li em {
  color: var(--muted);
  font-style: normal;
}
.source-filters {
  gap: 0.25rem;
  margin-bottom: 0.05rem;
}
.source-filters button {
  border-radius: 7px;
  padding: 0.22rem 0.48rem;
  font-size: 0.72rem;
  min-height: 28px;
}
.sources-group {
  display: grid;
  gap: 0.35rem;
}
.sources-group-title {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  list-style-position: outside;
}
.sources-group-title .channel-total {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
}
.sources-cards {
  gap: 0.28rem;
}
.sources-cards .sources-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.28rem;
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  background: rgba(255,255,255,0.7);
}
.sources-cards .sources-row:hover {
  background: #fffefa;
}
.source-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.sources-title {
  min-width: 0;
  gap: 0.3rem;
}
.sources-title strong {
  font-size: 0.88rem;
  line-height: 1.2;
}
.sources-status {
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 0.25rem;
}
.source-row-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.18rem 0.5rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}
.source-row-sub > * {
  min-width: 0;
}
.src-kind {
  color: var(--ink);
  font-weight: 600;
}
.source-row-sub .sources-url,
.source-row-sub .sources-query {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}
.source-row-sub .sources-query {
  display: inline-block;
  vertical-align: bottom;
}
.source-metrics {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.48rem;
  font-size: 0.7rem;
}
.source-metrics span {
  display: inline;
  color: var(--muted);
}
.source-metrics strong {
  font-size: 0.78rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.source-metrics div {
  border-left: 0;
  padding-left: 0;
}
.src-pill {
  font-size: 0.68rem;
  padding: 0.14rem 0.36rem;
}
.src-health {
  margin-top: 0;
  font-size: 0.7rem;
  max-width: 430px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.src-weight-input {
  width: 2.5rem;
  min-height: 24px;
}
.src-probe,
.src-preview {
  min-height: 26px;
  padding: 0.16rem 0.42rem;
  font-size: 0.72rem;
}
.src-more {
  position: relative;
}
.src-more summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--muted);
}
.src-more summary::-webkit-details-marker { display: none; }
.src-more-panel {
  position: absolute;
  z-index: 8;
  right: 0;
  top: calc(100% + 0.25rem);
  width: min(280px, 86vw);
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(37, 31, 23, 0.12);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  align-items: stretch;
}
.src-more-panel label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
}
.src-group-input {
  max-width: none;
  min-height: 30px;
  font-size: 0.74rem;
}
.src-note-input {
  margin-top: 0;
  min-height: 30px;
  background: #fff;
}
.src-del {
  margin-left: 0;
  width: auto;
  height: auto;
  min-height: 30px;
  padding: 0.2rem 0.5rem;
  justify-self: start;
}
.source-preview {
  padding-top: 0.35rem;
}
.source-preview-item {
  padding: 0.38rem 0.5rem;
}
.add-source-dialog {
  width: min(760px, 94vw);
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}
.add-source-dialog::backdrop {
  background: rgba(32, 28, 23, 0.28);
  backdrop-filter: blur(2px);
}
.add-source-dialog .add-source {
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: 0 20px 60px rgba(37, 31, 23, 0.2);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.dialog-x {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.add-source-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.rss-find-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: end;
}
.rss-find-block label { margin: 0; }
#find-rss {
  min-height: 32px;
}
#rss-found {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
#rss-found[hidden] { display: none; }
#rss-found p { margin: 0; }
.rss-pick {
  text-align: left;
  max-width: 100%;
}
.add-source label {
  font-size: 0.72rem;
}
.add-source input,
.add-source select {
  min-height: 32px;
  font-size: 0.78rem;
  padding: 0.25rem 0.38rem;
}
@media (max-width: 560px) {
  .source-row-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }
  .sources-status {
    justify-content: flex-start;
  }
  .src-more-panel {
    left: 0;
    right: auto;
    grid-template-columns: 1fr;
  }
  .add-source-grid {
    grid-template-columns: 1fr;
  }
}

/* --- дашборд расхода DeepSeek --- */
.costs-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2.5rem;
  display: grid;
  gap: 1.5rem;
}
a.pulse-chip { text-decoration: none; }
a.pulse-chip.ok { background: var(--accent); color: #fff; border-color: var(--accent); }

.cost-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}
.cost-tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: var(--card);
}
.cost-tile.big { border-color: #c5d9ce; background: #f4f9f6; }
.cost-tile-val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cost-tile.big .cost-tile-val { color: var(--accent); }
.cost-tile-lbl { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }

.cost-block h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.cost-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 0.45rem;
  display: grid;
  gap: 0.15rem;
}
.cost-head, .cost-row {
  display: grid;
  grid-template-columns: minmax(160px, 2fr) 0.8fr 1fr 1fr 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem 0.6rem;
}
.cost-table.top .cost-head, .cost-table.top .cost-row {
  grid-template-columns: 0.9fr 1.4fr 2fr 0.9fr 0.7fr;
}
.cost-head {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 0.5rem;
}
.cost-num { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.cost-num.strong { font-weight: 700; }
.cost-task { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; }
.cost-ref {
  font-size: 0.82rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cost-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.cost-dot-draft { background: #1f5c45; }
.cost-dot-hook { background: #2f7c8a; }
.cost-dot-rewrite { background: #8a6a2f; }
.cost-dot-judge { background: #3a4a7a; }
.cost-dot-editor { background: #6a3a86; }
.cost-dot-reader { background: #b06a1f; }
.cost-dot-other { background: #9a3b3b; }
.cost-bar-wrap { padding: 0 0.6rem 0.3rem; }
.cost-bar { height: 5px; border-radius: 999px; min-width: 2px; background: var(--muted); }

.cost-days {
  display: flex; align-items: flex-end; gap: 3px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); padding: 0.8rem 0.7rem 0.5rem;
  overflow-x: auto;
}
.cost-day { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 16px; flex: 1 0 auto; }
.cost-day-bar-track { height: 90px; width: 60%; display: flex; align-items: flex-end; }
.cost-day-bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.cost-day-lbl { font-size: 0.62rem; color: var(--muted); white-space: nowrap; transform: rotate(-45deg); transform-origin: center; }
.cost-note { font-size: 0.8rem; line-height: 1.45; }
@media (max-width: 760px) {
  .cost-head { display: none; }
  .cost-row { grid-template-columns: 1fr 1fr; }
  .cost-task { grid-column: 1 / -1; }
}

/* --- вкладки страницы поста --- */
.post-tabs {
  display: flex;
  gap: 0.15rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.post-tab {
  border: none;
  background: transparent;
  border-radius: 8px 8px 0 0;
  padding: 0.38rem 0.65rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.post-tab:hover { color: var(--ink); border-color: transparent; }
.post-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.tab-dot {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f3f3ef;
  color: var(--muted);
  line-height: 1.4;
}
.tab-dot.good { background: #eef5f1; border-color: #c5d9ce; color: var(--accent); }
.tab-dot.mid { background: #fbf3e8; border-color: #e6d3b3; color: var(--warn); }
.tab-dot.bad { background: #faf0f0; border-color: #e2b8b8; color: #9a3b3b; }
.tab-panel { display: grid; gap: 0.85rem; }
/* [hidden] должен побеждать display:grid — иначе скрытые вкладки/панели видны */
.tab-panel[hidden],
.quality-panel[hidden],
.reader-panel[hidden] { display: none; }
.tab-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.tab-actions-hint { font-size: 0.8rem; }
.tab-empty { margin: 0; }
.tab-cost {
  font-size: 0.68rem; font-weight: 700; color: var(--accent);
  background: #eef5f1; border: 1px solid #c5d9ce; border-radius: 999px;
  padding: 0.1rem 0.4rem; line-height: 1.4;
}
.tab-cost:empty { display: none; }

.hook-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0.65rem;
  display: grid;
  gap: 0.45rem;
}
.hook-box-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.8rem;
}
.hook-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hook-head-actions button {
  font-size: 0.8rem;
  padding: 0.28rem 0.55rem;
}
.hook-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hook-box h2 {
  margin: 0.05rem 0 0;
  font-size: 0.98rem;
}
.hook-score {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  border: 1px solid #c5d9ce;
  background: #eef5f1;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  white-space: nowrap;
}
.hook-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.7rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}
.hook-choice.is-selected .hook-text { font-weight: 750; }
.hook-text {
  font-size: 0.92rem;
  line-height: 1.35;
}
.hook-meta {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}
.hook-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 0.35rem;
}
.hook-use {
  grid-row: span 2;
  align-self: center;
  font-size: 0.8rem;
  padding: 0.28rem 0.55rem;
}
.hook-error {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
}
.hook-empty {
  border-top: 1px solid var(--line);
  margin: 0;
  padding-top: 0.45rem;
  font-size: 0.84rem;
}
@media (max-width: 640px) {
  .hook-box-head { display: grid; }
  .hook-head-actions { justify-content: start; }
  .hook-choice { grid-template-columns: 1fr; }
  .hook-use { grid-row: auto; justify-self: start; }
}

.postcost {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 0.5rem 0.9rem; display: grid; gap: 0.1rem; max-width: 460px;
}
.pc-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line);
}
.pc-row:last-child { border-bottom: none; }
.pc-l { font-size: 0.92rem; }
.pc-sub { font-size: 0.8rem; }
.pc-v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pc-total { border-top: 2px solid var(--line); margin-top: 0.15rem; }
.pc-total .pc-l { font-weight: 700; }
.pc-total .pc-v { font-weight: 800; font-size: 1.05rem; color: var(--accent); }

/* --- история версий поста (аккордеон на всю ширину) --- */
.versions-panel {
  display: block;
}
.versions-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.version-item {
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.version-item:last-child { border-bottom: none; }
.version-item.is-open {
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
}
.version-summary {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr) auto;
  gap: 0.45rem 0.55rem;
  align-items: start;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  cursor: default;
  font: inherit;
}
.version-item.is-expandable .version-summary {
  cursor: pointer;
}
.version-item.is-expandable .version-summary:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.version-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.25rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  transition: transform 0.15s ease;
  user-select: none;
}
.version-item.is-expandable .version-chevron::before {
  content: "▸";
}
.version-item.is-open .version-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}
.version-item.is-fact .version-chevron {
  visibility: hidden;
}
.version-summary-main {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.version-summary-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}
.version-when {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.version-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}
.version-sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.version-summary-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  padding-top: 0.05rem;
}
.version-hint {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.version-detail {
  padding: 0 0.75rem 0.85rem 2.4rem;
  border-top: 1px dashed var(--line);
}
.version-detail[hidden] { display: none !important; }
.version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0.55rem 0 0.45rem;
}
.version-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.version-actions button {
  padding: 0.42rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.2;
}
.version-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
}
.version-snapshot h3 {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
}
.version-snapshot .version-body {
  max-height: 36rem;
}
.version-body,
.version-diff {
  margin: 0;
  max-height: 32rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem;
}
.vd-line {
  padding: 0.05rem 0.2rem;
  border-radius: 4px;
}
.vd-add { background: #eaf5ee; color: #195a3d; }
.vd-del { background: #faeeee; color: #8a3434; text-decoration: line-through; }
.vd-same { color: #6d665d; }
.vd-skip {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  background: transparent;
  padding: 0.35rem 0.2rem;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin: 0.25rem 0;
}
.vd-change {
  background: #f7f5f0;
  padding: 0.15rem 0.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.vd-part-del {
  background: #faeeee;
  color: #8a3434;
  text-decoration: line-through;
}
.vd-part-add {
  background: #eaf5ee;
  color: #195a3d;
}
.vd-part-same { color: #3d3a35; }
.vd-summary { margin: 0 0 0.4rem; font-size: 0.8rem; }
@media (max-width: 860px) {
  .version-grid {
    grid-template-columns: 1fr;
  }
  .version-detail {
    padding-left: 0.75rem;
  }
  .version-summary {
    grid-template-columns: 1.1rem minmax(0, 1fr);
  }
  .version-summary-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }
}

/* --- редактор качества --- */
.q-badge {
  font-size: 0.68rem; font-weight: 700; line-height: 1;
  padding: 0.2rem 0.45rem; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap;
}
.q-badge.good { background: #eef5f1; border-color: #c5d9ce; color: var(--accent); }
.q-badge.mid { background: #fbf3e8; border-color: #e6d3b3; color: var(--warn); }

.quality-panel {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); padding: 0.9rem 1rem; display: grid; gap: 0.75rem;
}
.q-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.q-verdict {
  font-weight: 700; font-size: 0.85rem; padding: 0.3rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--line);
}
.q-verdict.good { background: #eef5f1; border-color: #c5d9ce; color: var(--accent); }
.q-verdict.mid { background: #fbf3e8; border-color: #e6d3b3; color: var(--warn); }
.q-score { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-when { font-size: 0.78rem; margin-left: auto; }
.review-timeline {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.q-stale {
  font-size: 0.82rem; font-weight: 600;
  color: #8a4b12; background: #fbf3e8; border: 1px solid #e6d3b3;
  border-radius: 8px; padding: 0.45rem 0.6rem;
}
.q-read-take {
  font-size: 0.9rem; line-height: 1.45; font-style: italic;
  color: #3a4a4a; background: #f4f6f5; border-left: 3px solid var(--accent);
  padding: 0.5rem 0.7rem; border-radius: 0 8px 8px 0;
}
.q-criteria { display: grid; gap: 0.3rem; }
.q-crit { display: grid; grid-template-columns: minmax(110px, 0.9fr) 1fr auto; align-items: center; gap: 0.6rem; }
.q-crit-lbl { font-size: 0.82rem; color: var(--muted); }
.q-crit-track { height: 7px; background: #eee7d8; border-radius: 999px; overflow: hidden; }
.q-crit-bar { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.q-crit-bar.low { background: #b5643a; }
.q-crit-bar.high { background: #1f7a55; }
.q-crit-num { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.85rem; min-width: 1.2rem; text-align: right; }

.q-list-title { font-size: 0.82rem; font-weight: 650; margin-top: 0.1rem; }
.q-list { margin: 0.1rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.q-list li { font-size: 0.86rem; line-height: 1.4; }
.q-list.q-risks li { color: #9a3b3b; }

/* --- панель «Взгляд читателя» --- */
.reader-panel {
  border: 1px solid #cdbfa0; border-radius: 14px;
  background: #fdfaf3; padding: 0.9rem 1rem; display: grid; gap: 0.7rem;
}
.r-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.r-ic { font-size: 1.1rem; }
.r-cap { font-weight: 650; font-size: 0.9rem; }
.r-verdict {
  margin-left: auto; font-weight: 700; font-size: 0.82rem;
  padding: 0.28rem 0.6rem; border-radius: 999px; border: 1px solid var(--line);
}
.r-verdict.r-good { background: #eef5f1; border-color: #c5d9ce; color: var(--accent); }
.r-verdict.r-mid { background: #fbf3e8; border-color: #e6d3b3; color: var(--warn); }
.r-verdict.r-bad { background: #faf0f0; border-color: #e2b8b8; color: #9a3b3b; }
.r-take {
  font-size: 0.95rem; line-height: 1.5; color: #43392a;
}
.r-signals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem;
}
.r-sig {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 0.45rem 0.6rem;
  background: #fff;
}
.r-sig-n {
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem;
  min-width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  border-radius: 50%; background: #eee7d8; color: var(--ink);
}
.r-sig.yes .r-sig-n { background: #dcece3; color: var(--accent); }
.r-sig.no .r-sig-n { background: #f3dede; color: #9a3b3b; }
.r-sig-l { font-size: 0.8rem; color: var(--muted); line-height: 1.25; }


/* ---- coach checklist ---- */
.rupor-coach {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  width: min(360px, calc(100vw - 1.5rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px -18px rgba(28, 25, 20, 0.45);
  padding: 0.85rem 0.95rem 0.9rem;
  display: grid;
  gap: 0.65rem;
  max-height: min(86vh, 640px);
  overflow: auto;
}
.rupor-coach.is-collapsed {
  padding: 0;
  width: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}
.rupor-coach-fab {
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 10px 28px -14px rgba(28, 25, 20, 0.5);
  cursor: pointer;
}
.rupor-coach-fab:hover { border-color: var(--accent); color: var(--accent); }
.rupor-coach-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}
.rupor-coach-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.rupor-coach-title { font-weight: 750; font-size: 1.05rem; margin-top: 0.15rem; }
.rupor-coach-eta { font-size: 0.82rem; margin-top: 0.15rem; }
.rupor-coach-head-actions { display: flex; gap: 0.2rem; }
.rupor-coach-meter {
  height: 6px;
  border-radius: 999px;
  background: #ebe4d6;
  overflow: hidden;
}
.rupor-coach-meter > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}
.rupor-coach-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.rupor-coach-steps li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  padding: 0.28rem 0.35rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}
.rupor-coach-steps li:hover { background: rgba(31, 92, 69, 0.06); color: var(--ink); }
.rupor-coach-steps li.is-current {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--ink);
  font-weight: 650;
}
.rupor-coach-steps li.is-progress:not(.is-current) {
  box-shadow: inset 3px 0 0 var(--accent);
}
.rupor-coach-steps li.is-done { color: var(--accent); }
.rupor-coach-check {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.rupor-coach-steps li.is-done .rupor-coach-check {
  background: #e7f2ec;
  border-color: #b9d4c5;
  color: var(--accent);
}
.rupor-coach-steps li.is-current .rupor-coach-check {
  border-color: var(--accent);
  color: var(--accent);
}
.rupor-coach-why { margin: 0; font-size: 0.9rem; line-height: 1.4; }
.rupor-coach-do {
  margin: 0.2rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.4;
  display: grid;
  gap: 0.25rem;
}
.rupor-coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.rupor-coach-hint, .rupor-coach-foot { margin: 0; font-size: 0.8rem; }
/* контент не прячется под фиксированным помощником */
body.has-rupor-coach {
  padding-bottom: min(420px, 58vh);
}
body.has-rupor-coach-collapsed {
  padding-bottom: 5.5rem;
}
@media (min-width: 960px) {
  body.has-rupor-coach {
    padding-bottom: 1.25rem;
    padding-right: min(392px, 34vw);
  }
  body.has-rupor-coach .rupor-coach {
    top: 4.75rem;
    bottom: 0.75rem;
    right: 0.75rem;
    max-height: none;
    width: min(360px, calc(34vw - 1.5rem));
  }
}
.coach-highlight {
  outline: 2px solid var(--accent) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 10px;
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}
.acc-prefs-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.acc-prefs-card h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.acc-coach-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  cursor: pointer;
}
@media (max-width: 720px) {
  .rupor-coach {
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
    bottom: max(0.6rem, env(safe-area-inset-bottom, 0px));
  }
}

/* --- рубрики канала: настройки + фильтр --- */
.rubrics-editor { display: grid; gap: 0.35rem; margin-bottom: 0.55rem; }
.rubric-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 0.3rem; align-items: center; }
.rubric-row .rubric-name { font: inherit; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.rubric-filter { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.65rem; }
.rubric-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 0.22rem 0.65rem; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.rubric-chip:hover { color: var(--ink); }
.rubric-chip.active { color: #fff; background: var(--accent); border-color: var(--accent); }
[data-rubric][hidden] { display: none !important; }

body.is-busy .rupor-coach {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .top {
    padding-left: max(1.2rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.2rem, env(safe-area-inset-right, 0px));
  }
  dialog:not(.add-source-dialog) {
    width: 100%;
    max-width: none;
    margin: 0;
    position: fixed;
    inset: auto 0 0 0;
    border-radius: 16px 16px 0 0;
    max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 0.5rem));
    overflow-y: auto;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }
  .fill-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
    margin: 0.1rem auto 0.75rem;
  }
  #busy {
    place-items: end center;
    padding: 0 0.5rem max(0.5rem, env(safe-area-inset-bottom, 0px));
  }
  .busy-card {
    width: 100%;
    max-height: min(88dvh, 100%);
    border-radius: 16px 16px 0 0;
  }
  #toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
  .hr-top-row {
    grid-template-columns: 1fr;
  }
  .hr-top-link {
    justify-self: start;
  }
  .idea-dlg-actions,
  .hunt-result-body menu,
  .interview-dlg-actions {
    flex-wrap: wrap;
  }
  .idea-dlg-actions .ok,
  .hunt-result-body menu .ok {
    flex: 1 1 100%;
  }
  .q-crit {
    grid-template-columns: 1fr auto;
  }
  .q-crit-lbl {
    grid-column: 1 / -1;
  }
  .q-when {
    margin-left: 0;
  }
  .card-menu-pop {
    max-width: min(16rem, calc(100vw - 2rem));
  }
  .login-page {
    padding: max(1rem, env(safe-area-inset-top, 0px)) 0.75rem max(1rem, env(safe-area-inset-bottom, 0px));
  }
  .rubric-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .day-head,
  .day-top {
    flex-wrap: wrap;
  }
  .tab-actions button.ok,
  .tab-actions button {
    min-height: 2.6rem;
  }
}

.voice-page { max-width: 880px; margin: 0 auto; padding: 1rem 1.1rem 2.4rem; display: grid; gap: 1rem; }
.voice-lead { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.voice-or {
  margin: -0.35rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.voice-card {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 1rem 1.05rem 1.1rem; display: grid; gap: 0.55rem;
}
.voice-card h2 { margin: 0; font-size: 1.05rem; }
.voice-type-split {
  display: grid;
  grid-template-columns: minmax(10.5rem, 0.85fr) minmax(0, 1.45fr);
  gap: 0.75rem;
  align-items: stretch;
}
.voice-roles { display: grid; grid-template-columns: 1fr; gap: 0.4rem; align-content: start; }
.voice-role {
  text-align: left; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 0.75rem 0.85rem; cursor: pointer; font: inherit; color: inherit;
  font-weight: 600; font-size: 0.98rem;
}
.voice-role.is-on { border-color: var(--accent); background: #eef6f1; color: var(--accent); }
.voice-role-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6f1e6;
  padding: 0.9rem 1rem 1rem;
  min-height: 12rem;
}
.voice-role-detail.is-on { background: #eef6f1; border-color: #b9d4c5; }
.voice-role-empty { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.voice-role-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.voice-role-detail h3 { margin: 0; font-size: 1.15rem; }
.voice-role-lead { margin: 0.35rem 0 0.7rem; font-size: 0.95rem; line-height: 1.4; }
.voice-role-dl { margin: 0; display: grid; gap: 0.55rem; }
.voice-role-row { display: grid; gap: 0.12rem; }
.voice-role-row dt {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
.voice-role-row dd { margin: 0; font-size: 0.9rem; line-height: 1.4; }
.voice-posts {
  width: 100%; font: inherit; min-height: 10rem; padding: 0.7rem 0.8rem;
  border: 1px solid var(--line); border-radius: 10px; resize: vertical;
}
.voice-post-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.voice-post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.5rem 0.7rem;
}
.voice-post-mark { font-weight: 600; font-size: 0.9rem; }
.voice-post-preview {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-post-item button {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
}
.voice-post-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.voice-tg-row { display: grid; gap: 0.55rem; }
.voice-tg-row input[type="text"] {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px;
}
.voice-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; font-weight: 600; }
.voice-actions { display: grid; justify-items: start; gap: 0.45rem; }
.voice-need { margin: 0; font-size: 0.9rem; color: var(--muted); max-width: 36rem; line-height: 1.4; }
.voice-need.is-ready { color: var(--ink); }
.voice-done {
  background: #eef6f1;
  border: 1px solid #b9d4c5;
  color: var(--ink);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  line-height: 1.45;
  margin: 0 0 1.1rem;
}
.voice-done[hidden] { display: none; }
.voice-banner { margin: 0.7rem 1.1rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.next-gap {
  max-width: 1180px;
  margin: 0.35rem auto 0;
  padding: 0.4rem 1.1rem 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.next-gap-line {
  margin: 0;
  min-width: 0;
  flex: 1 1 14rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
}
.next-gap-line strong {
  color: var(--ink);
  font-weight: 650;
}
.next-gap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  flex: 0 0 auto;
}
.next-gap-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
}
.next-gap-dismiss:hover { color: var(--ink); }
@media (max-width: 620px) {
  .next-gap { margin: 0 0.7rem; padding-left: 0; padding-right: 0; }
}
@media (max-width: 720px) {
  .voice-type-split { grid-template-columns: 1fr; }
  .voice-roles { grid-template-columns: 1fr 1fr; }
}


/* ---- единая навигация: меню пользователя, вторая строка канала, 403 ---- */
.role-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); margin-right: 0.45rem;
}
.role-badge.role-owner { color: #b23b1a; border-color: #f0c4b4; background: #fdece5; }
.role-badge.role-admin { color: var(--accent); border-color: #bcd6c8; background: #e7f5ed; }
.user-menu-name { font-weight: 600; }
.subnav {
  display: flex; align-items: center; gap: 0.15rem 0.35rem; flex-wrap: wrap;
  padding: 0.35rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--card); font-size: 0.92rem;
}
.subnav-crumbs { color: var(--muted); margin-right: 0.6rem; white-space: nowrap; }
.subnav-crumbs a { color: inherit; text-decoration: none; }
.subnav-crumbs strong { color: var(--ink); }
.subnav-link { padding: 0.32rem 0.7rem; border-radius: 999px; text-decoration: none; color: var(--muted); border: 1px solid transparent; }
.subnav-link:hover { color: var(--ink); border-color: var(--line); }
.subnav-link.active { color: var(--ink); background: rgba(31, 92, 69, 0.1); border-color: rgba(31, 92, 69, 0.25); font-weight: 600; }
.forbidden-page { max-width: 640px; margin: 3rem auto; padding: 0 1.2rem; }
.forbidden-page h1 { font-size: 1.4rem; margin: 0 0 0.6rem; }
@media (max-width: 640px) { .subnav { padding: 0.3rem 0.6rem; overflow-x: auto; flex-wrap: nowrap; } .subnav-crumbs { display: none; } .user-menu-name { display: none; } }

.ready-dots { margin-left: auto; display: flex; gap: 0.15rem 0.5rem; flex-wrap: wrap; font-size: 0.8rem; }
.ready-dot { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); text-decoration: none; padding: 0.2rem 0.4rem; border-radius: 999px; }
.ready-dot i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #c9c1b0; display: inline-block; }
.ready-dot.ok i { background: var(--accent); }
.ready-dot.no { color: var(--ink); }
.ready-dot.no i { background: #d9772f; }
.ready-dot:hover { background: rgba(31, 92, 69, 0.08); }
.rules-details { margin-top: 1.1rem; border-top: 1px dashed var(--line); padding-top: 0.6rem; }
.rules-details > summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; padding: 0.3rem 0; }
.rules-details[open] > summary { color: var(--ink); margin-bottom: 0.6rem; }
@media (max-width: 640px) { .ready-dots { display: none; } }

.stats-tabs { display: flex; gap: 0.3rem; margin: 0 0 1rem; flex-wrap: wrap; }
.stats-tab { padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.stats-tab.active, .stats-tab:hover { color: var(--ink); background: var(--card); }

.brand-link { font-weight: 700; text-decoration: none; color: var(--ink); }
.subnav-switch { font: inherit; font-weight: 700; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 0.1rem 1.4rem 0.1rem 0.3rem; max-width: 220px; cursor: pointer; }
.subnav-switch:hover, .subnav-switch:focus { border-color: var(--line); background: var(--card); outline: none; }

.ready-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.2rem; }
.ready-dot em { font-style: normal; color: #b23b1a; margin-left: 0.25rem; }
.ready-dot em::before { content: "·"; margin-right: 0.25rem; color: var(--muted); }
.ready-dot.ready-all { color: var(--accent); font-weight: 600; }

.top-channel-name { font-size: 1.05rem; }
