/* Спокойная служебная палитра: серо-синий акцент, белые карточки, без градиентов */
:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #22272b;
  --muted: #66707a;
  --border: #d8dde2;
  --accent: #34618c;
  --accent-dark: #2a4f73;
  --ok: #2f7d4f;
  --warn: #9c6b1f;
  --err: #a63d3d;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

h1 { font-size: 24px; margin: 24px 0 12px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 6px; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.hint { color: var(--muted); font-size: 13.5px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* Шапка */
.top { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; gap: 20px; min-height: 52px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { font-weight: 650; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-sub { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: -3px; }
.mainnav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.mainnav a {
  padding: 6px 10px; border-radius: 6px; color: var(--text); white-space: nowrap;
  font-size: 14px; transition: background .15s ease;
}
.mainnav a:hover { background: var(--bg); text-decoration: none; }
.mainnav a.active { background: var(--accent); color: #fff; }
.logout { margin-left: auto; }

.foot { color: var(--muted); font-size: 13px; padding: 24px 16px 32px; }

/* Карточки */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin: 0 0 16px;
}
.cards .card { margin: 0; }

/* Сообщения */
.msg { border-radius: var(--radius); padding: 10px 14px; margin: 16px 0; border: 1px solid; animation: appear .25s ease; }
.msg-ok { background: #eef6f0; border-color: #bcd9c6; color: var(--ok); }
.msg-err { background: #f9eeee; border-color: #e0bcbc; color: var(--err); }
.msg-warn { background: #f9f3e8; border-color: #e2d2ae; color: var(--warn); }
@keyframes appear { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.tag-ok { background: #eef6f0; color: var(--ok); }
.tag-warn { background: #f9f3e8; color: var(--warn); }
.tag-err { background: #f9eeee; color: var(--err); }

/* Таблицы */
.kv { border-collapse: collapse; width: 100%; }
.kv td { padding: 4px 0; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 38%; padding-right: 12px; }

.table-scroll { overflow-x: auto; }
.list { border-collapse: collapse; width: 100%; font-size: 14px; }
.list th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.list td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.list tr:last-child td { border-bottom: none; }
.actions form { margin: 2px 0; }

/* Формы */
label { display: block; font-size: 13.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; margin-top: 3px; padding: 7px 10px; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 97, 140, .15);
}
input.slim { width: 140px; display: inline-block; padding: 3px 8px; font-size: 13px; }
.keybox { resize: vertical; }

button { font: inherit; cursor: pointer; }
button.primary, .btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 8px 18px; border-radius: 6px; transition: background .15s ease;
}
button.primary:hover, .btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
button.secondary {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 6px; transition: border-color .15s ease, background .15s ease;
}
button.secondary:hover { border-color: var(--accent); }
button.linklike { background: none; border: none; color: var(--accent); padding: 0; font-size: 14px; }
button.linklike:hover { color: var(--accent-dark); text-decoration: underline; }
button.linklike.danger { color: var(--err); }
button[disabled] { opacity: .55; cursor: default; }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.form-actions { display: flex; gap: 8px; align-items: end; }
.row-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.row-form input { flex: 1; min-width: 220px; width: auto; margin: 0; }
.inline { display: inline; }

/* Вход */
body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 28px 30px; width: 100%; max-width: 400px; animation: appear .3s ease;
}
.auth-card h1 { margin-top: 0; }

/* Редактор манифеста */
.editor-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; position: sticky; top: 58px; z-index: 5; background: var(--bg); padding: 8px 0; }
.editor-head .spacer { flex: 1; }
.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 14px; margin-bottom: 8px; }
.fieldrow .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-top: 20px; }
.check input { width: auto; margin: 0; }
.subactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.subactions .note { color: var(--muted); font-size: 12.5px; }
.cert-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; transition: border-color .15s ease; }
.cert-item:hover { border-color: #c2cad2; }
.cert-head { display: flex; align-items: baseline; gap: 10px; cursor: pointer; }
.cert-head .title { font-weight: 600; }
.cert-head .meta { color: var(--muted); font-size: 12.5px; flex: 1; }
.cert-body { margin-top: 10px; }
.collapsed .cert-body { display: none; }
pre.preview {
  background: #f7f8f9; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; overflow-x: auto; font-size: 12.5px; max-height: 480px;
}
.progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; display: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

@media (max-width: 700px) {
  h1 { font-size: 20px; }
  .card { padding: 14px; }
  .bar { gap: 10px; }
  .editor-head { top: 96px; }
}
