/* ─── Design tokens ────────────────────────────────────────────── */
:root {
  --bg:          #F6F2EB;
  --surface:     #FFFFFF;
  --navy:        #1B3A62;
  --navy-dark:   #122848;
  --amber:       #C97520;
  --amber-hover: #A85F15;
  --amber-light: #FEF3E2;
  --text:        #1A1A1A;
  --muted:       #5A6070;
  --border:      #DDD8CE;
  --success-bg:  #EAF7EE;
  --success-fg:  #1D6B37;
  --error-bg:    #FEECEC;
  --error-fg:    #B02020;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 2px 16px rgba(0,0,0,0.08);
}

/* ─── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }

/* ─── Header ───────────────────────────────────────────────────── */
.app-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 1.3rem; }
.brand-name { font-family: "Playfair Display", serif; font-size: 1.1rem; letter-spacing: .02em; }

/* Steps indicator */
.steps { display: flex; align-items: center; gap: 4px; }
.step {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.5);
  font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.step.active { background: var(--amber); border-color: var(--amber); color: #fff; }
.step.done   { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); color: #fff; }
.step-line   { width: 20px; height: 2px; background: rgba(255,255,255,0.25); }

/* ─── Main / card ──────────────────────────────────────────────── */
.main {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.card-title {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 6px;
}
.card-sub { color: var(--muted); font-size: .95rem; margin-bottom: 24px; }

/* ─── Upload area ──────────────────────────────────────────────── */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 2.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  background: var(--amber-light);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.upload-area:active, .upload-area:hover { border-color: var(--amber); background: #FDEFD6; }
.upload-icon { font-size: 2.8rem; line-height: 1; }
.upload-text { font-size: 1rem; font-weight: 600; color: var(--navy); }
.upload-hint { font-size: .85rem; font-weight: 400; color: var(--muted); }

/* Receipt preview */
.receipt-preview { margin-bottom: 16px; text-align: center; }
.receipt-preview img {
  border-radius: var(--radius-sm);
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--border);
}

/* Receipt data table */
.receipt-data {
  background: #F9F6F0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-family: "Courier New", Courier, monospace;
  font-size: .88rem;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dotted var(--border);
}
.receipt-row:last-child { border-bottom: none; }
.receipt-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.receipt-value { color: var(--navy); font-weight: 700; text-align: right; max-width: 65%; word-break: break-all; }

/* ─── Stars ────────────────────────────────────────────────────── */
.star-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.star {
  font-size: 2.8rem;
  color: var(--border);
  background: none;
  border: none;
  padding: 4px;
  transition: color .15s, transform .1s;
  min-width: 48px; min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.star.selected, .star.hover-select { color: var(--amber); transform: scale(1.1); }
.star-label {
  text-align: center;
  font-weight: 700;
  color: var(--amber);
  font-size: 1rem;
  margin-bottom: 22px;
  min-height: 1.5em;
}

/* ─── Notes / review textarea ──────────────────────────────────── */
.field-label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.optional { font-weight: 400; color: var(--muted); }

.notes-input, .review-output {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  resize: vertical;
  transition: border-color .2s;
  background: #FAFAFA;
  line-height: 1.55;
}
.notes-input:focus, .review-output:focus {
  border-color: var(--navy);
  outline: none;
  background: #fff;
}
.notes-hint {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 22px;
}
.review-output {
  background: var(--amber-light);
  border-color: #E5C990;
  font-size: .98rem;
  margin-bottom: 20px;
  min-height: 140px;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: center;
  margin-bottom: 12px;
  transition: background .2s, transform .1s;
  min-height: 52px;
}
.btn-primary:active { background: var(--amber-hover); transform: scale(0.98); }
.btn-primary:disabled { background: #C9B99A; cursor: not-allowed; }

.btn-ghost {
  display: block;
  width: 100%;
  padding: 13px;
  background: none;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  transition: background .2s, border-color .2s;
  min-height: 48px;
}
.btn-ghost:active { background: #F0EDE7; border-color: #C0B8AE; }

.btn-copy {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  cursor: pointer;
  min-height: 48px;
}
.btn-survey-link {
  display: block;
  width: 100%;
  padding: 13px;
  background: none;
  color: var(--amber);
  border: 2px solid var(--amber);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  margin-bottom: 12px;
  min-height: 48px;
  line-height: 1.6;
}

/* ─── Status / feedback ────────────────────────────────────────── */
.status {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: .92rem;
  line-height: 1.5;
}
.status.loading { background: #EEF4FB; color: var(--navy); }
.status.success { background: var(--success-bg); color: var(--success-fg); }
.status.error   { background: var(--error-bg);   color: var(--error-fg); }
.status.info    { background: #EEF4FB; color: var(--navy); border-left: 3px solid var(--amber); }

/* Spinner animation */
.spinner { display: inline-block; margin-right: 6px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Fallback panel ───────────────────────────────────────────── */
.fallback-panel {
  border-top: 2px dashed var(--border);
  padding-top: 22px;
  margin-top: 8px;
}
.fallback-title { font-weight: 700; font-size: 1.05rem; color: var(--navy); margin-bottom: 6px; }
.fallback-body  { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.fallback-note  { font-size: .82rem; color: var(--muted); margin-top: 8px; text-align: center; }

/* ─── Success screen ───────────────────────────────────────────── */
.success-icon { font-size: 4rem; text-align: center; margin-bottom: 16px; }
#stepDone .card-title { text-align: center; }
#stepDone .card-sub   { text-align: center; margin-bottom: 28px; }

/* ─── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
