:root {
  color-scheme: light dark;
  --background: #f4f6f8;
  --surface: #fff;
  --text: #182a36;
  --muted: #546774;
  --border: #dfe6ec;
  --accent: #146451;
  --tint: #e8f4ed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.page-header { margin-bottom: 30px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .06em; margin: 0 0 8px; }
h1 { font-size: clamp(24px, 5vw, 32px); line-height: 1.2; letter-spacing: -.025em; margin: 0 0 12px; }
.intro { color: var(--muted); margin: 0; font-size: 15px; }
.section-header { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
h2 { font-size: 20px; margin: 0; }
.caption, .message-time { color: var(--muted); font-size: 13px; }
.messages { list-style: none; padding: 0; margin: 0; }
.message-card, .status { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px 14px; overflow-wrap: anywhere; }
.message-card + .message-card { margin-top: 8px; }
.case-preview { cursor: pointer; list-style: none; }
.case-preview::-webkit-details-marker { display: none; }
.case-preview::after { content: 'Развернуть ▾'; font-size: 11px; color: var(--muted); }
.case-details[open] > .case-preview::after { content: 'Свернуть ▴'; }
.case-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.preview-meta, .preview-reply { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.preview-text { margin: 0 0 6px; font-size: 14px; white-space: pre-wrap; }
.case-preview .message-meta { margin: 0; gap: 4px 8px; }
.case-preview .category { margin: 0; }
.case-body { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 12px; }
.reason-panel { border-left: 3px solid var(--accent); background: var(--tint); padding: 1px 12px 8px; margin-top: 12px; }
.reason-panel .analysis-reason { margin-bottom: 0; }
.feed-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.feed-filter { font-size: 13px; padding: 6px 10px; }
.query-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 10px 0; }
.query-row label { font-size: 13px; color: var(--muted); }
.query-row input, select { display: block; font: inherit; padding: 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); max-width: 100%; }
.search-label { flex: 1; min-width: 170px; }
.search-label input { width: 100%; }
.open-remark { color: var(--accent); font-size: 12px; font-weight: 700; }
.attachments { white-space: pre-wrap; font-size: 13px; padding-left: 20px; }
.category { font-size: 12px; color: var(--accent); font-weight: 700; margin: 0 0 6px; }
.message-title { font-size: 18px; line-height: 1.4; margin: 0 0 8px; }
.summary { margin: 0 0 16px; white-space: pre-wrap; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; font-size: 12px; }
.badge { border-radius: 8px; background: var(--background); color: var(--muted); padding: 4px 8px; }
.badge.attention { background: var(--tint); color: var(--accent); }
.delivery, .status { color: var(--muted); }
.message-time { display: block; margin: 0; }
.original-text, .analysis-reason { white-space: pre-wrap; margin: 0 0 16px; }
.field-label { font-size: 13px; font-weight: 700; margin: 16px 0 6px; }
.feedback-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 9px 12px; }
button[aria-pressed="true"] { background: var(--tint); border-color: var(--accent); }
button:disabled { opacity: .65; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.feedback-status { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.feedback-form .expected-choice { margin: 4px 6px 4px 0; }
.feedback-comment { display: block; resize: vertical; width: 100%; min-height: 76px; padding: 8px; margin: 6px 0; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); font: inherit; }
.remark-status { font-size: 13px; font-weight: 700; }
.history-event { white-space: pre-wrap; font-size: 13px; color: var(--muted); }
.feedback-history { margin-top: 12px; }
.load-more { display: block; margin: 20px auto 0; }
[hidden] { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root { --background: #131c24; --surface: #1b2732; --text: #e8eff5; --muted: #b1c0cd; --border: #324350; --accent: #9adbbc; --tint: #203e35; }
}
