/* Regaldi Studio admin portal: a light working tool in the Regaldi palette. */
:root {
  --canvas: #f4f1e8;
  --sidebar: #ece7da;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --hover: #f6f2e9;
  --selected: #f3ebdf;
  --line: #e7e1d3;
  --line-strong: #d6cdb8;
  --text: #221d17;
  --text-2: #4a4237;
  --muted: #7a7062;
  --copper: #b0794c;
  --copper-ink: #875c38;
  --copper-deep: #6b4a2b;
  --copper-tint: #f5ebdf;
  --on-copper: #fbf8f1;
  --ok: #1f8a55;
  --ok-ink: #24613f;
  --ok-tint: #e6f2ea;
  --run: #b0794c;
  --run-ink: #7a512f;
  --run-tint: #f6ece1;
  --warn: #c58a1d;
  --warn-ink: #7f540c;
  --warn-tint: #fbf1dc;
  --bad: #aa3939;
  --bad-ink: #8e2d2d;
  --bad-tint: #f8e5e2;
  --idle: #9a9184;
  --idle-ink: #5f574c;
  --idle-tint: #efebe3;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 2px rgba(60, 45, 25, 0.05);
  --shadow-lift: 0 10px 30px rgba(60, 45, 25, 0.1);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--sans);
  color: var(--text);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  min-width: 1100px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
a {
  color: var(--copper-ink);
  text-decoration: none;
}
a:hover {
  color: var(--copper-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
h1,
h2,
h3,
h4,
h5,
p {
  margin-top: 0;
}
h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.2px;
  margin: 0;
}
h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.05px;
}
h2.display {
  font-family: var(--display);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.1px;
}
h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 22px 0 10px;
}
p {
  margin-bottom: 12px;
}
small,
.muted {
  color: var(--muted);
}
code,
.mono {
  font-family: var(--mono);
  font-size: 12px;
}
code.mono {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  overflow-wrap: anywhere;
}
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Controls -------------------------------------------------------------------------- */
button,
.button-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}
button:hover,
.button-link:hover {
  background: var(--hover);
  border-color: #c7bca3;
  text-decoration: none;
  color: var(--text);
}
button:active {
  transition-duration: 0.08s;
  background: var(--selected);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button.primary {
  background: var(--copper-ink);
  border-color: var(--copper-ink);
  color: var(--on-copper);
}
button.primary:hover {
  background: var(--copper-deep);
  border-color: var(--copper-deep);
  color: var(--on-copper);
}
button.danger {
  color: var(--bad);
  border-color: #e3c4bf;
}
button.danger:hover {
  background: var(--bad-tint);
  border-color: #d6aaa4;
  color: var(--bad-ink);
}
button.danger-solid {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
button.danger-solid:hover {
  background: var(--bad-ink);
  color: #fff;
}
button.small {
  padding: 4px 10px;
  font-size: 12.5px;
}
button.selected {
  background: var(--copper-tint);
  border-color: #dcc0a3;
  color: var(--copper-deep);
}
.icon-button {
  padding: 7px;
}
.link-button {
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--copper-ink);
  font-size: 12.5px;
}
.link-button:hover {
  background: none;
  text-decoration: underline;
}
.button-link {
  font-size: 12.5px;
  padding: 5px 10px;
}
.quiet-link {
  color: var(--text-2);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.2s var(--ease);
}
input:hover,
select:hover,
textarea:hover {
  border-color: #c7bca3;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(176, 121, 76, 0.15);
}
textarea {
  min-height: 84px;
  resize: vertical;
}
label {
  display: grid;
  gap: 5px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.checkbox-field input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--copper-ink);
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  background: var(--surface-2);
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  background: var(--idle-tint);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.segmented button {
  border-color: transparent;
  background: transparent;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.segmented button:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: transparent;
}
.segmented button.selected {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---- State labels: a coloured marker always paired with words --------------------------- */
.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--ok-tint);
  color: var(--ok-ink);
  vertical-align: middle;
}
.pill::before,
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  opacity: 0.85;
}
.tone-ok {
  --tone: var(--ok);
  --tone-ink: var(--ok-ink);
  --tone-tint: var(--ok-tint);
}
.tone-run {
  --tone: var(--run);
  --tone-ink: var(--run-ink);
  --tone-tint: var(--run-tint);
}
.tone-wait,
.tone-warn {
  --tone: var(--warn);
  --tone-ink: var(--warn-ink);
  --tone-tint: var(--warn-tint);
}
.tone-bad {
  --tone: var(--bad);
  --tone-ink: var(--bad-ink);
  --tone-tint: var(--bad-tint);
}
.tone-idle {
  --tone: var(--idle);
  --tone-ink: var(--idle-ink);
  --tone-tint: var(--idle-tint);
}
.pill[class*="tone-"],
.badge[class*="tone-"] {
  background: var(--tone-tint);
  color: var(--tone-ink);
}
.pill[class*="tone-"]::before,
.badge[class*="tone-"]::before {
  background: var(--tone);
}
.badge.blocked,
.badge.archive {
  background: var(--bad-tint);
  color: var(--bad-ink);
}
.badge.unknown {
  background: var(--warn-tint);
  color: var(--warn-ink);
}
.pill.is-live::before {
  animation: pulse 1.6s var(--ease) infinite;
}
.pill .sep {
  opacity: 0.5;
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(176, 121, 76, 0.5);
  }
  60% {
    box-shadow: 0 0 0 5px rgba(176, 121, 76, 0);
  }
}
.chip {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--text-2);
  background: var(--surface-2);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
.spinner.small {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Shell ------------------------------------------------------------------------------ */
.initial {
  padding: 48px;
  color: var(--muted);
}
.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(
    to right,
    var(--sidebar) 232px,
    transparent 232px
  );
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 20px 12px 14px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
}
.crown {
  width: 30px;
  height: 30px;
  fill: var(--copper-ink);
  flex: none;
}
.brand-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.1px;
  line-height: 1.15;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
}
.sidebar nav {
  display: grid;
  gap: 1px;
}
.nav-zone {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 6px;
}
.nav-zone:first-child {
  padding-top: 0;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: var(--text-2);
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: background 0.2s var(--ease);
}
.sidebar nav a .icon {
  color: var(--muted);
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.sidebar nav a.active .icon {
  color: var(--copper-ink);
}
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--copper);
}
.account {
  margin-top: auto;
  border-top: 1px solid var(--line-strong);
  padding: 12px 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.account-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account button {
  padding: 4px 9px;
  font-size: 12px;
  background: transparent;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--copper-tint);
  color: var(--copper-deep);
  font-size: 11.5px;
  font-weight: 600;
  flex: none;
}
.avatar.large {
  width: 44px;
  height: 44px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 32px 13px;
  background: rgba(244, 241, 232, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  min-width: 0;
}
.topbar-title h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62vw;
}
.crumbs {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 1px;
}
.crumbs a {
  color: var(--muted);
}
.crumbs a:hover {
  color: var(--copper-ink);
}
.crumb-sep {
  opacity: 0.6;
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.page-status {
  font-size: 12px;
  color: var(--muted);
}
.fresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse-ok 3s var(--ease) infinite;
}
@keyframes pulse-ok {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(31, 138, 85, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(31, 138, 85, 0);
  }
}
.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 340px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.2s var(--ease);
}
.global-search:focus-within {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(176, 121, 76, 0.15);
}
.global-search input {
  border: 0;
  padding: 7px 0;
  background: transparent;
  box-shadow: none;
}
.global-search input:focus {
  box-shadow: none;
}
.page {
  padding: 24px 32px 48px;
  width: 100%;
  max-width: 1680px;
}
.flash:empty {
  display: none;
}

/* ---- Cards, tables, layout helpers ------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card.flush {
  padding: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 {
  margin: 0;
}
.card-head.padded {
  padding: 16px 20px 12px;
  margin: 0;
}
.card-link {
  font-size: 12.5px;
}
.count {
  color: var(--muted);
  font-weight: 400;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.grid .card {
  margin-bottom: 0;
}
.metric .value {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.4px;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric .label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.metric:first-child {
  box-shadow:
    inset 0 3px 0 var(--copper),
    var(--shadow);
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.split > .card {
  margin-bottom: 18px;
}
.hermes-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}
.form-grid {
  display: grid;
  gap: 14px;
  max-width: 640px;
}
.autonomy-form,
.autonomy-actions {
  margin-bottom: 18px;
}
.actions,
.filters,
.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
}
.filters {
  margin-bottom: 16px;
}
.filters label {
  flex: 1;
  min-width: 150px;
}
.filters.compact label {
  min-width: 110px;
}
.filters .download {
  align-self: center;
  font-size: 12.5px;
}
.pagination {
  justify-content: end;
  align-items: center;
  margin-top: 14px;
}
.pagination small {
  margin-right: auto;
}
.period {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.period .segmented {
  align-self: end;
}
.period label {
  min-width: 140px;
}
.period small {
  align-self: center;
  margin-left: auto;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
}
td small {
  display: block;
  max-width: 340px;
  overflow-wrap: anywhere;
}
td.number,
td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background 0.2s var(--ease);
}
tbody tr:hover {
  background: var(--surface-2);
}
.empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 18px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--text-2);
}
.state small {
  max-width: 560px;
}
.state.loading {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}
.state.pending {
  border: 1px dashed #d9c4a9;
  background: #fbf6ee;
}
.state.pending strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--copper);
  vertical-align: 1px;
}
.state.failed {
  border: 1px solid #ecc9c4;
  background: var(--bad-tint);
  color: var(--bad-ink);
}
.state.failed button {
  margin-top: 6px;
}
.notice {
  padding: 10px 14px;
  background: #f1f4f2;
  color: #33503f;
  border: 1px solid #d7e3da;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.notice.error {
  background: var(--bad-tint);
  color: var(--bad-ink);
  border-color: #ecc9c4;
}
.notice.warning {
  background: var(--warn-tint);
  color: var(--warn-ink);
  border-color: #efdcb4;
}
.chart {
  width: 100%;
  height: 170px;
  display: block;
  color: var(--copper);
}
.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart-area {
  fill: rgba(176, 121, 76, 0.1);
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: var(--radius);
  max-height: 460px;
  overflow: auto;
  margin: 0 0 10px;
}
details {
  margin: 10px 0;
}
summary {
  cursor: pointer;
  color: var(--copper-ink);
}
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(540px, calc(100vw - 40px));
  box-shadow: 0 24px 80px rgba(40, 30, 15, 0.25);
  color: var(--text);
  background: var(--surface);
}
dialog h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 20px;
}
dialog::backdrop {
  background: rgba(34, 29, 23, 0.32);
  backdrop-filter: blur(2px);
}
dialog .actions {
  justify-content: end;
  margin-top: 6px;
}
.secret {
  font-family: var(--mono);
  font-size: 13px;
}
.log-error {
  color: var(--bad-ink);
  font-weight: 600;
}
.log-message {
  white-space: pre-wrap;
  word-break: break-word;
}
dl {
  margin: 0;
}
dd {
  margin: 0;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 22px;
}
.fact dt {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 2px;
}
.fact dd {
  overflow-wrap: anywhere;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 0 6px;
}
.plain-list,
.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:first-child {
  padding-top: 0;
}
.list-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.list-row > .pill {
  margin-top: 1px;
}
.list-main {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.list-meta {
  color: var(--muted);
  font-size: 12.5px;
}
.list-time {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mini-list li {
  padding: 4px 0;
}

/* ---- Сейчас ----------------------------------------------------------------------------- */
.counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.counter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px 14px;
  box-shadow:
    inset 3px 0 0 var(--tone),
    var(--shadow);
}
.counter-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.counter-value {
  font-family: var(--display);
  font-size: 32px;
  line-height: 1.15;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 0;
}
.counter-hint {
  font-size: 12px;
  color: var(--muted);
}
.counter.is-zero {
  box-shadow:
    inset 3px 0 0 var(--line-strong),
    var(--shadow);
}
.counter.is-zero .counter-value {
  color: var(--muted);
}
.counter.tone-bad:not(.is-zero) {
  background: #fdf6f4;
  border-color: #efd3ce;
}
.counter.tone-bad:not(.is-zero) .counter-value {
  color: var(--bad-ink);
}
.run-table th:first-child,
.run-table td:first-child {
  padding-left: 14px;
  padding-right: 0;
  width: 28px;
}
.run-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}
.run-table th:nth-child(2) {
  width: 22%;
}
.run-table th:nth-child(3) {
  width: 24%;
}
.toggle {
  padding: 3px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.toggle .icon,
.chevron {
  transition: transform 0.32s var(--ease);
}
.toggle[aria-expanded="true"] .icon,
[aria-expanded="true"] > .chevron {
  transform: rotate(90deg);
}
.who {
  font-weight: 500;
  margin-bottom: 4px;
}
.who a {
  color: var(--text);
}
.task-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.task-title a {
  color: var(--text);
}
.task-title a:hover {
  color: var(--copper-ink);
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.kind {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--copper-ink);
}
.kind-voice {
  color: #6d5a8a;
}
.kind-job {
  color: #4e6a7e;
}
.attention-note {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--warn-ink);
}
.attention-note::before {
  content: "! ";
  font-weight: 700;
}
tr.needs-attention > td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}
tr.needs-attention {
  background: #fffcf5;
}
.step-now .step-title {
  font-weight: 500;
}
.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.waiting {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--warn-ink);
}
.waiting::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--warn);
  vertical-align: 1px;
}
td.quiet {
  color: var(--warn-ink);
  font-weight: 500;
}
.cell-action {
  text-align: right;
  white-space: nowrap;
}
.run-detail td {
  background: var(--surface-2);
  padding-top: 12px;
  padding-bottom: 16px;
}
.run-detail .facts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.now-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.now-grid .card {
  margin-bottom: 0;
}

/* ---- Пользователь 360° ------------------------------------------------------------------ */
.user-head {
  padding: 16px 20px 0;
  margin-bottom: 14px;
}
.user-ident {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding-bottom: 14px;
}
.user-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.user-id {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.user-id code.mono {
  white-space: nowrap;
}
.head-facts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr;
  border-top: 1px solid var(--line);
  margin: 0 -20px;
}
.head-facts > div {
  padding: 11px 20px 13px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.head-facts > div:first-child {
  border-left: 0;
}
.head-facts dt {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 3px;
}
.head-facts dd {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.head-facts dd small {
  display: inline;
}
.head-facts .state.loading {
  padding: 0;
  justify-content: flex-start;
}
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tabs a {
  padding: 8px 12px 9px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.tabs a:hover {
  color: var(--text);
  border-bottom-color: var(--line-strong);
}
.tabs a.active {
  color: var(--text);
  border-bottom-color: var(--copper);
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.overview-grid > .card {
  margin-bottom: 0;
}
.now-item {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.now-item-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-weight: 500;
}
.now-item .pill {
  justify-self: start;
}
.mini-metrics {
  display: flex;
  gap: 36px;
  margin-bottom: 8px;
}
.mini-metrics .label {
  font-size: 12px;
  color: var(--muted);
}
.mini-metrics .value {
  font-family: var(--display);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.memory-text {
  max-width: 640px;
}
.memory-text .clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Чат -------------------------------------------------------------------------------- */
body[data-route="chat"] .page {
  height: calc(100vh - 68px);
  padding-bottom: 18px;
  display: flex;
  flex-direction: column;
  max-width: none;
}
body[data-route="chat"] #content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.chat-head-main,
.chat-head-state {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.chat-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}
.feed-wrap {
  position: relative;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.feed-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 8px 28px 28px;
  scroll-behavior: auto;
}
.feed-top {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}
.feed-start {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.feed-start::before,
.feed-start::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.feed,
.live-slot {
  max-width: 860px;
  margin: 0 auto;
}
.msg {
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
}
.live-slot .msg {
  border-bottom: 0;
}
.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.msg-head strong {
  font-size: 13px;
}
.msg-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.msg.from-user .msg-body {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
}
.msg.from-user .msg-head strong {
  color: var(--text-2);
}
.msg.from-agent .msg-head strong {
  color: var(--copper-deep);
}
.msg.live {
  position: relative;
}
.msg.live::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 18px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--copper), rgba(176, 121, 76, 0.1));
}
.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--copper-ink);
}
.warn-text {
  color: var(--warn-ink);
}
.parts {
  display: grid;
  gap: 6px;
}
.md {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p {
  margin-bottom: 9px;
}
.md h4,
.md h5 {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 600;
}
.md ul,
.md ol {
  margin: 0 0 9px;
  padding-left: 22px;
}
.md li.nested {
  margin-left: 18px;
}
.md code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
}
.md pre code,
pre.code code {
  border: 0;
  background: none;
  padding: 0;
}
.md blockquote {
  margin: 0 0 9px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-2);
}
.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}
.md-table {
  overflow-x: auto;
  margin-bottom: 9px;
}
.md-table td,
.md-table th {
  padding: 5px 9px;
  font-size: 13px;
  border: 1px solid var(--line);
}
pre.code {
  position: relative;
}
.code-lang {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 10.5px;
  color: var(--muted);
}
.part-thinking {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}
.step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color 0.2s var(--ease);
}
.step:hover,
.step.open {
  border-color: var(--line-strong);
}
.step-head {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
.step-head:hover {
  background: var(--hover);
}
.step-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tone-ink);
}
.step-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone);
}
.step-kind {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 82px;
}
.step-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.step-dur {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.step .chevron {
  color: var(--muted);
}
.step-body {
  padding: 4px 12px 10px;
  border-top: 1px solid var(--line);
}
.step-body pre {
  background: var(--surface);
  max-height: 340px;
}
.step-error {
  margin: 8px 0;
  color: var(--bad-ink);
}
.call-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.call-line .section-label {
  margin: 0;
}
.truncated {
  text-transform: none;
  letter-spacing: 0;
}
.step-files {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.added {
  color: var(--ok-ink);
}
.removed {
  color: var(--bad-ink);
}
.nested-calls {
  display: grid;
  gap: 6px;
}
.orphan-calls {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-2);
}
.file-chip small {
  display: inline;
}
.photo img {
  display: block;
  max-width: 320px;
  max-height: 260px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.new-events {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: var(--copper-ink);
  border-color: var(--copper-ink);
  color: var(--on-copper);
  box-shadow: var(--shadow-lift);
  border-radius: 999px;
  padding: 6px 14px;
}
.new-events:hover {
  background: var(--copper-deep);
  color: var(--on-copper);
}
.side-pane {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.side-card {
  padding: 14px 16px;
  margin-bottom: 12px;
}
.side-card h2 {
  font-size: 13px;
  margin-bottom: 10px;
}
.side-facts {
  display: grid;
  gap: 7px;
}
.side-fact {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  font-size: 12.5px;
}
.side-fact dt {
  color: var(--muted);
}
.side-fact dd {
  overflow-wrap: anywhere;
}
.side-fact dd small {
  display: inline;
}
.side-card .state {
  padding: 14px 10px;
}
.side-card .filters {
  gap: 6px;
  margin-bottom: 10px;
}
.side-card .filters label {
  font-size: 11.5px;
}
.side-card .filters select {
  padding: 4px 6px;
  font-size: 12.5px;
}
.side-card .filters button {
  padding: 4px 9px;
  font-size: 12px;
}
.runs {
  display: grid;
  gap: 6px;
}
.run-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.run-head {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  font-weight: 400;
  font-size: 12.5px;
}
.run-time {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.run-tokens {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.run-head .chevron {
  color: var(--muted);
  margin-left: auto;
}
.run-tokens + .chevron {
  margin-left: 0;
}
.run-body {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.run-entry pre {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.log-list {
  display: grid;
}
.log-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.log-item:last-child {
  border-bottom: 0;
}
.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.log-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.log-kind {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11.5px;
}
.log-data {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 2px;
}

/* ---- Сторож ----------------------------------------------------------------------------- */
.duty-status {
  padding: 12px 16px;
}
.duty-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.duty-fact {
  font-size: 12.5px;
  color: var(--text-2);
}
.duty-fact .live-time {
  font-weight: 500;
}
.duty-line > button {
  margin-left: auto;
}
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 14px;
}
.filter-label {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}
.filter-label:first-child {
  margin-left: 0;
}
.duty-split {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.incident-pane {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.incident-list {
  display: grid;
}
.incident-list > .empty,
.incident-list > .state {
  margin: 12px;
}
.incident-item {
  display: grid;
  gap: 5px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 14px;
  background: var(--surface);
  white-space: normal;
  font-weight: 400;
  position: relative;
}
.incident-item:last-child {
  border-bottom: 0;
}
.incident-item.selected {
  background: var(--selected);
}
.incident-item.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--copper);
}
.incident-item-head {
  display: flex;
  gap: 6px;
}
.incident-title {
  font-weight: 500;
  line-height: 1.35;
}
.incident-card {
  padding: 22px 26px;
  margin-bottom: 0;
}
.incident-head {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.incident-head h2 {
  margin: 0;
}
.incident-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}
.incident-texts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 6px 0 20px;
}
.incident-texts section {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.incident-texts section:first-child {
  grid-column: 1 / -1;
  background: var(--copper-tint);
  border-color: #ead6c0;
}
.incident-texts h3 {
  margin: 0 0 6px;
}
.incident-texts p {
  margin: 0;
}
.incident-card .facts {
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
}
.mail-list li {
  font-size: 13px;
}
.note-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}
.note-list li {
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 12px;
}
.note-meta {
  font-size: 12px;
  color: var(--muted);
}
.note-text {
  white-space: pre-wrap;
}
.note-form {
  display: grid;
  gap: 8px;
  max-width: 640px;
}

/* ---- Поиск ------------------------------------------------------------------------------ */
.find-form {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.find-form input {
  font-size: 15px;
  padding: 9px 12px;
}
.find .card > .muted {
  margin: 0;
  font-size: 12.5px;
}
.find-filter {
  margin-bottom: 14px;
}
.find-results > .state {
  margin-bottom: 14px;
}
.results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.result {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 200px 110px;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.result:last-child {
  border-bottom: 0;
}
.result-type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.result-title {
  font-weight: 500;
}
.result-owner,
.result-time {
  font-size: 12.5px;
  color: var(--muted);
}
.result-time {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- Login ------------------------------------------------------------------------------ */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--canvas);
  padding: 28px;
}
.login-box {
  width: 400px;
  max-width: 100%;
}
.login .brand {
  justify-content: center;
  padding-bottom: 22px;
}
.login .crown {
  width: 38px;
  height: 38px;
}
.login .brand-name {
  font-size: 24px;
}
.login .card {
  padding: 30px;
  box-shadow: var(--shadow-lift);
}
.login h1 {
  font-size: 22px;
  margin-bottom: 6px;
}
.login form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}
.login button {
  width: 100%;
  justify-content: center;
  padding: 9px 15px;
  margin-top: 4px;
}
.login-footer {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 1360px) {
  .page {
    padding-inline: 24px;
  }
  .topbar {
    padding-inline: 24px;
  }
  .global-search {
    width: 280px;
  }
  .now-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-body {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .duty-split {
    grid-template-columns: 330px minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}
.side-card .state.pending {
  padding: 10px 12px;
  align-items: flex-start;
  text-align: left;
  font-size: 12.5px;
}
.side-card .state.pending strong {
  font-weight: 500;
}
.side-card .download {
  font-size: 12px;
}
.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}
.inline-field select {
  width: auto;
  padding: 4px 8px;
  font-size: 12.5px;
}
.duty-split.single {
  grid-template-columns: minmax(0, 1fr);
}
.duty-split.single .incident-pane {
  position: static;
  max-height: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.duty-split.single .incident-list > .state {
  margin: 0;
}
.period input {
  padding: 5px 9px;
}
.segmented:empty,
.form-grid small:empty,
.form-grid p:empty {
  display: none;
}
small.block {
  display: block;
  margin-top: 2px;
}

/* ---- Polish: one state, outcomes, details on demand ------------------------------------- */
.grid.metrics-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.counter.is-unknown:not(.is-zero) {
  background: var(--warn-tint);
  border-color: #efdcb4;
  box-shadow:
    inset 3px 0 0 var(--warn),
    var(--shadow);
}
.counter.is-unknown:not(.is-zero) .counter-value {
  color: var(--warn-ink);
}
.counter.is-unknown .counter-hint {
  color: var(--warn-ink);
  font-weight: 500;
}
.empty-line {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.now-grid .card {
  padding: 14px 18px;
}
.now-grid .card-head {
  margin-bottom: 6px;
}
.list-count {
  min-width: 34px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--bad-ink);
}
.wait-tag {
  display: inline-block;
  margin-bottom: 2px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--warn-ink);
  background: var(--warn-tint);
}
.tone-text-run {
  color: var(--run-ink);
}
.tone-text-warn {
  color: var(--warn-ink);
}
.tone-text-bad {
  color: var(--bad-ink);
}
.tone-text-ok {
  color: var(--ok-ink);
}
.details-block {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--copper-ink);
  font-size: 12.5px;
  cursor: pointer;
}
.details-toggle .chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.2s var(--ease);
}
.details-block.open .details-toggle .chevron {
  transform: rotate(90deg);
}
.details-block.open .side-facts {
  margin-top: 8px;
}
.details-block.open.memory-used .details-toggle .chevron {
  transform: rotate(90deg);
}
.memory-body {
  margin-top: 8px;
}
.memory-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
.memory-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.memory-item:last-child {
  border-bottom: 0;
}
.memory-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
}
.memory-text {
  margin-top: 3px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.memory-note {
  display: block;
  color: var(--muted);
}
.memory-use small {
  color: var(--muted);
}
.side-fact .mono {
  font-size: 11.5px;
  word-break: break-all;
}
.live-state {
  font-weight: 500;
}
.agent-label .muted {
  font-weight: 400;
  font-size: 12px;
}
.outcome {
  margin: 8px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--line-strong);
}
.outcome.tone-ok {
  box-shadow: inset 3px 0 0 var(--ok);
}
.outcome.tone-warn {
  box-shadow: inset 3px 0 0 var(--warn);
  background: #fffcf5;
}
.outcome.tone-bad {
  box-shadow: inset 3px 0 0 var(--bad);
  background: #fdf6f4;
}
.outcome-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.outcome-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin: 10px 0 0;
  font-size: 13px;
}
.outcome-facts dt {
  color: var(--muted);
  font-size: 11.5px;
}
.outcome-facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.outcome-note {
  margin: 10px 0 0;
  font-size: 13px;
}
.stop-target {
  display: grid;
  gap: 8px;
  margin: 0 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.stop-target > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
}
.stop-target dt {
  color: var(--muted);
}
.stop-target dd {
  margin: 0;
  font-weight: 500;
}
.msg.from-user.is-focused .msg-body {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px var(--copper-tint);
}
.run-cost {
  color: var(--muted);
}
.mini-chart .chart {
  height: 72px;
}
.mini-chart .chart-labels {
  font-size: 11px;
}
.nowrap {
  white-space: nowrap;
}
.memory-source a {
  font-size: 12px;
}
.memory-hint {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  max-width: 180px;
}
mark.hit {
  background: var(--copper-tint);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.find .results .result {
  grid-template-columns: minmax(0, 1fr) 190px 170px;
  padding: 7px 0;
}
.find .card {
  padding: 12px 18px;
  margin-bottom: 12px;
}
.find .card h2 {
  margin-bottom: 4px;
  font-size: 13px;
}
.find-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.result-time small {
  display: block;
  font-size: 11px;
}
.error-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.error-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.error-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.error-code {
  font-size: 11.5px;
  color: var(--muted);
}
.error-message {
  margin: 2px 0;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.status-explain {
  font-size: 12.5px;
  color: var(--muted);
}
.rules-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.rules-toggle .chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
}
.rules-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}
.incident-head .notes-inline {
  margin-top: 10px;
}
.run-table th:nth-child(2) {
  width: 18%;
}
.run-table th:nth-child(4) {
  width: 26%;
}
.head-facts dd .task-doing {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.mini-metrics .value.as-text {
  font-family: inherit;
  font-size: 14px;
  padding-top: 6px;
}

/* Phones and narrow windows: one column, the sidebar becomes a wrapped bar above the page. */
@media (max-width: 740px) {
  body {
    min-width: 0;
  }
  .layout {
    display: block;
    background: none;
  }
  .nav-zone {
    width: 100%;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
  }
  .topbar {
    position: static;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  .topbar-title h1 {
    max-width: 100%;
    white-space: normal;
  }
  .topbar-tools {
    flex-wrap: wrap;
    width: 100%;
  }
  .main > * {
    min-width: 0;
    max-width: 100vw;
  }
  /* Every multi-column grid of the pages stacks; wide tables scroll inside their own frame. */
  #content * {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
