/* ===== Design tokens ===== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-alt: #fafbfd;
  --border: #e4e7ef;
  --text: #1b2133;
  --text-muted: #6b7388;
  --primary: #2b5cff;
  --primary-hover: #1f4be8;
  --primary-bg: #eaf0ff;
  --success: #12a26b;
  --warning: #d98b00;
  --danger: #e0363f;
  --shadow: 0 2px 6px rgba(27, 33, 51, 0.06), 0 1px 2px rgba(27, 33, 51, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "Noto Sans Gujarati", "Shruti", "Nirmala UI", system-ui, -apple-system,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 32px; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.brand .sub { margin: 0; color: var(--text-muted); font-size: 13px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Steps bar ===== */
.steps {
  display: flex;
  gap: 6px;
  margin: 20px 0 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.steps::-webkit-scrollbar { height: 4px; }
.steps::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.step-pill {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.step-pill:hover { border-color: var(--primary); color: var(--primary); }
.step-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.step-pill.done::before { content: "✓ "; }

/* ===== Step sections ===== */
.step {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.15s;
}
.step.active { display: block; }
.step h2 { margin: 0 0 4px; font-size: 20px; }
.step .hint { margin: 0 0 18px; color: var(--text-muted); font-size: 13px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.app-main { padding: 20px 0 80px; }

/* ===== Form fields ===== */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.field input[type="text"],
.field textarea,
.field select {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}
.field input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary);
  margin-right: 8px;
}
.field.checkbox {
  flex-direction: row;
  align-items: center;
  grid-column: 1 / -1;
}

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-hover); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 28px; font-size: 16px; font-weight: 600; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Repeatable lists ===== */
.list-block {
  margin: 16px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-header {
  background: var(--surface-alt);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
}
.list-rows { padding: 8px 10px; }
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.list-row-fields .field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.list-row-fields .field input,
.list-row-fields .field textarea {
  font-size: 13px;
  padding: 6px 8px;
}
.row-del {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.row-del:hover { background: #fde8ea; }

/* ===== Documents grid ===== */
.doc-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.pdf-toggle {
  margin-left: auto;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.pdf-toggle input { accent-color: var(--primary); }
.doc-category { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.doc-item:hover { border-color: var(--primary); }
.doc-item input { margin-top: 4px; accent-color: var(--primary); }
.doc-item-title { font-weight: 500; font-size: 14px; }
.doc-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.doc-item.checked { background: var(--primary-bg); border-color: var(--primary); }

/* ===== Step nav ===== */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.step-label { font-size: 14px; color: var(--text-muted); }

/* ===== Summary ===== */
.summary-grid { display: grid; gap: 10px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-radius: 6px;
  font-size: 14px;
}
.summary-row strong { color: var(--primary); }
.big-action {
  margin-top: 24px;
  padding: 24px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  text-align: center;
}
.gen-status {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.gen-status a {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--success);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}
.gen-status a:hover { background: #0e8958; }

/* ===== Footer ===== */
.app-footer {
  margin-top: 30px;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.app-footer code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ===== Mobile ===== */
@media (max-width: 600px) {
  .app-header .wrap { flex-direction: column; align-items: stretch; }
  .brand h1 { font-size: 18px; }
  .step { padding: 16px 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .list-row { grid-template-columns: 1fr; }
  .row-del { justify-self: end; }
  .step-nav { flex-direction: row; gap: 8px; }
  .btn.big { width: 100%; }
}

.small-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
  font-style: italic;
}
