/* Панель онбординга. Стиль — как у «Мониторинга сайтов» (Monitorus, monitoring.dv-expert.org,
   monitorus/web/static/dashboard.css): светлый фон, тёмная шапка, белые карточки, синий акцент, статусы — пилюлями.
   Встроенных стилей и скриптов нет (CSP панели): всё здесь и в app.js. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #243242;
  --muted: #8a97a6;
  --line: #e4e9ef;
  --accent: #2f6fb0;
  --ok: #2e9e5b;
  --crit: #d64545;
  --soon: #d98a2b;
  --hover: #eef3f8;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-weight: normal; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; background: var(--hover);
  padding: 1px 5px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #243242; color: #fff; padding: 12px 24px;
}
.topbar .brand { font-weight: 600; font-size: 17px; white-space: nowrap; }
.topbar .brand .sub { color: #8fa1b5; font-weight: 400; font-size: 14px; margin-left: 6px; }
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 20px; }
.topbar nav a, .topbar nav .linkish { color: #cfdae6; }
.topbar nav a:hover, .topbar nav .linkish:hover { color: #fff; text-decoration: none; }
.topbar nav a.on { color: #fff; box-shadow: inset 0 -2px 0 #6fa3dc; padding-bottom: 2px; }
.topbar nav form { margin: 0; display: inline; }
.topbar nav .linkish { background: none; border: 0; padding: 0; cursor: pointer; font-size: 15px; }
.topbar nav .logout { color: #f0b5b5; }
.topbar nav .who { color: #8fa1b5; font-size: 13px; }
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.nav-dot-green { background: #3ad27f; box-shadow: 0 0 5px rgba(58,210,127,.85); }
.nav-dot-red { background: #ff5a5a; box-shadow: 0 0 6px rgba(255,90,90,.95); }

main { max-width: 1100px; margin: 24px auto; padding: 0 20px 40px; }
main.narrow { max-width: 820px; }
h1 { font-size: 22px; margin: 0 0 18px; }
h1 .muted { font-size: 18px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.live-note { font-size: 12px; margin: -12px 0 16px; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head-row h1 { margin: 0; }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-tools form { margin: 0; }
.back { font-size: 14px; display: inline-block; margin-bottom: 8px; }

/* ---------- сообщения ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: #e5f5ec; color: #1f7a45; border: 1px solid #b7e3c8; }
.flash-error { background: #fbe7e7; color: #a82b2b; border: 1px solid #f0bcbc; }
.flash-info { background: #e8f0f9; color: #24538a; border: 1px solid #c4d7ee; }
.flash-warn { background: #fdf2e3; color: #8a5a17; border: 1px solid #f1d4a8; }
.flash a { color: inherit; text-decoration: underline; }

.empty { background: var(--card); padding: 30px; border-radius: 10px; text-align: center; color: var(--muted);
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- карточки и таблицы ---------- */
.card { background: var(--card); border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 18px 20px;
  margin-bottom: 18px; }
.card > h2:first-child { margin-top: 0; }
.card .card-note { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.scroll { overflow-x: auto; }

table.list {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card table.list { box-shadow: none; border-radius: 0; }
table.list th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.disabled { opacity: .55; }
table.list td.n, table.list th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.mid { vertical-align: middle; }

.name-main { font-weight: 600; }
.name-main a { color: var(--ink); }
.name-main a:hover { color: var(--accent); }
.name-kw { font-size: 12px; color: var(--muted); margin-top: 2px; }
.detail { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 520px; }
.err { font-size: 12px; color: var(--crit); margin-top: 3px; }

/* статусы — пилюли, как в Monitorus */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; color: #fff;
  background: #c2ccd6; white-space: nowrap; }
.badge.ok { background: var(--ok); }
.badge.crit { background: var(--crit); }
.badge.soon { background: var(--soon); }
.badge.muted { background: #c2ccd6; }
.badge.info { background: var(--accent); }
.badge.small { padding: 1px 8px; font-size: 12px; }

/* кнопки-значки «Управление» */
.actions { white-space: nowrap; }
.actions form { display: inline; margin: 0; }
.actions button, .actions .btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 7px; padding: 5px 9px; cursor: pointer; font-size: 14px; margin-left: 2px;
  display: inline-block; line-height: 1;
}
.actions button:hover, .actions .btn:hover { background: var(--hover); text-decoration: none; }
.actions button.danger:hover { background: #fbe7e7; border-color: #f0bcbc; }
.actions button[disabled] { opacity: .45; cursor: not-allowed; }

/* обычные кнопки */
.button, button.primary, .form button[type=submit]:not(.secondary):not(.danger) {
  background: var(--accent); color: #fff; border: none; padding: 9px 20px; border-radius: 8px; font-size: 15px;
  cursor: pointer; display: inline-block;
}
.button:hover, button.primary:hover { filter: brightness(1.07); text-decoration: none; }
.button.secondary, button.secondary, .btn.cancel {
  background: var(--hover); color: var(--ink); border: none; padding: 9px 18px; border-radius: 8px; font-size: 15px;
  cursor: pointer; display: inline-block;
}
.button.secondary:hover, button.secondary:hover, .btn.cancel:hover { background: #e2eaf3; text-decoration: none; }
button.danger, .button.danger { background: #fff; color: var(--crit); border: 1px solid #f0bcbc; padding: 8px 18px;
  border-radius: 8px; font-size: 15px; cursor: pointer; }
button.danger:hover { background: #fbe7e7; }
button[disabled], .button[disabled] { opacity: .45; cursor: not-allowed; }
.button.small, button.small { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.actions button.danger { padding: 5px 9px; font-size: 14px; color: var(--crit); border: 1px solid var(--line);
  border-radius: 7px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 18px; }
.card .row-actions { margin-bottom: 0; }
p.field-hint { margin: -4px 0 14px; }
.plan + p.field-hint { margin: 10px 0 0; }
.section-h { margin: 22px 0 12px; }
.form h2 .badge, .card h2 .badge { vertical-align: 2px; margin-left: 6px; }
.form.inline-form { padding: 0; background: none; box-shadow: none; margin: 0; }
.edit-row .form.inline-form { padding: 6px 0; }
.bottom-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.row-actions form { margin: 0; }

/* ---------- формы ---------- */
.form { background: var(--card); padding: 22px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 18px; }
.form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.form label.checkbox { font-weight: normal; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.form label.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.form input[type=text], .form input[type=password], .form input:not([type]), .form select, .form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 15px; font-weight: normal; background: #fff;
}
.form input:focus, .form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #dbe8f6; }
.form .grid3 { display: grid; grid-template-columns: 1fr 1fr 160px; gap: 0 14px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-hint { font-size: 12px; color: var(--muted); font-weight: normal; margin: 4px 0 2px; }
.form-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details.more { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 4px 0 14px; }
details.more summary { cursor: pointer; font-size: 14px; color: var(--accent); }
details.more[open] summary { margin-bottom: 10px; }

/* что произойдёт / чек-лист */
.plan { list-style: none; margin: 0; padding: 0; }
.plan li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan li:last-child { border-bottom: none; }
.plan li b { min-width: 170px; }
.checklist { margin: 0; padding-left: 18px; font-size: 14px; }
.checklist li { padding: 3px 0; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
pre.diff { margin: 8px 0 0; padding: 8px 10px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 7px;
  white-space: pre-wrap; font-size: 12px; color: var(--ink); max-height: 260px; overflow: auto; }

/* фильтры — как журнал Monitorus */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 13px; color: var(--muted); }
.filter-btn {
  font-size: 13px; padding: 4px 11px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--ink); background: #fff;
}
.filter-btn:hover { background: var(--hover); text-decoration: none; }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search { display: flex; gap: 6px; margin-left: auto; }
.search input { padding: 5px 11px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; width: 220px; }
.filters select { padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; background: #fff; }

/* журнал */
.lv { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 20px; color: #fff;
  background: #c2ccd6; }
.lv-WARNING { background: var(--soon); }
.lv-ERROR { background: var(--crit); }
.log-act { color: var(--muted); margin-right: 4px; }
.log-act::after { content: " ·"; }
.log-act.only::after { content: ""; }

/* живой ход задания */
.live { display: flex; align-items: center; gap: 10px; }
.spinner { width: 14px; height: 14px; border: 2px solid #c4d7ee; border-top-color: var(--accent); border-radius: 50%;
  animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* настройки и аккаунты */
.chat-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; font-size: 14px; }
.pw { display: flex; gap: 6px; align-items: center; }
.pw input { flex: 1; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { margin-bottom: 0; }
.inline-form input[type=text], .inline-form select { width: auto; min-width: 160px; }
tr.edit-row td { background: #f7f9fb; }

/* ---------- вход ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-wrap { width: 340px; max-width: 100%; }
.login-card { background: var(--card); padding: 30px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.login-card h1 { text-align: center; font-size: 22px; line-height: 1.2; }
.login-card h1 span { color: var(--muted); font-size: 16px; font-weight: 400; }
.login-card label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.login-card input { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 15px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #dbe8f6; }
.login-card button { width: 100%; margin-top: 6px; background: var(--accent); color: #fff; border: none;
  padding: 10px 22px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.login-error { background: #fbe7e7; color: #a82b2b; padding: 9px; border-radius: 7px; font-size: 14px;
  margin-bottom: 12px; text-align: center; }
.login-card .hint { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 14px; }
.login-card .logout-link { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; }
  .topbar .brand .sub { display: none; }
  main { padding: 0 12px 32px; margin-top: 16px; }
  .form .grid3, .form .grid2 { grid-template-columns: 1fr; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .plan li { flex-direction: column; gap: 2px; }
  dl.kv { grid-template-columns: 1fr; }
}
