:root {
  --bg: #ffffff; --text: #1f2933; --muted: #66727f; --line: #dfe5ea; --soft: #f4f7f9;
  --accent: #1a7f8c; --accent-text: #ffffff; --bad: #b3261e; --bad-bg: #fdecea;
  --manager: #8a4b00; --manager-bg: #fff4e0; --ask: #0b5cad; --ask-bg: #e8f1fb; --check: #b3261e; --check-bg: #fdecea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c2126; --text: #e7ecf0; --muted: #9aa6b1; --line: #343c44; --soft: #252b31;
    --accent: #3fb0be; --accent-text: #0e1519; --bad: #ff8a80; --bad-bg: #3a2220;
    --manager: #ffc56b; --manager-bg: #3a2f1c; --ask: #8cc0ff; --ask-bg: #1d2b3c; --check: #ff8a80; --check-bg: #3a2220;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
main { padding: 12px 14px; }
[hidden] { display: none !important; }

.status { color: var(--muted); padding: 4px 0 8px; }
.status.bad { color: var(--bad); }
.status.wait::after { content: "…"; display: inline-block; width: 1.2em; animation: dots 1.2s steps(4, end) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@media (prefers-reduced-motion: reduce) { .status.wait::after { animation: none; } }

.draft { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 46vh; overflow: auto; user-select: text; }
.notes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.notes li { border-radius: 6px; padding: 5px 9px; font-size: 13px; background: var(--soft); color: var(--muted); }
.notes li.k-manager { background: var(--manager-bg); color: var(--manager); }
.notes li.k-ask { background: var(--ask-bg); color: var(--ask); }
.notes li.k-check { background: var(--check-bg); color: var(--check); }
.meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
button { font: inherit; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }

.toast { margin-top: 10px; padding: 7px 10px; border-radius: 6px; background: var(--ask-bg); color: var(--ask); font-size: 13px; }
.toast.bad { background: var(--bad-bg); color: var(--bad); }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

.note { max-width: 720px; }
.note h1 { font-size: 18px; margin: 4px 0 10px; }
.note p { margin: 0 0 10px; }
.note .warn { color: var(--bad); }
.note .muted { color: var(--muted); font-size: 12px; }
.note table { border-collapse: collapse; width: 100%; }
.note th, .note td { text-align: left; vertical-align: top; padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.note th { color: var(--muted); white-space: nowrap; width: 1%; }

/* --- страница вопросов и отзывов --- */
.inbox { max-width: 920px; margin: 0 auto; padding: 14px 16px 28px; }
.inbox .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inbox h1 { font-size: 18px; margin: 4px 0 6px; }
.inbox .muted { color: var(--muted); font-size: 12px; margin: 4px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 12px; }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tab:hover { border-color: var(--line); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.list { display: grid; gap: 12px; }
.empty { color: var(--muted); padding: 18px 0; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); min-width: 0; }
.card .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.card .when { font-variant-numeric: tabular-nums; }
.card .stars { color: #c98a00; letter-spacing: 1px; }
.card .stars.low { color: var(--bad); }
.card .product { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.card .link { color: var(--accent); text-decoration: none; white-space: nowrap; }
.card .link:hover { text-decoration: underline; }
.card .buyer { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.card .media { color: var(--muted); font-size: 12px; margin: -2px 0 8px; }
.card .draft { max-height: none; }
/* черновик в поле: оператор может поправить текст перед отправкой */
textarea.draft { display: block; width: 100%; min-height: 90px; font: inherit; color: var(--text); resize: vertical; }
textarea.draft:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.draft[readonly] { opacity: .8; }
.card .changed { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 4px; }
.card .ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--manager-bg); color: var(--manager); }
.card .ask span { flex: 1 1 260px; min-width: 0; }
.card.sent { opacity: .75; }
.status.ok { color: var(--accent); font-weight: 600; }
/* на длинной странице сообщение должно быть видно там, где сейчас оператор */
.inbox .toast { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; margin: 0; max-width: min(92%, 640px); box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.card .status { padding: 6px 0 0; }
.linklike { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.linklike:hover { color: var(--accent); }
.keybox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.keybox input { flex: 1 1 220px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
