:root {
  --accent: #2E7D32;
  --accent-2: #7CB342;
  --grad: linear-gradient(135deg, #7CB342, #2E7D32);
  --bg: #f6f8f7;
  --card: #ffffff;
  --line: #e3ebe5;
  --text: #152018;
  --muted: #6b7a70;
  --danger: #c62828;
  --warn: #b26a00;
  --ok: #2E7D32;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.brand b { color: var(--accent); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
}

.userbox { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--muted); font-size: 14px; }

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 34px 22px 70px;
}

.hero { padding: 12px 0 22px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 { margin: 0 0 10px; font-size: clamp(26px, 4vw, 38px); line-height: 1.1; }
h2 { margin: 32px 0 14px; font-size: 20px; }
.lead { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.55; }
.section-note { margin: -4px 0 16px; color: var(--muted); font-size: 14px; }
.section-note a { color: var(--accent); font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 54, 26, .05);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card h3 { margin: 0; font-size: 18px; }
.card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #eef3ef;
  color: var(--muted);
}
.badge.ok { background: #E8F5E9; color: var(--ok); }
.badge.warn { background: #fff4e5; color: var(--warn); }
.badge.off { background: #fdecea; color: var(--danger); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 12px;
  font-size: 13.5px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 700; color: #33443a; }
input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #dfe6e1;
  border-radius: 11px;
  background: #fbfcfb;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus { outline: none; border-color: var(--accent); background: #fff; }
.field { margin-bottom: 12px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }

.btn {
  border: 0;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(46, 125, 50, .22); }
.btn-secondary { background: #E8F5E9; color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-small { padding: 7px 10px; font-size: 12.5px; }

.alert {
  margin: 8px 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecea;
  color: var(--danger);
  font-size: 14px;
}
.alert.ok { background: #E8F5E9; color: var(--ok); }
.hidden { display: none !important; }

.code {
  margin: 0 0 12px;
  padding: 16px;
  overflow-x: auto;
  background: #0f1b13;
  color: #d7ead9;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.55;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 32px 0 12px;
}
.section-head h2 { margin: 0; }

.section-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.switch input { width: auto; margin: 0; accent-color: var(--accent); }

.card-head { align-items: flex-start; }
.card-head h3 { overflow-wrap: anywhere; }

.card-chev { margin-top: 7px; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.card .template-line { margin: 0; font-size: 12.5px; color: var(--muted); }
.card .template-line b { color: #33443a; }

.card-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.tmpl-card { height: 100%; min-height: 168px; }
.tmpl-card .actions { margin-top: auto; }

.card-clickable {
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.card-clickable:hover,
.card-clickable:focus-visible {
  border-color: #b7dfba;
  box-shadow: 0 12px 28px rgba(20, 54, 26, .1);
  transform: translateY(-1px);
  outline: none;
}
.card-archived { opacity: .75; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: #fdecea; color: var(--danger); }
.icon-btn:focus-visible { outline: 2px solid #f3b8b2; outline-offset: 1px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 15px;
  border-radius: 12px;
  background: #152018;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  font-size: 14px;
  z-index: 30;
}

@media (max-width: 620px) {
  .topbar { padding: 12px 14px; }
  .user-name { display: none; }
  .page { padding: 24px 14px 60px; }
  .card { padding: 17px; }
}
.config-fields { display:grid; gap:10px; margin-top:12px; }


.url-row code { word-break: break-all; }

/* Свёрнутый раздел шаблонов CMCPT */
.collapsible { margin: 32px 0 0; }

.collapsible > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 20px;
  background: var(--card);
  border: 1px solid #dce9de;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 54, 26, .05);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background .15s ease, border-color .15s ease;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::marker { content: ""; }
.collapsible > summary:hover { border-color: #b7dfba; }
.collapsible > summary:focus-visible {
  outline: 2px solid #b7dfba;
  outline-offset: 2px;
}
.collapsible[open] > summary {
  background: #f1f7f2;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.summary-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.summary-count { margin-left: auto; }

.chev {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .18s ease;
}
.collapsible[open] .chev { transform: rotate(-135deg); }

.chev-circle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef3ef;
  transition: background .15s ease;
}
.collapsible[open] .chev-circle { background: var(--card); }

.collapsible-body {
  padding: 20px;
  border: 1px solid #dce9de;
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fbfcfb;
}
.collapsible-body .section-note { margin-top: 0; }
.collapsible-body .hint:empty { display: none; }
