/* ===== DESIGN TOKENS — easy to customise ===== */
:root {
  --c-primary:    #C8700A;   /* warm amber */
  --c-primary-d:  #A85C08;
  --c-secondary:  #4ECDC4;   /* teal */
  --c-accent:     #FFE66D;   /* yellow */
  --c-purple:     #C084FC;
  --c-green:      #6EE7B7;

  --c-bg:         #EAE5DC;   /* warm beige page background */
  --c-card:       #FFFFFF;
  --c-border:     #DFDAD5;
  --c-text:       #1A1A1A;
  --c-text-muted: #888888;
  --c-error:      #E53E3E;
  --c-success:    #38A169;

  --font-head:    'Cormorant Garamond', 'Georgia', serif;
  --font-body:    'Nunito', sans-serif;

  --radius-sm:    5px;
  --radius-md:    8px;
  --radius-lg:    10px;
  --radius-xl:    32px;

  --shadow-card:  0 2px 12px rgba(0,0,0,0.08);
  --shadow-btn:   0 2px 8px rgba(200,112,10,0.25);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.logo-text {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1A1A1A;
  letter-spacing: 0.3px;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.credit-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--c-bg);
  color: var(--c-text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
}

/* ===== SCREENS ===== */
.screen { min-height: 100vh; }

/* ===== VOUCHER SCREEN ===== */
.voucher-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #fff9f0 0%, #ffe8e8 50%, #e8f8ff 100%);
}
.voucher-card {
  background: var(--c-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}
.voucher-logo { margin-bottom: 32px; }
.logo-icon-lg { font-size: 3.5rem; display: block; margin-bottom: 8px; }
.brand-title {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #1A1A1A;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.brand-coloring {
  background: linear-gradient(90deg, #E53935 0%, #FB8C00 38%, #FDD835 70%, #43A047 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-tagline {
  color: #888888;
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}
.zero-storage-note {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  margin: 8px auto 0;
  text-align: center;
}
.voucher-form { text-align: left; }
.voucher-footer-note {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--c-text);
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--c-text);
  transition: border-color 0.2s;
  background: var(--c-bg);
}
.form-input:focus {
  outline: none;
  border-color: var(--c-primary);
  background: white;
}
.voucher-input {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  text-align: center;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* PIN digits */
.pin-input-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.pin-digit {
  width: 56px;
  height: 64px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 1.8rem;
  text-align: center;
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color 0.2s;
}
.pin-digit:focus {
  outline: none;
  border-color: var(--c-primary);
  background: white;
}
.pin-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--c-text-muted);
  text-align: center;
}
.remember-row { margin-bottom: 16px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--c-text-muted);
}
.checkbox-label input { width: 16px; height: 16px; cursor: pointer; }

.error-msg {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: var(--c-error);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 1rem;
  transition: all 0.18s;
}
.btn-primary {
  background: var(--c-primary);
  color: white;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--c-primary-d); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-generate {
  background: #1A1A1A;
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: 5px;
  box-shadow: none;
  width: 100%;
}
.btn-generate:hover { background: #2D2D2D; transform: none; }
.btn-generate:active { opacity: 0.9; transform: none; }

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== WELCOME MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-card {
  background: var(--c-card);
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  padding: 32px;
  width: 100%;
  max-width: 480px;
}
.welcome-header { text-align: center; margin-bottom: 28px; }
.welcome-emoji { font-size: 3rem; display: block; margin-bottom: 8px; }
.welcome-header h2 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  color: var(--c-primary);
  margin-bottom: 6px;
}
.welcome-credits { color: var(--c-text-muted); font-size: 0.95rem; }
.welcome-credits strong { color: var(--c-primary); font-size: 1.1rem; }

.welcome-steps { margin-bottom: 28px; display: flex; flex-direction: column; gap: 14px; }
.step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--c-bg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.step-number {
  min-width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.step-body { display: flex; flex-direction: column; gap: 2px; }
.step-body strong { font-size: 0.95rem; color: var(--c-text); }
.step-body span { font-size: 0.85rem; color: var(--c-text-muted); }

/* ===== GENERATOR LAYOUT ===== */
.generator-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* TABS */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 24px;
  width: fit-content;
}
.tab {
  padding: 10px 20px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #AAAAAA;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab.active { color: #1A1A1A; border-bottom-color: var(--c-primary); }

/* GENERATOR GRID */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* UPLOAD */
.upload-zone {
  border: 1.5px dashed #C8C2BB;
  border-radius: 10px;
  background: var(--c-card);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-primary);
  background: #FBF7F2;
}
.upload-placeholder { text-align: center; padding: 24px; }
.upload-icon-circle {
  width: 56px;
  height: 56px;
  border: 1px solid #CBCBCB;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: #888888;
}
.upload-placeholder p { font-weight: 600; font-size: 0.95rem; margin-bottom: 5px; color: var(--c-text); }
.upload-hint { font-size: 0.78rem; color: var(--c-text-muted); }
#photoCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 380px;
}
.upload-actions {
  padding: 10px;
  display: flex;
  justify-content: center;
}

/* OPTIONS CARD */
.options-card {
  background: var(--c-card);
  border-radius: 10px;
  padding: 0 0 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.options-rainbow-bar {
  height: 5px;
  background: linear-gradient(90deg, #FF4B4B 0%, #FF8C00 25%, #FFD700 50%, #43C59E 72%, #4B9FFF 86%, #9B6DD6 100%);
  flex-shrink: 0;
  margin-bottom: 20px;
}
.option-group {
  padding: 0 20px;
  margin-bottom: 16px;
}
.option-label {
  display: block;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #AAAAAA;
  margin-bottom: 8px;
}

/* Style grid */
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.style-btn {
  padding: 9px 8px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-muted);
  background: #FAFAFA;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: left;
}
.style-btn:hover { border-color: var(--c-primary); color: var(--c-primary); background: #FDF7F0; }
.style-btn.active {
  border-color: var(--c-primary);
  background: #FDF7F0;
  color: var(--c-primary);
  font-weight: 700;
}

/* Age grid */
.age-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.age-btn {
  padding: 6px 13px;
  border: 1px solid var(--c-border);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-muted);
  background: #FAFAFA;
  transition: all 0.15s;
}
.age-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.age-btn.active {
  border-color: var(--c-primary);
  background: #FDF7F0;
  color: var(--c-primary);
  font-weight: 700;
}
.age-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Toggle row */
.toggle-row {
  display: flex;
  gap: 6px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  padding: 3px;
  background: #FAFAFA;
}
.toggle-btn {
  flex: 1;
  padding: 7px 8px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-text-muted);
  transition: all 0.15s;
}
.toggle-row-wrap { flex-wrap: wrap; }
.toggle-row-wrap .toggle-btn { flex: 1 1 auto; min-width: 55px; }
.toggle-btn.active {
  background: white;
  color: var(--c-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-weight: 700;
}

/* Generate footer */
.generate-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px 0;
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
}
.credits-remaining {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  font-weight: 600;
}

.buy-credits-link {
  color: var(--c-primary, #7c6ef7);
  text-decoration: none;
  font-weight: 600;
}
.buy-credits-link:hover {
  text-decoration: underline;
}

/* RESULT PANEL */
.result-panel { margin-top: 8px; }
.result-card {
  background: var(--c-card);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid #A8D5C0;
}
.result-title {
  font-family: var(--font-head);
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--c-text);
}
.result-preview {
  width: 100%;
  height: 600px;
  background: #f5f5f5;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.pdf-preview { width: 100%; height: 100%; border: none; display: block; }
.result-actions { display: flex; gap: 12px; }
.result-annotation-note {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  background: #f9f5ec;
  border-left: 3px solid var(--c-accent);
  padding: 8px 12px;
  border-radius: 6px;
}

/* CROP MODAL */
.crop-modal-card {
  max-width: 680px;
  width: 95vw;
}
.crop-modal-title {
  font-family: var(--font-head);
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.crop-modal-hint {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.crop-orientation-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.crop-orient-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 2px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.crop-orient-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.crop-orient-btn.active { border-color: var(--c-primary); background: var(--c-primary); color: #fff; }
.crop-canvas-wrap {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #111;
  cursor: crosshair;
  margin-bottom: 16px;
}
#cropCanvas { display: block; max-width: 100%; }
.crop-actions { display: flex; gap: 12px; }

/* GENERATING PANEL */
.generating-card {
  background: var(--c-card);
  border-radius: 8px;
  padding: 48px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-border);
  text-align: center;
}
.generating-animation {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: bounce 1s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.generating-card h3 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.generating-card p { color: var(--c-text-muted); margin-bottom: 20px; }
.progress-bar {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  height: 8px;
  background: var(--c-border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-purple));
  border-radius: 99px;
  width: 0%;
  transition: width 0.5s ease;
}

/* HISTORY */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.history-header h2 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--c-text);
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.history-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 24px;
  color: var(--c-text-muted);
}
.history-empty span { font-size: 3rem; display: block; margin-bottom: 12px; }
.history-card {
  background: var(--c-card);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  overflow: hidden;
  border: 1px solid var(--c-border);
}
.history-thumb {
  width: 100%;
  height: 150px;
  background: #F0EBE4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C8C2BB;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-meta { padding: 10px 12px 12px; }
.history-style {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-primary);
  margin-bottom: 2px;
}
.history-date { font-size: 0.72rem; color: var(--c-text-muted); margin-bottom: 8px; }
.history-nickname { font-size: 0.75rem; color: var(--c-primary); margin-bottom: 2px; font-weight: 600; }
.history-purged { font-size: 0.72rem; color: var(--c-text-muted); font-style: italic; }

/* History notice */
.history-notice {
  background: #FFFBF0;
  border: 1px solid #F0D98A;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #7A6200;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* History card download btn */
.history-dl-btn {
  width: 100%;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid var(--c-border) !important;
  color: var(--c-text-muted) !important;
  border-radius: 5px;
  padding: 7px 12px;
}
.history-dl-btn:hover { border-color: var(--c-primary) !important; color: var(--c-primary) !important; }

/* History toolbar (select-all + download-selected) */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.history-select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--c-text-muted);
}

/* Checkbox overlay on card */
.history-card { position: relative; }
.history-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  cursor: pointer;
  line-height: 0;
}
.history-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.history-check-indicator {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(0,0,0,0.22);
  background: rgba(255,255,255,0.88);
  transition: background 0.15s, border-color 0.15s;
}
.history-check input[type="checkbox"]:checked ~ .history-check-indicator {
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.history-check input[type="checkbox"]:checked ~ .history-check-indicator::after {
  content: '✓';
  display: block;
  text-align: center;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

/* Name row */
.history-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  margin-bottom: 3px;
}
.history-name {
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-name:empty::before {
  content: 'Add a name…';
  color: var(--c-text-muted);
  font-weight: 400;
  font-style: italic;
}
.history-rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  font-size: 0.72rem;
  opacity: 0.4;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.history-rename-btn:hover { opacity: 1; }
.history-name-input {
  flex: 1;
  font-size: 0.82rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-family: inherit;
  min-width: 0;
  outline: none;
}
.history-name-input:focus { border-color: var(--c-primary); }
.history-rename-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* Extra-small button */
.btn-xs {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.4;
}

/* Pagination */
.records-capped-notice {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  text-align: center;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: var(--c-surface-2, #f5f5f5);
  border-radius: 6px;
}
.records-capped-notice a {
  color: var(--c-accent, #e85d4a);
  text-decoration: underline;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  padding-bottom: 16px;
}
#historyPageInfo {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  font-weight: 700;
  min-width: 100px;
  text-align: center;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--c-text);
  color: white;
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 999;
  transition: transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-error); }

/* ===== AUTH SCREENS (login / verify / reset-pin) ===== */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #E8E3DC;
}
.auth-card {
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.09);
  padding: 0 40px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  overflow: hidden;
}

/* Rainbow top bar */
.auth-rainbow-bar {
  height: 5px;
  background: linear-gradient(90deg, #FF4B4B 0%, #FF8C00 25%, #FFD700 50%, #43C59E 72%, #4B9FFF 86%, #9B6DD6 100%);
  margin: 0 -40px 32px;
}

/* Pencil icon in circle */
.auth-pencil-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.auth-logo { margin-bottom: 24px; }

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-bottom: 1px solid #E0E0E0;
}
.auth-tab {
  flex: 1;
  padding: 11px 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #AAAAAA;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab:first-child.active { border-bottom-color: #1A1A1A; color: #1A1A1A; }
.auth-tab:last-child.active  { border-bottom-color: #1A1A1A; color: #1A1A1A; }

/* Auth sub-tabs (Sign In / Register) */
.auth-subtabs {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.auth-subtab {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-text-muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.auth-subtab.active { color: #B8720A; border-bottom-color: #B8720A; }

.auth-panel { text-align: left; }

/* Input with icon */
.input-icon-wrap {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #A0AEC0;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.input-icon-wrap .auth-input {
  padding-left: 42px;
}
.auth-input {
  background: #F9F9F9;
  border: 1px solid #DCDCDC !important;
  border-radius: 8px !important;
  padding: 13px 16px;
  font-size: 0.95rem;
  color: #4A4A4A;
}
.auth-input:focus {
  background: #FFFFFF;
  border-color: #AAAAAA !important;
}
.auth-input::placeholder {
  color: #ADADAD;
  font-weight: 400;
}

/* Pencil divider */
.pencil-divider {
  height: 3px;
  width: 40px;
  border-radius: 2px;
  transform: rotate(-2deg);
  display: inline-block;
}
.pencil-divider-coral  { background: var(--c-primary); }
.pencil-divider-teal   { background: var(--c-secondary); }

/* Black sign-in button for auth screens */
.btn-auth {
  background: #1A1A1A;
  color: white;
  letter-spacing: 2.5px;
  font-size: 0.82rem;
  box-shadow: none;
  border-radius: 5px;
  padding: 15px 24px;
  font-weight: 700;
  font-family: var(--font-body);
}
.btn-auth:hover { background: #2D2D2D; transform: none; }
.btn-auth:active { transform: none; opacity: 0.9; }

.auth-link-row {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--c-text-muted);
}
.auth-link-row a { color: var(--c-text-muted); font-weight: 400; }
.auth-link-row a:hover { text-decoration: underline; color: var(--c-text); }
.forgot-pin-row {
  text-align: right;
  margin-top: 6px;
  font-size: 0.8rem;
}
.forgot-pin-row a { color: var(--c-text-muted); }
.forgot-pin-row a:hover { color: var(--c-primary); }
.auth-footer-note {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  text-align: center;
}
.auth-footer-note a { color: var(--c-text-muted); text-decoration: underline; }
.auth-footer-note a:hover { color: var(--c-text); }

.voucher-login-note {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.success-msg {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  color: var(--c-success);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
}

/* Button press interaction */
.btn:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
  .btn:active, .auth-card:hover { transform: none; }
  .auth-tab, .auth-subtab { transition: none; }
}

/* ===== VERIFY SCREEN ===== */
.verify-card { padding-bottom: 32px; }
.verify-icon { font-size: 3.5rem; margin-bottom: 8px; }
.verify-title {
  font-family: var(--font-head);
  font-size: 1.6rem;
  color: var(--c-primary);
  margin-bottom: 12px;
}
.verify-body { color: var(--c-text-muted); font-size: 0.95rem; }
.verify-email {
  font-weight: 800;
  font-size: 1rem;
  color: var(--c-text);
  margin-top: 4px;
  word-break: break-all;
}
.verify-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.verify-cooldown {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 8px;
  text-align: center;
}

/* ===== HEADER: USER DROPDOWN ===== */
.header-user-section { position: relative; }
.user-dropdown-wrap  { position: relative; }
.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dropdown-arrow { font-size: 0.7rem; }
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
}
.dropdown-item {
  display: block;
  width: 100%;
  padding: 11px 16px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-text);
  background: none;
  transition: background 0.12s;
}
.dropdown-item:hover { background: var(--c-bg); }
.dropdown-item-danger { color: var(--c-error); }
.dropdown-divider { height: 1px; background: var(--c-border); margin: 4px 0; }
.voucher-nickname-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text-muted);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== MODAL HEADER (shared) ===== */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: var(--c-text);
}
.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg);
  color: var(--c-text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--c-border);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.modal-close-btn:hover { background: #fff0f0; color: var(--c-error); border-color: var(--c-error); }

/* ===== MY VOUCHERS MODAL ===== */
.my-vouchers-modal { max-width: 500px; max-height: 80vh; overflow-y: auto; }
.voucher-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}
.voucher-list-item:last-child { border-bottom: none; }
.voucher-list-code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  color: var(--c-text);
}
.voucher-type-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-private { background: #e8f4fd; color: #1E88E5; }
.badge-shared  { background: #e8faf8; color: #2a9d8f; }
.badge-promo   { background: #fef3e2; color: #e07b00; }
.voucher-list-credits { font-size: 0.82rem; color: var(--c-text-muted); font-weight: 600; }

/* ===== ACTIVATE VOUCHER MODAL ===== */
.activate-voucher-modal { max-width: 460px; }
.activate-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}
.activate-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.activate-step-dot.active { opacity: 1; }
.activate-dot-red   { background: #E53935; }
.activate-dot-blue  { background: #1E88E5; }
.activate-dot-green { background: #43A047; }
.activate-step-line {
  flex: 1;
  height: 2px;
  background: var(--c-border);
  max-width: 48px;
}
.activate-panel { text-align: left; }
.activate-instruction {
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--c-text);
}
.activate-type-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.activate-type-card {
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  background: var(--c-bg);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  cursor: pointer;
}
.activate-type-card:hover {
  border-color: var(--c-primary);
  background: #fff5f5;
  transform: translateY(-2px);
}
.activate-type-icon { font-size: 2rem; margin-bottom: 8px; }
.activate-type-label {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--c-text);
  margin-bottom: 6px;
}
.activate-type-desc { font-size: 0.78rem; color: var(--c-text-muted); line-height: 1.4; }
.activate-conversion-note {
  font-size: 0.82rem;
  color: var(--c-secondary);
  background: #e8faf8;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
}
.activate-confirm-box {
  background: var(--c-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
  border: 2px solid var(--c-border);
}
.activate-confirm-box p { font-size: 1rem; color: var(--c-text); margin-bottom: 6px; }
.activate-confirm-box strong { color: var(--c-primary); font-size: 1.2rem; }
.activate-confirm-sub { font-size: 0.82rem; color: var(--c-text-muted); }

/* ===== CREDIT HISTORY MODAL ===== */
.credit-history-modal { max-width: 520px; max-height: 80vh; overflow-y: auto; }
.credit-history-table { width: 100%; border-collapse: collapse; }
.credit-history-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-text-muted);
  padding: 0 8px 10px;
  border-bottom: 2px solid var(--c-border);
}
.credit-history-table td {
  padding: 10px 8px;
  font-size: 0.875rem;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.credit-history-table tr:last-child td { border-bottom: none; }
.ch-amount-pos { color: var(--c-success); font-weight: 800; }
.ch-amount-neg { color: var(--c-error); font-weight: 800; }
.ch-type-label { font-size: 0.8rem; color: var(--c-text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .auth-card { padding: 0 24px 32px; }
  .auth-rainbow-bar { margin: 0 -24px 28px; }
  .activate-type-cards { grid-template-columns: 1fr; }
  .credit-history-modal, .my-vouchers-modal { max-width: 100%; margin: 0 8px; }
}

/* ===== CONTACT MODAL ===== */
.contact-textarea { resize: vertical; min-height: 110px; font-family: var(--font-body); }
.contact-char-count { text-align: right; font-size: 0.78rem; color: var(--c-text-muted); margin-top: 4px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--c-border); }
.modal-body { /* ensure padding doesn't clip */ }
