.nav { flex: 1; min-height: 0; overflow-y: auto; }
.nav-label {
  margin: 12px 10px 4px;
  color: #a38e80;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.letopis-panel {
  display: grid;
  gap: 22px;
  max-width: 1040px;
  margin-inline: auto;
  padding: 0 8px 32px;
}
.letopis-list { display: grid; gap: 10px; }
.letopis-card {
  display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line, #ead9cb);
  border-radius: 16px; background: rgba(255,255,255,.72); text-align: left;
}
.letopis-card small { color: var(--muted, #97877c); }
.letopis-card pre { margin: 0; white-space: pre-wrap; font-size: 11px; }
.letopis-row { grid-template-columns: 1fr auto; align-items: center; }
.letopis-split { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 16px; }
.letopis-thread {
  display: grid;
  flex: 1;
  min-height: 0;
  max-height: min(70vh, 40rem);
  gap: 10px;
  overflow: auto;
}
.letopis-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.letopis-panel .task-panel { max-width: 560px; }
.lp-step-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.letopis-panel {
  accent-color: var(--accent, #ff621b);
}

.lp-bench {
  display: grid;
  gap: 0;
  padding: 6px;
  border: 1px solid var(--line-strong, #dfd0c1);
  border-radius: 18px;
  background: var(--shell-strong, #f6e9dc);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .72),
    0 18px 40px -32px rgb(82 49 29 / .35);
}
.lp-bench-head,
.lp-bench-id,
.lp-pipeline,
.lp-bench-actions {
  background: #fff;
}
.lp-bench-head {
  padding: 20px 22px 8px;
  border-radius: 12px 12px 0 0;
}
.lp-bench-head h2 {
  margin: 0;
  font: 400 22px/1.2 Georgia, "Times New Roman", serif;
}
.lp-bench-head p {
  max-width: 52ch;
  margin: 6px 0 0;
  color: var(--muted, #94867b);
  font-size: 13px;
}
.lp-bench-id {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px 16px;
  padding: 12px 22px 8px;
}
.lp-field { display: grid; gap: 6px; min-width: 0; }
.lp-field .field-label { margin: 0; }
.lp-hint {
  margin: -2px 0 6px;
  color: var(--muted, #94867b);
  font-size: 12px;
}
.lp-pipeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 8px 18px 4px 14px;
  list-style: none;
}
.lp-step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px 12px;
  position: relative;
  padding: 0 0 18px;
}
.lp-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 44px;
  bottom: 0;
  width: 1px;
  background: var(--line-strong, #dfd0c1);
}
.lp-step-num {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #efad8e;
  border-radius: 10px;
  color: var(--accent-dark, #e65312);
  background: var(--accent-soft, #fdebe2);
  font: 400 16px/1 Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums;
}
.lp-step-body {
  min-width: 0;
  margin: 0;
  padding: 14px 16px 14px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 14px;
  background: var(--surface, #fefaf7);
}
.lp-step-kind-row {
  display: grid;
  gap: 6px;
  max-width: 280px;
  margin-bottom: 12px;
}
.lp-step-kind-row .field-label { margin: 0; }
.lp-control,
.lp-step-prompt {
  min-height: 48px;
  font-size: 1rem;
}
.lp-step-prompt {
  min-height: 8.5rem;
  margin: 0;
  background: #fff;
}
.lp-step-meta {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.lp-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink, #2b2b2b);
  font-size: 13px;
  font-weight: 650;
}
.lp-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
}
.lp-need {
  margin: 0;
  padding: 0;
  border: 0;
}
.lp-need legend {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
}
.lp-need-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lp-seg {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line-strong, #dfd0c1);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.lp-seg:has(input:checked) {
  border-color: var(--accent, #ff621b);
  background: var(--accent-soft, #fdebe2);
}
.lp-seg input { accent-color: var(--accent, #ff621b); }
.lp-seg:focus-within {
  outline: 2px solid rgb(255 98 27 / .28);
  outline-offset: 2px;
}
.lp-step-rail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}
.lp-rail-btn {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft, #565656);
  font-size: 11px;
  font-weight: 700;
}
.lp-rail-btn:hover { background: var(--surface, #fefaf7); }
.lp-rail-btn:focus-visible,
.lp-run:focus-visible,
.lp-save:focus-visible,
.lp-seg:focus-within {
  outline: 2px solid rgb(255 98 27 / .28);
  outline-offset: 2px;
}
.lp-rail-danger { color: var(--danger, #b9382b); }
.lp-bench-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px 16px;
  border-top: 1px solid var(--line, #eadfd5);
  border-radius: 0 0 12px 12px;
}
.lp-save {
  min-height: 48px;
  padding-inline: 20px;
  margin-inline-start: auto;
}
#lpAddStep {
  min-height: 44px;
  border-style: dashed;
  background: var(--surface, #fefaf7);
}

.lp-racks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.lp-rack {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 16px;
  background: var(--shell, #fdf3ea);
}
.lp-rack-mine { background: var(--surface, #fefaf7); scroll-margin-top: 1.5rem; }
.lp-rack-catalog { background: var(--peach, #fff0df); }
.lp-rack header h2 {
  margin: 0;
  font: 400 22px/1.2 Georgia, "Times New Roman", serif;
}
.lp-rack header p {
  margin: 4px 0 0;
  color: var(--muted, #94867b);
  font-size: 12px;
}
.lp-ticket-list { display: grid; gap: 10px; }
.lp-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 14px;
  background: #fff;
}
.lp-ticket-body { display: grid; gap: 4px; min-width: 0; }
.lp-ticket-body b { font-size: 15px; }
.lp-ticket-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted, #94867b);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.lp-ticket-body small {
  color: var(--ink-soft, #565656);
  font-variant-numeric: tabular-nums;
}
.lp-ticket-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}
.lp-run {
  min-height: 48px;
  padding-inline: 16px;
  white-space: nowrap;
}

.lp-run-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 12px;
  padding: 12px 14px;
  border: 1px solid #efad8e;
  border-radius: 12px;
  background: var(--accent-soft, #fdebe2);
  color: var(--ink, #2b2b2b);
  font-size: 13px;
  font-weight: 650;
}
.lp-run-banner .loader {
  width: 16px;
  height: 16px;
  border-width: 2px;
  flex: none;
}
.lp-chat-open .lp-run-banner { margin: 0 22px 12px; }
.lp-chat-id {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
}
.letopis-panel:has(.lp-chat-stage) { max-width: 1120px; }
.lp-chat-stage {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: min(70vh, 40rem);
}
.lp-chat-rail { background: var(--surface, #fefaf7); }
.lp-chat-item {
  width: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.lp-chat-item:hover { background: var(--surface, #fefaf7); }
.lp-chat-item:focus-visible {
  outline: 2px solid rgb(255 98 27 / .28);
  outline-offset: 2px;
}
.lp-chat-item.is-selected {
  border-color: #efad8e;
  background: var(--accent-soft, #fdebe2);
  box-shadow: 0 0 0 3px rgb(242 99 45 / .07);
}
.lp-dialogue {
  display: grid;
  min-height: 0;
  max-height: min(70vh, 40rem);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.lp-composer .lp-run-banner { margin: 0; }
.lp-thread-head h2 {
  text-wrap: balance;
}
.lp-run-meter {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 28px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line-strong, #dfd0c1);
  border-radius: 999px;
  background: var(--surface, #fefaf7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.lp-run-meter[data-status="awaiting_input"] {
  border-color: #efad8e;
  background: var(--accent-soft, #fdebe2);
}
.lp-run-meter[data-status="failed"],
.lp-run-meter[data-status="stopped"] {
  border-color: #f1c5bd;
  color: var(--danger, #b9382b);
  background: var(--danger-soft, #fff0ed);
}
.lp-turns {
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: auto;
  background: #fff;
}
.lp-turn {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px 12px;
  position: relative;
  padding: 0 0 18px;
}
.lp-turn:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 44px;
  bottom: 0;
  width: 1px;
  background: var(--line-strong, #dfd0c1);
}
.lp-turn-card {
  min-width: 0;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 14px;
  background: var(--surface, #fefaf7);
}
.lp-turn-you,
.lp-turn-ai {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-wrap: pretty;
  font-size: 14px;
  line-height: 1.45;
}
.lp-turn-you span,
.lp-turn-ai span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted, #94867b);
  font-size: 12px;
  font-weight: 700;
}
.lp-turn-ai {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #eadfd5);
}
.lp-turn.is-error .lp-turn-ai span { color: var(--danger, #b9382b); }
.lp-hand-card {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #eadfd5);
  display: grid;
  gap: 8px;
}
.lp-hand-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}
.lp-hand-head span { color: var(--muted, #94867b); }
.lp-hand-error { margin: 0; color: var(--danger, #b9382b); font-size: 13px; }
.lp-hand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.lp-dialogue-empty {
  margin: 0;
  padding: 28px 22px;
  color: var(--muted, #94867b);
  background: #fff;
  font: 400 18px/1.35 Georgia, "Times New Roman", serif;
  text-wrap: pretty;
}
.lp-composer {
  display: grid;
  gap: 12px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--line, #eadfd5);
  border-radius: 0 0 12px 12px;
  background: #fff;
  box-shadow: 0 -14px 28px -22px rgb(82 49 29 / .55);
}
.lp-composer[data-waiting="1"] { scroll-margin-bottom: 12px; }
.lp-composer-input {
  min-height: 5.5rem;
  max-height: 12rem;
  margin: 0;
  overflow-y: auto;
  field-sizing: content;
  background: #fff;
}
.lp-thread-actions,
.lp-inline-run {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.lp-inline-run .lp-field { flex: 1; min-width: min(240px, 100%); }
.lp-inline-run .text-input { min-width: min(240px, 100%); }
.lp-composer .lp-bench-actions {
  padding-inline: 0;
}
.lp-ticket.is-blocked {
  border-color: #e8c4bc;
  background: #faf6f2;
}
.lp-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-height: 22px;
  line-height: 1;
}
.lp-ticket-meta > span {
  display: inline-flex;
  align-items: center;
  height: 22px;
}
.lp-chip {
  padding: 0 8px;
  border: 1px solid var(--line, #eadfd5);
  border-radius: 999px;
  background: var(--surface, #fefaf7);
  font-size: 11px;
}
.lp-chip.is-warn {
  color: var(--danger, #b9382b);
  border-color: #e8c4bc;
  background: var(--danger-soft, #fff0ed);
}
.letopis-panel:has(.lp-account),
.letopis-panel:has(.lp-invite-strip) {
  gap: 14px;
  padding-bottom: 20px;
}
.lp-invite-strip .lp-bench-head,
.lp-account .lp-bench-head {
  padding: 12px 16px 6px;
}
.lp-invite-strip .lp-bench-head h2,
.lp-account .lp-bench-head h2 { font-size: 20px; }
.lp-invite-strip .lp-bench-head p,
.lp-account .lp-bench-head p { margin-top: 4px; }
.lp-account.lp-bench,
.lp-invite-strip.lp-bench { border-radius: 16px; }
.lp-invite-strip { container: invite / inline-size; }
.lp-invite-strip .lp-bench-id {
  grid-template-columns: minmax(8.5rem, .9fr) minmax(13rem, 1.4fr) minmax(12rem, 12rem);
  gap: 12px;
  padding: 8px 16px;
}
.lp-account .lp-bench-id {
  padding: 8px 16px;
  gap: 10px 12px;
}
.lp-account .lp-field,
.lp-invite-strip .lp-field { gap: 4px; }
.lp-account .field-label,
.lp-invite-strip .field-label { margin: 0; font-size: 11px; }
.lp-account .text-input,
.lp-invite-strip .text-input {
  min-height: 32px;
  height: 32px;
  padding: 6px 10px;
  border-radius: 12px;
}
.lp-account .text-input::placeholder,
.lp-invite-strip .text-input::placeholder {
  color: #c4b4a8;
  opacity: 1;
}
.lp-account .lp-bench-actions,
.lp-invite-strip .lp-bench-actions {
  padding: 8px 16px 10px;
  border-radius: 0;
}
.lp-account .lp-account-pass .lp-bench-actions,
.lp-invite-strip .lp-bench-actions {
  border-radius: 0 0 12px 12px;
}
.lp-account .lp-save,
.lp-invite-strip .lp-save {
  min-height: 32px;
  padding: 4px 14px;
  border-radius: 12px;
}
.lp-account-pass { border-top: 1px solid var(--line, #eadfd5); }
.lp-account-pass .lp-bench-id {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.letopis-panel:has(.lp-invite-strip) .lp-ticket-list { gap: 8px; }
.letopis-panel:has(.lp-invite-strip) .lp-ticket {
  padding: 10px 12px;
}

@media (max-width: 860px) {
  .letopis-split,
  .lp-racks,
  .lp-bench-id,
  .lp-chat-id,
  .lp-chat-stage,
  .lp-ticket { grid-template-columns: 1fr; }
  .lp-step {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .lp-turn { grid-template-columns: 40px minmax(0, 1fr); }
  .lp-step-rail {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .lp-save { margin-inline-start: 0; width: 100%; }
  .lp-run { width: 100%; }
  .lp-invite-strip .lp-bench-id,
  .lp-account-pass .lp-bench-id { grid-template-columns: 1fr; }
}

@container invite (max-width: 720px) {
  .lp-invite-strip .lp-bench-id {
    grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 1.4fr);
  }
}
@container invite (max-width: 520px) {
  .lp-invite-strip .lp-bench-id { grid-template-columns: 1fr; }
}

@media (pointer: coarse) {
  .lp-control,
  .lp-step-prompt,
  .lp-composer-input,
  .lp-seg { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .lp-ticket,
  .lp-rail-btn,
  .lp-run,
  .lp-save { transition: none; }
}
