*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark: #0c2d4f;
  --blue-mid: #2d4a6e;
  --blue-light: #5a7a96;
  --blue-pale: #7a9bb5;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --border: #d0dcea;
  --border-light: #e0e8f0;
  --green: #2d8a4e;
  --green-bg: #d4edda;
  --text: #0c2d4f;
  --text-muted: #5a7a96;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }

/* ── ШАПКА ── */
.header { background: var(--blue-dark); color: #fff; padding: 14px 32px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 100; }
.header-logo { font-size: 17px; font-weight: 700; }
.header-sub { font-size: 12px; opacity: 0.65; margin-top: 2px; }
.header-badge { margin-left: auto; background: rgba(255,255,255,0.12); border-radius: 20px; padding: 4px 14px; font-size: 11px; }

/* ── РАЗМЕТКА ── */
.layout { display: flex; min-height: calc(100vh - 52px); }

/* ── САЙДБАР ── */
.sidebar { width: 240px; background: var(--bg-card); border-right: 1px solid var(--border-light); padding: 28px 0; flex-shrink: 0; }
.steps-label { font-size: 10px; font-weight: 700; color: var(--blue-pale); text-transform: uppercase; letter-spacing: 1px; padding: 0 20px 14px; }
.step { display: flex; align-items: flex-start; gap: 12px; padding: 10px 20px; cursor: pointer; transition: background .15s; }
.step:hover { background: #f5f8fa; }
.step.active { background: #e8f0f7; }
.step.inactive { opacity: .55; cursor: default; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--border-light); color: var(--blue-pale); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.step.done .step-num { background: var(--green); color: #fff; }
.step.active .step-num { background: var(--blue-dark); color: #fff; }
.step-title { font-size: 12px; font-weight: 600; color: var(--text); }
.step.inactive .step-title { color: var(--blue-pale); }
.step-desc { font-size: 10px; color: var(--blue-pale); margin-top: 2px; }
.sidebar-divider { border: none; border-top: 1px solid var(--border-light); margin: 12px 20px; }

/* ── ОСНОВНАЯ ОБЛАСТЬ ── */
.main { flex: 1; padding: 36px 44px; overflow-y: auto; max-width: 900px; }
.screen { display: none; }
.screen.active { display: block; }
.page-title { font-size: 20px; font-weight: 700; color: var(--blue-dark); margin-bottom: 4px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ── КАРТОЧКИ ── */
.card { background: var(--bg-card); border-radius: 12px; padding: 24px; box-shadow: 0 1px 4px rgba(12,45,79,.07); margin-bottom: 18px; }
.card-title { font-size: 11px; font-weight: 700; color: var(--blue-dark); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 16px; }

/* ── КНОПКИ ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; font-family: inherit; }
.btn-primary { background: var(--blue-dark); color: #fff; }
.btn-primary:hover { background: var(--blue-mid); }
.btn-secondary { background: var(--border-light); color: var(--blue-dark); }
.btn-secondary:hover { background: #d0dcea; }
.btn-outline { background: transparent; color: var(--blue-dark); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--blue-mid); background: #f5f8fa; }
.btn-danger { background: #fde8e8; color: #c0392b; }
.btn-danger:hover { background: #f5c6c6; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #247a42; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-group { display: flex; gap: 10px; margin-top: 24px; }

/* ── ПОЛЯ ФОРМЫ ── */
.field { margin-bottom: 16px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--blue-mid); margin-bottom: 6px; display: block; }
.field-required::after { content: ' *'; color: #c0392b; }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 7px;
  padding: 9px 12px; font-size: 13px; color: var(--text);
  font-family: inherit; background: #fff; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue-dark); }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11px; color: var(--blue-pale); margin-top: 4px; }
.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── S1: ВЫБОР ТИПА ── */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.type-card { border: 2px solid var(--border-light); border-radius: 10px; padding: 18px; cursor: pointer; transition: all .15s; position: relative; }
.type-card:hover:not(.locked) { border-color: var(--blue-mid); }
.type-card.selected { border-color: var(--blue-dark); background: #f0f4f8; }
.type-card.selected::after { content: '✓'; position: absolute; top: 10px; right: 12px; background: var(--blue-dark); color: #fff; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.type-card.locked { opacity: .4; cursor: not-allowed; }
.locked-badge { position: absolute; top: 10px; right: 12px; background: var(--border-light); color: var(--blue-pale); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.npd-badge { display: inline-block; background: var(--green-bg); color: var(--green); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-bottom: 8px; }
.type-icon { font-size: 22px; margin-bottom: 8px; }
.type-name { font-size: 13px; font-weight: 700; color: var(--blue-dark); margin-bottom: 4px; }
.type-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.type-docs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.doc-chip { background: #e8f0f7; color: var(--blue-mid); font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }

/* ── S3: ПАКЕТЫ ── */
.pkg-tabs { display: flex; border-bottom: 2px solid var(--border-light); margin-bottom: 18px; }
.pkg-tab { padding: 8px 18px; font-size: 12px; font-weight: 600; color: var(--blue-pale); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.pkg-tab.active { color: var(--blue-dark); border-bottom-color: var(--blue-dark); }
.pkg-pane { display: none; }
.pkg-pane.active { display: block; }
.packages-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pkg-card { border: 2px solid var(--border-light); border-radius: 10px; padding: 14px; cursor: pointer; transition: all .15s; }
.pkg-card:hover { border-color: var(--blue-mid); background: #f8fafc; }
.pkg-card.selected { border-color: var(--blue-dark); background: #f0f4f8; }
.pkg-num { font-size: 10px; font-weight: 700; color: var(--blue-pale); margin-bottom: 5px; }
.pkg-name { font-size: 12px; font-weight: 600; color: var(--blue-dark); margin-bottom: 5px; line-height: 1.3; }
.pkg-price { font-size: 13px; font-weight: 700; color: var(--blue-mid); }
.pkg-price span { font-size: 10px; font-weight: 400; color: var(--blue-pale); }
.items-list { list-style: none; }
.items-list li { padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 12px; color: var(--text); display: flex; align-items: flex-start; gap: 8px; }
.items-list li:last-child { border-bottom: none; }
.items-list li::before { content: '—'; color: var(--blue-pale); flex-shrink: 0; }
.item-add-row { display: flex; gap: 8px; margin-top: 10px; }
.item-add-row input { flex: 1; }

/* ── S5: ПРЕДПРОСМОТР ── */
.preview-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-light); margin-bottom: 20px; }
.preview-tab { padding: 8px 18px; font-size: 12px; font-weight: 600; color: var(--blue-pale); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.preview-tab.active { color: var(--blue-dark); border-bottom-color: var(--blue-dark); }
.preview-doc { display: none; }
.preview-doc.active { display: block; }
.preview-content { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; padding: 32px 40px; font-family: 'Times New Roman', serif; font-size: 13px; line-height: 1.7; color: #111; max-height: 520px; overflow-y: auto; }
.preview-content h1 { font-size: 14px; text-align: center; margin-bottom: 16px; }
.preview-content h2 { font-size: 13px; margin: 16px 0 8px; }
.preview-content p { text-indent: 1.5em; margin-bottom: 8px; }
.preview-content .no-indent { text-indent: 0; }
.tag-placeholder { background: #fff3cd; border-radius: 3px; padding: 0 3px; color: #856404; font-style: normal; }

/* ── S6: СКАЧАТЬ ── */
.download-pkg { text-align: center; padding: 32px; }
.download-icon { font-size: 48px; margin-bottom: 16px; }
.download-title { font-size: 18px; font-weight: 700; color: var(--blue-dark); margin-bottom: 8px; }
.download-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.download-files { display: flex; flex-direction: column; gap: 10px; max-width: 400px; margin: 0 auto 24px; text-align: left; }
.download-file { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 8px; padding: 10px 14px; font-size: 12px; }
.download-file-icon { font-size: 20px; }

/* ── S7: РЕЕСТР ── */
.registry-toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.registry-toolbar input { border: 1.5px solid var(--border); border-radius: 7px; padding: 8px 12px; font-size: 12px; color: var(--text); font-family: inherit; width: 200px; }
.registry-table-wrap { border: 1px solid var(--border-light); border-radius: 8px; overflow: auto; }
.registry-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.registry-table th { background: #f5f8fa; padding: 10px 12px; text-align: left; font-weight: 700; color: var(--blue-mid); border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.registry-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); color: var(--text); }
.registry-table tr:last-child td { border-bottom: none; }
.registry-table tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.badge-npd { background: var(--green-bg); color: var(--green); }
.badge-ip { background: #e8f0f7; color: var(--blue-mid); }
.badge-org { background: #f0e8f7; color: #6a3d9a; }
.badge-framework { background: #fff3cd; color: #856404; }
.badge-oneshot { background: #fde8e8; color: #c0392b; }
.registry-empty { text-align: center; padding: 40px; color: var(--blue-pale); font-size: 13px; }
.danger-zone { border: 1.5px solid #f5c6c6; border-radius: 10px; padding: 16px 20px; background: #fff8f8; margin-top: 24px; }
.danger-zone-title { font-size: 11px; font-weight: 700; color: #c0392b; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px; }
.danger-zone-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── S8: ЧАТ ── */
.chat-wrap { display: flex; flex-direction: column; height: 520px; background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-light); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; }
.chat-msg.user { background: var(--blue-dark); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.assistant { background: var(--border-light); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg.system { background: #fff3cd; color: #856404; align-self: center; font-size: 11px; border-radius: 8px; text-align: center; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border-light); background: #f8fafc; }
.chat-input-row textarea { flex: 1; border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px; font-family: inherit; resize: none; height: 44px; color: var(--text); }
.chat-input-row textarea:focus { outline: none; border-color: var(--blue-dark); }
.chat-disclaimer { font-size: 11px; color: var(--blue-pale); padding: 6px 16px; background: #fffbf0; border-top: 1px solid #fdedc0; text-align: center; }
.chat-typing { display: none; align-items: center; gap: 8px; padding: 10px 14px; background: var(--border-light); border-radius: 12px; max-width: 120px; border-bottom-left-radius: 4px; }
.chat-typing.visible { display: flex; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-pale); animation: bounce .8s infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

/* ── УТИЛИТЫ ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 12px; margin-bottom: 14px; }
.alert-info { background: #e8f0f7; color: var(--blue-mid); }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-success { background: var(--green-bg); color: var(--green); }
.divider { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
