/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8fafc; color: #1e293b; font-size: 15px; line-height: 1.5; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .5rem; }
.page-header h1 { font-size: 1.6rem; }

/* ── Nav ── */
.nav { background: #1e293b; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: .75rem 1.5rem; }
.nav-brand a { color: #fff; font-weight: 700; font-size: 1.1rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; padding: .45rem .9rem; border-radius: 6px; border: 1px solid #cbd5e1; background: #fff; color: #1e293b; cursor: pointer; font-size: .875rem; font-weight: 500; transition: background .15s; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Cards ── */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 1rem; overflow: hidden; }
.card-body { padding: 1.25rem; }
.card-actions { padding: .75rem 1.25rem; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; gap: .5rem; flex-wrap: wrap; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .3rem; font-size: .875rem; }
input[type=text], input[type=email], textarea, select {
  width: 100%; padding: .5rem .75rem; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: .9rem; font-family: inherit; background: #fff; color: #1e293b;
}
input[type=text]:focus, textarea:focus, select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
textarea { resize: vertical; }
input[type=file] { padding: .4rem; }
input[type=checkbox] { width: auto; margin-right: .3rem; }

/* ── Question builder cards ── */
.question-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 1rem; }
.question-header { display: flex; gap: .5rem; align-items: center; padding: .75rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
.question-num { font-weight: 700; color: #64748b; min-width: 2rem; }
.question-header input[type=text] { flex: 1; min-width: 180px; }
.question-header select { width: auto; }
.question-body { padding: 1rem; }
.option-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.option-row input[type=text] { flex: 1; }
.option-row select { width: auto; font-size: .8rem; }
.option-row .skip-label { font-size: .8rem; color: #64748b; white-space: nowrap; }
.action-row { display: flex; gap: .75rem; margin: 1.5rem 0; }
.section-title { font-size: .8rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }

/* ── Logic / display conditions ── */
.logic-section { border-top: 1px solid #e2e8f0; padding: .75rem 1rem; background: #fafafa; }
.condition-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; font-size: .85rem; }
.condition-row select, .condition-row input[type=text] { width: auto; font-size: .85rem; padding: .3rem .5rem; }
.condition-row span { color: #64748b; }

/* ── Survey take ── */
.survey-shell { max-width: 680px; margin: 2rem auto; padding: 1rem; }
.survey-header { margin-bottom: 2rem; }
.survey-header h1 { font-size: 1.5rem; }
.survey-question { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.survey-question h4 { margin-bottom: .75rem; font-size: 1rem; }
.option-label { display: flex; align-items: center; gap: .5rem; padding: .4rem .2rem; cursor: pointer; border-radius: 4px; }
.option-label:hover { background: #f1f5f9; }
.option-label input { width: auto; }
.survey-question textarea { min-height: 100px; }
.submit-row { margin-top: 1.5rem; }
.thank-you { text-align: center; padding: 3rem 1rem; }
.thank-you h2 { font-size: 1.8rem; margin-bottom: .5rem; }

/* ── Dashboard metrics ── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.metric-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1.25rem; text-align: center; }
.metric-card.green { border-color: #86efac; background: #f0fdf4; }
.metric-card.amber { border-color: #fcd34d; background: #fffbeb; }
.metric-card.red   { border-color: #fca5a5; background: #fef2f2; }
.metric-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.metric-label { font-size: .8rem; color: #64748b; margin-top: .25rem; }
.progress-bar-wrap { background: #e2e8f0; border-radius: 999px; height: 12px; overflow: hidden; }
.progress-bar { background: #22c55e; height: 100%; border-radius: 999px; transition: width .5s; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
.table th { background: #f8fafc; font-weight: 600; }

/* ── Misc ── */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; background: #e2e8f0; font-size: .75rem; font-weight: 500; }
.badge-red { background: #fee2e2; color: #dc2626; }
.meta { font-size: .8rem; color: #64748b; margin-top: .25rem; }
.muted { color: #94a3b8; }
.success { color: #16a34a; font-weight: 500; margin-top: .5rem; }
.error { color: #dc2626; font-weight: 500; margin-top: .5rem; }
.link { color: #2563eb; font-size: .85rem; }
.question-list { padding-left: 1.2rem; }
.question-list li { margin-bottom: .75rem; }
.question-list ul { margin-top: .25rem; color: #64748b; font-size: .875rem; }
