* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}
.brand { font-weight: 700; font-size: 18px; }
.user-menu { display: flex; gap: 12px; align-items: center; }
.user-menu button { background: none; border: 1px solid #d0d0d0; padding: 6px 12px; border-radius: 6px; cursor: pointer; }

.screen { padding: 0; max-width: none; margin: 0; }
.card {
  max-width: 400px;
  margin: 80px auto;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.card h1 { margin: 0 0 8px; }
.lede { color: #666; margin-bottom: 24px; }
.card input { display: block; width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid #d0d0d0; border-radius: 6px; font-size: 14px; }

.btn-primary {
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #333; }

.error { color: #c00; margin-top: 8px; }
.empty { color: #888; text-align: center; margin-top: 40px; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.brand-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  cursor: pointer;
  transition: border-color 0.15s;
}
.brand-card:hover { border-color: #1a1a1a; }
.brand-card h3 { margin: 0 0 4px; }
.brand-card .meta { color: #888; font-size: 12px; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e5e5;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Brand Lock --- */
.btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d0d0;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: #1a1a1a; }

.btn-link {
  background: none;
  border: none;
  color: #1a1a1a;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}
.btn-link:hover { color: #555; }

.brand-lock-card {
  max-width: 640px;
  margin: 0 auto 24px;
}
.brand-lock-card label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin: 12px 0 4px;
}
.brand-lock-card input {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
}
.brand-lock-card .help { color: #888; font-size: 12px; margin: 4px 0 12px; }
.brand-lock-card .warn {
  background: #fff7e6;
  border: 1px solid #f0c674;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 12px 0;
  color: #6b4a00;
  font-size: 13px;
}

.phase-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.phase-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #f4f4f4;
  font-size: 14px;
}
.phase-row .phase-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}
.phase-row.phase-done { background: #eef7ee; color: #2a6e2a; }
.phase-row.phase-done .phase-dot { background: #2a6e2a; }
.phase-row.phase-active { background: #eef3fa; color: #1f4d8a; font-weight: 600; }
.phase-row.phase-active .phase-dot {
  background: #1f4d8a;
  animation: phase-pulse 1.2s ease-in-out infinite;
}
.phase-row.phase-cancelled { background: #faf0f0; color: #8a1f1f; }
.phase-row.phase-cancelled .phase-dot { background: #8a1f1f; }
.phase-row.phase-failed { background: #faf0f0; color: #8a1f1f; }
.phase-row.phase-failed .phase-dot { background: #8a1f1f; }

@keyframes phase-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}

.brand-lock-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.meta { color: #666; font-size: 12px; margin: 8px 0; }

/* --- Brand Lock Review --- */
.brand-lock-review-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
}
.review-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 800px) {
  .review-layout { grid-template-columns: 1fr; }
}
.review-sidebar {
  position: sticky;
  top: 24px;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
}
.review-sidebar h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}
.stats-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.stats-list li {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.stats-list li:last-child { border-bottom: none; }
.stats-count { color: #1a1a1a; font-weight: 600; text-align: right; }
.stats-pct { color: #888; font-size: 12px; }
.stats-total {
  margin: 0 0 16px;
  font-size: 12px;
  color: #888;
}
.review-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-actions .btn-primary,
.review-actions .btn-secondary {
  width: 100%;
}

.review-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.review-section {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
}
.review-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.field-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f4f4f4;
  font-size: 14px;
}
.field-row:last-child { border-bottom: none; }
.field-label {
  font-weight: 600;
  color: #444;
}
.field-value { color: #1a1a1a; }
.field-missing {
  color: #aaa;
  font-style: italic;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.product-card {
  border: 1px solid #ececec;
  border-radius: 8px;
  padding: 16px;
  background: #fafafa;
}
.product-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.product-header h3 { margin: 0; font-size: 16px; }

.review-modifier .modifier-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.modifier-paragraph {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
  font-style: italic;
  background: #f9f9f9;
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid #1a1a1a;
}

/* Confidence badges (used by sidebar stats + every field row) */
.conf-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.conf-high    { background: #e6f4ea; color: #1e6b34; }
.conf-medium  { background: #fff4d4; color: #8a6500; }
.conf-low     { background: #ffe4d4; color: #a04500; }
.conf-missing { background: #ececec; color: #777; }

/* --- Brand Lock Augment (Sub-story 2E) --- */

.brand-lock-augment-wrap {
  margin-top: 16px;
}

.augment-tab-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border, #e6e6e6);
  padding-bottom: 8px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--bg, #fff);
  z-index: 1;
}

.augment-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border, #e6e6e6);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  color: var(--fg, #222);
}

.augment-tab.is-active {
  background: var(--accent, #111);
  color: #fff;
  border-color: var(--accent, #111);
}

.augment-tab-chip {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 999px;
}

.augment-tab.is-active .augment-tab-chip {
  background: rgba(255, 255, 255, 0.18);
}

.augment-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.augment-question-card {
  border: 1px solid var(--border, #e6e6e6);
  border-radius: 8px;
  padding: 20px;
  background: var(--bg-soft, #fafafa);
}

.augment-question-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted, #777);
  font-size: 13px;
  margin-bottom: 8px;
}

.augment-required {
  background: #f8e2e2;
  color: #a33;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.augment-question-prompt {
  font-size: 17px;
  line-height: 1.4;
  margin: 0 0 12px 0;
}

.augment-state-banner {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.augment-state-banner.augment-state-answered { background: #e3f4e3; color: #2a7a2a; }
.augment-state-banner.augment-state-skipped { background: #f0f0f0; color: #666; }
.augment-state-banner.augment-state-inference-requested { background: #fff3e0; color: #a85d00; }

.augment-answer-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

.augment-action-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.augment-progress-badge {
  font-size: 13px;
  color: var(--muted, #555);
  margin: 0;
}

.augment-progress-total {
  color: var(--muted, #999);
}

.augment-done-row {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--border, #e6e6e6);
}

.augment-done-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Remember-me hint under the sign-in card */
.signin-hint { font-size: 12px; color: #6b6b6b; margin: 8px 0 0; text-align: center; }

/* Google OAuth — primary path for future tenants */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  color: #18181b;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  cursor: pointer;
  margin: 0 0 14px;
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
}
.btn-google:hover {
  background: #f9fafb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-google:disabled {
  opacity: 0.6;
  cursor: progress;
}

.signin-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: #9ca3af;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.signin-divider::before,
.signin-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e4e4e7;
}
