:root{
  --bg: #f3f4f6;
  --bg-elevated: #fafafa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow: 0 22px 55px rgba(15, 23, 42, 0.08);
  --shadow-tile: 0 1px 0 rgba(255,255,255,0.9) inset, 0 18px 40px rgba(15, 23, 42, 0.06);

  --brand: #0f172a;
  --brand-2: #1e293b;
  --accent: #b08d57;
  --accent-soft: rgba(176, 141, 87, 0.14);

  --info-bg: #e8f4fc;
  --info-br: #b6e0f7;
  --error-bg:#fef2f2;
  --error-br:#fecaca;
  --success-bg:#ecfdf5;
  --success-br:#86efac;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;

  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;

  --container: 1040px;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Literata", "Georgia", "Times New Roman", serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(ellipse 900px 480px at 12% -8%, rgba(176, 141, 87, 0.09), transparent 55%),
    radial-gradient(ellipse 800px 500px at 92% 0%, rgba(15, 23, 42, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 45%, #eef1f5 100%);
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; }

h1, h2, h3{
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h1{ font-size: clamp(1.55rem, 2.4vw, 2rem); margin: 0 0 12px; }
h2{ font-size: 1.25rem; margin: 0 0 10px; }
h3{ font-size: 1.05rem; margin: 0 0 8px; }

.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 18px 72px;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.topbar-inner{
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  text-decoration:none;
  color: inherit;
}
.brand-mark{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.brand-mark img{ width: 100%; height: 100%; object-fit: cover; }
.brand-title{
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-size: 1.15rem;
}
.brand-sub{
  display:block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}
.nav{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items:center;
  justify-content:flex-end;
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 28px);
  box-shadow: var(--shadow);
}

.row{
  display:flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.hint{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.kicker{
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}

.lead{
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 52ch;
  line-height: 1.55;
}

.page-intro{
  margin-bottom: 22px;
}

.info,.error,.success{
  padding: 14px 16px;
  border-radius: var(--r-sm);
  margin: 14px 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
}
.info{ background: var(--info-bg); border: 1px solid var(--info-br); color: #0c4a6e; }
.error{ background: var(--error-bg); border: 1px solid var(--error-br); color: #991b1b; }
.success{ background: var(--success-bg); border: 1px solid var(--success-br); color: #14532d; }

label{
  display:block;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
input,select,textarea{
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  min-width: 220px;
  outline: none;
  background: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus,select:focus,textarea:focus{
  border-color: rgba(176, 141, 87, 0.65);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button, .btn{
  padding: 11px 18px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
button{
  border: 0;
  background: linear-gradient(165deg, var(--brand-2) 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}
button:hover, .btn:hover{ transform: translateY(-1px); }
button.secondary{
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.btn{
  background: linear-gradient(165deg, var(--brand-2) 0%, var(--brand) 100%);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}
.btn.secondary{
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn.ghost{
  background: transparent;
  color: var(--text);
  border-color: transparent;
  box-shadow: none;
  font-weight: 500;
  padding-inline: 12px;
}
.btn.ghost:hover{
  background: rgba(15, 23, 42, 0.05);
  border-color: transparent;
}
.btn:focus, button:focus{
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 22px rgba(15, 23, 42, 0.15);
}

hr{
  border:0;
  border-top: 1px solid var(--border);
  margin: 22px 0;
}

.hero{
  display:grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items:center;
  margin: 16px 0 22px;
}
@media (min-width: 900px){
  .hero{ grid-template-columns: 1.15fr 0.85fr; }
}
.img{
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  object-fit: cover;
}

/* Modal */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-backdrop.open{ display: flex; }
.modal{
  width: min(860px, 100%);
  max-height: min(85vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: 0 28px 80px rgba(0,0,0,0.28);
}
.modal-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
}
.modal-title{
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}
.modal-body{ padding: 18px; }
.modal-close{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

/* Wizard — editorial stepper */
.wizard{
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px 0;
  margin: 0 0 20px;
  background: var(--surface);
  box-shadow: var(--shadow-tile);
}
.wizard-top{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
}
.wizard-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.wizard-actions .btn.secondary{
  font-weight: 600;
}
.wizard-actions .btn:not(.secondary){
  background: linear-gradient(165deg, #334155 0%, var(--brand) 100%);
}
.wizard .hint{
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted-2);
}
.wizard-steps{
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-top: 1px solid var(--border);
  margin: 0 -18px;
  padding: 0 6px;
}
.wstep{
  flex: 0 0 auto;
  font-size: 13px;
  padding: 12px 14px 14px;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.wstep:hover{
  color: var(--text);
  background: rgba(15, 23, 42, 0.03);
}
.wstep.done{
  color: var(--muted-2);
}
.wstep.active{
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--accent);
  background: transparent;
}

.row[style*="align-items:center"] button{ align-self: center; }

.grid{
  display:grid;
  gap: 14px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 640px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px){
  .grid.grid--3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tile{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 44px 18px 18px;
  text-decoration:none;
  box-shadow: var(--shadow-tile);
  display:block;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.tile::after{
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
  transform: translateY(-50%) rotate(-45deg);
  opacity: 0.55;
  transition: border-color 0.18s ease, opacity 0.18s ease;
}
.tile:hover{
  border-color: rgba(176, 141, 87, 0.45);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}
.tile:hover::after{
  border-color: var(--accent);
  opacity: 1;
}
.tile-title{
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-size: 1.02rem;
}
.tile-desc{
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.tile--compact{
  padding: 14px 40px 14px 16px;
}
.tile--compact .tile-title{
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.tile--compact .tile-desc{
  font-size: 12px;
}

.section-label{
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 8px 0 12px;
}

.doc-item{
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin: 12px 0;
  background: #fff;
}
.doc-actions{
  margin-top: 10px;
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.prose{
  max-width: 68ch;
}
.prose p{
  margin: 0 0 12px;
}

/* Вторичные панели, предупреждения, списки админки */
.surface-panel{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}
.admin-row{
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin: 12px 0;
  background: var(--surface);
}
.notice-warn{
  border-left: 3px solid #b45309;
  padding: 12px 14px;
  margin: 12px 0;
  background: rgba(180, 83, 9, 0.08);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.table-simple-wrap{
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin: 12px 0;
}
table.table-simple{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.table-simple th{
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-strong);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
table.table-simple td{
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.table-simple tr:last-child td{
  border-bottom: none;
}
.status-ok{
  font-weight: 700;
  color: #15803d;
}
.code-block{
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.45;
}
.stack-links a{
  display: block;
  margin: 8px 0;
  font-weight: 600;
  text-decoration: none;
  color: var(--brand-2);
}
.stack-links a:hover{
  text-decoration: underline;
  text-underline-offset: 3px;
}
