* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  max-width: 760px;
  margin: 24px auto;
  padding: 0 20px;
  line-height: 1.5;
}
h1 { font-size: 22px; margin-bottom: 4px; }
.subline { font-size: 13px; color: #6e6e73; margin-bottom: 18px; }

/* Tester-Banner */
.tester-banner {
  background: #f0f4ff;
  border: 1px solid #c6d4ff;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tester-banner small { color: #6e6e73; }
.tester-banner button {
  background: none;
  border: none;
  color: #007aff;
  cursor: pointer;
  font-size: 12px;
}

/* Input-Card */
.input-card {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.warn-banner {
  background: #fff8e6;
  border: 1px solid #ffd966;
  color: #7a5e00;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}
textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.input-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.submit-btn {
  background: #007aff;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-left: auto;
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Progress */
.progress-card {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d2d2d7;
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid #f0f0f0;
}
.step {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
.step:last-child { border-bottom: none; }
.step-icon { display: inline-block; width: 16px; }
.step-detail {
  margin: 6px 0 0 22px;
  font-size: 13px;
  color: #6e6e73;
  display: none;
}
.progress-card.expanded .step-detail { display: block; }
.toggle-btn {
  background: none;
  border: none;
  color: #007aff;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 8px;
}

/* Answer */
.answer-card {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.badges {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-high   { background: #d6f5d6; color: #1d6b1d; }
.badge-medium { background: #fff3cd; color: #856404; }
.badge-low    { background: #ffd6d6; color: #7a1f1f; }
.badge-strict { background: #e3eaff; color: #1f3a7a; }
.answer-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.answer-body p { margin: 0 0 12px; }
.answer-body strong { font-weight: 600; }
.answer-body h1, .answer-body h2, .answer-body h3 {
  margin-top: 16px;
  margin-bottom: 8px;
}
.answer-body code {
  background: #f5f5f7;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
.answer-body table { border-collapse: collapse; margin: 8px 0; }
.answer-body th, .answer-body td {
  border: 1px solid #d2d2d7;
  padding: 6px 10px;
  text-align: left;
}

.meta-section {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  font-size: 13px;
}
.meta-label {
  color: #6e6e73;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.citation {
  display: inline-block;
  background: #f5f5f7;
  padding: 2px 8px;
  border-radius: 4px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.feedback-section {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
.feedback-buttons {
  display: flex;
  gap: 8px;
}
.feedback-buttons button {
  padding: 6px 14px;
  border: 1px solid #d2d2d7;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.feedback-buttons button:hover {
  border-color: #007aff;
  color: #007aff;
}
.feedback-buttons button.selected {
  background: #007aff;
  color: #fff;
  border-color: #007aff;
}
.feedback-buttons button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.comment-form {
  margin-top: 10px;
}
.comment-form textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}
.comment-submit {
  background: #007aff;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.comment-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.feedback-confirmation {
  margin-top: 10px;
  padding: 8px 12px;
  background: #d6f5d6;
  color: #1d6b1d;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.disclaimer {
  padding: 12px 16px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  font-size: 12px;
  color: #6e6e73;
  line-height: 1.5;
}

/* Refusal */
.refusal-card {
  background: #fff;
  border: 1px solid #ffd6d6;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.refusal-header {
  background: #ffe8e8;
  padding: 12px 16px;
  color: #7a1f1f;
  font-weight: 500;
  font-size: 14px;
}
.refusal-body {
  padding: 16px;
  font-size: 14px;
}
.refusal-tips {
  margin: 12px 0 0 0;
  padding: 12px;
  background: #f9f9fb;
  border-radius: 6px;
  font-size: 13px;
}
.refusal-tips strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.refusal-tips ul { margin: 0; padding-left: 20px; }
.refusal-tips li { margin-bottom: 4px; }

/* Error */
.error-card {
  background: #fff;
  border: 1px solid #ffd6d6;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 16px;
}
.error-header {
  color: #7a1f1f;
  font-weight: 500;
  margin-bottom: 8px;
}
.error-body {
  font-size: 13px;
  margin-bottom: 12px;
}
#retry-btn {
  padding: 8px 18px;
  border: 1px solid #d2d2d7;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}

/* Source-aktualität */
.source-fresh { color: #1d6b1d; }
.source-stale { color: #856404; }

/* Sign-In Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 440px;
  max-width: 90%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.modal-card h2 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { margin: 0 0 16px; font-size: 13px; color: #6e6e73; }
.modal-card label {
  display: block;
  font-size: 12px;
  color: #6e6e73;
  margin: 12px 0 4px;
}
.modal-card input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.modal-card .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.modal-card .modal-actions button {
  padding: 8px 18px;
  border-radius: 6px;
  border: 1px solid #d2d2d7;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.modal-card .modal-actions button.primary {
  background: #007aff;
  color: #fff;
  border-color: #007aff;
}
.privacy-note {
  margin-top: 14px;
  padding: 10px;
  background: #fafafa;
  border-radius: 6px;
  font-size: 12px;
  color: #6e6e73;
  line-height: 1.5;
}
.privacy-note code {
  background: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* Boot-Loading + WIP-Page (Phase 1B Auth-Routing) */
.boot-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}
.wip-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 80px 24px;
}
.wip-card {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
}
.wip-card h1 { margin: 0 0 16px 0; font-size: 28px; }
.wip-card .subtitle {
  color: #6e6e73; font-size: 15px; line-height: 1.6; margin-bottom: 20px;
}
.wip-note {
  margin-top: 28px;
  padding: 12px 16px;
  background: #fafafa;
  border-radius: 8px;
  color: #6e6e73;
  font-size: 13px;
  text-align: left;
}
.wip-note.invalid-token {
  background: #fff8e6;
  border: 1px solid #ffd966;
  color: #7a5e00;
}
.wip-relogin {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e5ea;
  text-align: left;
}
.wip-relogin h3 {
  margin: 0 0 8px 0; font-size: 16px; color: #1d1d1f;
}
.wip-relogin p {
  margin: 0 0 12px 0; color: #6e6e73; font-size: 13px;
}
.wip-relogin-form {
  display: flex; gap: 8px;
}
.wip-relogin-form input[type=email] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 14px;
}
.wip-relogin-form button {
  padding: 8px 16px;
  background: #007aff;
  color: #fff;
  border: 1px solid #007aff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.wip-relogin-msg {
  margin-top: 10px;
  padding: 8px 12px;
  background: #d6f5d6;
  color: #1d6b1d;
  border-radius: 6px;
  font-size: 13px;
}
.wip-relogin-msg.error {
  background: #ffd6d6;
  color: #7a1f1f;
}

/* Gesetzes-Filter (collapsible) */
.laws-filter {
  margin-top: 10px;
  border-top: 1px solid #e5e5ea;
  padding-top: 10px;
  font-size: 13px;
}
.laws-filter summary {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1d1d1f;
  list-style: none;
}
.laws-filter summary::-webkit-details-marker { display: none; }
.laws-filter summary::before {
  content: '▶';
  font-size: 11px;
  color: #6e6e73;
  transition: transform 0.15s;
}
.laws-filter[open] summary::before { transform: rotate(90deg); }
.laws-filter-label { font-weight: 500; }
.laws-filter-count {
  margin-left: auto;
  color: #6e6e73;
  font-size: 12px;
  background: #f5f5f7;
  padding: 2px 8px;
  border-radius: 4px;
}
.laws-filter-master {
  margin-top: 10px;
  padding: 8px 10px;
  background: #f0f7ff;
  border: 1px solid #cfe4ff;
  border-radius: 6px;
}
.laws-filter-master label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.laws-filter-master small { color: #6e6e73; }
.laws-filter-groups {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.laws-group {
  border: 1px solid #e5e5ea;
  border-radius: 6px;
  padding: 8px 10px;
}
.laws-group-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6e6e73;
  font-weight: 600;
  margin-bottom: 6px;
}
.laws-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.laws-group-items label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
}
.laws-group-items label[title] { cursor: help; }

/* Premium-Stack-Warnung neben Dropdown — sichtbar bei premium-Auswahl */
.stack-warning {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff8e6;
  border: 1px solid #ffd966;
  color: #7a5e00;
  border-radius: 5px;
  font-size: 12px;
}

/* Beta-Banner ganz oben — sichtbar wenn WEB_DEBUG_PLAINTEXT=true */
.beta-banner {
  background: #ffe6e6;
  border: 1px solid #ff6b6b;
  color: #7a1f1f;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin: 12px 0 14px 0;
  font-weight: 500;
}

/* Sign-In-Modal: Debug-Hinweis (dynamisch je nach Mode) */
.debug-note {
  margin-top: 10px;
  padding: 10px;
  background: #ffe6e6;
  border: 1px solid #ff6b6b;
  border-radius: 6px;
  font-size: 12px;
  color: #7a1f1f;
  line-height: 1.5;
}
.debug-note code {
  background: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
