:root {
  --brand: #0d3b66;
  --brand-2: #1d6fb8;
  --accent: #f4a259;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #c62828;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #1f2933;
  --muted: #64748b;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
header.app {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; padding: 18px 24px; display: flex; align-items: center; gap: 14px;
}
header.app .logo { width: 42px; height: 42px; background:#fff; border-radius:50%; display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--brand); }
header.app h1 { font-size: 18px; margin: 0; }
header.app p { margin: 2px 0 0; font-size: 12.5px; opacity: .9; }
.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }

/* Stepper */
.stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 24px; }
.stepper .step {
  flex: 1 1 110px; min-width: 92px; text-align: center; padding: 8px 6px; border-radius: 8px;
  background: #e8eef5; color: var(--muted); font-size: 12px; font-weight: 600; position: relative;
}
.stepper .step .num { display:inline-flex;width:22px;height:22px;border-radius:50%;background:#cbd5e1;color:#fff;align-items:center;justify-content:center;margin-right:6px;font-size:12px; }
.stepper .step.active { background: var(--brand); color: #fff; }
.stepper .step.active .num { background: var(--accent); }
.stepper .step.done { background: #d4edda; color: var(--ok); }
.stepper .step.done .num { background: var(--ok); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 18px; color: var(--brand); }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.btn { border: none; border-radius: 8px; padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: #eef2f7; color: var(--brand); }
.btn.accent { background: var(--accent); color: #3a2a12; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-row.spread { justify-content: space-between; }

.dropzone { border: 2px dashed var(--brand-2); border-radius: 12px; padding: 40px 20px; text-align: center; background: #f0f6fc; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.drag { background: #e2eefb; }
.dropzone .big { font-size: 40px; }
.dropzone small { color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .stepper .step { flex-basis: 46%; } }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.CATALOG { background:#e3f2fd;color:#0d47a1; }
.badge.SMARTDOS { background:#ede7f6;color:#4527a0; }
.badge.AI_GENERATED,.badge.AI_ADJUSTED { background:#fff3e0;color:#e65100; }
.badge.USER_INPUT { background:#e8f5e9;color:#1b5e20; }
.badge.TEMPLATE_FIXED { background:#eceff1;color:#37474f; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin: 10px 0; border-left: 4px solid; }
.alert.err { background:#fdecea;color:var(--err);border-color:var(--err); }
.alert.warn { background:#fff8e1;color:var(--warn);border-color:var(--warn); }
.alert.ok { background:#e8f5e9;color:var(--ok);border-color:var(--ok); }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

.match { border:1px solid var(--line); border-radius:8px; padding:12px; margin-bottom:8px; display:flex; align-items:center; gap:12px; cursor:pointer; }
.match:hover { border-color: var(--brand-2); background:#f8fbff; }
.match.selected { border-color: var(--brand); background:#eef5ff; }
.match .conf { margin-left:auto; font-weight:700; }
.match .conf.high { color: var(--ok); }
.match .conf.mid { color: var(--warn); }
.match .conf.low { color: var(--err); }

table.preview { width: 100%; border-collapse: collapse; font-size: 11px; margin: 8px 0; }
table.preview th, table.preview td { border: 1px solid #b0bec5; padding: 4px 6px; vertical-align: top; }
table.preview th { background: #d9e2f3; text-align: center; }
.preview-wrap { overflow-x: auto; border:1px solid var(--line); border-radius:8px; padding:14px; background:#fff; }
.preview-doc h3 { color: var(--brand); margin: 16px 0 6px; font-size: 14px; }
.doc-header { text-align:center; border:2px solid #333; padding:8px; margin-bottom:10px; }
.doc-header .u { font-weight:800; }

.spinner { display:inline-block; width:16px;height:16px;border:3px solid #cbd5e1;border-top-color:var(--brand);border-radius:50%;animation:spin .7s linear infinite;vertical-align:middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-list { list-style:none; padding:0; margin:0; }
.progress-list li { padding:6px 0; font-size:13.5px; }
.progress-list li::before { content:"✓ "; color: var(--ok); font-weight:700; }
.progress-list li.pending::before { content:"… "; color: var(--muted); }
.hidden { display: none; }
.small { font-size: 12px; color: var(--muted); }
.kv { font-size: 13px; margin: 3px 0; }
.kv b { display:inline-block; min-width: 150px; color: var(--muted); font-weight:600; }
.editable-list .row { display:flex; gap:8px; align-items:flex-start; margin-bottom:8px; }
.editable-list .row span.code { min-width: 70px; font-weight:700; padding-top:8px; }
footer.app { text-align:center; color:var(--muted); font-size:12px; padding:20px; }
