.wrap { max-width: 920px; margin: 0 auto; padding: 24px 20px 64px; }
@media (max-width: 640px) { .wrap { padding: 16px 16px 48px; } }

.head h1 { margin: 0; font-size: 26px; }
.sub { margin: 6px 0 16px; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 14px; cursor: pointer;
}
.chip .n { margin-left: 5px; opacity: .65; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.search { flex: 1; min-width: 200px; max-width: 320px; margin-left: auto; }
@media (max-width: 640px) { .search { max-width: none; margin-left: 0; } }

/* «Чекає вашої відповіді» */
.waiting {
  margin-bottom: 28px; padding: 16px; border-radius: 14px; background: var(--k-question-bg);
  border: 1px solid color-mix(in srgb, var(--k-question) 30%, transparent);
}
.waiting-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 17px; }
.pill {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--k-question); color: var(--surface); font-size: 13px; font-weight: 700;
}
.waiting-list { display: grid; gap: 10px; }
.q-card { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.q-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.q-title { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.q-card .md { color: var(--ink-2); font-size: 14px; }

/* стрічка */
.day { margin: 24px 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.rec { margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 72px; }
.rec.is-flash { animation: flash 1.8s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 3px transparent; } }
.rec-head {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px; border: 0; border-radius: var(--radius); background: none; text-align: left; cursor: pointer;
}
.rec-head:hover { background: var(--surface-2); }
.rec-id { font: 600 13px var(--mono); color: var(--ink-2); }
.rec-title { min-width: 0; font-weight: 600; }
.rec-meta { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.rec.is-superseded .rec-title { color: var(--ink-2); text-decoration: line-through; }
@media (max-width: 640px) {
  .rec-head { grid-template-columns: auto auto 1fr; row-gap: 4px; }
  .rec-head .badge { justify-self: start; }
  .rec-meta { grid-column: 3; grid-row: 1; justify-self: end; }
  .rec-title { grid-column: 1 / -1; grid-row: 2; }
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.k-decision { color: var(--k-decision); background: var(--k-decision-bg); }
.k-change { color: var(--k-change); background: var(--k-change-bg); }
.k-report { color: var(--k-report); background: var(--k-report-bg); }
.k-question { color: var(--k-question); background: var(--k-question-bg); }
.k-plan { color: var(--k-plan); background: var(--k-plan-bg); }

.rec-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.rel { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.ref { font-family: var(--mono); font-weight: 600; text-decoration: none; }
.ref:hover { text-decoration: underline; }

/* текст записів (Markdown) */
.md { overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; font-size: 16px; }
.md p, .md ul, .md ol { margin: 10px 0; }
.md ul, .md ol { padding-left: 22px; }
.md li + li { margin-top: 3px; }
.md code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); font: .92em var(--mono); }
.md pre { overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.md pre code { padding: 0; background: none; }
.md table { display: block; overflow-x: auto; margin: 12px 0; border-collapse: collapse; font-size: 14px; }
.md th, .md td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: normal; }
.md th { white-space: nowrap; }
.md th { background: var(--surface-2); }
.md blockquote { margin: 10px 0; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--ink-2); }

/* відповіді */
.answers { display: grid; gap: 8px; margin-top: 14px; }
.answer { padding: 10px 12px; border-radius: 8px; background: var(--k-change-bg); }
.answer-meta { margin-bottom: 2px; font-size: 12px; color: var(--ink-2); }
.answer-opt { font-weight: 600; }
.answer-text { white-space: pre-wrap; }
.ask { display: grid; gap: 10px; margin-top: 14px; }
.ask-options { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  min-height: 38px; padding: 6px 14px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--surface); color: var(--accent); font-weight: 600; text-align: left; cursor: pointer;
}
.opt:hover { background: var(--accent-soft); }
.opt:disabled { opacity: .55; cursor: default; }
.ask textarea { min-height: 44px; height: 44px; resize: vertical; transition: height .15s; }
.ask textarea:focus, .ask textarea.has-text { height: 96px; }
.ask-row { display: flex; justify-content: flex-end; gap: 8px; }
.ask-error { margin: 0; font-size: 14px; color: var(--danger); }
.more { justify-self: start; margin-top: 10px; }

/* «Написати Claude» */
.compose { margin-bottom: 20px; }
.compose-open {
  width: 100%; min-height: 48px; padding: 0 16px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--radius); background: var(--surface); color: var(--accent); font-weight: 600; text-align: left; cursor: pointer;
}
.compose-open::before { content: "+"; margin-right: 10px; font-size: 18px; }
.compose-open:hover { background: var(--accent-soft); }
.compose-form { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.compose-label { font-size: 14px; font-weight: 600; }
.compose-form textarea { min-height: 120px; resize: vertical; }
.k-message { color: var(--k-message); background: var(--k-message-bg); }

/* розмова під записом */
.thread { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.thread-title { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 10px; }
.msg-owner { justify-self: end; background: var(--accent-soft); }
.msg-claude { justify-self: start; background: var(--surface-2); }
.msg-meta { margin-bottom: 2px; font-size: 12px; color: var(--ink-2); }
.msg .md > :first-child { margin-top: 0; }
.msg .md > :last-child { margin-bottom: 0; }
.thread-wait { margin: 0; font-size: 13px; color: var(--ink-2); }
.reply { display: grid; gap: 8px; }
.reply textarea { min-height: 44px; height: 44px; resize: vertical; transition: height .15s; }
.reply textarea:focus, .reply textarea.has-text { height: 96px; }
.tag-wait { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--k-message); background: var(--k-message-bg); }
.talk { margin-left: 6px; }

.empty, .loading { padding: 32px 0; text-align: center; color: var(--ink-2); }

.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgb(5 12 24 / 45%); }
.dialog h3 { margin: 0 0 10px; }
.confirm-preview { max-height: 40vh; overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); white-space: pre-wrap; }
.dialog .hint { margin: 10px 0 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
