/* ─────────────────────────────────────────────
   Base & Reset
──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f7f7f7;
  --surface:      #ffffff;
  --surface-alt:  #f4f4f4;
  --border:       #e8e8e8;
  --border-dark:  #d0d0d0;
  --text:         #1a1a1a;
  --text-muted:   #6b6b6b;
  --text-faint:   #9a9a9a;
  --accent:       #1a1a1a;
  --accent-hover: #333333;
  --danger:       #c0392b;
  --danger-light: #fdf2f2;
  --success:      #27ae60;
  --success-light:#f0faf4;
  --warning:      #e67e22;
  --warning-light:#fdf6ed;
  --radius:       8px;
  --radius-sm:    5px;
  --shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background:  var(--bg);
  color:       var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────
   Layout
──────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-img {
  display: block;
  max-width: 140px;
  max-height: 52px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.logo-text-fallback {
  display: none;
}
.sidebar-logo .logo-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav a.active {
  font-weight: 500;
  border-left: 2px solid var(--text);
}
.sidebar-nav .nav-icon { font-size: 15px; opacity: 0.7; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px 36px;
  max-width: calc(100vw - 220px);
}

/* ─────────────────────────────────────────────
   Page Header
──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-header-left h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.page-header-left p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─────────────────────────────────────────────
   Stats Grid
──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card.pending  .stat-value { color: var(--warning); }
.stat-card.completed .stat-value { color: var(--success); }
.stat-card.expired  .stat-value { color: var(--text-faint); }

/* ─────────────────────────────────────────────
   Table
──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-alt); }

/* ─────────────────────────────────────────────
   Badges / Status
──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge-pending   { background: var(--warning-light);  color: var(--warning); }
.badge-completed { background: var(--success-light);  color: var(--success); }
.badge-expired   { background: var(--surface-alt);    color: var(--text-faint); }
.badge-service   { background: var(--surface-alt);    color: var(--text-muted); font-size: 11px; }

/* ─────────────────────────────────────────────
   Buttons
──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-dark);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: #e8c4c0;
}
.btn-danger:hover { background: var(--danger-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ─────────────────────────────────────────────
   Forms
──────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
label .required { color: var(--danger); margin-left: 2px; }
label .optional  { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 4px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
textarea { resize: vertical; min-height: 90px; }

.checkbox-group, .radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checkbox-item, .radio-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.checkbox-item input, .radio-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.checkbox-item label, .radio-item label {
  margin-bottom: 0;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

/* ─────────────────────────────────────────────
   Flash Messages
──────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: var(--success-light); color: #1e6b3f; border: 1px solid #b8e6cc; }
.flash-error   { background: var(--danger-light);  color: #8b1a1a; border: 1px solid #f0c0c0; }

/* ─────────────────────────────────────────────
   Login Page
──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.login-card .subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ─────────────────────────────────────────────
   Onboarding Form
──────────────────────────────────────────── */
.onboarding-wrapper {
  min-height: 100vh;
  background: var(--bg);
  padding: 40px 20px;
}
.onboarding-container {
  max-width: 680px;
  margin: 0 auto;
}
.onboarding-header {
  text-align: center;
  margin-bottom: 36px;
}
.onboarding-header .brand {
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.onboarding-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.onboarding-header p {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Progress Steps */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 4px;
  margin-bottom: 32px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.step-indicators {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.step-indicator {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 500;
}
.step-indicator.active { color: var(--text); }
.step-indicator.done   { color: var(--success); }

/* Form Steps */
.form-step {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}
.form-step.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.step-header .step-number {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.step-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.step-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Form Navigation */
.form-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   Success / Expired Pages
──────────────────────────────────────────── */
.status-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.status-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 52px 40px;
  box-shadow: var(--shadow-md);
}
.status-icon {
  font-size: 44px;
  margin-bottom: 20px;
  display: block;
}
.status-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.status-card p {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─────────────────────────────────────────────
   Submission Detail
──────────────────────────────────────────── */
.submission-section {
  margin-bottom: 32px;
}
.submission-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.qa-item {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.qa-item:last-child { border-bottom: none; }
.qa-question { color: var(--text-muted); line-height: 1.5; }
.qa-answer   { color: var(--text); font-weight: 400; line-height: 1.5; white-space: pre-wrap; }

/* ─────────────────────────────────────────────
   URL Copy Box
──────────────────────────────────────────── */
.url-copy-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 16px 0;
}
.url-copy-box .url-text {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-copy {
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 12px;
}
.copy-success-msg {
  font-size: 12px;
  color: var(--success);
  display: none;
}

/* ─────────────────────────────────────────────
   Questions Management
──────────────────────────────────────────── */
.question-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  font-size: 13.5px;
}
.question-row:last-child { border-bottom: none; }
.question-row.inactive { opacity: 0.45; }
.question-row-text { flex: 1; }
.question-row-meta { color: var(--text-faint); font-size: 11.5px; }
.question-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─────────────────────────────────────────────
   Utilities
──────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-faint  { color: var(--text-faint); }
.text-sm     { font-size: 12.5px; }
.text-xs     { font-size: 11.5px; }
.font-mono   { font-family: 'SF Mono', 'Fira Code', monospace; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.justify-between { justify-content: space-between; }
.w-full      { width: 100%; }
.divider     { height: 1px; background: var(--border); margin: 24px 0; }

/* ─────────────────────────────────────────────
   Responsive
──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 0; overflow: hidden; }
  .main    { margin-left: 0; padding: 20px 16px; max-width: 100vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .qa-item { grid-template-columns: 1fr; gap: 4px; }
  .form-step { padding: 20px 18px; }
}
