/* Nunito and Playfair Display, SIL Open Font License 1.1. License files are in static/fonts. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/nunito-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(/fonts/playfair-display-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(/fonts/playfair-display-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0b0e14;
  --surface: #121721;
  --surface-2: #19202e;
  --surface-hover: #212a3b;
  --border: #252e3f;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #388bfd;
  --accent-bg: rgba(56, 139, 253, 0.14);
  --green: #3fb950;
  --green-bg: rgba(63, 185, 80, 0.14);
  --yellow: #d29922;
  --yellow-bg: rgba(210, 153, 34, 0.15);
  --red: #f85149;
  --red-bg: rgba(248, 81, 73, 0.15);
  --teal: #2ea043;
  --button-fill: #1f6feb;
  --button-hover: #388bfd;
  --button-ink: #fff;
  --hover-border: #3b465e;
  --overlay: #000a;
  --shadow: rgba(0, 0, 0, 0.45);
  --error-outline: rgba(248, 81, 73, 0.35);
  --error-line: rgba(248, 81, 73, 0.3);
  --error-border: rgba(248, 81, 73, 0.4);
  --ok-line: rgba(63, 185, 80, 0.3);
  --warn-line: rgba(210, 153, 34, 0.3);
  --warn-border: rgba(210, 153, 34, 0.4);
  --accent-line: rgba(56, 139, 253, 0.3);
  --accent-border: rgba(56, 139, 253, 0.4);
  --accent-strong-line: rgba(56, 139, 253, 0.45);
  --accent-wash: rgba(56, 139, 253, 0.08);
  --outgoing-border: rgba(56, 139, 253, 0.35);
  --outgoing-fill: rgba(31, 111, 235, 0.2);
  --goal-fill: rgba(46, 160, 67, 0.2);
  --goal-ink: #56d364;
  --goal-line: rgba(86, 211, 100, 0.4);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.pill {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 11px;
}

.pill-warn {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--error-outline);
}

.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 24px;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.card-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.kpi-pct {
  color: var(--muted);
  font-size: 11.5px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

.progress {
  height: 4px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.input-row {
  display: flex;
  gap: 8px;
}

.overview-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-ok { background: var(--green-bg); color: var(--green); border-color: var(--ok-line); }
.badge-warn { background: var(--yellow-bg); color: var(--yellow); border-color: var(--warn-line); }
.badge-err { background: var(--red-bg); color: var(--red); border-color: var(--error-line); }
.badge-info { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-line); }
.badge-goal { background: var(--goal-fill); color: var(--goal-ink); border-color: var(--goal-line); }

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--hover-border);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-primary {
  background: var(--button-fill);
  border-color: var(--button-hover);
  color: var(--button-ink);
}

.btn-primary:hover {
  background: var(--button-hover);
}

.btn-accent {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-warn {
  background: var(--yellow-bg);
  border-color: var(--warn-border);
  color: var(--yellow);
}

.btn-danger {
  background: var(--red-bg);
  border-color: var(--error-border);
  color: var(--red);
}

.filter-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
}

.chip.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-strong-line);
}

/* Диалоги */
.dialogs-layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 14px;
  min-height: 680px;
}

@media (max-width: 980px) {
  .dialogs-layout {
    grid-template-columns: 1fr;
  }
}

.dialogs-sidebar {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 78vh;
}

.dialogs-items {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.dlg-item {
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dlg-item:hover {
  border-color: var(--hover-border);
}

.dlg-item.selected {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.dlg-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.dlg-item-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dlg-item-sub {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dlg-item-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.dlg-item-goal {
  font-size: 11.5px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dlg-quick-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dialog-inspector {
  display: flex;
  flex-direction: column;
  max-height: 78vh;
}

.dialog-detail-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.dialog-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-title-row h2 {
  margin: 0;
  font-size: 16px;
}

.tg-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12.5px;
}

.tg-link:hover {
  text-decoration: underline;
}

.dialog-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dlg-bio {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text);
  opacity: 0.9;
}

.dlg-alert {
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--yellow-bg);
  color: var(--yellow);
  font-size: 12px;
}

.goal-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.goal-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.stage-pill {
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 1px 8px;
  border-radius: 4px;
}

.goal-input-row {
  display: flex;
  gap: 6px;
}

.goal-presets {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.preset-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11.5px;
  cursor: pointer;
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 280px;
}

.msg-bubble {
  max-width: 76%;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  word-break: break-word;
}

.msg-in {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.msg-out {
  align-self: flex-end;
  background: var(--outgoing-fill);
  border: 1px solid var(--outgoing-border);
}

.msg-meta {
  font-size: 10.5px;
  color: var(--muted);
  align-self: flex-end;
}

/* Таблицы и логи */
.table-wrap {
  overflow-x: auto;
  max-height: 560px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.log-box {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.compact-log {
  height: 360px;
}

.full-log {
  height: 620px;
}

.log-line {
  display: flex;
  gap: 8px;
  padding: 2px 5px;
  border-radius: 4px;
  word-break: break-word;
}

.log-time { color: var(--muted); flex-shrink: 0; }
.log-lvl { font-weight: 700; width: 62px; flex-shrink: 0; }
.log-WARN { background: var(--yellow-bg); color: var(--yellow); }
.log-ERR { background: var(--red-bg); color: var(--red); }

.input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input-sm {
  width: 220px;
  padding: 4px 9px;
  font-size: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

#stoplist-form label {
  display: block;
  margin-bottom: 10px;
}

.stop-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(78px, 115px);
  gap: 12px;
}

.stop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.stop-row button:first-child {
  text-align: left;
}

.stop-reviews {
  max-height: 420px;
  overflow: auto;
}

.stop-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.stop-photos figure {
  margin: 0;
  min-width: 0;
}

.stop-photos .btn {
  display: block;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

.stop-photos img {
  display: block;
  width: 100%;
  height: clamp(72px, 19vw, 150px);
  object-fit: contain;
  background: var(--bg);
}

.stop-comparison {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.stop-comparison h4, #stop-review-detail h4, #stop-entry-detail h4 {
  margin: 8px 0;
}

.stop-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

#profile-lightbox {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 94vw;
}

#profile-lightbox::backdrop { background: var(--overlay); }
#feed-profile-actions[hidden], #feed-select-column[hidden] { display: none; }
#profile-lightbox img { display: block; max-width: 86vw; max-height: 75vh; margin-top: 8px; }

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
}

.cfg-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 9px;
  background: var(--bg);
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 42px 18px;
}

.muted { color: var(--muted); }
.small { font-size: 11.5px; }

.toast {
  position: fixed;
  bottom: 18px;
  right: 22px;
  background: var(--button-fill);
  color: var(--button-ink);
  padding: 9px 15px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12.5px;
  box-shadow: 0 6px 20px var(--shadow);
  z-index: 100;
}

/* Палитры панели. Светлая также используется до выбора темы. */
body:is(:has(.leo-app), .admin-new) {
  --bg: #eee5db;
  --surface: #f8f1e8;
  --surface-2: #eae0d5;
  --surface-hover: #e5d6ca;
  --well: #efe5da;
  --sidebar: #f4eae0;
  --border: #d6c4b6;
  --border-strong: #90786e;
  --text: #33262b;
  --muted: #655154;
  --accent: #a1382d;
  --accent-hover: #853027;
  --accent-ink: #fff5eb;
  --accent-bg: #edd5cc;
  --green: #315a44;
  --green-bg: #dce7dc;
  --yellow: #694b1f;
  --yellow-bg: #f0dfad;
  --red: #952f40;
  --red-bg: #f0d5d8;
  --shadow: rgb(65 42 35 / 12%);
  --overlay: rgb(52 34 44 / 52%);
  --hero-surface: #efd1bd;
  --hero-ink: #624536;
  --heart-glow: #edd8a0;
  --postmark-line: rgb(160 60 38 / 16%);
  --stamp-rule: #b37459;
  --stamp-heart: #c25b42;
  --stamp-blue: #3d5e8f;
  --stamp-gold: #775221;
  --likes-surface: #efdcd2;
  --messages-surface: #dce3ef;
  --replies-surface: #dfe6d8;
  --teal: var(--green);
  --accent-ring: var(--accent);
  --button-fill: var(--accent);
  --button-hover: var(--accent-hover);
  --button-ink: var(--accent-ink);
  --hover-border: var(--border-strong);
  --shadow: var(--panel-shadow);
  --overlay: var(--panel-overlay);
  --error-outline: color-mix(in srgb, var(--red) 34%, var(--surface));
  --error-line: var(--error-outline);
  --error-border: var(--error-outline);
  --ok-line: color-mix(in srgb, var(--green) 32%, var(--surface));
  --warn-line: var(--accent-line);
  --warn-border: var(--accent-line);
  --accent-line: color-mix(in srgb, var(--accent) 31%, var(--surface));
  --accent-border: var(--accent-line);
  --accent-strong-line: var(--accent-line);
  --accent-wash: var(--accent-bg);
  --outgoing-border: var(--accent-line);
  --outgoing-fill: var(--accent-bg);
  --goal-fill: var(--green-bg);
  --goal-ink: var(--green);
  --goal-line: var(--ok-line);
  --font-ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --gutter: clamp(16px, 2.8vw, 40px);
  --text-xs: 13px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 19px;
  --text-xl: 25px;
  --text-display: 42px;
  --radius-panel: 15px;
  --radius-control: 9px;
  --control: 44px;
  color-scheme: light;
  font-size: var(--text-md);
}

:root[data-leo-theme="dark"] body:is(:has(.leo-app), .admin-new) {
  --bg: #171e2b;
  --surface: #222c3d;
  --surface-2: #2a3548;
  --surface-hover: #324058;
  --well: #1a2332;
  --sidebar: #1c2535;
  --border: #3b4860;
  --border-strong: #77869d;
  --text: #f4ece3;
  --muted: #bcbdd0;
  --accent: #ffae76;
  --accent-hover: #ffc092;
  --accent-ink: #392214;
  --accent-bg: #41322e;
  --green: #a6d6b5;
  --green-bg: #29423e;
  --yellow: #f2ce8f;
  --yellow-bg: #4b3b26;
  --red: #ffb4b9;
  --red-bg: #4b303c;
  --shadow: rgb(5 10 20 / 25%);
  --overlay: rgb(8 13 25 / 70%);
  --hero-surface: #2b3951;
  --hero-ink: #e1d5ce;
  --heart-glow: #4c5674;
  --postmark-line: rgb(161 182 229 / 18%);
  --stamp-rule: #8197c0;
  --stamp-heart: #ee9165;
  --stamp-blue: #91b5f5;
  --stamp-gold: #f6c98a;
  --likes-surface: #3d303a;
  --messages-surface: #283c59;
  --replies-surface: #283b3e;
  color-scheme: dark;
}

:root[data-leo-theme="midnight"] body:is(:has(.leo-app), .admin-new) {
  --bg: #0b0c10;
  --surface: #14161d;
  --surface-2: #1c1f29;
  --surface-hover: #262b38;
  --well: #101116;
  --sidebar: #101117;
  --border: #303440;
  --border-strong: #717788;
  --text: #eeeaf0;
  --muted: #b5b4c2;
  --accent: #a3baff;
  --accent-hover: #bccdff;
  --accent-ink: #121d3d;
  --accent-bg: #232e49;
  --green: #aad2b6;
  --green-bg: #21342e;
  --yellow: #e9c486;
  --yellow-bg: #362c21;
  --red: #efa6b1;
  --red-bg: #3d2530;
  --shadow: rgb(0 0 0 / 42%);
  --overlay: rgb(0 0 0 / 76%);
  --hero-surface: #1a1e2d;
  --hero-ink: #cdc7d2;
  --heart-glow: #32374b;
  --postmark-line: rgb(150 168 217 / 16%);
  --stamp-rule: #6679aa;
  --stamp-heart: #ce7a80;
  --stamp-blue: #8da8ee;
  --stamp-gold: #e4b984;
  --likes-surface: #2a2028;
  --messages-surface: #1c2940;
  --replies-surface: #1c2b29;
  color-scheme: dark;
}

html, body { overflow-x: clip; }
[hidden] { display: none !important; }

body:has(.leo-app) button,
body:has(.leo-app) summary { font-family: inherit; }
body:has(.leo-app) .input {
  min-height: 44px;
  padding: 9px 12px;
  border-color: var(--border-strong);
  font-size: var(--text-md);
}
body:has(.leo-app) .input::placeholder { color: var(--muted); opacity: 1; }
body:has(.leo-app) .small { font-size: var(--text-sm); }
body:has(.leo-app) .card-header h3 { font-size: var(--text-lg); }
body:has(.leo-app) .badge, body:has(.leo-app) .chip { font-size: var(--text-sm); }
body:has(.leo-app) .chip { min-height: 38px; }
body:has(.leo-app) .overview-split { align-items: start; }

body:has(.leo-app) .btn {
  min-height: var(--control);
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-weight: 750;
  line-height: 1.2;
  border-radius: var(--radius-control);
  white-space: normal;
}
body:has(.leo-app) .btn-sm { min-height: 40px; }
body:has(.leo-app) .btn-xs { min-height: 36px; padding: 4px 8px; }
body:has(.leo-app) .btn-primary:not(:disabled) { border-color: var(--button-fill); }
body:has(.leo-app) .btn:disabled {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--border);
  cursor: not-allowed;
}
body:has(.leo-app) .btn:not(:disabled):active { box-shadow: inset 0 0 0 1px currentColor; }
body:has(.leo-app) :is(button, a, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

body:has(.leo-app) .card {
  border-radius: var(--radius-panel);
  color: var(--text);
}
body:has(.leo-app) .overview-split {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}
body:has(.leo-app) .dialogs-layout { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
body:has(.leo-app) .toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
body:has(.leo-app) h1, body:has(.leo-app) h2 { min-width: 0; overflow-wrap: break-word; text-wrap: balance; }

/* Leo authenticated workspace */
.leo-app {
  display: grid;
  --sidebar-width: 256px;
  --controls-width: 208px;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--controls-width);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
}
.leo-sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px 18px 20px;
  background: var(--sidebar);
  border-inline-end: 1px solid var(--border);
}
.leo-sidebar-top { margin: 0 8px 32px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  flex: 0 0 46px;
  height: 46px;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 15px;
}
.leo-heart {
  position: relative;
  display: block;
  width: var(--heart-size, 13px);
  aspect-ratio: 1;
  background: currentColor;
  transform: rotate(-45deg);
}
.leo-heart::before, .leo-heart::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: 50%;
}
.leo-heart::before { transform: translateY(-50%); }
.leo-heart::after { transform: translateX(50%); }
.brand-mark .leo-heart { margin-top: 4px; }
.brand-title {
  display: grid;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -.055em;
}
.brand-description {
  margin-top: 6px;
  font: 650 12px/1.25 var(--font-ui);
  color: var(--muted);
  letter-spacing: 0;
}
#leo-menu-toggle { display: none; }
#main-tabs {
  display: grid;
  gap: 4px;
  padding: 0;
  overflow: visible;
  background: none;
  border: 0;
}
#main-tabs .tab {
  padding: 10px 12px;
  min-height: 48px;
  gap: 11px;
  width: 100%;
  color: var(--muted);
  border: none;
  border-radius: 10px;
  font-size: var(--text-md);
  text-align: start;
  white-space: normal;
}
#main-tabs .tab:hover { background: var(--surface-hover); color: var(--text); }
#main-tabs .tab.active {
  color: var(--accent);
  background: var(--accent-bg);
  font-weight: 800;
}
#main-tabs .tab svg {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#main-tabs .pill { margin-inline-start: auto; padding: 0 7px; font-size: var(--text-xs); }
.leo-appearance {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 20px 8px 14px;
}
.leo-appearance label { color: var(--muted); font-size: var(--text-sm); font-weight: 750; }
body:has(.leo-app) .leo-appearance select {
  padding-block: 6px;
  border-color: var(--border);
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
  font-weight: 750;
  cursor: pointer;
}
.leo-sidebar .account-bar {
  display: grid;
  width: 100%;
  gap: 6px;
  padding: 16px 8px 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.account-cluster { display: grid; min-width: 0; }
#account-bar-name {
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-connection { font-size: var(--text-sm); }
.account-switch {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 750;
  text-decoration: none;
}
.account-switch:hover { text-decoration: underline; }

.leo-workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.leo-workspace:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.leo-app[data-view="overview"] .leo-workspace { scroll-padding-block-start: 84px; }
body:has(.leo-app) .container,
.leo-workspace > .topbar,
#overview-status {
  width: min(100%, 1420px);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.leo-workspace > .topbar { display: none; padding-block: 16px 0; }
.leo-app[data-view="overview"] .leo-workspace > .topbar { display: block; }
body:has(.leo-app) .container { padding-block: 30px 56px; }
.leo-hero {
  position: relative;
  isolation: isolate;
  display: none;
  align-items: center;
  min-height: 226px;
  padding: 36px 40px;
  overflow: clip;
  border-radius: 22px;
  background: var(--hero-surface);
  color: var(--text);
}
.leo-app[data-view="overview"] .leo-hero { display: flex; }
.leo-hero-copy { position: relative; width: 65%; }
.leo-hero h1, .view-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(36px, 4vw, 59px);
  line-height: 1.07;
  letter-spacing: -.045em;
}
.leo-hero p {
  max-width: 35ch;
  margin: 16px 0 0;
  color: var(--hero-ink);
  font-size: 18px;
  line-height: 1.4;
}
.leo-postmark {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 auto;
  width: 41%;
  background:
    radial-gradient(circle at 72% 48%, var(--heart-glow) 0 21%, transparent 21.5%),
    repeating-linear-gradient(125deg, var(--postmark-line) 0 1px, transparent 1px 17px);
  mask-image: linear-gradient(90deg, transparent, currentColor 21%);
}
.postmark-frame {
  position: absolute;
  top: 12%;
  right: 15%;
  width: 56%;
  height: 76%;
  transform: rotate(-12deg);
  border: 2px dashed var(--stamp-rule);
  border-radius: 24px;
}
.postmark-heart {
  --heart-size: clamp(52px, 7vw, 112px);
  position: absolute;
  top: 36%;
  right: 32%;
  color: var(--stamp-heart);
  transform: rotate(-57deg);
}
.postmark-mini {
  --heart-size: clamp(17px, 2.1vw, 30px);
  position: absolute;
  right: 14%;
  top: 26%;
  color: var(--stamp-blue);
  transform: rotate(-30deg);
}
.postmark-spark {
  position: absolute;
  font-family: Georgia, serif;
  line-height: 1;
}

.account-identity-row { display: flex; min-width: 0; align-items: center; gap: 10px; }
.account-avatar {
  position: relative;
  display: grid;
  flex: 0 0 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 800;
}
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spark-top { top: 20%; left: 28%; color: var(--stamp-gold); font-size: 35px; }
.spark-bottom { right: 15%; bottom: 18%; color: var(--stamp-gold); font-size: 29px; }

.status-label { color: var(--muted); font-size: var(--text-sm); font-weight: 650; }
.status-note { color: var(--muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.status-note:empty { display: none; }
[data-state="idle"] { color: var(--muted); }
[data-state="active"] { color: var(--green); }
[data-state="paused"] { color: var(--yellow); }
[data-state="error"] { color: var(--red); }
#autopilot-status[data-state="idle"] { color: var(--text); }
#account-bar-error { display: block; margin-top: 6px; max-width: 220px; color: var(--red); overflow-wrap: anywhere; }
.leo-section-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 30px;
  letter-spacing: -.035em;
}
body:has(.leo-app) .kpi-grid { gap: 14px; margin-bottom: 18px; }
body:has(.leo-app) .kpi-card {
  padding: 16px 18px;
  gap: 8px;
  border: 0;
  background: var(--surface-2);
}
body:has(.leo-app) .kpi-card:nth-child(1) { background: var(--likes-surface); }
body:has(.leo-app) .kpi-card:nth-child(2) { background: var(--messages-surface); }
body:has(.leo-app) .kpi-card:nth-child(2) .progress-fill { background: var(--stamp-blue); }
body:has(.leo-app) .kpi-card:nth-child(3) { background: var(--replies-surface); }
body:has(.leo-app) .kpi-card:nth-child(3) .progress-fill { background: var(--green); }
body:has(.leo-app) .kpi-label, body:has(.leo-app) .kpi-sub { font-size: var(--text-sm); }
body:has(.leo-app) .kpi-value { font-size: 27px; }
.settings-technical summary { cursor: pointer; font-weight: 800; }
body:has(.leo-app) .compact-log { height: 230px; }

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}
.settings-layout > .card { padding: 24px; }
#reference-import-settings { grid-column: 1 / -1; }
.style-archive-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.style-archive-columns fieldset { margin: 0; min-inline-size: 0; border: 1px solid var(--border); border-radius: 12px; }
.style-archive-columns textarea { inline-size: 100%; }
.style-archive-list { list-style: none; padding: 0; margin: 8px 0; }
.style-archive-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.style-archive-list label { display: inline-flex; align-items: start; gap: 8px; min-inline-size: 0; }
.style-archive-list select { inline-size: min(100%, 12rem); }
#style-archive-groups { margin-block: 12px; }
#style-archive-preview textarea { inline-size: 100%; }
@media (max-width: 600px) {
  .style-archive-columns { grid-template-columns: minmax(0, 1fr); }
}
#reference-import-jobs { margin-block: 0; padding-inline-start: 1.4em; line-height: 1.6; overflow-wrap: anywhere; }
.reference-link { color: var(--accent); }
.reference-row .dlg-conversation-open { color: inherit; text-decoration: none; }
.reference-info { display: grid; min-inline-size: 0; gap: 2px; }
.reference-owner { min-inline-size: 0; overflow-wrap: anywhere; }
#reference-dialog {
  inline-size: min(680px, calc(100% - 24px));
  block-size: min(720px, calc(100dvh - 24px));
  max-inline-size: none;
  max-block-size: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  color: var(--text);
}
#reference-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#reference-dialog::backdrop { background: var(--overlay); }
#reference-dialog header { padding: 12px 16px; }
.reference-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; }
#reference-dialog .dlg-import-head > div { min-inline-size: 0; }
#reference-dialog :is(h2, p) { margin: 0; overflow-wrap: anywhere; }
#reference-dialog h2 { font-family: var(--font-display); }
#reference-dialog #reference-status { padding: 8px 16px; }
#reference-history { max-height: none; min-height: 0; }
#reference-history:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#reference-older { flex: none; align-self: center; }
#reference-messages { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 600px) {
  #reference-dialog .dlg-import-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .reference-header-actions { display: contents; }
  #reference-close { grid-area: 1 / 2; }
  #reference-delete { grid-area: 2 / 1 / 3 / -1; justify-self: start; }
}
.settings-layout .settings-conversation { border: 0; background: var(--likes-surface); }
.settings-layout h2 {
  margin: 0 0 22px;
  font: 650 var(--text-xl)/1.2 var(--font-display);
  letter-spacing: -.025em;
}
.settings-layout .form-group { margin-bottom: 22px; }
.settings-layout .form-group label { margin-bottom: 6px; }
.settings-layout .form-group p { margin: 6px 0 10px; }
.settings-layout .form-actions { margin-top: 10px; }
.settings-technical { padding-top: 16px; border-top: 1px solid var(--border); }
.settings-technical .config-grid { margin-top: 12px; grid-template-columns: minmax(0,1fr); }
.settings-technical .cfg-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 0;
  gap: 8px;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.settings-technical .cfg-row strong { text-align: end; }
.settings-save-status { margin: 8px 0 0; color: var(--muted); font-size: var(--text-sm); }
.settings-save-status:empty { margin: 0; }
.settings-save-status[data-error] { color: var(--red); }
#btn-save-settings[aria-disabled="true"] { opacity: .7; cursor: wait; }

:root:not([data-leo-design="new"]) .settings-new-only,
:root[data-leo-design="new"] .settings-classic-only { display: none; }

:root[data-leo-design="new"] #view-settings {
  max-inline-size: 860px;
  margin-inline: auto;

  .settings-layout {
    display: block;
    container-type: inline-size;
  }
  .settings-conversation {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .settings-conversation h2 {
    margin: 0;
    padding-block: 4px 16px;
    font: 800 var(--text-lg)/1.25 var(--font-ui);
    letter-spacing: -.015em;
  }
  .settings-field {
    display: grid;
    gap: 12px;
    margin: 0;
    padding-block: 20px;
    border-block-start: 1px solid var(--border);
  }
  .settings-field label { margin: 0; font-weight: 800; }
  .settings-field p { margin: 5px 0 0; max-inline-size: 52ch; }
  .settings-field .input { min-inline-size: 0; background: var(--surface); }
  textarea.input { resize: vertical; }
  @container (min-width: 42rem) {
    .settings-field {
      grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
      gap: 28px;
      align-items: start;
      padding-block: 22px;
    }
  }
  .settings-save {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: clamp(8px, 1.4vw, 16px);
    align-items: center;
    margin-top: 20px;
    color: var(--accent);
  }
  .settings-save::before, .settings-save::after {
    content: "";
    block-size: 1px;
    background: var(--accent-line);
  }
  #btn-save-settings {
    min-block-size: var(--control);
    padding-inline: 8px;
    border-color: transparent;
    background: transparent;
    color: inherit;
    transition: text-shadow 150ms ease-out;
  }
  #btn-save-settings:hover:not([aria-disabled]) {
    background: transparent;
    text-shadow: 0 0 12px color-mix(in srgb, currentColor 32%, transparent);
  }
  .settings-save-status { text-align: center; overflow-wrap: anywhere; }

}
@media (prefers-reduced-motion: reduce) {
  :root[data-leo-design="new"] #view-settings #btn-save-settings { transition: none; }
}

@media (max-width: 1060px) {
  .leo-app { --sidebar-width: 218px; }
  .leo-sidebar { padding-inline: 12px; }
  .leo-hero { padding-inline: 24px; }
}
@media (max-width: 1120px) {
  .settings-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 800px) {
  .leo-sidebar {
    grid-row: 1;
    max-height: 36dvh;
    padding: 12px var(--gutter);
    border: 0;
    border-bottom: 1px solid var(--border);
  }
  .leo-sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
  .brand-mark { flex-basis: 40px; height: 40px; border-radius: 12px; }
  .brand-title { font-size: 29px; }
  #leo-menu-toggle { display: inline-flex; align-items: center; }
  #main-tabs { display: none; margin-top: 12px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .leo-appearance { display: none; padding: 12px 0 4px; }
  .leo-sidebar.is-menu-open :is(#main-tabs, .leo-appearance) { display: grid; }
  #main-tabs .tab { padding-inline: 8px; font-size: var(--text-sm); }
  .leo-sidebar .account-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin-top: 8px;
    padding: 6px 0 0;
  }
  #account-bar-name, .account-connection { font-size: var(--text-sm); }
  .account-switch { min-height: 44px; }
  .leo-workspace > .topbar { padding-block: 16px 0; }
  body:has(.leo-app) .container { padding-block: 24px 40px; }
  .leo-hero { min-height: 184px; padding: 20px; }
}
@media (max-width: 480px) {
  .leo-hero { min-height: 174px; }
  .leo-hero-copy { width: 70%; }
  .leo-hero h1 { font-size: clamp(29px, 8.8vw, 39px); }
  .leo-hero p { margin-top: 10px; font-size: var(--text-md); }
  .leo-postmark { width: 43%; }
  .postmark-heart { right: 24%; }
  .postmark-frame { right: 5%; width: 68%; }
  .spark-top { left: 26%; font-size: 23px; }
  .spark-bottom { right: 12%; font-size: 21px; }
  .postmark-mini { right: 12%; }
  .settings-layout > .card { padding: 16px; }
  body:has(.leo-app) .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body:has(.leo-app) .kpi-card { padding: 12px; }
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: clip;
  clip-path: inset(50%);
  white-space: nowrap;
}
.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 20px;
}
.view-heading h1 { font-size: var(--text-display); }
.view-heading p { max-width: 58ch; margin: 8px 0 0; color: var(--muted); }
#feed-profile-count { font-size: var(--text-sm); }

.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
}
.has-feed-detail .feed-layout { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.feed-list { min-width: 0; }
.feed-toolbar {
  display: flex;
  min-height: 60px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
#feed-selection-count { color: var(--muted); font-size: var(--text-sm); }
.feed-bulk-actions, .feed-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#clear-feed-selection { display: none; }
#feed-table-wrap {
  max-height: min(66vh, 680px);
  scrollbar-gutter: stable;
  border-radius: 0 0 0 var(--radius-panel);
}
.feed-table { table-layout: fixed; font-size: var(--text-md); }
.feed-table th, .feed-table td {
  padding: 9px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.feed-table th {
  background: var(--well);
  color: var(--muted);
  z-index: 1;
  font-size: var(--text-xs);
}
.feed-row:last-child td { border-bottom: 0; }
.feed-table .feed-check-cell { width: 48px; padding: 0; }
.feed-table .feed-time-cell { width: 68px; color: var(--muted); }
.feed-table .feed-score-cell { width: 80px; }
.feed-table .feed-action-cell { width: 125px; }
.feed-check {
  display: grid;
  min-height: 48px;
  place-items: center;
  cursor: pointer;
}
.feed-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.has-feed-detail .feed-row { cursor: pointer; }
.has-feed-detail .feed-row:hover { background: var(--surface-hover); color: var(--text); }
.feed-row.is-marked, .feed-row.is-marked:hover { background: var(--surface-2); color: var(--text); }
.feed-row.is-open, .feed-row.is-open:hover { background: var(--accent-bg); color: var(--text); }
.feed-row.is-open td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.feed-profile-link, .feed-profile-name {
  display: inline-block;
  max-width: 100%;
  min-height: 20px;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 0;
  font-size: var(--text-md);
  font-weight: 650;
  text-align: left;
  overflow-wrap: anywhere;
}
.feed-profile-link { cursor: pointer; }
.feed-profile-link:active { color: var(--accent); }
.feed-profile-link:hover { text-decoration: underline; }
.feed-row.is-open .feed-profile-link { color: var(--accent); }
.feed-row-preview {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.feed-mobile-time { display: none; }
.feed-mobile-time:has(~ :not(:empty))::after { content: " · "; }
.feed-row-city:not(:empty) + .feed-row-message:not(:empty)::before { content: " — "; }
:root:not([data-leo-design="new"]) #feed-detail-person { display: none; }
.feed-decision { color: var(--muted); font-size: var(--text-xs); }
.feed-decision.liked { color: var(--green); }
.feed-decision.failed { color: var(--red); }
.feed-table .feed-list-message { padding: 32px 16px; color: var(--muted); }
.feed-results:empty { display: none; }
.feed-result-list { padding: 16px; border-top: 1px solid var(--border); }
.feed-results-title { margin: 0; font-size: var(--text-lg); }
.feed-result { padding-block: 12px; border-bottom: 1px solid var(--border); }
.feed-result-list > .btn { margin-top: 12px; }

.feed-layout:has(.is-marked) #feed-profile-slot [data-profile-action="check"] {
  --button-fill: var(--surface-2);
  --button-hover: var(--surface-hover);
  --button-ink: var(--text);
  border-color: var(--border);
}
#feed-profile-slot { min-width: 0; align-self: stretch; }
.has-feed-detail #feed-profile-slot { border-inline-start: 1px solid var(--border); }
.feed-detail { min-width: 0; padding: 20px; overflow-wrap: anywhere; }
.feed-detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 16px;
}
.feed-detail-top h2 { margin: 0; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.feed-detail-empty { margin: 24px 0; color: var(--muted); }
.feed-detail-name { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; line-height: 1.2; }
.feed-detail-city, .feed-no-photos { margin: 4px 0 12px; color: var(--muted); }
.feed-detail .stop-photos { margin-block: 16px; }
.feed-detail .stop-photos .btn { padding: 0; }
.feed-detail .stop-photos img {
  height: auto;
  aspect-ratio: 4 / 5;
  max-height: 184px;
  object-fit: contain;
}
.feed-detail .stop-photos figcaption { margin-top: 4px; font-size: var(--text-xs); }
.feed-bio { margin: 12px 0 16px; }
.feed-bio p { margin: 0; }
:root:not([data-leo-design="new"]) .feed-bio-empty { display: none; }
.feed-profile-nav, .feed-bio-label, .feed-missing-gallery, .feed-close-icon { display: none; }
.feed-finding-preview .feed-finding-label { display: none; }
.feed-finding p { margin: 0; white-space: pre-wrap; }
.feed-report .feed-finding { margin-block: 1em; }
.feed-result-name { margin: 0; font: inherit; }
.feed-message { padding: 8px 12px; border-inline-start: 2px solid var(--border-strong); margin-bottom: 16px; }
.feed-message p { margin: 4px 0 0; white-space: pre-wrap; }
.feed-rule-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.feed-report:empty { display: none; }
.feed-report { padding-top: 12px; }
:is(#feed-profile-dialog, #priority-dialog) {
  width: min(560px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-panel);
}
:is(#feed-profile-dialog, #priority-dialog)::backdrop { background: var(--overlay); }

@media (max-width: 1120px) {
  body:has(.leo-app) .dialogs-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1280px) {
  .has-feed-detail .feed-layout { grid-template-columns: minmax(0, 1fr); }
  #feed-profile-slot { display: none; }
}

@media (max-width: 600px) {
  .view-heading h1 { font-size: 34px; }
  .feed-toolbar { padding: 8px 12px; }
  .feed-bulk-actions { flex: 1 0 100%; }
  .feed-bulk-actions .btn { flex: 1 1 auto; }
  #feed-table-wrap { max-height: 57vh; }
  .feed-table .feed-time-cell { display: none; }
  .feed-mobile-time { display: inline; }
  .feed-table { overflow-wrap: anywhere; }
  .feed-table .feed-check-cell { width: 44px; }
  .feed-table .feed-score-cell { width: 62px; white-space: nowrap; }
  .feed-table .feed-action-cell { width: 86px; }
  .feed-table th, .feed-table td { padding-inline: 7px; }
  .feed-profile-link { min-height: 24px; }
  .feed-detail { padding: 16px; }
  .feed-detail-actions .btn, .feed-rule-actions .btn { min-height: 44px; }
  body:has(.leo-app) .input-row, body:has(.leo-app) .goal-input-row { flex-wrap: wrap; }
  body:has(.leo-app) .dialog-top, body:has(.leo-app) .dialog-actions { flex-wrap: wrap; }
  body:has(.leo-app) .toast { inset: auto 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; }
}

/* The workspace scrolls independently of the navigation, status and controls. */
.autopilot {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  margin: 14px var(--gutter) 0;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}
#overview-status {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-block: 10px 4px;
  background: var(--bg);
}
.leo-app:not([data-view="overview"]) #overview-status { display: none; }
#overview-status > .autopilot { margin: 0; }
.autopilot-state {
  display: grid;
  gap: 2px;
  min-width: 0;
  align-content: center;
  text-align: center;
  padding-inline: clamp(8px, 1.2vw, 16px);
  overflow-wrap: anywhere;
}
.autopilot-state + .autopilot-state { border-inline-start: 1px solid var(--border); }
.autopilot .status-label { font-size: var(--text-xs); font-weight: 750; line-height: 1.18; }
.autopilot .status-value { font-size: var(--text-sm); font-weight: 850; line-height: 1.22; }
.autopilot .status-note { font-size: 11px; line-height: 1.2; }
.autopilot [data-state="off"] { color: var(--red); }

/* The first cell shows the worker state without its run history. */
:root[data-leo-design="new"] .autopilot-state:first-child .status-note { display: none; }
.bot-controls #account-bar-error { grid-column: 1 / -1; margin: 4px 4px 0; }
:root:is([data-leo-theme="dark"], [data-leo-theme="midnight"]) .autopilot .status-value:is([data-state="active"], [data-state="paused"], [data-state="off"], [data-state="error"]) {
  text-shadow: 0 0 10px color-mix(in srgb, currentColor 34%, transparent);
}
/* The right column is a full-height sibling of the navigation and workspace. */
.bot-controls {
  grid-column: 3;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 12px;
  border-inline-start: 1px solid var(--border);
  background: var(--sidebar);
}
.bot-control-group {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  margin-block: auto;
}
.bot-controls-title { display: none; }
.reply-switch-label, #feed-card-actions { display: none; }
.bot-control-group .tab {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  text-align: start;
  white-space: normal;
  font-size: var(--text-sm);
  font-weight: 750;
}
.bot-control-group .tab:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.bot-control-group .tab:disabled {
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
}
.bot-control-group .control-danger:not(:disabled) { color: var(--red); background: var(--red-bg); }
.bot-control-group .control-start:not(:disabled) { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.bot-control-group .control-start:hover:not(:disabled) { background: var(--accent-hover); }
.bot-control-group .tab[aria-expanded="true"] { color: var(--accent); background: var(--accent-bg); }
#control-account-stop:empty { display: none; }
#control-account-stop:not(:empty), #btn-stop-bot { margin-top: 4px; }
.feed-pause-panel {
  padding: 14px;
  border-inline-start: 3px solid var(--accent);
  background: var(--surface);
}
.feed-pause-panel label { display: block; margin-bottom: 6px; color: var(--muted); }
.feed-pause-panel .input { width: min(100%, 10rem); }
.pause-presets, .pause-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#feed-pause-error { margin-bottom: 0; color: var(--red); }
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.summary-metrics > div { padding: 12px 16px; border-radius: var(--radius-panel); background: var(--surface); }
.summary-metrics dt { color: var(--muted); }
.summary-metrics dd { margin: 4px 0 0; font-size: var(--text-xl); font-weight: 800; }
.summary-metric-symbols { position: absolute; }
.summary-metric-icon { display: none; }
.overview-events .log-box { margin-top: 8px; }
.overview-events .log-box:has(> .empty-state:only-child) { height: auto; }
@media (max-width: 960px) {
  .leo-app {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .bot-controls {
    grid-column: 2;
    grid-row: 3;
    max-height: 38dvh;
    padding: 8px var(--gutter) max(8px, env(safe-area-inset-bottom));
    border-inline-start: 0;
    border-top: 1px solid var(--border);
  }
  .bot-control-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #control-account-stop:not(:empty), #btn-stop-bot { margin-top: 0; }
  .bot-control-group .tab { min-height: 44px; }
  .feed-pause-panel { grid-column: 1 / -1; }
  body:has(.leo-app) .toast { bottom: 74px; pointer-events: none; }
}
@media (max-width: 800px) {
  .leo-app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .autopilot { grid-column: 1; grid-row: 2; margin: 8px var(--gutter) 0; }
  .leo-workspace { grid-column: 1; grid-row: 3; }
  .bot-controls { grid-column: 1; grid-row: 4; }
}
@media (max-width: 600px) {
  .autopilot { padding: 8px 2px; }
  .autopilot-state { padding-inline: 4px; }
  .autopilot .status-label, .autopilot .status-value { font-size: clamp(10px, 3.1vw, 13px); }
  .bot-control-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:has(.leo-app) .toast { bottom: 118px; }
  .summary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* New design palettes. Classic uses the three palettes above. */
:root[data-leo-design="new"] body:has(.leo-app) {
  --hero-surface: #f2d6ab;
  --hero-ink: #543835;
  --art-surface: #202f83;
  --heart-glow: #783b7f;
  --postmark-line: rgb(183 184 255 / 28%);
  --stamp-rule: #a9adf6;
  --stamp-heart: #ff775d;
  --stamp-blue: #79d9be;
  --stamp-gold: #ffd77f;
}

:root[data-leo-design="new"][data-leo-theme="light"] body:is(:has(.leo-app), .admin-new) {
  --bg: #f5f2e9;
  --surface: #fffdf7;
  --surface-2: #f1eee4;
  --surface-hover: #e9ede1;
  --well: #efebdf;
  --sidebar: #ede9dd;
  --border: #d7d2c4;
  --border-strong: #7d8273;
  --text: #252c25;
  --muted: #555e51;
  --accent: #2b5847;
  --accent-hover: #204637;
  --accent-ink: #fbf8ef;
  --accent-bg: #dfe9db;
  --green: #355d3b;
  --green-bg: #e2edda;
  --red: #8a3b2d;
  --red-bg: #f6e1d7;
  --yellow: #6f4a15;
  --yellow-bg: #f5e8c9;
  --warn-line: color-mix(in srgb, var(--yellow) 30%, var(--surface));
  --warn-border: var(--warn-line);
  --shadow: rgb(36 48 38 / 12%);
  --overlay: rgb(34 47 39 / 48%);
  --hero-surface: #e4e9db;
  --hero-ink: #233f33;
  --art-surface: #285443;
  --heart-glow: #3d6953;
  --postmark-line: rgb(224 236 210 / 23%);
  --stamp-rule: #a7bba1;
  --stamp-heart: #f5d6a0;
  --stamp-blue: #c1d8b8;
  --stamp-gold: #e9c88d;
  --likes-surface: #eee6d4;
  --messages-surface: #e6e9df;
  --replies-surface: #e0ead9;
}

:root[data-leo-design="new"][data-leo-theme="dark"] body:is(:has(.leo-app), .admin-new) {
  --bg: #0d1e17;
  --surface: #172e24;
  --surface-2: #213b2e;
  --surface-hover: #2d493a;
  --well: #10261c;
  --sidebar: #11251b;
  --border: #315040;
  --border-strong: #779688;
  --text: #f6f0e2;
  --muted: #c1d2c4;
  --accent: #ffb865;
  --accent-hover: #ffcb8a;
  --accent-ink: #382416;
  --accent-bg: #4e3928;
  --green: #9ee7b6;
  --green-bg: #274b39;
  --red: #ffada8;
  --red-bg: #523339;
  --yellow: #ffe194;
  --yellow-bg: #51432c;
  --overlay: rgb(9 24 20 / 72%);
  --hero-surface: #1f4637;
  --hero-ink: #fff0d6;
  --art-surface: #11332d;
  --heart-glow: #255c49;
  --postmark-line: rgb(178 235 198 / 22%);
  --stamp-rule: #a5d8b9;
  --stamp-heart: #ffbe78;
  --stamp-blue: #96e4c8;
  --stamp-gold: #f5d887;
  --likes-surface: #51392c;
  --messages-surface: #274b4a;
  --replies-surface: #2e5039;
}

:root[data-leo-design="new"][data-leo-theme="midnight"] body:is(:has(.leo-app), .admin-new) {
  --bg: #0b090e;
  --surface: #16121a;
  --surface-2: #201926;
  --surface-hover: #302239;
  --well: #110d15;
  --sidebar: #100d15;
  --border: #392c43;
  --border-strong: #867292;
  --text: #f5edf7;
  --muted: #c7b6ce;
  --accent: #f3a9d8;
  --accent-hover: #ffc5e9;
  --accent-ink: #35142c;
  --accent-bg: #40263a;
  --hero-surface: #171022;
  --hero-ink: #ddd0e5;
  --art-surface: #202069;
  --heart-glow: #4d256b;
  --postmark-line: rgb(172 169 255 / 30%);
  --stamp-rule: #a29bf3;
  --stamp-heart: #eb6fa8;
  --stamp-blue: #9ab9ff;
  --stamp-gold: #ffbe86;
  --likes-surface: #322037;
  --messages-surface: #1d2947;
  --replies-surface: #192f2b;
}

:root[data-leo-design="new"] .leo-app[data-view="overview"] .leo-hero {
  display: grid;
  grid-template-columns: minmax(0, 56fr) minmax(0, 44fr);
  align-items: stretch;
  padding: 0;
}

:root[data-leo-design="new"] .leo-hero-copy {
  width: auto;
  padding: clamp(22px, calc((100vw - var(--sidebar-width) - var(--controls-width)) * .04), 52px);
}

:root[data-leo-design="new"] .leo-hero h1 {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(34px, calc((100vw - var(--sidebar-width) - var(--controls-width)) * .08), 96px);
  line-height: .95;
  letter-spacing: -.065em;
  text-transform: uppercase;
}

:root[data-leo-design="new"] .leo-hero h1 span { display: block; }
:root[data-leo-design="new"] .leo-postmark {
  position: relative;
  z-index: 0;
  inset: auto;
  width: auto;
  overflow: clip;
  background:
    radial-gradient(circle at 59% 50%, var(--heart-glow) 0 24%, transparent 24.5%),
    repeating-radial-gradient(ellipse at 59% 50%, transparent 0 13px, var(--postmark-line) 14px 15px),
    var(--art-surface);
  mask-image: none;
}

:root[data-leo-design="new"] .postmark-frame {
  inset: 10% 13%;
  width: auto;
  height: auto;
  border-style: solid;
  opacity: .75;
}

:root[data-leo-design="new"] .postmark-heart {
  --heart-size: clamp(60px, 10vw, 146px);
  top: 35%;
  right: 31%;
}

:root[data-leo-design="new"] .postmark-mini {
  --heart-size: clamp(15px, 3vw, 42px);
  right: 16%;
  top: 23%;
}

@media (max-width: 960px) {
  .leo-app { --controls-width: 0px; }
}
@media (max-width: 800px) {
  .leo-app { --sidebar-width: 0px; }
}
@media (max-width: 650px) {
  :root[data-leo-design="new"] .leo-app[data-view="overview"] .leo-hero {
    grid-template-columns: minmax(0, 64fr) minmax(0, 36fr);
  }
  :root[data-leo-design="new"] .leo-hero-copy { padding: 20px 12px 20px 16px; }
  :root[data-leo-design="new"] .leo-hero h1 { font-size: clamp(28px, 8.5vw, 48px); }
  :root[data-leo-design="new"] .leo-hero p { margin-top: 12px; font-size: var(--text-md); }
  :root[data-leo-design="new"] .postmark-heart { --heart-size: clamp(38px, 12vw, 74px); right: 29%; }
}

.feed-today { display: none; }

/* The feed keeps the list in place while its side pane changes. */
:root[data-leo-design="new"] {
  .leo-app:is([data-view="profiles"], [data-view="matches"], [data-view="always-likes"]) .leo-workspace { overflow: clip; }
  .leo-app:is([data-view="profiles"], [data-view="matches"], [data-view="always-likes"]) .container {
    block-size: 100%;
    padding-block: 24px 20px;
  }
  :is(#view-profiles, #view-always-likes).active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    block-size: 100%;
    max-width: 1080px;
    margin-inline: auto;
  }
  #view-profiles .view-heading { align-items: baseline; margin-bottom: 12px; padding-inline-start: 12px; }
  #view-profiles.active { grid-template-rows: auto minmax(0, 1fr) auto; }
  .summary-metrics dt { display: flex; align-items: center; gap: 6px; }
  .summary-metrics dd { font-variant-numeric: tabular-nums; }
  .summary-metric-icon {
    display: block;
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .feed-today {
    display: block;
    grid-row: 3;
    grid-column: 1 / -1;
    margin-block-start: 12px;
  }
  .feed-today .leo-section-title { margin-block-end: 8px; }
  .feed-today .summary-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
  .feed-today dd { overflow-wrap: anywhere; }
  #feed-profile-count { margin-inline-end: -8px; }
  .feed-intro,
  .feed-action-suffix,
  .feed-row-message,
  .feed-mobile-time:has(+ .feed-row-city:empty)::after,
  #view-profiles:not(.has-feed-selection) .feed-toolbar,
  .feed-inline-results-title,
  .feed-preview-prefix,
  .feed-detail .stop-photos figcaption,
  .feed-detail .stop-photos figure:not(:has(img)),
  .feed-detail .stop-photos:not(:has(img)) { display: none; }

  .feed-layout {
    border: 0;
    background: transparent;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }
  .feed-list {
    display: flex;
    flex-direction: column;
    min-block-size: 0;
    background: var(--surface);
    border-radius: var(--radius-panel);
  }

  .feed-toolbar {
    flex: none;
    background: var(--surface-2);
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
    min-height: 0;
    padding: 8px 16px;
  }
  .feed-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
  .feed-toolbar .btn { min-height: 38px; }
  .feed-selection #clear-feed-selection {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 4px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: var(--text-xs);
  }
  #clear-feed-selection:hover { color: var(--accent); text-decoration: underline; }
  #feed-selection-count { color: var(--text); font-weight: 750; }
  #feed-table-wrap {
    --feed-column-head: 36px;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    scrollbar-gutter: auto;
    scroll-padding-block-start: var(--feed-column-head);
    padding-inline: 12px;
    padding-block-end: 8px;
    border-radius: 0 0 var(--radius-panel) var(--radius-panel);
  }
  #feed-table-wrap:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
  .feed-table { font-variant-numeric: tabular-nums; border-collapse: separate; border-spacing: 0; }
  .feed-table thead { position: sticky; inset-block-start: 0; z-index: 2; }
  .feed-table th {
    position: static;
    height: var(--feed-column-head);
    padding-block: 4px;
    font-size: var(--text-xs);
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
  }
  #view-profiles:not(.has-feed-selection) .feed-table th:first-child {
    border-start-start-radius: var(--radius-panel);
  }
  #view-profiles:not(.has-feed-selection) .feed-table th:last-child {
    border-start-end-radius: var(--radius-panel);
  }
  .feed-table td:not(.feed-check-cell) { padding-block: 4px; }
  .feed-table :is(th, td) { border-color: color-mix(in srgb, var(--border) 75%, transparent); }
  .feed-table .feed-check-cell { width: 40px; }
  .feed-check { min-height: 44px; }
  .feed-table .feed-time-cell { width: 86px; padding-inline: 6px; white-space: nowrap; font-size: var(--text-xs); text-align: center; }
  .feed-table .feed-score-cell { width: 64px; padding-inline: 6px; text-align: center; }
  .feed-table .feed-action-cell { width: 108px; padding-inline-start: 8px; }
  .feed-profile-link, .feed-profile-name {
    font-weight: 800;
    vertical-align: top;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .feed-profile-link:hover { color: var(--accent); }
  .feed-row-city:empty { display: none; }
  .feed-row.is-marked:not(.is-open) { background: var(--surface-2); }
  .has-feed-detail .feed-row td:last-child { position: relative; padding-inline-end: 18px; }
  .has-feed-detail .feed-row td:last-child::after {
    content: "";
    position: absolute;
    inset-inline-end: 7px;
    inset-block-start: 50%;
    width: 6px;
    height: 6px;
    color: var(--muted);
    border-block-start: 1.5px solid;
    border-inline-end: 1.5px solid;
    transform: translateY(-50%) rotate(45deg);
  }
  .feed-row.is-open td:last-child::after { color: var(--accent); }
  .feed-decision:is(.liked, .failed) {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-control);
    line-height: 1.25;
    font-weight: 750;
  }
  .feed-decision.liked { background: var(--green-bg); }
  .feed-decision.failed { background: var(--red-bg); }

  .feed-detail { padding: 0; min-block-size: 100%; display: flex; flex-direction: column; }
  #feed-profile-detail { block-size: 100%; }
  .feed-detail-top {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    padding: 12px 16px 8px;
    margin: 0;
    align-items: center;
    justify-content: flex-start;
    background: var(--surface);
  }
  .feed-detail-top h2 {
    align-self: center;
    font: 650 var(--text-xl)/1.18 var(--font-display);
    color: var(--text);
  }
  #feed-profile-detail .feed-detail-top { flex: none; block-size: 56px; }
  #feed-detail-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #feed-detail-label:has(#feed-detail-person:not([hidden])) .feed-detail-caption,
  .feed-detail-name { display: none; }
  #account-profile-card {
    flex: 1 1 auto;
    min-block-size: 0;
    padding: 0 16px;
    overflow: auto;
    scrollbar-width: none;
    container-type: size;
  }
  .feed-detail-city {
    block-size: 22px;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .feed-no-photos, .feed-bio {
    background: var(--well);
    padding: 12px;
    border-radius: var(--radius-control);
  }
  .feed-missing-gallery { display: block; }
  .feed-gallery {
    block-size: clamp(196px, calc(100cqh - 46px), 380px);
    display: grid;
    place-items: center;
    grid-template-columns: minmax(0, 1fr);
  }
  #account-profile-card:has(.feed-message) .feed-gallery {
    block-size: clamp(196px, calc(100cqh - 64px), 380px);
  }
  .feed-gallery .feed-no-photos { margin: 0; }
  .feed-detail .stop-photos {
    display: flex;
    justify-content: safe center;
    block-size: 100%;
    inline-size: 100%;
    max-width: 100%;
    overflow: auto hidden;
    scrollbar-width: none;
    margin: 0;
  }
  .feed-detail .feed-photo-stack {
    position: relative;
    display: block;
    isolation: isolate;
    overflow: clip;
  }
  .feed-photo-stack figure {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    inline-size: min(52%, 216px);
    block-size: calc(100% - 20px);
    margin: 0;
    transform: translate(-50%, -50%);
    transition: transform 260ms cubic-bezier(.22, 1, .36, 1),
                opacity 200ms ease-out, visibility 200ms;
  }
  .feed-photo-stack figure[data-position="front"] { z-index: 2; }
  .feed-photo-stack figure[data-position="left"] { transform: translate(-97%, -50%) scale(.84) rotate(-4deg); }
  .feed-photo-stack figure[data-position="right"] { transform: translate(-3%, -50%) scale(.84) rotate(4deg); }
  .feed-photo-stack figure[data-position="behind"] { opacity: 0; visibility: hidden; pointer-events: none; }
  .feed-photo-stack figure:is([data-position="left"], [data-position="right"]) img { filter: brightness(.78) blur(.7px); }
  .feed-photo-stack figure[data-position="front"] > .btn {
    border-color: var(--border-strong);
    box-shadow: 0 5px 12px var(--shadow);
    cursor: zoom-in;
  }
  .feed-photo-stack figure > .btn { transition: transform 180ms cubic-bezier(.22, 1, .36, 1); }
  @media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .feed-photo-stack figure:hover > .btn { transform: translateY(-7px) scale(1.04); }
    .feed-photo-stack figure img { transition: filter 180ms ease-out; }
    .feed-photo-stack figure:is([data-position="left"], [data-position="right"]):hover img {
      filter: brightness(.95) blur(.2px);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .feed-photo-stack figure, .feed-photo-stack figure > .btn { transition: none; }
  }
  .feed-detail .stop-photos .btn { padding: 0; width: 100%; height: 100%; overflow: hidden; }
  .feed-detail .stop-photos img { object-fit: contain; height: 100%; max-height: none; }
  .feed-bio {
    block-size: var(--profile-bio-height);
    margin: 0 0 8px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .feed-bio p { line-height: 1.5; overflow: auto; scrollbar-width: none; }
  .feed-bio-label, .feed-finding-label {
    display: block;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 750;
    margin-bottom: 4px;
  }
  .feed-message {
    background: var(--well);
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
  }
  .feed-detail-actions, .feed-rule-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 8px;
  }
  #feed-card-actions {
    --profile-bio-height: clamp(64px, 13.5dvh, 124px);
    display: block;
    flex: none;
    min-block-size: calc(var(--profile-bio-height) + 113px);
    padding: 0 16px 12px;
    background: var(--surface);
  }
  #feed-card-actions .feed-rule-actions { margin-top: 6px; padding-top: 6px; }
  #feed-card-actions :is(.feed-detail-actions, .feed-rule-actions) { margin-inline: clamp(4px, 1.2vw, 12px); }
  .feed-detail :is(.feed-detail-actions, .feed-rule-actions, .feed-detail-top, .feed-result-list) .btn {
    min-height: 36px;
    padding: 6px 10px;
  }
  .feed-detail .feed-detail-top .feed-close { flex: none; order: -1; min-inline-size: 40px; }
  .feed-close-icon { display: inline-block; font-size: var(--text-xl); line-height: 1; }
  .feed-close-caption { font-size: 0; }
  .feed-rule-actions .btn { background: transparent; }
  .feed-detail :is(.feed-detail-actions, .feed-rule-actions) .btn { block-size: 40px; padding-block: 4px; }
  .feed-rule-actions .btn:hover:not(:disabled) { background: var(--surface-hover); }
  #account-profile-card > [data-profile-action="refresh_photos"] {
    width: 100%;
    margin-block: 8px;
    background: transparent;
  }
  #account-profile-card > .feed-message { margin: 4px 0; padding: 6px 10px; }
  .feed-message summary { cursor: pointer; line-height: 1.25; }
  .feed-profile-nav {
    flex: none;
    position: sticky;
    inset-block-end: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 58px minmax(7ch, max-content) 58px;
    place-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 12px;
  }
  .feed-profile-nav .feed-arrow {
    display: grid;
    place-items: center;
    min-height: 44px;
    width: 100%;
    padding: 0;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 28px;
    line-height: 1;
  }
  .feed-profile-nav .feed-arrow:disabled { background: transparent; color: var(--muted); opacity: .65; }
  #feed-profile-position {
    min-width: 7ch;
    text-align: center;
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--muted);
  }
  .feed-report { padding-top: 12px; scroll-margin-block-end: 52px; }
  .feed-report > .btn { margin-top: 8px; }
  .feed-finding { padding: 8px 12px; border-radius: var(--radius-control); background: var(--well); }
  .feed-report .feed-finding { margin: 0; }
  .feed-finding + .feed-finding { margin-top: 6px; }
  .feed-finding-summary { font-weight: 750; line-height: 1.35; }
  .feed-finding-notes { color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
  .feed-finding .feed-finding-notes { margin-top: 4px; }
  .feed-result-list { padding: 0 16px 16px; border: 0; overflow-wrap: anywhere; }
  .feed-result-list > .muted { margin: 0; font-size: var(--text-sm); }
  .feed-result-name { font-weight: 800; margin-bottom: 6px; }
  .feed-result:last-child { border-bottom: 0; padding-bottom: 0; }
  .feed-result-body:has(.feed-result-photo) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(86px, 33%);
    align-items: center;
    gap: 12px;
  }
  .feed-result-findings { display: grid; gap: 10px; min-width: 0; }
  .feed-result-findings .feed-finding {
    margin: 0;
    padding: 6px 10px;
    border-radius: var(--radius-control);
    background: var(--well);
  }
  .feed-detail .feed-result-list .feed-result-photo {
    display: grid;
    place-items: center;
    min-height: 0;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
  }
  .feed-result-photo img { display: block; width: 100%; max-height: 280px; object-fit: contain; }
  .feed-detail .feed-result-list div.feed-result-photo {
    min-height: 64px;
    padding: 8px;
    border-radius: var(--radius-control);
    background: var(--well);
    color: var(--muted);
    text-align: center;
    font-size: var(--text-xs);
  }
  #feed-profile-dialog { overscroll-behavior: contain; border: 0; scrollbar-width: none; }
  #feed-profile-dialog:has(#feed-profile-detail:not([hidden])) { block-size: min(680px, calc(100dvh - 32px)); }
  #feed-profile-dialog::backdrop,
  .leo-app:is([data-view="profiles"], [data-view="matches"]) #profile-lightbox::backdrop {
    background: var(--overlay, rgb(52 34 44 / 52%));
  }

  @media (width > 960px) {
    .bot-controls { padding: 24px 16px; }
    .bot-control-group {
      margin-block: clamp(24px, 6dvh, 56px) auto;
      gap: 6px;
    }
    .bot-controls-title {
      display: block;
      margin: 0;
      padding: 0 4px 8px;
      font: 650 var(--text-lg)/1.2 var(--font-display);
    }
    #control-account-stop:not(:empty), #btn-stop-bot {
      margin-top: 4px;
      padding-top: 8px;
      border-top: 1px solid var(--border);
    }
    #btn-stop-bot { margin-top: 8px; }
    .bot-control-group .control-start:not(:disabled) { background: var(--accent); }
    .bot-control-group .control-start:hover:not(:disabled) { background: var(--accent-hover); }
    .feed-pause-panel { padding: 8px; }
  }

  #btn-kick-feed, #feed-pause-panel { display: none; }
  #reply-action-label { display: none; }
  .reply-switch-label { display: inline; }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message) {
    position: relative;
    min-height: 44px;
    padding: 6px 45px 6px 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message):hover:not(:disabled) {
    color: var(--text);
    background: transparent;
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message)::after {
    content: "";
    position: absolute;
    inset-inline-end: 4px;
    inset-block-start: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 20px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: var(--well);
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message)::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset-inline-end: 22px;
    inset-block-start: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--muted);
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message):is([data-on="true"], [aria-checked="true"]) {
    color: var(--accent);
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message):is([data-on="true"], [aria-checked="true"])::after {
    border-color: var(--accent);
    background: var(--accent-bg);
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message):is([data-on="true"], [aria-checked="true"])::before {
    inset-inline-end: 8px;
    background: var(--accent);
  }
  .bot-control-group :is(#btn-kick-feed, #btn-toggle-feed, #btn-toggle-replies, #btn-feed-message):disabled { opacity: .65; }
  .bot-control-group .control-danger:not(:disabled) {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border-color: transparent;
  }
  .bot-control-group .control-danger:not(:disabled)::before {
    content: "";
    flex: 0 0 8px;
    height: 8px;
    border-radius: 2px;
    background: currentColor;
  }
  .bot-control-group .control-danger:hover:not(:disabled) { background: var(--red-bg); }
  @media (601px <= width <= 960px) {
    .bot-control-group { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }

  @media (width > 1280px) {
    #view-profiles.has-feed-detail {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: clamp(16px, 2vw, 32px);
    }
    #view-profiles.has-feed-detail .view-heading { grid-area: 1 / 1; }
    #view-profiles.has-feed-detail .feed-layout { display: contents; }
    .has-feed-detail .feed-list { grid-area: 2 / 1; }
    .has-feed-detail #feed-profile-slot {
      grid-area: 2 / 2;
      align-self: stretch;
      min-block-size: 0;
      overflow: auto;
      overscroll-behavior: contain;
      scrollbar-width: none;
      background: var(--surface);
      border: 0;
      border-radius: var(--radius-panel);
    }
    #feed-slot-empty { margin: 0; padding: 24px; text-align: center; align-content: center; block-size: 100%; }
    .feed-detail .feed-detail-top .feed-close { display: none; }
  }
  @media (max-width: 1120px) {
    .feed-today .leo-section-title { font-size: 24px; }
    .feed-today .summary-metrics { gap: 8px; }
    .feed-today .summary-metrics > div { padding: 8px; }
    .feed-today dt { gap: 4px; font-size: var(--text-xs); }
    .feed-today dd { font-size: var(--text-lg); }
    .feed-today .summary-metric-icon { width: 13px; height: 13px; }
  }
  @media (max-width: 600px) {
    .leo-app:is([data-view="profiles"], [data-view="matches"], [data-view="always-likes"]) .container { padding-block: 16px 12px; }
    .feed-today { margin-block-start: 8px; }
    .feed-today .leo-section-title { font-size: 20px; margin-block-end: 4px; }
    .feed-today .summary-metrics { gap: 4px; }
    .feed-today .summary-metrics > div { padding: 5px; }
    .feed-today dt { gap: 3px; font-size: 11px; }
    .feed-today .summary-metric-icon { width: 11px; height: 11px; }
    .feed-today dd { font-size: var(--text-md); }
    #feed-table-wrap { padding-inline: 8px; }
    .feed-toolbar { padding-inline: 8px; gap: 4px 8px; }
    .feed-toolbar .btn { min-height: 36px; padding-inline: 8px; }
    .bot-control-group #control-account-stop, .bot-control-group #btn-stop-bot { grid-column: 1 / -1; }
    .feed-bulk-actions { flex: 0 1 auto; gap: 4px; }
    .feed-table .feed-score-cell { width: 58px; }
    .feed-table .feed-action-cell { width: 116px; }
    .feed-table .feed-row-preview { display: block; }
    .feed-decision:is(.liked, .failed) { padding-inline: 4px; }
    .has-feed-detail .feed-row td:last-child { padding-inline-end: 16px; }
    .has-feed-detail .feed-row td:last-child::after { inset-inline-end: 7px; }
    .feed-detail :is(.feed-detail-actions, .feed-rule-actions, .feed-detail-top, .feed-result-list) .btn { min-height: 40px; }
    #feed-card-actions .btn { padding-inline: 8px; }
  }
}



:root:not([data-leo-design="new"]) {
  #priority-slot { display: contents; }
  :is(.stop-new-only, #stop-entry-slot) { display: none; }
  #stop-history { display: block; margin-block-start: 14px; }
  #stop-review-slot:has(#stop-review-detail[hidden]) { display: none; }
  #stop-review-heading { font: inherit; font-size: var(--text-lg); font-weight: 700; }
  #always-likes-profile { display: flex; flex-direction: column; }
  .priority-bio { order: -1; margin: 12px 0 16px; }
  .priority-bio p { margin: 0; }
  .priority-heading { order: -2; }
}

:root[data-leo-design="new"] {
  #view-always-likes .view-heading { margin-bottom: 12px; padding-inline-start: 12px; }
  .leo-app .priority-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(16px, 2vw, 32px);
    align-items: stretch;
    min-block-size: 0;
  }
  :is(.priority-list, .priority-detail).card {
    border: 0;
    min-width: 0;
    min-block-size: 0;
  }
  .priority-list.card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: transparent;
  }
  .priority-detail.card { background: var(--surface); }
  :is(#always-likes-search, #stoplist-search, #match-search) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    flex: none;
  }
  :is(#always-likes-search, #stoplist-search, #match-search) label { grid-column: 1 / -1; margin: 0; }
  :is(#always-likes-search, #stoplist-search, #match-search) .form-actions { margin: 0; }
  :is(#always-likes-search, #stoplist-search, #match-search) :is(.input, .btn) { min-block-size: 44px; border-radius: 24px; }
  :is(#always-likes-search, #stoplist-search, #match-search) .btn { padding-inline: 16px; }
  :is(#always-likes-name, #stoplist-name, #match-name):focus {
    border-color: var(--accent);
    outline: 1px solid var(--accent);
    outline-offset: -1px;
  }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) {
    flex: 1 1 auto;
    gap: 0;
    min-block-size: 0;
    max-block-size: none;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .stop-row { display: block; padding: 2px 0; }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    inline-size: 100%;
    min-block-size: 48px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--text);
    font-weight: 750;
    overflow-wrap: anywhere;
  }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .btn::after {
    content: "›" / "";
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
  }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .btn:hover { background: var(--surface-hover); }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .btn[aria-expanded="true"] {
    background: var(--accent-bg);
    color: var(--accent);
  }
  :is(#always-likes-rules, #stoplist-entries, #match-entries) .btn:focus-visible { outline-offset: -2px; }

  #priority-slot { display: none; min-block-size: 0; }
  #priority-dialog {
    block-size: min(680px, calc(100dvh - 32px));
    overscroll-behavior: contain;
    border: 0;
    scrollbar-width: none;
  }
  .priority-detail {
    position: relative;
    display: flex;
    flex-direction: column;
    block-size: 100%;
  }
  :is(#priority-back, #stop-entry-back) {
    position: absolute;
    inset: 12px auto auto 16px;
    z-index: 1;
    inline-size: 44px;
    min-block-size: 44px;
    padding: 0;
    font-size: var(--text-xl);
  }
  .rule-profile-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-block-size: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    scroll-padding-block: 4px;
  }
  .priority-heading {
    flex: none;
    min-block-size: 44px;
    margin: 0;
  }
  .priority-person { min-width: 0; }
  .priority-heading h3,
  .leo-app[data-view="matches"] #feed-detail-label:has(#feed-detail-person:not([hidden])) {
    overflow-wrap: anywhere;
    font: 650 clamp(1.625rem, 2.5vw, 2.25rem)/1.12 var(--font-display);
  }
  .priority-city { margin: 0; overflow-wrap: anywhere; }
  .priority-gallery {
    --priority-photo-height: clamp(150px, 30dvh, 264px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(18px, 3vw, 38px);
    flex: none;
    block-size: calc(var(--priority-photo-height) + 24px);
    margin-block: 12px;
    padding: 12px 8px;
    border-radius: var(--radius-panel);
    background: var(--well);
  }
  .priority-photo-stage {
    flex: 0 1 264px;
    min-inline-size: 0;
    block-size: var(--priority-photo-height);
  }
  .priority-photo-stage .btn {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
  }
  .priority-photo-stage img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    border-radius: var(--radius-control);
  }
  .priority-photo-thumbs {
    display: flex;
    flex-direction: column;
    align-self: center;
    flex: none;
    gap: 6px;
    max-block-size: var(--priority-photo-height);
    padding: 3px;
    overflow: auto;
    scrollbar-width: none;
  }
  .priority-photo-thumbs:empty { display: none; }
  .priority-photo-thumbs .btn {
    flex: none;
    inline-size: 56px;
    block-size: 56px;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
  }
  .priority-photo-thumbs .btn[aria-pressed="true"] { border-color: var(--accent); }
  .priority-photo-thumbs img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    border-radius: inherit;
    object-fit: cover;
  }
  .priority-photo-empty { margin: 0; }
  .priority-bio {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    flex: 1 0 88px;
    max-block-size: 124px;
    margin: 0;
    padding: 12px;
    border-radius: var(--radius-control);
    background: var(--well);
    overflow-wrap: anywhere;
  }
  .priority-bio p {
    margin: 0;
    overflow: auto;
    scrollbar-width: none;
  }
  .priority-bio p:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
  .priority-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 0 72px;
    margin: 0;
    padding: 12px 12px 0;
  }
  .priority-action::before,
  .priority-action::after {
    content: "";
    flex: 1;
    border-block-start: 1px solid var(--border);
  }
  .priority-action p { margin: 0; }
  .priority-action .btn {
    min-block-size: 44px;
    border-color: transparent;
    background: transparent;
  }
  .priority-action .btn:hover { background: var(--surface-hover); }
  .priority-action .btn[aria-disabled="true"] { opacity: .65; cursor: wait; }
  .priority-nav {
    display: grid;
    grid-template-columns: 52px minmax(7ch, max-content) 52px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: none;
    padding-block-start: 10px;
    border-block-start: 1px solid var(--border);
  }
  .priority-nav .btn {
    min-block-size: 44px;
    padding: 0;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 1.375rem;
    line-height: 1;
  }
  .priority-nav .btn[aria-disabled="true"] {
    background: transparent;
    color: var(--muted);
    opacity: .65;
    cursor: default;
  }
  .rule-position {
    color: var(--muted);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    text-align: center;
  }
  .priority-empty {
    margin: auto;
    padding: 12px;
    text-align: center;
  }
  :is(#priority-dialog, #stop-entry-dialog) .priority-heading { padding-inline-start: 52px; }

  .leo-app #view-stoplist { max-inline-size: 1080px; margin-inline: auto; }
  #view-stoplist .view-heading { align-items: center; flex-wrap: wrap; gap: 12px; }
  .stop-view-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--well);
  }
  .stop-view-switch .btn {
    min-block-size: 36px;
    padding: 6px 10px;
    border: 0;
    background: transparent;
  }
  .stop-view-switch .btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-bg); }
  .stop-view-switch .btn:hover:not([aria-pressed="true"]) { background: var(--surface-hover); }
  :is(.stoplist-manual, .stop-classic-only) { display: none; }
  .leo-app .stoplist-layout { block-size: clamp(340px, 57dvh, 530px); }
  .stoplist-list .form-group { margin-block-end: 12px; }
  #stop-entry-slot { display: none; min-block-size: 0; }
  #stop-review-slot { display: none; min-block-size: 0; }
  #stop-review-panel { padding: 0; overflow: hidden; }
  #stop-review-heading { margin: 0 0 10px; font: 650 var(--text-xl)/1.2 var(--font-display); }
  #stoplist-reviews { flex: 1 1 auto; min-height: 0; max-height: none; scrollbar-width: none; }
  .stop-history-date {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    margin: 0;
    padding: 8px 10px 5px;
    background: var(--bg);
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 750;
  }
  .stop-history-day + .stop-history-day { margin-block-start: 12px; }
  .leo-app #stop-history {
    block-size: auto;
    grid-template-rows: auto clamp(300px, 48dvh, 420px);
    row-gap: 12px;
  }
  .stop-history-filter {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 6px 0 10px;
    border-block-end: 1px solid var(--border);
  }
  .stop-reason-selection {
    min-width: 0;
    padding: 8px 10px;
    border-radius: var(--radius-control);
    background: var(--well);
  }
  .stop-reason-list {
    min-width: 0;
    padding-block-start: 8px;
    border-block-start: 1px solid var(--border);
  }
  .stop-reason-label {
    margin: 0 0 4px;
    padding-inline: 2px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 750;
  }
  .stop-reason-selected-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
  }
  .stop-reason-track {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 40px;
    padding: 2px;
  }
  .stop-reason-track .btn,
  .stop-history-filter #stop-reason-reset {
    flex: none;
    min-block-size: 36px;
    max-inline-size: 100%;
    padding: 5px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: start;
  }
  #stop-reason-options { align-items: stretch; }
  #stop-reason-options .btn {
    max-inline-size: min(100%, 250px);
    padding-inline: 8px;
    font-size: var(--text-xs);
    line-height: 1.25;
  }
  .stop-reason-track p { margin: 0; }
  .stop-reason-track .btn:focus-visible { outline-offset: -2px; }
  #stop-reason-options .btn[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--surface);
  }
  .stop-reason-track .stop-reason-chip {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--accent-bg);
  }
  .stop-reason-remove { margin-inline-start: 7px; font-size: 1.15em; }
  #stoplist-reviews .stop-row { display: block; padding: 2px 0; }
  #stoplist-reviews .stop-history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 50%) 12px;
    align-items: center;
    gap: 12px;
    inline-size: 100%;
    min-block-size: 48px;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--text);
    overflow-wrap: anywhere;
  }
  #stoplist-reviews .stop-history-row:hover { background: var(--surface-hover); }
  #stoplist-reviews .stop-history-row[aria-current="true"] { background: var(--accent-bg); color: var(--accent); }
  #stoplist-reviews .stop-history-row:focus-visible { outline-offset: -2px; }
  #stoplist-reviews .stop-history-row::after {
    content: "›" / "";
    color: var(--accent);
    font-size: 1.25rem;
    line-height: 1;
  }
  .stop-history-stage {
    justify-self: stretch;
    font-size: var(--text-xs);
    line-height: 1.3;
    text-align: start;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 4px 8px;
    border-radius: var(--radius-control);
  }
  .stop-history-row[aria-current="true"] .stop-history-stage { background: var(--well); }
  .stop-history-pagination { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
  .stop-history-pagination:has(button:not([hidden])) { margin-block-start: 12px; }

  .stop-dialog {
    inline-size: min(880px, calc(100% - 24px));
    max-inline-size: none;
    max-block-size: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--radius-panel);
    background: var(--surface);
    color: var(--text);
    overscroll-behavior: contain;
  }
  .stop-dialog::backdrop { background: var(--overlay); }
  #stop-entry-dialog {
    inline-size: min(560px, calc(100% - 24px));
    block-size: min(680px, calc(100dvh - 32px));
  }
  .stop-review-top {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px clamp(12px, 2vw, 24px);
    border-block-end: 1px solid var(--border);
    background: var(--surface);
  }
  .stop-review-top .btn { flex: none; inline-size: 44px; min-block-size: 44px; padding: 0; font-size: var(--text-xl); }
  .stop-review-top h2 { margin: 0; font: 650 var(--text-xl)/1.2 var(--font-display); }
  #stop-review-dialog[open] {
    display: flex;
    flex-direction: column;
    block-size: min(720px, calc(100dvh - 32px));
    overflow: hidden;
  }
  .stop-review-top { flex: none; }
  #stop-review-meta { margin: 3px 0 0; overflow-wrap: anywhere; }
  #stop-review-meta:empty { display: none; }
  #stop-review-detail { padding-block: 12px; }
  #stop-review-panel #stop-review-detail {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow: auto;
    padding: 12px clamp(12px, 2vw, 24px);
    scrollbar-width: thin;
  }
  #stop-review-detail:has(> .priority-empty:only-child) { display: grid; place-content: center; }
  .stop-review-selector { margin-block-end: 12px; }
  .stop-review-selector label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .stop-review-selector select { inline-size: min(100%, 300px); }
  .stop-review-pair {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
    column-gap: clamp(16px, 2vw, 28px);
  }
  .stop-review-pair:has(.stop-review-profile + .stop-review-profile)::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 50%;
    border-inline-start: 1px dashed var(--border-strong);
    opacity: .55;
    pointer-events: none;
  }
  .stop-review-profile {
    display: grid;
    min-width: 0;
    grid-row: 1 / span 5;
    grid-template-rows: subgrid;
    overflow-wrap: anywhere;
  }
  .stop-review-profile .stop-comparison-label { margin: 0 0 4px; font-size: var(--text-xs); }
  .stop-review-profile h3 { margin: 0; font: 650 var(--text-lg)/1.25 var(--font-display); }
  .stop-review-description {
    grid-row: 4;
    min-block-size: 76px;
    max-block-size: 120px;
    margin-block-end: 8px;
    padding-block: 8px;
  }
  .stop-review-description p { max-block-size: 3lh; }
  .stop-review-gallery {
    --priority-photo-height: clamp(156px, 29dvh, 248px);
    margin-block: 0 8px;
    gap: 8px;
  }
  #stop-review-slot .stop-review-gallery {
    --priority-photo-height: clamp(168px, 26dvh, 236px);
    block-size: calc(var(--priority-photo-height) + 16px);
    padding-block: 8px;
  }
  .stop-review-gallery .priority-photo-thumbs .btn { inline-size: 40px; block-size: 40px; }
  .stop-review-action-area { display: grid; grid-row: 5; gap: 8px; }
  .stop-review-action-status { margin: 0; }
  .stop-review-no-reference { padding: 12px; }
  .stop-review-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
  }
  .stop-review-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-block-size: 48px;
    padding: 6px 8px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .stop-review-actions .stop-review-correct {
    grid-column: 1 / -1;
    justify-self: center;
    min-block-size: 44px;
    color: var(--accent);
    border-color: transparent;
    background: transparent;
  }
  .stop-review-actions .stop-review-correct:hover { text-decoration: underline; }
  .stop-review-actions .btn[aria-disabled="true"] { opacity: .65; cursor: wait; }
  .stop-review-footer { flex: none; padding: 0 clamp(12px, 2vw, 24px) 12px; }
  .stop-evidence { margin-block-start: 12px; border-block-start: 1px solid var(--border); }
  .stop-evidence summary { cursor: pointer; color: var(--muted); padding-block: 8px; }
  .stop-evidence p { overflow-wrap: anywhere; }

  @media (prefers-reduced-motion: no-preference) {
    .priority-gallery { animation: priority-gallery-enter 200ms ease-out; }
  }

  @media (width > 1280px) {
    .leo-app .priority-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
    .leo-app #view-stoplist:has(#stop-history:not([hidden])) { max-inline-size: 1160px; }
    .leo-app #stop-history {
      grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr);
      grid-template-rows: auto clamp(490px, calc(100dvh - 340px), 660px);
    }
    :is(#priority-slot, #stop-entry-slot, #stop-review-slot) { display: block; }
    .leo-app .stoplist-layout { block-size: clamp(580px, calc(100dvh - 232px), 740px); }
  }

  @media (max-width: 600px) {
    .priority-photo-thumbs .btn { inline-size: 48px; block-size: 48px; }
    #view-stoplist .stop-view-switch { max-inline-size: 100%; }
    #stop-review-dialog[open] { block-size: min(756px, calc(100dvh - 32px)); }
    #stoplist-reviews .stop-history-row { grid-template-columns: minmax(0, 1fr) minmax(0, 38%) 10px; gap: 6px; }
    .stop-review-gallery {
      --priority-photo-height: 144px;
      flex-direction: column;
      justify-content: flex-start;
      block-size: calc(var(--priority-photo-height) + 60px);
      gap: 4px;
      padding: 6px;
    }
    .stop-review-gallery .priority-photo-stage { flex: none; inline-size: 100%; }
    .stop-review-gallery .priority-photo-thumbs {
      flex-direction: row;
      max-inline-size: 100%;
      padding: 2px;
    }
    .stop-review-gallery .priority-photo-thumbs .btn { inline-size: 36px; block-size: 36px; }
    .stop-review-actions { grid-template-columns: minmax(0, 1fr); }
    .stop-review-actions .btn { inline-size: 100%; }
  }
}

@keyframes priority-gallery-enter {
  from { opacity: .45; transform: translateY(4px); }
}

:root:not([data-leo-design="new"]) #view-stats .stats-new-only,
:root[data-leo-design="new"] #view-stats .stats-classic-only {
  display: none;
}

:root[data-leo-design="new"] #view-stats {
  .view-heading {
    align-items: center;
    margin-bottom: 12px;
  }
  :is(#stats-period, #stats-chart-mode) {
    display: grid;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-control);
    background: var(--well);
  }
  #stats-period { grid-template-columns: repeat(3, minmax(76px, 1fr)); }
  #stats-chart-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(#stats-period, #stats-chart-mode) label {
    position: relative;
    margin: 0;
    cursor: pointer;
  }
  :is(#stats-period, #stats-chart-mode) input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    clip-path: inset(50%);
  }
  :is(#stats-period, #stats-chart-mode) span {
    display: grid;
    justify-items: center;
    align-items: center;
    min-block-size: 36px;
    padding-inline: 8px;
    border-radius: var(--radius-control);
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 750;
    text-align: center;
  }
  :is(#stats-period, #stats-chart-mode) label:hover span { background: var(--surface-hover); }
  :is(#stats-period, #stats-chart-mode) input:checked + span {
    color: var(--accent);
    background: var(--accent-bg);
  }
  :is(#stats-period, #stats-chart-mode) input:focus-visible + span,
  #stats-table-wrap:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: -2px;
  }
  .stats-period-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-block-size: 22px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: var(--text-sm);
  }
  .stats-period-caption h2 { margin: 0; font: inherit; font-weight: 750; }
  #stats-feedback { text-align: right; }
  #stats-feedback[data-error] { color: var(--red); }
  .stats-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-metrics > div { padding: 10px 16px; }
  .stats-metrics > div:first-child { background: color-mix(in srgb, var(--surface), var(--accent-bg) 35%); }
  .stats-metrics dt { font-size: var(--text-sm); font-weight: 700; }
  .stats-metrics dd {
    margin-top: 2px;
    font-size: var(--text-display);
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .stats-metrics > div:first-child dd { color: var(--accent); }
  :is(.stats-chart-card, .stats-daily) { border: 0; }
  .stats-chart-card { margin-bottom: 16px; }
  .stats-panel-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: var(--text-sm);
  }
  .stats-chart-legend {
    display: flex;
    justify-content: end;
    gap: 12px;
    min-block-size: 20px;
    margin-bottom: 8px;
    font-size: var(--text-xs);
  }
  .stats-chart-card:not(:has(#stats-chart-mode input[value="compare"]:checked)) .stats-chart-compare,
  .stats-chart-card:has(#stats-chart-mode input[value="compare"]:checked) .stats-chart-single { display: none; }
  .stats-chart-compare {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .stats-chart-compare::before {
    content: "";
    inline-size: 8px;
    block-size: 8px;
    border-radius: 2px;
    background: var(--accent);
  }
  .stats-legend-matches::before { background: var(--green); }
  .stats-panel-heading h2,
  #stats-daily-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 800;
  }
  #stats-chart { --stats-plot-height: 108px; min-block-size: calc(var(--stats-plot-height) + 27px); }
  .stats-graph {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 6px;
    color: var(--muted);
    font-size: var(--text-xs);
  }
  .stats-graph-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-block: -.7em;
    text-align: right;
  }
  .stats-graph-plot {
    display: grid;
    grid-template-columns: repeat(var(--stats-days), minmax(0, 1fr));
    place-items: end center;
    block-size: var(--stats-plot-height);
    border-block: 1px solid var(--border);
    background: linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat;
  }
  .stats-graph-day {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: min(3px, 8%);
    inline-size: 84%;
    block-size: 100%;
  }
  .stats-graph-bar {
    flex: 1 1 0;
    max-inline-size: 44px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
  }
  .stats-graph-bar-match { background: var(--green); }
  .stats-graph-dates { grid-column: 2; display: flex; justify-content: space-between; }
  .stats-graph-dates:has(:only-child) { justify-content: center; }
  .stats-chart-empty {
    display: grid;
    place-items: center;
    block-size: calc(var(--stats-plot-height) + 27px);
    margin: 0;
    border-radius: var(--radius-control);
    background: var(--well);
    font-size: var(--text-sm);
  }
  .stats-daily .card-header { margin-bottom: 8px; }
  #stats-table-wrap {
    overflow: auto;
    max-block-size: 292px;
    scrollbar-width: none;
    border-radius: var(--radius-control);
  }
  .stats-daily .data-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
  }
  .stats-daily :is(th, td) {
    text-align: right;
    vertical-align: middle;
    padding: 8px;
    overflow-wrap: anywhere;
  }
  .stats-daily :is(th, td):first-child { text-align: left; }
  .stats-daily thead th {
    z-index: 1;
    background: var(--well);
    font-size: var(--text-xs);
    font-weight: 750;
    overflow-wrap: normal;
  }
  .stats-daily thead th:is(:first-child, :nth-child(5)) { inline-size: 14%; }
  .stats-header-short { display: none; }
  .stats-daily abbr { text-decoration: none; }
  .stats-daily .stats-row-date {
    position: static;
    color: var(--text);
    font-weight: 750;
  }
  #stats-empty, #stats-lifetime { font-size: var(--text-sm); color: var(--muted); }
  #stats-empty { margin: 12px 8px 4px; }
  #stats-lifetime { margin: 10px 0 0; }
  @media (max-width: 1200px) {
    .stats-header-wide { display: none; }
    .stats-header-short { display: inline; }
  }
  @media (max-width: 640px) {
    #stats-period { inline-size: 100%; }
    :is(#stats-period, #stats-chart-mode) span { min-block-size: 44px; }
    .stats-period-caption { font-size: var(--text-xs); }
    .stats-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
    .stats-metrics > div { padding: 8px; }
    .stats-metrics dt { font-size: var(--text-xs); }
    .stats-metrics dd { font-size: var(--text-xl); }
    .stats-chart-card { margin-bottom: 12px; }
    :is(.stats-chart-card, .stats-daily) { padding: 10px 8px; }
    .stats-panel-heading { padding-inline: 4px; }
    #stats-chart-mode { flex: 1 1 190px; }
    #stats-chart { --stats-plot-height: 72px; }
    .stats-graph { column-gap: 6px; }
    #stats-daily-title { padding-inline: 4px; }
    #stats-table-wrap { max-block-size: 200px; }
    .stats-daily :is(th, td) { padding: 6px 2px; font-size: var(--text-xs); }
    .stats-daily thead th { font-size: 11px; }
    .stats-daily .stats-row-date { font-size: 12px; white-space: nowrap; }
    .stats-daily thead th:first-child { inline-size: 15%; }
    .stats-daily thead th:is(:nth-child(3), :nth-child(4), :nth-child(6)) { inline-size: 11%; }
    .stats-daily thead th:nth-child(5) { inline-size: 13%; }
    .stats-daily thead th:nth-child(7) { inline-size: 12%; }
    .stats-daily thead th:last-child { inline-size: 14%; }
  }
}

@media (max-width: 640px) {
  :root[data-leo-design="new"] body:has(.leo-app[data-view="stats"]) .container {
    padding-block-start: 18px;
  }
}

/* Переписки. The new layout uses the panel's existing theme tokens. */
:root:not([data-leo-design="new"]) #view-dialogs .dlg-new { display: none; }
:root:not([data-leo-design="new"]) :is(#dlg-settings, #dlg-settings-form) { display: contents; }

:root[data-leo-design="new"] #view-dialogs {
  .dlg-classic { display: none; }
  .dlg-heading { align-items: center; margin-block-end: 14px; }
  #dlg-add { flex-shrink: 0; }
  .dialogs-layout {
    grid-template-columns: minmax(280px, 33%) minmax(0, 1fr);
    gap: 14px;
    min-block-size: 0;
    block-size: clamp(550px, calc(100dvh - 198px), 850px);
  }
  :is(.dialogs-sidebar, .dialog-inspector) {
    min-inline-size: 0;
    min-block-size: 0;
    max-block-size: none;
    block-size: 100%;
    padding: 0;
    overflow: clip;
  }
  .dialogs-sidebar { gap: 0; }
  .dlg-list-tools { padding: 14px; border-block-end: 1px solid var(--border); }
  .dlg-list-footer { flex: none; display: grid; padding: 10px 14px; border-block-start: 1px solid var(--border); }
  .dlg-list-footer .btn { min-block-size: 40px; }
  #dlg-filter-panel { flex: 0 1 auto; max-block-size: 48%; overflow: auto; padding: 8px 14px 10px; border-block-end: 1px solid var(--border); }
  .dlg-filter-selection { display: grid; gap: 6px; background: var(--well); border-radius: var(--radius-control); padding: 8px; }
  .dlg-filter-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); font-size: var(--text-xs); font-weight: 750; }
  .dlg-filter-options { display: grid; gap: 6px; margin-block-start: 8px; padding-block-start: 8px; border-block-start: 1px solid var(--border); }
  .dlg-filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
  .dlg-filter-chips .btn, #dlg-filter-reset { min-block-size: 32px; padding: 3px 8px; }
  .dlg-filter-selection .dlg-filter-head { min-block-size: 32px; }
  #dlg-filter-selected { block-size: 40px; min-inline-size: 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; align-items: flex-start; scrollbar-width: thin; }
  #dlg-filter-selected > * { flex: none; }
  #dlg-filter-selected > span { align-self: center; }
  .dlg-filter-active { color: var(--accent); background: var(--accent-bg); }
  .dlg-filter-chips [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
  #dlg-list-status { padding: 9px 14px 0; }
  .dialogs-items { flex: 1; gap: 0; padding: 0; scrollbar-width: thin; }
  .dlg-conversation {
    display: grid;
    flex-shrink: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 2px;
    min-block-size: 62px;
    padding: 0 8px 0 0;
    border: 0;
    border-block-end: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: start;
  }
  .dlg-conversation-open { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 9px; min-inline-size: 0; border: 0; padding: 8px 4px 8px 14px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
  .reference-row .dlg-conversation-open {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "avatar name badge" "avatar owner owner";
    align-content: center;
    row-gap: 2px;
  }
  .reference-row .reference-info { display: contents; }
  .reference-row .dlg-avatar { grid-area: avatar; }
  .reference-row .dlg-item-title { grid-area: name; }
  .reference-row .badge { grid-area: badge; }
  .reference-row .reference-owner { grid-area: owner; }
  .dlg-ai-indicator { grid-column: 4; display: grid; place-items: center; min-inline-size: 25px; padding: 1px 3px; border: 1px solid var(--border-strong); border-radius: 6px; color: var(--muted); font-size: 10px; font-weight: 850; line-height: 1.4; }
  .dlg-ai-indicator[data-enabled="true"] { color: var(--green); background: var(--replies-surface); border-color: currentColor; }
  .dlg-archive.btn { align-self: center; display: grid; place-items: center; inline-size: 34px; min-block-size: 36px; padding: 0; border-color: transparent; color: var(--muted); background: transparent; }
  .dlg-archive.btn:is(:hover, :focus-visible) { color: var(--accent); background: var(--surface-hover); border-color: var(--border); }
  .dlg-archive svg { inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
  .dlg-conversation:hover { background: var(--surface-hover); border-color: var(--border); }
  .dlg-conversation.selected { background: var(--accent-bg); border-color: var(--border); box-shadow: inset 3px 0 var(--accent); }
  .dlg-item-title { font-size: var(--text-md); font-weight: 850; }
  .dlg-tag { display: inline-block; max-inline-size: 100%; padding: 2px 8px; border: 1px solid currentColor; border-radius: 99px; font-size: var(--text-xs); font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .dlg-tag-mutual { background: var(--replies-surface); color: var(--green); }
  .dlg-tag-manual { background: var(--well); color: var(--accent); }
  #dlg-presence:empty { display: none; }
  #dlg-presence.is-online { color: var(--green); font-weight: 750; }
  .dlg-avatar img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; opacity: 0; }
  .dlg-avatar img.is-loaded { opacity: 1; }
  .dlg-avatar {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    inline-size: 42px;
    block-size: 42px;
    flex: none;
    border-radius: 50%;
    background: var(--likes-surface);
    color: var(--text);
    font-size: var(--text-md);
    font-weight: 850;
  }
  .dlg-conversation:nth-child(3n+2) .dlg-avatar { background: var(--messages-surface); }
  .dlg-conversation:nth-child(3n) .dlg-avatar { background: var(--replies-surface); }
  #dlg-inspector-slot { min-block-size: 0; min-inline-size: 0; }
  #dialog-empty { display: grid; flex: 1; place-items: center; }
  .dialog-detail-wrap { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-block-size: 0; gap: 0; }
  .dialog-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 4px; padding: 12px 16px; }
  .dialog-top-info { min-inline-size: 0; }
  .dialog-title-row { gap: 2px 8px; }
  .dialog-title-row h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.12; overflow-wrap: anywhere; }
  .dialog-title-row .tg-link { min-inline-size: 0; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; }
  .dialog-title-row .badge { white-space: normal; }
  #dlg-meta:empty, .dlg-tags:empty, #dlg-bio, #dlg-back { display: none; }
  .dlg-tags { grid-column: 2 / -1; display: flex; gap: 5px; flex-wrap: wrap; }
  #dlg-settings-toggle { color: var(--muted); white-space: nowrap; grid-row: 1; grid-column: -2 / -1; }
  #dlg-settings-toggle[data-enabled="true"] { color: var(--accent); }
  #dlg-settings-toggle[aria-expanded="true"] { background: var(--accent-bg); border-color: var(--accent); }
  .dlg-settings {
    display: none;
    position: absolute;
    z-index: 2;
    grid-area: 2 / 1 / 4 / 2;
    inset-block: 0;
    inset-inline-end: 0;
    inline-size: min(100%, max(64%, 420px));
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-panel) 0 0 var(--radius-panel);
    background: var(--surface);
    box-shadow: 0 8px 24px var(--overlay);
  }
  .dlg-settings.is-open { display: flex; flex-direction: column; gap: 14px; animation: dlg-settings-enter 240ms cubic-bezier(.22, 1, .36, 1) both; }
  .dlg-settings-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-block-start: auto; padding-block-start: 12px; border-block-start: 1px solid var(--border); }
  .dlg-settings-actions .btn { min-block-size: 42px; padding-inline: 5px; line-height: 1.2; white-space: normal; }
  .dlg-ai-settings { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--well); }
  .dlg-settings-form { display: flex; flex: 1 0 auto; flex-direction: column; gap: 12px; min-inline-size: 0; }
  .dlg-settings-form label { font-size: var(--text-sm); font-weight: 750; }
  .dlg-settings-form > button { align-self: flex-start; }
  .dlg-settings-form .input { min-inline-size: 0; }
  .dlg-mode-field { position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); align-items: center; justify-self: center; inline-size: min(100%, 378px); gap: clamp(22px, calc(100% - 318px), 34px); padding-block-start: 10px; border-block-start: 1px solid var(--border); }
  #dlg-mode-label { justify-self: start; min-block-size: 40px; padding: 5px 7px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text); font: inherit; font-weight: 750; font-size: var(--text-sm); text-align: start; touch-action: none; user-select: none; cursor: grab; }
  #dlg-mode-label:hover:not(:disabled), .is-wiring #dlg-mode-label { color: var(--accent); background: var(--accent-bg); }
  #dlg-mode-label:disabled { cursor: default; opacity: .65; }
  .dlg-mode-field { user-select: none; }
  .is-wiring #dlg-mode-label { cursor: grabbing; }
  :is(.dlg-mode-port, .dlg-mode-jack) { position: relative; z-index: 2; inline-size: 9px; block-size: 9px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--well); }
  .dlg-mode-tail { white-space: nowrap; }
  .dlg-mode-port { display: inline-block; margin-inline-start: 6px; vertical-align: middle; border-color: var(--accent); }
  .dlg-mode-field:not(.is-wiring) #dlg-assistant-mode :checked + span .dlg-mode-jack,
  #dlg-assistant-mode .is-wire-target .dlg-mode-jack { border-color: var(--accent); background: var(--accent); }
  .is-wiring .dlg-mode-port { background: var(--accent); }
  #dlg-mode-wire { position: absolute; z-index: 1; inset: 0; inline-size: 100%; block-size: 100%; overflow: hidden; pointer-events: none; color: var(--accent); }
  #dlg-mode-wire path { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; opacity: .65; }
  .is-wiring #dlg-mode-wire path { stroke-width: 2; opacity: 1; }
  #dlg-assistant-mode .is-wire-target span { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
  .dlg-save-row { display: grid; flex: 1 0 auto; grid-template-columns: minmax(0, 62px) max-content minmax(0, 62px); align-items: center; place-content: center; gap: 4px 10px; min-block-size: 56px; padding-block: 4px; }
  .dlg-save-row::before, .dlg-save-row::after { content: ""; grid-row: 1; block-size: 1px; background: var(--border-strong); opacity: .6; }
  .dlg-save-row::before { grid-column: 1; }
  .dlg-save-row::after { grid-column: 3; }
  .dlg-save-row:focus-within::before, .dlg-save-row:focus-within::after, .dlg-save-row:hover::before, .dlg-save-row:hover::after { background: var(--accent); opacity: .8; }
  #dlg-save-settings { grid-area: 1 / 2; min-block-size: 40px; padding: 3px 4px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--accent); font: inherit; font-weight: 850; cursor: pointer; }
  #dlg-save-settings:hover:not(:disabled) { text-shadow: 0 0 12px var(--accent); }
  #dlg-settings-status { grid-column: 1 / -1; text-align: center; }
  #dlg-save-settings:disabled { color: var(--muted); cursor: default; }
  #dlg-assistant-mode { display: grid; gap: 4px; min-inline-size: 0; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); }
  #dlg-assistant-mode:disabled { opacity: .65; }
  #dlg-assistant-mode label { position: relative; margin: 0; }
  #dlg-assistant-mode input { position: absolute; inline-size: 1px; block-size: 1px; clip-path: inset(50%); }
  #dlg-assistant-mode span { display: grid; grid-template-columns: 9px minmax(0, 1fr); align-items: center; gap: 7px; min-block-size: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius-control); cursor: pointer; }
  .dlg-mode-field:not(.is-wiring) #dlg-assistant-mode:not(:disabled) label:hover span { background: var(--surface-hover); }
  .dlg-mode-field:not(.is-wiring) #dlg-assistant-mode :checked + span { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
  #dlg-assistant-mode :focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
  #dlg-assistant-mode :disabled + span { cursor: default; }
  .dlg-setting-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-block-size: 36px; }
  #dlg-auto-reply {
    display: grid;
    grid-template-columns: 38px 4ch;
    align-items: center;
    gap: 6px;
    min-block-size: 36px;
    padding: 0 3px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: var(--text-sm);
    text-align: start;
    cursor: pointer;
  }
  #dlg-auto-reply[aria-checked="true"] { color: var(--accent); }
  #dlg-auto-reply:disabled { cursor: default; opacity: .55; }
  .dlg-switch-track { display: flex; align-items: center; block-size: 22px; padding-inline: 3px; border: 1px solid var(--border-strong); background: var(--well); border-radius: 99px; }
  .dlg-switch-track::before { content: ""; inline-size: 14px; block-size: 14px; border-radius: 50%; background: var(--muted); }
  #dlg-auto-reply[aria-checked="true"] .dlg-switch-track { justify-content: flex-end; border-color: var(--accent); background: var(--accent-bg); }
  #dlg-auto-reply[aria-checked="true"] .dlg-switch-track::before { background: var(--accent); }
  .goal-bar-head { flex-wrap: wrap; }
  .chat-messages {
    min-block-size: 0;
    background: var(--well);
    border: 0;
    border-radius: 0;
    padding: 14px clamp(12px, 3vw, 38px) 17px;
    gap: 8px;
    overflow-anchor: none;
    scrollbar-width: thin;
  }
  .chat-messages > :first-child { margin-block-start: auto; }
  .chat-messages .empty-state { margin: auto; }
  .dlg-day { align-self: center; margin-block: 5px; color: var(--muted); font-size: var(--text-sm); font-weight: 750; }
  .msg-bubble { font-size: var(--text-md); border-radius: 15px; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
  .msg-meta { display: flex; align-items: center; gap: 5px; }
  .dlg-message-remove { display: grid; place-items: center; min-inline-size: 30px; min-block-size: 30px; padding: 0; border: 0; border-radius: var(--radius-control); color: var(--muted); background: transparent; opacity: .7; cursor: pointer; }
  .dlg-message-remove:is(:hover, :focus-visible) { color: var(--red); background: var(--red-bg); opacity: 1; }
  .dlg-message-remove:disabled { display: none; }
  .dlg-message-remove svg { inline-size: 15px; block-size: 15px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
  #dlg-message-delete { inline-size: min(420px, calc(100% - 24px)); max-inline-size: none; }
  .dlg-message-delete-body { padding: 16px; }
  .dlg-message-delete-body h2 { margin: 0; font-family: var(--font-display); }
  #dlg-message-delete-preview { max-block-size: 110px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
  .dlg-message-delete-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .dlg-message-delete-actions .btn { padding-inline: 5px; }
  .msg-in { border-end-start-radius: 4px; background: var(--surface); }
  .msg-out { border-end-end-radius: 4px; background: var(--accent-bg); border-color: var(--border); }
  .msg-meta { font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
  .dlg-message-media { display: block; max-inline-size: 100%; max-block-size: 260px; object-fit: contain; border-radius: 8px; }
  .dlg-composer { display: grid; gap: 5px; padding: 10px 12px; border-block-start: 1px solid var(--border); }
  .dlg-compose-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 6px; }
  .dlg-attach-actions { display: flex; gap: 4px; }
  .dlg-attach-actions button { display: grid; place-items: center; inline-size: 38px; padding: 0; }
  .dlg-attach-actions svg { inline-size: 18px; block-size: 18px; }
  .dlg-compose-row :is(.btn, .input) { min-block-size: 42px; }
  #dlg-message-input { min-inline-size: 0; resize: none; field-sizing: content; max-block-size: 115px; }
  #dlg-composer-status:empty, #dlg-settings-status:empty { display: none; }
  .dlg-attachments { display: flex; flex-wrap: wrap; gap: 4px; max-block-size: 80px; overflow: auto; }
  .dlg-attachment { display: flex; align-items: center; gap: 4px; min-inline-size: 0; max-inline-size: 100%; border-radius: var(--radius-control); padding-inline-start: 6px; background: var(--well); font-size: var(--text-sm); }
  .dlg-attachment span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .dlg-file-over { box-shadow: inset 0 0 0 2px var(--accent); }
  .dlg-file-over .chat-messages { background: var(--accent-bg); }
  :is(#dlg-mobile, #dlg-import, #dlg-message-delete) { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 0; }
  :is(#dlg-mobile, #dlg-import, #dlg-message-delete)::backdrop { background: var(--overlay); }
  #dlg-mobile { inline-size: min(760px, calc(100% - 24px)); block-size: min(760px, calc(100dvh - 24px)); max-inline-size: none; max-block-size: none; }
  #dlg-mobile .dialog-inspector { border: 0; border-radius: inherit; }
  #dlg-import { inline-size: min(430px, calc(100% - 24px)); max-inline-size: none; }
  #dlg-import-form { display: grid; gap: 10px; padding: 18px; }
  #dlg-import-form p { margin: 0; }
  .dlg-import-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .dlg-import-head h2 { margin: 0; font-family: var(--font-display); line-height: 1.1; }
  :is(button, input, select, textarea, a, .chat-messages):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  #dialog-stats-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
}

@media (max-width: 1280px) {
  :root[data-leo-design="new"] #view-dialogs {
    .dialogs-layout { grid-template-columns: minmax(0, 1fr); }
    #dlg-inspector-slot { display: none; }
    #dlg-mobile .dialog-top { grid-template-columns: auto auto minmax(0, 1fr) auto; }
    #dlg-back { display: inline-grid; place-items: center; padding-inline: 8px; min-block-size: 37px; }
    .dlg-tags { grid-column: 3 / -1; }
  }
}

@media (max-width: 600px) {
  :root[data-leo-design="new"] #view-dialogs {
    .dlg-heading { gap: 6px; }
    .dlg-heading h1 { font-size: clamp(25px, 8vw, 34px); }
    #dlg-add { padding-inline: 8px; font-size: var(--text-sm); }
    .dialogs-layout { block-size: clamp(420px, calc(100dvh - 230px), 640px); }
    #dlg-mobile { inline-size: 100%; block-size: 100dvh; margin: 0; border: 0; border-radius: 0; }
    .dialog-top { padding: 9px 8px; column-gap: 6px; }
    .dialog-top .dlg-avatar { inline-size: 34px; block-size: 34px; }
    .dialog-title-row h2 { font-size: 20px; }
    #dlg-settings-toggle { padding-inline: 6px; }
    .msg-bubble { max-inline-size: 91%; }
    .dlg-composer { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
    .dlg-attach-actions button { inline-size: 33px; }
    #dlg-send { padding-inline: 7px; font-size: var(--text-sm); }
  }
}

@keyframes dlg-settings-enter {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-leo-design="new"] #view-dialogs .dlg-settings.is-open { animation: none; }
}

.account-run-dialog {
  box-sizing: border-box;
  width: min(calc(100% - 28px), 29rem);
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(16px, 5vw, 28px);
  background: var(--surface);
  color: var(--text);
}
.account-run-dialog::backdrop { background: var(--overlay); }
.account-run-dialog form { display: grid; gap: 18px; }
.account-run-dialog h2 {
  margin: 0;
  font: 650 clamp(25px, 5vw, 30px)/1.15 var(--font-display, "Playfair Display", Georgia, serif);
  letter-spacing: -.025em;
}
.account-run-dialog p { margin: 0; }

.account-run-fields { display: grid; gap: 12px; min-inline-size: 0; }
.account-run-fields > label { font-size: .875rem; font-weight: 750; }
.account-run-duration {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding-block-start: 4px;
  color: var(--muted);
}
.account-run-duration input {
  box-sizing: border-box;
  width: min(100%, 8ch);
  padding: 2px 0 8px;
  border: 0;
  border-block-end: 1px solid var(--border-strong, var(--border));
  background: transparent;
  color: var(--text);
  font: 700 clamp(38px, 10vw, 54px)/1.1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  text-align: center;
}
.account-run-duration input:focus,
body:has(.leo-app) .account-run-duration input:focus-visible {
  outline: none;
  border-block-end: 2px solid var(--accent);
  padding-block-end: 7px;
}
.account-run-duration input[aria-invalid="true"] { border-color: var(--red); }
.account-run-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.account-run-dialog .account-run-presets .btn {
  min-height: 44px;
  padding-inline: 10px;
  background: transparent;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.account-run-dialog .account-run-presets .btn:hover { background: var(--surface-hover); }
.account-run-hint { color: var(--muted); font-size: .875rem; }
.account-run-fields .account-run-hint { text-align: center; }
.duration-error { font-size: .875rem; overflow-wrap: anywhere; }
.duration-error:empty { margin-top: -18px; }

.account-run-dialog .account-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.account-run-dialog .account-actions .btn { min-height: 44px; }
.account-run-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.account-run-dialog [hidden] { display: none; }
.account-error { color: var(--red); }
.account-run-dialog .account-actions { margin: 0; }
.account-picker {
  position: fixed;
  inset: auto;
  box-sizing: border-box;
  width: min(226px, calc(100vw - 16px));
  margin: 0;
  padding: 5px;
  overflow: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 26px var(--shadow);
}
.account-picker-list { display: grid; }
.account-picker-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  font-weight: 750;
  text-align: start;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.account-picker-row:hover { background: var(--surface-hover); }
.account-picker-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.account-picker-row:disabled { opacity: .6; }
.account-picker-avatar, .account-picker-plus {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.account-picker-avatar { background: var(--accent-bg); color: var(--accent); }
.account-picker-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}
.account-picker-row[aria-current="true"] .account-picker-avatar {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
.account-picker-add { color: var(--accent); }
.account-picker-plus::before, .account-picker-plus::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 15px;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.account-picker-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.account-picker .account-error { margin: 5px 8px; font-size: .8125rem; }
button.account-switch { font: inherit; background: none; border: 0; text-align: start; cursor: pointer; }
#feed-pause-timer { display: none; }
:root[data-leo-design="new"] :is(.feed-pause-control, .feed-message-control) { display: flex; align-items: center; min-width: 0; }
:root[data-leo-design="new"] :is(#feed-pause-timer, #feed-message-label) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 4px;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-weight: 700;
}
:root[data-leo-design="new"] :is(#feed-pause-timer, #feed-message-label):hover { color: var(--text); }
:root[data-leo-design="new"] :is(#btn-toggle-feed, #btn-feed-message) { flex: 0 0 44px; padding: 0; }
:root[data-leo-design="new"] .classic-feed-label { display: none; }

#leo-theme-label { color: var(--muted); font-size: var(--text-sm); font-weight: 750; }
.theme-picker { position: relative; min-width: 0; }
#leo-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}
#leo-theme::-webkit-details-marker { display: none; }
#leo-theme-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-chevron {
  flex: 0 0 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.theme-picker[open] .theme-chevron { transform: translateY(2px) rotate(225deg); }
.theme-picker-options {
  position: absolute;
  z-index: 4;
  inset: auto 0 calc(100% + 4px) auto;
  width: max(100%, 10rem);
  max-height: min(48vh, 18rem);
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: 0 8px 24px var(--shadow);
}
.theme-picker-options button {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.theme-picker-options button:is(:hover, [aria-pressed="true"]) { background: var(--surface-hover); }
#add-leo-theme { color: var(--accent); background: var(--accent-bg); font-weight: 800; margin-bottom: 4px; }
#add-leo-theme:hover { background: var(--surface-hover); }

.theme-dialog form { gap: 15px; }
.theme-dialog label { min-width: 0; }
.theme-name { display: grid; gap: 4px; color: var(--muted); font-size: var(--text-sm); }
.theme-dialog .theme-name-input {
  width: 100%;
  min-height: 44px;
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-md);
}
body:has(.leo-app) .theme-dialog .theme-name-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 1px var(--accent);
}
.theme-base-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr);
  align-items: center;
  justify-self: center;
  gap: 25px;
  width: min(100%, 310px);
}
.mode-wire-label {
  display: flex;
  border: 0;
  padding: 7px 0 7px 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
  align-items: center;
  justify-self: end;
  gap: 6px;
  font-weight: 750;
  font-size: var(--text-sm);
}
.theme-base-field :is(.dlg-mode-port, .dlg-mode-jack) {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--well);
}
.mode-wire-label .dlg-mode-port { margin: 0; border-color: var(--accent); }
.mode-wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.mode-wire path { fill: none; stroke: var(--accent); stroke-width: 1.25; opacity: .75; }
.theme-base-field.is-wiring .mode-wire-label { color: var(--accent); cursor: grabbing; }
.theme-base-field.is-wiring .mode-wire path { stroke-width: 2; opacity: 1; }
.theme-base-field .is-wire-target span { background: var(--accent-bg); color: var(--accent); }
.theme-base-field .is-wire-target .dlg-mode-jack { border-color: var(--accent); background: var(--accent); }
.theme-bases, .theme-colors { min-inline-size: 0; border: 0; margin: 0; padding: 0; }
.theme-bases { display: grid; gap: 2px; }
.theme-bases label { position: relative; }
.theme-bases input { position: absolute; inline-size: 1px; block-size: 1px; clip-path: inset(50%); }
.theme-bases label span {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 37px;
  padding: 4px 6px;
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
  cursor: pointer;
}
.theme-bases label:hover span { background: var(--surface-hover); }
.theme-bases :checked + span { background: var(--accent-bg); color: var(--accent); }
.theme-bases :checked + span i { border-color: var(--accent); background: var(--accent); }
.theme-bases :focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.theme-colors { border-top: 1px solid var(--border); padding-top: 6px; }
.theme-colors legend { float: left; width: 100%; padding: 0; font-weight: 750; }
.theme-colors #theme-colors-help { clear: both; margin-block: 4px 8px; }
.theme-color-selection {
  padding: 8px;
  background: var(--well);
  border-radius: var(--radius-control);
}
.theme-dialog .theme-filter-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 750;
}
.theme-color-row { display: flex; align-items: flex-start; gap: 6px; }
.theme-color-row > .theme-color-options { flex: 1 1 auto; }
.theme-color-row .btn { flex: 0 0 auto; }
.theme-color-all {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.theme-color-options { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.theme-dialog .theme-color-chip {
  display: grid;
  place-items: center;
  inline-size: 34px;
  min-block-size: 29px;
  padding: 2px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}
.theme-color-chip::before {
  content: "";
  inline-size: 25px;
  block-size: 10px;
  border: 1px solid color-mix(in srgb, var(--swatch) 68%, var(--text));
  border-radius: 2px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--swatch) 87%, white), var(--swatch));
}
.theme-color-column { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.theme-dialog .theme-color-all .theme-color-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  align-items: start;
  gap: 6px 3px;
  max-block-size: 225px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 3px;
}
.theme-dialog .theme-color-chip:hover { background: var(--surface-hover); }
.theme-dialog .theme-color-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); }
.theme-color-selection .theme-color-chip { border-color: var(--accent-line); background: var(--accent-bg); }
@media (max-width: 600px) {
  .theme-picker-options { position: static; width: auto; margin-block-start: 4px; }
  .theme-dialog .theme-color-all .theme-color-options {
    max-block-size: clamp(110px, calc(100dvh - 500px), 214px);
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 3px;
  }
  .theme-dialog .account-actions {
    position: sticky;
    inset-block-end: 0;
    padding-block-start: 4px;
    background: var(--surface);
  }
}

:root[data-leo-custom-theme][data-leo-design] body:has(.leo-app) {
  --bg: var(--leo-theme-background);
  --surface: var(--leo-theme-surface);
  --sidebar: color-mix(in srgb, var(--surface) 60%, var(--bg));
  --border: color-mix(in srgb, var(--surface) 80%, var(--text));
  --border-strong: color-mix(in srgb, var(--surface) 51%, var(--text));
  --hero-surface: color-mix(in srgb, var(--surface) 91%, var(--accent));
  --hero-ink: var(--text);
  --art-surface: color-mix(in srgb, var(--accent) 73%, var(--bg));
  --heart-glow: color-mix(in srgb, var(--accent) 57%, var(--surface));
  --likes-surface: color-mix(in srgb, var(--surface) 89%, var(--accent));
  --messages-surface: color-mix(in srgb, var(--surface) 94%, var(--accent));
  --replies-surface: color-mix(in srgb, var(--surface) 97%, var(--accent));
  --surface-2: color-mix(in srgb, var(--surface) 91%, var(--text));
  --surface-hover: color-mix(in srgb, var(--surface) 86%, var(--text));
  --well: var(--bg);
  --accent: var(--leo-theme-accent);
  --accent-hover: color-mix(in srgb, var(--accent) 87%, var(--text));
  --accent-ink: var(--leo-theme-accentInk);
  --accent-bg: color-mix(in srgb, var(--surface) 89%, var(--accent));
  --accent-line: color-mix(in srgb, var(--accent) 34%, var(--surface));
  --accent-border: var(--accent-line);
  --accent-ring: var(--accent);
  --button-fill: var(--accent);
  --button-hover: var(--accent-hover);
  --button-ink: var(--accent-ink);
  background: var(--bg);
}

.stats-metrics > div { position: relative; }
.stats-metrics .stats-card-action { margin: 0; }
.stats-card-action button {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.stats-metrics > div:hover { background: var(--surface-hover); }
.stats-card-action button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: var(--radius-panel);
}
.feed-pages, .dlg-compose-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.feed-pages { flex: none; padding: 8px 12px; }

#feed-filter-panel { flex: none; display: grid; padding: 8px 12px; gap: 6px; }
#feed-filter-panel[hidden], [data-view="matches"] .feed-today { display: none; }
#feed-filter-panel :is(.stop-reason-track, .stop-reason-selected-row) { display: flex; gap: 6px; }
#feed-filter-panel .stop-reason-track { flex-wrap: wrap; min-height: 36px; align-items: center; }
#feed-filter-panel .stop-reason-track p { margin: 0; }
#feed-filter-panel .stop-reason-list { padding-top: 6px; }
#feed-filter-panel .btn { min-height: 36px; }
#feed-filters [aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
#feed-filter-reset { margin-inline-start: auto; }
#feed-profile-detail .feed-bio { block-size: auto; padding: 8px 12px; }
#feed-profile-detail .feed-bio p { white-space: pre-wrap; overflow: visible; }
:root[data-leo-design="new"] #feed-profile-detail .feed-gallery {
  block-size: clamp(150px, 42cqh, 228px);
}
:root[data-leo-design="new"] #feed-profile-detail .feed-gallery:not(:has(img)):has(.feed-no-photos) {
  block-size: auto;
  min-block-size: 56px;
}
:root[data-leo-design="new"] #feed-profile-detail .feed-notes { padding-block-start: 10px; }
#feed-selected-filters { block-size: 42px; }
#feed-filter-panel #feed-selected-filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#feed-selected-filters button { flex: 0 0 auto; white-space: nowrap; }
#feed-filter-panel #feed-filter-reset { flex: none; align-self: center; }
#match-list[hidden], #view-profiles .feed-list[hidden], #feed-profile-count[hidden] { display: none; }
#match-entries .stop-row { border-block-end: 1px solid var(--border); }
:root[data-leo-design="new"] .leo-app[data-view="matches"] #view-profiles .view-heading {
  padding-inline-start: 0;
}
:root[data-leo-design="new"] .leo-app[data-view="matches"] #view-profiles .feed-layout {
  display: grid;
  min-block-size: 0;
}
:root[data-leo-design="new"] .leo-app[data-view="matches"] #view-profiles {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
:root[data-leo-design="new"] .leo-app[data-view="matches"] #feed-profile-slot { grid-area: auto; }
@media (width > 1280px) {
  :root[data-leo-design="new"] .leo-app[data-view="matches"] #view-profiles .feed-layout {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}
#feed-profile-detail .feed-match-feedback:empty { display: none; }
#feed-profile-detail #feed-card-actions { min-block-size: 0; }
#feed-profile-detail .feed-detail-actions:has(button:nth-child(3)) > :first-child { grid-column: 1 / -1; }

:root[data-leo-design="new"] .leo-app[data-view="matches"] #feed-profile-dialog:has(#feed-profile-detail:not([hidden])) {
  block-size: min(760px, calc(100dvh - 32px));
}

:root[data-leo-design="new"] .leo-app[data-view="matches"] #feed-profile-detail {
  .feed-detail-top { block-size: auto; min-block-size: 56px; }
  #account-profile-card:has(> .feed-notes) {
    display: flex;
    flex-direction: column;
    padding-block-end: 4px;
  }
  #account-profile-card > * { flex: none; }
  #account-profile-card > .priority-gallery {
    flex-grow: 1;
    max-block-size: 380px;
    margin-block: 0;
  }
  .priority-gallery ~ .feed-notes { margin-block-start: auto; }
  #feed-card-actions :is(.feed-detail-actions, .feed-rule-actions) { margin-inline: 0; }

  @media (max-width: 600px) {
    .priority-gallery { --priority-photo-height: clamp(150px, 24dvh, 264px); }
    .feed-detail-actions .btn, .feed-rule-actions .btn { block-size: auto; }
  }
}

.feed-pages { justify-content: flex-end; }
#feed-card-actions:empty, .feed-gallery:empty, .feed-match-actions + p:empty { display: none; }
.feed-detail .feed-match-actions {
  display: flex;
  margin-block-end: 12px;
}

.log-lvl { width: 76px; }

@media (max-width: 480px) {
  .feed-filters { padding-inline: 8px; }
  .log-lvl { width: auto; }
}
