:root {
  --bg: #f6f4fb;
  --card: #ffffff;
  --ink: #2f2b3a;
  --muted: #6f6880;
  --line: #e6e1f2;
  --accent: #7c6bb5;
  --accent-soft: #efeafc;
  --ok: #3f8f6f;
  --ok-soft: #e6f4ee;
  --bad: #b5566b;
  --bad-soft: #fbe9ed;
  --warn-soft: #fdf3e2;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Поля ввода не наследуют шрифт сами — без этого форма выглядит чужой. */
button, input, textarea, select { font-family: inherit; font-size: inherit; }

.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 80px; }

.head { margin-bottom: 22px; }
h1 { font-size: 30px; line-height: 1.2; margin: 10px 0; }
h2 { font-size: 19px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.lead { color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 18px;
}

.pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.live .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

.privacy { background: var(--warn-soft); border-color: #f0e2c6; }
.privacy .warn { font-weight: 600; }

.field { display: block; margin-bottom: 18px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

input[type=text], input[type=password], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcff;
  color: inherit;
  resize: vertical;
}
input:focus, textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.drop {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  background: #fdfcff;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

.linklike {
  background: none; border: 0; padding: 0;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 24px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.error {
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 14px;
}

/* Фазы */
.phases { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.phases li {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  color: var(--muted);
}
.phases li .mark {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.phases li.now { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.phases li.now .mark { border-color: var(--accent); color: var(--accent); }
.phases li.done .mark { border-color: var(--ok); background: var(--ok); color: #fff; }

/* Лента событий */
.timeline { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.ev {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  background: #fdfcff;
}
.ev .ico { font-size: 15px; line-height: 1.4; }
.ev .what { font-weight: 600; }
.ev .arg {
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
}
.ev .state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ev.ok { border-color: #cfe7dc; background: var(--ok-soft); }
.ev.bad { border-color: #f0cdd6; background: var(--bad-soft); }

.thinking {
  font-size: 14px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.55;
}

iframe {
  width: 100%;
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-top: 12px;
}

.log {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  background: #fdfcff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  max-height: 260px;
  overflow-y: auto;
}

/* Отчёт методиста */
.report { font-size: 15px; }
.report h1, .report h2, .report h3 { font-size: 18px; margin: 20px 0 8px; }
.report table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.report th, .report td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.report th { color: var(--muted); font-weight: 600; }
.report ul, .report ol { margin: 8px 0; padding-left: 22px; }
.report code {
  background: var(--accent-soft);
  border-radius: 5px; padding: 1px 5px;
  font-size: 13px;
}
/* Широкую таблицу лучше прокрутить, чем сломать страницу. */
.report .scroll { overflow-x: auto; }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .card { padding: 18px; }
  iframe { height: 460px; }
}
