:root {
  --bg: #0f1412;
  --bg-elev: #171d1a;
  --bg-soft: #1e2722;
  --line: #2c3832;
  --text: #e8efe9;
  --muted: #8fa398;
  --accent: #c8f542;
  --accent-dim: #8fb52a;
  --warn: #ffb020;
  --hot: #ff5c5c;
  --ok: #3dd68c;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2a18 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2428 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
}
button:hover { border-color: var(--accent-dim); }

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

@media (max-width: 640px) {
  .shell { padding-top: 1rem; }
  .brand { font-size: 1.65rem; }
  .kpi .value { font-size: 1.35rem; }
  .feed, .alerts, .deals { max-height: 360px; }
  .meta-row { width: 100%; }
  .meta-row button { flex: 1; min-height: 44px; }
  .pill { font-size: 0.68rem; }
  .pill.ver { opacity: 0.75; font-family: var(--font-mono); }
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.brand span { color: var(--accent); }

.sub {
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: var(--bg-elev);
}
.pill.ok { color: var(--ok); border-color: #24553c; }
.pill.warn { color: var(--warn); border-color: #5a4518; }
.pill.off { color: var(--muted); }
.pill.ver {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

.grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  min-width: 0;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.9rem;
  color: var(--muted);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

.kpi {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
}
button.kpi {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 72px;
}
button.kpi:hover { border-color: var(--accent-dim); }
button.kpi:active { transform: scale(0.98); }
button.kpi.active {
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: inset 0 0 0 1px rgba(200, 245, 66, 0.25);
}
button.kpi:disabled {
  opacity: 0.55;
  cursor: default;
}
.kpi .label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 750;
  margin-top: 0.2rem;
  letter-spacing: -0.03em;
}
.kpi .value.accent { color: var(--accent); }

.today-panel { min-height: 280px; }
.today-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}
.today-bar h2 { margin: 0; flex: 1; }
.today-back {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
}
.today-body {
  margin-top: 0.75rem;
  max-height: min(62vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  -webkit-overflow-scrolling: touch;
}
.today-row {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 0 10px 10px 0;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.today-row.important { border-left-color: var(--warn); }
.today-row.urgent { border-left-color: var(--hot); }
.today-row:hover { border-color: var(--accent-dim); }
.today-row .when {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.today-row .title { font-weight: 650; margin-top: 0.2rem; }
.today-row .preview {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.today-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--bg);
}
.today-detail .when {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.today-detail .title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 750;
  margin: 0.35rem 0 0.55rem;
  letter-spacing: -0.02em;
}
.today-detail .body {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}
.today-detail .meta-line {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.thread {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.35rem;
}
.thread-bubble {
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg);
  max-width: 100%;
}
.thread-bubble.out {
  border-color: rgba(200, 245, 66, 0.35);
  background: rgba(200, 245, 66, 0.06);
}
.thread-bubble.in {
  border-color: rgba(61, 214, 140, 0.35);
  background: rgba(61, 214, 140, 0.06);
}
.thread-bubble .dir {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.thread-bubble .t { font-weight: 650; margin-top: 0.2rem; }
.thread-bubble .b {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: pre-wrap;
}
@media (max-width: 640px) {
  .today-body { max-height: min(70vh, 520px); }
}

.funnels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) {
  .funnels { grid-template-columns: 1fr; }
}

.funnel-row {
  display: grid;
  grid-template-columns: 88px 1fr 36px;
  gap: 0.5rem;
  align-items: center;
  margin: 0.35rem 0;
  font-size: 0.82rem;
}
.funnel-row .name { color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; }
.bar {
  height: 8px;
  background: #101612;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 99px;
}
.funnel-row .n { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; }

.agents {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.agent {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.agent .who {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.agent .detail { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.agent .seen { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

.feed, .alerts, .deals {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 520px;
  overflow: auto;
}

.item {
  border-left: 3px solid var(--line);
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border-radius: 0 10px 10px 0;
}
.item.important { border-left-color: var(--warn); }
.item.urgent { border-left-color: var(--hot); }
.item .when {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.item .title { font-weight: 650; margin-top: 0.15rem; }
.item .body { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }
.item .tags {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.deal {
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.deal .h {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.deal .h strong { font-size: 0.95rem; }
.deal .status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}
.deal .status.paid,
.paid-badge {
  color: #e11d48;
  border: 1px solid #e11d48;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(225, 29, 72, 0.08);
}
.item.payment .title::after,
.item.urgent.payment .title::after {
  content: none;
}
.item .paid-badge {
  display: inline-block;
  margin-left: 0.35rem;
  vertical-align: middle;
  font-size: 0.68rem;
}
.deal .meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.3rem; }

.dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 70vh;
  overflow: auto;
}
.dialogue-card {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem 0.85rem;
  align-items: start;
}
.dialogue-card.needs {
  border-color: var(--hot);
  box-shadow: inset 3px 0 0 var(--hot);
}
.dialogue-card.queued {
  border-color: var(--warn);
  box-shadow: inset 3px 0 0 var(--warn);
}
.dialogue-card.waiting-them {
  border-color: var(--ok);
  box-shadow: inset 3px 0 0 var(--ok);
}
/* Stas button outcomes — tint overrides green/red when set */
.dialogue-card.stas-called {
  border-color: #5b8cff;
  box-shadow: inset 3px 0 0 #5b8cff;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.1), transparent 55%);
}
.dialogue-card.stas-pay_site {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: linear-gradient(135deg, rgba(200, 245, 66, 0.1), transparent 55%);
}
.dialogue-card.stas-needs_invoice {
  border-color: #c084fc;
  box-shadow: inset 3px 0 0 #c084fc;
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.12), transparent 55%);
}
.dialogue-card.stas-sending_receipt {
  border-color: #2dd4bf;
  box-shadow: inset 3px 0 0 #2dd4bf;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.1), transparent 55%);
}
.dialogue-card.stas-thinking_later {
  border-color: #fb923c;
  box-shadow: inset 3px 0 0 #fb923c;
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.1), transparent 55%);
}
.dialogue-card.stas-not_interested {
  border-color: #6b7280;
  box-shadow: inset 3px 0 0 #6b7280;
  opacity: 0.85;
}
.dialogue-card.paid {
  border-color: #5b8cff;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.12), transparent 55%);
  box-shadow: inset 3px 0 0 #5b8cff;
}
.dialogue-card.paid.needs {
  box-shadow: inset 3px 0 0 var(--hot);
  border-color: var(--hot);
}
.dialogue-card.paid.waiting-them {
  box-shadow: inset 3px 0 0 #5b8cff;
  border-color: #5b8cff;
}
.dialogue-ratio {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 3.2rem;
  color: var(--text);
}
.dialogue-ratio.hot { color: var(--hot); }
.dialogue-ratio.queued { color: var(--warn); }
.dialogue-ratio.ok { color: var(--ok); }
.dialogue-main { min-width: 0; }
.dialogue-when {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.dialogue-title {
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.dialogue-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  word-break: break-word;
}
.dialogue-preview {
  margin-top: 0.4rem;
  font-size: 0.84rem;
  color: var(--text);
  opacity: 0.9;
}
.dlg-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dlg-badge.paid {
  color: #9db7ff;
  border-color: #5b8cff;
  background: rgba(91, 140, 255, 0.12);
}
.dlg-badge.stas {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 176, 32, 0.1);
}
.dlg-badge.hot {
  color: var(--hot);
  border-color: var(--hot);
}
.dlg-badge.queued {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 176, 32, 0.1);
}
.dlg-badge.stas-out {
  text-transform: none;
  letter-spacing: 0;
}
.dlg-badge.stas-out.stas-called {
  color: #9db7ff;
  border-color: #5b8cff;
  background: rgba(91, 140, 255, 0.12);
}
.dlg-badge.stas-out.stas-pay_site {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(200, 245, 66, 0.12);
}
.dlg-badge.stas-out.stas-needs_invoice {
  color: #e9d5ff;
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
}
.dlg-badge.stas-out.stas-sending_receipt {
  color: #99f6e4;
  border-color: #2dd4bf;
  background: rgba(45, 212, 191, 0.12);
}
.dlg-badge.stas-out.stas-thinking_later {
  color: #fdba74;
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
}
.dlg-badge.stas-out.stas-not_interested {
  color: #9ca3af;
  border-color: #6b7280;
  background: rgba(107, 114, 128, 0.15);
}

.dialogue-preview {
  cursor: pointer;
}
.dialogue-preview:hover {
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: rgba(200, 245, 66, 0.35);
}
.dialogue-card {
  cursor: pointer;
}

.dlg-modal[hidden] { display: none !important; }
.dlg-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 720px) {
  .dlg-modal { align-items: center; padding: 1.5rem; }
}
.dlg-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.dlg-modal-sheet {
  position: relative;
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1.05rem 1.25rem;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}
@media (min-width: 720px) {
  .dlg-modal-sheet { border-radius: 16px; }
}
.dlg-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  padding-bottom: 0.5rem;
  z-index: 1;
}
.dlg-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.dlg-lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.dlg-lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.dlg-lang-btn.active {
  background: rgba(200, 245, 66, 0.16);
  color: var(--accent);
}
.dlg-lang-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.dlg-modal-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.dlg-modal-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
  word-break: break-word;
}
.dlg-modal-x {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.dlg-thread-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
  background: rgba(255, 255, 255, 0.02);
}
.dlg-thread-item.in { border-left: 3px solid var(--hot); }
.dlg-thread-item.out { border-left: 3px solid var(--ok); }
.dlg-thread-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.dlg-thread-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.empty { color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
}
.tab {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-height: 40px;
}
.tab.active {
  color: var(--ink, #0f1412);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}
.tab-view { display: none; }
.tab-view.active { display: block; }

.mail-panel {
  min-height: 280px;
  overflow-x: hidden;
  max-width: 100%;
}
.mail-panel .today-body {
  max-height: min(58vh, 460px);
  overflow-x: hidden;
  max-width: 100%;
}
#view-mail {
  overflow-x: hidden;
  max-width: 100%;
}
.mail-refresh {
  margin-left: auto;
  font-size: 0.78rem;
  min-height: 36px;
}
.mail-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  width: 100%;
  max-width: 100%;
  min-height: 0;
}
.mail-list .today-row {
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: 0;
  border-left: 3px solid var(--line);
  background: var(--bg);
  flex: 1 1 auto;
  min-width: 0;
}
.mail-list .today-row .title {
  font-size: 0.95rem;
  margin-top: 0.25rem;
}
.mail-list .today-row .mail-from {
  margin-top: 0.35rem;
  color: var(--accent-dim);
  font-size: 0.84rem;
  font-family: var(--font-mono);
  line-height: 1.35;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mail-list .today-row .preview {
  -webkit-line-clamp: 1;
  font-size: 0.78rem;
  margin-top: 0.2rem;
  opacity: 0.9;
}
.dismiss-row,
.mail-item {
  position: relative;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #b42318;
  overflow: hidden;
  /* critical: overflow:hidden would zero out min-size in a flex column → rows collapse */
  flex-shrink: 0;
  flex-grow: 0;
  min-height: min-content;
}
.dismiss-under,
.mail-hide-under {
  position: absolute;
  inset: 0 0 0 auto;
  width: 84px;
  border: 0;
  border-radius: 0;
  background: #b42318;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 650;
  z-index: 0;
  padding: 0;
}
.dismiss-panel,
.mail-item-panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--bg);
  transform: translate3d(0, 0, 0);
  transition: transform 0.15s ease;
  touch-action: pan-y;
  will-change: transform;
}
.dismiss-main {
  flex: 1 1 auto;
  min-width: 0;
}
.dismiss-main .item,
.dismiss-main .deal {
  border-radius: 0;
}
.dismiss-main .today-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  border-left: 3px solid var(--line);
}
.dismiss-row.dragging .dismiss-panel,
.mail-item.dragging .mail-item-panel { transition: none; }
.dismiss-row.dismissing,
.mail-item.dismissing {
  opacity: 0;
  transition: opacity 0.12s ease;
}
.dismiss-x,
.mail-hide-x {
  flex: 0 0 48px;
  width: 48px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-elev);
  color: var(--hot);
  font-size: 1.45rem;
  line-height: 1;
  padding: 0;
  z-index: 2;
}
.dismiss-x:active,
.mail-hide-x:active { background: var(--hot); color: #fff; }

/* Обзор / Сегодня: контент как до dismiss (полная ширина), × только поверх */
#view-overview .dismiss-row,
#view-today .dismiss-row {
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  min-height: min-content !important;
}
.feed > .dismiss-row,
.alerts > .dismiss-row,
.deals > .dismiss-row,
.today-body > .dismiss-row {
  flex-shrink: 0 !important;
  min-height: min-content !important;
}
#view-overview .dismiss-panel,
#view-today .dismiss-panel {
  display: block !important;
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  background: transparent !important;
  transform: none;
  will-change: auto;
}
#view-overview .dismiss-panel.swiping,
#view-today .dismiss-panel.swiping {
  will-change: transform;
}
#view-overview .dismiss-panel .item,
#view-overview .dismiss-panel .deal,
#view-today .dismiss-panel .today-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#view-overview .dismiss-under,
#view-today .dismiss-under {
  width: 72px;
  z-index: 0;
}
#view-overview .dismiss-x,
#view-today .dismiss-x {
  position: absolute;
  top: 0.3rem;
  right: 0.2rem;
  z-index: 6;
  flex: none !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border: 0 !important;
  border-left: 0 !important;
  border-radius: 7px;
  background: rgba(15, 20, 18, 0.45);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 !important;
  pointer-events: auto !important;
}
#view-overview .dismiss-x:active,
#view-today .dismiss-x:active {
  background: var(--hot);
  color: #fff;
}
/* исходный размер .item / .today-row — только снять обрезку текста */
#view-overview .dismiss-panel .item .body,
#view-today .dismiss-panel .today-row .preview {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}
.mail-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.mail-pager button:disabled { opacity: 0.4; cursor: default; }
.mail-detail .body {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.85rem 0 1rem;
  max-height: min(55vh, 480px);
  overflow: auto;
}
.mail-compose {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.mail-compose label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.mail-compose input,
.mail-compose textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  width: 100%;
}
.mail-compose textarea {
  min-height: 180px;
  resize: vertical;
  font-family: var(--font-body);
}

.kpis-inline {
  margin-bottom: 0;
}
@media (max-width: 900px) {
  .kpis-inline { grid-template-columns: repeat(2, 1fr); }
}

.agent-card .agent-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.agent-card .who {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.95rem;
}
.agent-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}
.agent-feed { max-height: 280px; }
.live-live { border-color: #24553c; }
.live-idle { border-color: #5a4518; }
.live-stale { border-color: #5a3030; opacity: 0.92; }

code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--accent);
}

/* —— Agents live stage —— */
.stage-wrap { margin-bottom: 1.1rem; }
.agent-stage {
  position: relative;
  height: min(62vw, 420px);
  min-height: 280px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 70% 50% at 50% 45%, #1a2a1c 0%, transparent 70%),
    linear-gradient(160deg, #121816, #0c100e 60%, #141c18);
}
.stage-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.stage-wires .wire {
  stroke: #2f4a38;
  stroke-width: 0.35;
  stroke-dasharray: 2 1.5;
  opacity: 0.55;
  animation: wire-flow 4s linear infinite;
}
.stage-wires .wire-1 { animation-delay: -0.7s; }
.stage-wires .wire-2 { animation-delay: -1.4s; }
.stage-wires .wire-3 { animation-delay: -2.1s; }
.stage-wires .wire-4 { animation-delay: -2.8s; }
.stage-wires .wire-5 { animation-delay: -3.5s; }
@keyframes wire-flow {
  to { stroke-dashoffset: -20; }
}

.stage-nodes { position: absolute; inset: 0; }
.anode {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 7.2rem;
  text-align: center;
  z-index: 2;
}
.anode-orb {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.35rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #152019;
  position: relative;
  box-shadow: 0 0 0 0 transparent;
}
.anode-orb::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
}
.anode-zz {
  position: absolute;
  top: -0.15rem;
  right: 1.1rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: #6a7a70;
  opacity: 0;
  pointer-events: none;
}
.anode-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
}
.anode-state {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.12rem;
}
.anode-detail {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.25;
  max-width: 7.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anode.state-work .anode-orb {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(200, 245, 66, 0.35);
  animation: orb-pulse 1.4s ease-in-out infinite;
}
.anode.state-work .anode-orb::after {
  background: var(--accent);
  opacity: 1;
  animation: core-spin 2.2s linear infinite;
}
.anode.state-work .anode-state { color: var(--accent); }
.anode.state-work .anode-zz { opacity: 0; }

.anode.state-think .anode-orb {
  border-color: var(--warn);
  animation: orb-breathe 2.6s ease-in-out infinite;
}
.anode.state-think .anode-orb::after {
  background: var(--warn);
  opacity: 0.85;
}
.anode.state-think .anode-state { color: var(--warn); }

.anode.state-sleep .anode-orb {
  border-color: #3a4540;
  opacity: 0.75;
  animation: sleep-sway 3.5s ease-in-out infinite;
}
.anode.state-sleep .anode-orb::after {
  background: #4a5850;
  opacity: 0.45;
}
.anode.state-sleep .anode-state { color: #6a7a70; }
.anode.state-sleep .anode-zz {
  opacity: 1;
  animation: zzz 2.8s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(200, 245, 66, 0.25); }
  50% { transform: scale(1.08); box-shadow: 0 0 26px rgba(200, 245, 66, 0.5); }
}
@keyframes orb-breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes sleep-sway {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}
@keyframes core-spin {
  to { transform: rotate(360deg); }
}
@keyframes zzz {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  50% { transform: translate(4px, -6px) scale(1.15); opacity: 1; }
}

.stage-packets {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.packet {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(200, 245, 66, 0.8);
}
.packet-scout {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  background: #9dff6a;
  box-shadow: 0 0 14px rgba(157, 255, 106, 0.95);
}

.anode-tap {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.anode-tap:hover .anode-orb,
.anode-tap:focus .anode-orb {
  border-color: var(--accent);
  transform: scale(1.06);
}
.anode-tap:focus { outline: none; }

.agent-stage.hunting {
  box-shadow: inset 0 0 60px rgba(200, 245, 66, 0.08);
}
.agent-stage.hunting::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(200, 245, 66, 0.07) 75%, transparent 85%);
  animation: hunt-sweep 3.2s linear infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes hunt-sweep {
  to { transform: rotate(360deg); }
}

.scout-hud {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.7rem;
  z-index: 5;
  padding: 0.7rem 0.8rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #3a5a28;
  background: rgba(10, 16, 12, 0.88);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.scout-hud[hidden] { display: none !important; }
.scout-hud-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}
.scout-track {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.45rem;
  align-items: center;
  margin: 0.35rem 0;
}
.scout-track-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
}
.scout-track[data-kind="cleaners"] .scout-track-name { color: #b8f06a; }
.scout-track[data-kind="buildings"] .scout-track-name { color: #7ec8ff; }
.scout-track-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.scout-track-nums b {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: 0.2rem;
}
.scout-stop {
  margin-top: 0.55rem;
  width: 100%;
  min-height: 40px;
  border-color: #3a5a28;
  background: #152019;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .scout-track { grid-template-columns: 1fr; gap: 0.15rem; }
  .scout-hud { left: 0.45rem; right: 0.45rem; bottom: 0.45rem; padding: 0.55rem 0.6rem; }
  .agent-stage.hunting { min-height: 380px; }
}

.agent-card.state-work { border-color: #3a5a28; box-shadow: inset 0 0 0 1px rgba(200, 245, 66, 0.12); }
.agent-card.state-think { border-color: #5a4518; }
.agent-card.state-sleep { border-color: #3a3030; opacity: 0.88; }
.agent-card .seen {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.agent-card .detail { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }

@media (max-width: 640px) {
  .agent-stage { min-height: 320px; height: 58vh; }
  .anode { width: 5.6rem; }
  .anode-orb { width: 2.1rem; height: 2.1rem; }
  .anode-detail { display: none; }
  .anode-name { font-size: 0.7rem; }
}
