:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #68738a;
  --border: #e2e6ee;
  --accent: #2456d6;
  --accent-hover: #1c46b3;
  --ok: #1a7f4b;
  --warn: #a06008;
  --err: #bb2c3d;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.topbar nav a.active { color: var(--accent); background: #e9effc; }

main { padding: 28px 20px 60px; }
h1 { font-size: 26px; margin: 8px 0 20px; }
h2 { font-size: 19px; margin-top: 32px; }
.lead { font-size: 16px; color: #333e55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.bignum { font-size: 34px; font-weight: 700; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { margin-bottom: 6px; }

.btn {
  display: inline-block; padding: 9px 18px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.small-btn { padding: 3px 10px; font-size: 12.5px; }
a.btn:hover { text-decoration: none; }

.status.running { font-weight: 600; color: var(--warn); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

.badge { padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge.success { background: #e2f4ea; color: var(--ok); }
.badge.warning { background: #fdf1dc; color: var(--warn); }
.badge.error { background: #fce4e7; color: var(--err); }
.badge.running { background: #e9effc; color: var(--accent); }
.badge.stopped { background: #eceff3; color: var(--muted); }

.log {
  background: #10151f; color: #cdd6e4; padding: 14px 16px; border-radius: var(--radius);
  font-family: Consolas, monospace; font-size: 13px; max-height: 420px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* Строка текущей стадии генерации в карточке запуска */
.run-stage { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--accent); }

.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.idea-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; color: var(--text);
  transition: box-shadow .15s, border-color .15s;
}
.idea-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(36,86,214,.10); }
.idea-title { font-weight: 700; margin-bottom: 8px; }
.idea-title a { color: var(--text); }
.idea-title a:hover { color: var(--accent); text-decoration: none; }
.idea-summary { font-size: 14px; color: #333e55; margin-bottom: 10px; }

.digest-list { list-style: none; padding: 0; }
.digest-list li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; flex-wrap: wrap;
}
.digest-link { font-weight: 600; font-size: 16px; }

.doc {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 38px; margin-top: 20px; max-width: 820px;
}
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 19px; margin-top: 28px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.doc h3 { font-size: 16px; }
.doc p, .doc li { font-size: 15px; }
.doc blockquote { border-left: 3px solid var(--accent); margin: 0; padding: 4px 16px; color: var(--muted); }
.doc img { max-width: 100%; }
.doc table { margin: 12px 0; }
.doc pre, .doc code { background: #f0f2f6; border-radius: 6px; }
.doc pre { padding: 12px; overflow-x: auto; }
.doc code { padding: 1px 5px; font-size: 13.5px; }
.doc pre code { padding: 0; }

.notice { padding: 12px 16px; border-radius: var(--radius); margin: 14px 0; font-size: 14px; }
.notice.ok { background: #e2f4ea; color: var(--ok); }
.notice.warn { background: #fdf1dc; color: var(--warn); }

.settings-form fieldset {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 18px;
}
.settings-form legend { font-weight: 700; padding: 0 8px; }
.settings-form label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
.settings-form label.checkbox { display: flex; align-items: center; gap: 8px; }
.settings-form input[type=text], .settings-form input[type=number],
.settings-form input[type=password], .settings-form select, .settings-form textarea {
  display: block; width: 100%; max-width: 520px; margin-top: 5px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-weight: 400; background: #fff;
}
.settings-form textarea { max-width: 100%; font-family: Consolas, monospace; font-size: 13px; }
.settings-form .hint { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .doc { padding: 20px; }
}
