* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #1a1a1a;
  background: #f5f5f7;
  min-height: 100vh;
}
.app-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  min-height: 100vh;
}
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header { text-align: center; padding: 16px 0 24px; }
.header h1 { font-size: 20px; font-weight: 600; }
.header .subtitle { font-size: 13px; color: #6b6b6b; margin-top: 4px; }

.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; background: #fff; border-radius: 12px; margin-bottom: 16px;
}
.admin-header h1 { font-size: 18px; }
.admin-user { font-size: 13px; color: #6b6b6b; }

/* Progress */
.progress-container {
  background: #fff; border-radius: 12px; padding: 16px 20px;
  margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.progress-info {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #6b6b6b; margin-bottom: 8px;
}
.progress-bar { height: 6px; background: #e5e5e7; border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #007aff, #5856d6);
  transition: width 0.3s ease;
}

/* Cards */
.question-card {
  background: #fff; border-radius: 16px; padding: 28px 24px;
  margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.question-section-label {
  font-size: 11px; font-weight: 600; color: #007aff;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.question-title {
  font-size: 22px; font-weight: 600; line-height: 1.3; margin-bottom: 8px;
}
.question-hint {
  font-size: 14px; color: #6b6b6b; line-height: 1.5; margin-bottom: 20px;
}

/* Inputs */
.input-group { margin-bottom: 16px; }
.input-label {
  font-size: 13px; font-weight: 500; color: #444;
  margin-bottom: 6px; display: block;
}
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="month"],
select, textarea {
  width: 100%; padding: 14px 16px; font-size: 16px;
  border: 1.5px solid #e5e5e7; border-radius: 12px;
  background: #fff; color: #1a1a1a;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #007aff;
}
textarea {
  resize: vertical; min-height: 100px; font-family: inherit;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Radio / Check */
.radio-group, .check-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .check-option {
  display: flex; align-items: center;
  padding: 14px 16px; border: 1.5px solid #e5e5e7; border-radius: 12px;
  background: #fff; cursor: pointer; font-size: 16px;
  transition: all 0.15s;
}
.radio-option:hover, .check-option:hover { border-color: #007aff; background: #f5faff; }
.radio-option.selected, .check-option.selected { border-color: #007aff; background: #f0f7ff; }
.radio-option input, .check-option input { margin-right: 12px; accent-color: #007aff; }

/* Buttons */
.button-row { display: flex; gap: 12px; margin-top: 8px; }
.btn {
  flex: 1; padding: 16px 20px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary { background: #007aff; color: #fff; }
.btn-primary:hover { background: #0066d6; }
.btn-primary:disabled { background: #b8d4f0; cursor: not-allowed; }
.btn-secondary { background: #f0f0f3; color: #1a1a1a; }
.btn-secondary:hover { background: #e5e5e7; }
.btn-skip { background: transparent; color: #6b6b6b; font-weight: 500; }
.btn-skip:hover { color: #1a1a1a; }

/* Entries */
.entry-list { margin-bottom: 16px; }
.entry-item {
  background: #f9f9fb; border: 1px solid #e5e5e7; border-radius: 12px;
  padding: 16px; margin-bottom: 12px; position: relative;
}
.entry-item-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.entry-item-title { font-size: 14px; font-weight: 600; color: #444; }
.entry-remove {
  background: transparent; border: none; color: #ff3b30;
  font-size: 13px; cursor: pointer; padding: 4px 8px;
}
.entry-add {
  width: 100%; padding: 14px;
  border: 2px dashed #c0c0c5; background: transparent; border-radius: 12px;
  color: #6b6b6b; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.entry-add:hover { border-color: #007aff; color: #007aff; }
.entry-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 12px;
}
.entry-row-full { grid-column: 1 / -1; }

/* Photo */
.photo-upload-area {
  border: 2px dashed #c0c0c5; border-radius: 16px;
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.photo-upload-area:hover { border-color: #007aff; background: #f5faff; }
.photo-preview {
  width: 148px; height: 185px; margin: 16px auto;
  border: 1px solid #e5e5e7; border-radius: 8px;
  object-fit: contain; background: #fff; display: block;
}
.photo-upload-area input[type="file"] { display: none; }

/* Messages */
.message {
  padding: 14px 16px; border-radius: 12px;
  margin-bottom: 16px; font-size: 14px;
}
.message-info { background: #e8f4ff; color: #003d80; }
.message-success { background: #e8f8ee; color: #00674a; }
.message-error { background: #fef0f0; color: #a02020; }
.message-warning { background: #fff8e6; color: #6b4400; }

/* Spinner */
.spinner {
  border: 3px solid #e5e5e7; border-top-color: #007aff;
  border-radius: 50%; width: 20px; height: 20px;
  animation: spin 0.8s linear infinite;
  display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Email input mode */
.email-input-mode { margin-top: 40px; text-align: center; }
.email-input-mode .hero-title { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.email-input-mode .hero-subtitle { font-size: 16px; color: #6b6b6b; margin-bottom: 32px; }

/* Done page */
.done-page { text-align: center; padding: 60px 20px; }
.done-icon { font-size: 72px; margin-bottom: 24px; }
.done-title { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.done-message { font-size: 16px; color: #6b6b6b; margin-bottom: 32px; line-height: 1.6; }
.download-link {
  display: block; padding: 16px; margin-bottom: 12px;
  background: #007aff; color: #fff; text-decoration: none;
  border-radius: 12px; font-weight: 600;
}
.download-link.secondary { background: #f0f0f3; color: #1a1a1a; }

/* Admin table */
.admin-toolbar {
  background: #fff; padding: 16px 20px; border-radius: 12px;
  margin-bottom: 16px; display: flex; gap: 12px;
  flex-wrap: wrap; align-items: center;
}
.search-input { flex: 1; min-width: 200px; }
table {
  width: 100%; background: #fff; border-radius: 12px;
  overflow: hidden; border-collapse: collapse;
}
th, td {
  padding: 12px 16px; text-align: left; font-size: 14px;
  border-bottom: 1px solid #f0f0f3;
}
th {
  background: #f9f9fb; font-weight: 600;
  font-size: 12px; text-transform: uppercase; color: #6b6b6b;
}
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: #f9f9fb; cursor: pointer; }
.status-badge { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.status-draft { background: #fff8e6; color: #6b4400; }
.status-submitted { background: #e8f8ee; color: #00674a; }
.status-archived { background: #f0f0f3; color: #6b6b6b; }
.status-generation_failed { background: #fef0f0; color: #a02020; }

.detail-grid {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 8px 24px; padding: 16px 0;
}
.detail-label { font-size: 13px; color: #6b6b6b; padding: 6px 0; }
.detail-value { font-size: 14px; padding: 6px 0; word-break: break-word; }
.detail-section {
  background: #fff; padding: 20px 24px;
  border-radius: 12px; margin-bottom: 16px;
}
.detail-section h3 {
  font-size: 15px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid #f0f0f3;
}
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-box {
  width: 148px; height: 185px;
  border: 1px solid #e5e5e7; border-radius: 8px;
  background: #f9f9fb;
  display: flex; align-items: center; justify-content: center;
  color: #6b6b6b; font-size: 13px;
}
.photo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.hidden { display: none !important; }
