:root {
  --ink: #1a1410;
  --parchment: #f7f3ee;
  --cream: #efe9e0;
  --gold: #c9a96e;
  --gold-light: #e8d5b0;
  --gold-dark: #9a7840;
  --rose: #d4877a;
  --slate: #6b7280;
  --slate-light: #9ca3af;
  --mist: #e8e4df;
  --deep: #2d2318;
  --success: #6b9e78;
  --warning: #d4a96a;
  --danger: #c97a7a;
  --shadow: rgba(26,20,16,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Instrument Sans', sans-serif;
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(ellipse at 20% 20%, rgba(201,169,110,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(212,135,122,0.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Header */
.app-header {
  position: relative;
  z-index: 10;
  padding: 2rem 3rem 1.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid rgba(201,169,110,0.3);
  max-width: 825px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 0.3rem;
}

.logo > span:first-child { color: var(--ink); }

.logo-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: var(--slate);
  text-transform: uppercase;
  font-weight: 400;
  max-width: 28rem;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-end;
}

.header-row {
  display: flex;
  gap: 0.3rem;
  flex-wrap: nowrap;
}

/* All header buttons share one base style */
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  height: 2rem;
  border: 1px solid rgba(201,169,110,0.35);
  border-radius: 6px;
  background: var(--parchment);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.header-btn:hover { border-color: var(--gold); color: var(--ink); background: rgba(201,169,110,0.06); }

/* On medium screens, hide text labels for lower-priority buttons, keep emoji */
@media (max-width: 900px) {
  .header-btn.btn-icon-only { padding: 0.45rem 0.6rem; }
  .header-btn.btn-icon-only .btn-label { display: none; }
  .header-actions { max-width: 55%; }
}
@media (max-width: 860px) {
  .header-actions { max-width: 100%; justify-content: flex-start; }
  .app-header { flex-wrap: wrap; gap: 0.6rem; align-items: flex-start; }
}

/* Main layout */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 825px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 3rem 5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.left-col, .right-panel {
  position: relative;
  z-index: 1;
}

/* Cards get solid background so sparkles can't bleed through backdrop-filter */
.card {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 12px;
  padding: 1.75rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 20px var(--shadow);
  position: relative;
  z-index: 1;
}

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--gold);
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-gold {
  background: var(--gold);
  color: white;
}
.btn-gold:hover { background: var(--gold-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201,169,110,0.4); }

.btn-outline {
  background: var(--parchment);
  color: var(--ink);
  border: 1px solid rgba(201,169,110,0.4);
}
.btn-outline:hover { border-color: var(--gold); background: rgba(201,169,110,0.08); }

.btn-ghost {
  background: var(--parchment);
  color: var(--slate);
  font-size: 0.75rem;
}
.btn-ghost:hover { color: var(--ink); }

.btn-large {
  padding: 0.85rem 2rem;
  font-size: 0.9rem;
  width: 100%;
  justify-content: center;
  border-radius: 8px;
}

/* Form elements */
.form-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--slate);
}

.field select,
.field input[type="text"],
.field input[type="number"],
.field input[type="range"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(201,169,110,0.25);
  border-radius: 6px;
  background: rgba(255,255,255,0.8);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--ink);
  appearance: none;
  transition: border-color 0.2s;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: white;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9a96e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Range slider */
.range-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-wrapper input[type="range"] {
  padding: 0;
  height: 4px;
  cursor: pointer;
  accent-color: var(--gold);
}

.range-value {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold-dark);
  min-width: 2.5rem;
  text-align: right;
}

/* Zone tabs */
.zone-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.zone-tab {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid rgba(201,169,110,0.25);
  border-radius: 6px;
  background: var(--parchment);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.zone-tab.active {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.zone-tab:hover:not(.active) {
  border-color: var(--gold);
  color: var(--ink);
}

/* Level selector */
.level-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.level-btn {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  font-weight: 500;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.level-btn:hover { transform: scale(1.1); }
.level-btn.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-light); transform: scale(1.12); }

/* Colour category grid */
.colour-categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.colour-category {
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 8px;
  overflow: hidden;
}

.colour-category-header {
  padding: 0.65rem 1rem;
  background: rgba(201,169,110,0.08);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.colour-category-header:hover { background: rgba(201,169,110,0.15); }

.colour-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  padding: 0.75rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, padding 0.32s ease;
  padding-top: 0;
  padding-bottom: 0;
}

.colour-category.open .colour-swatches {
  max-height: 600px;
  opacity: 1;
  padding: 0.75rem;
}

.colour-swatch {
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.2s;
  aspect-ratio: 1;
  position: relative;
}

.colour-swatch:hover { transform: scale(1.05); border-color: var(--gold-light); }
.colour-swatch.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

.colour-swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.colour-swatch-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: white;
  font-size: 0.55rem;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.25rem 0.2rem;
  text-align: center;
}

/* Right panel */
/* Target preview */
.target-preview {
  border-radius: 10px;
  overflow: visible;
  border: 1px solid rgba(201,169,110,0.2);
  background: var(--cream);
  position: relative;
  z-index: 1;
}

.target-preview-header {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.5);
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--slate);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(201,169,110,0.15);
  border-radius: 10px 10px 0 0;
  position: relative;
  z-index: 10;
}

.preview-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  border-radius: 0 0 10px 10px;
}

.preview-slot {
  aspect-ratio: 3/4;
  position: relative;
  overflow: hidden;
  background: var(--mist);
}

.preview-slot + .preview-slot {
  border-left: 1px solid rgba(201,169,110,0.2);
}

.preview-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-slot-label {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(255,255,255,0.85);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-family: 'DM Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--slate);
}

.preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.4rem;
  height: 100%;
  color: var(--slate-light);
  font-size: 0.75rem;
  font-family: 'Instrument Sans', sans-serif;
}

.preview-empty svg {
  opacity: 0.3;
}

/* ── Photo Analysis ── */
@keyframes analyseSpín {
  to { transform: rotate(360deg); }
}
.analyse-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(201,169,110,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto;
  animation: analyseSpín 0.9s linear infinite;
}
.photo-action-row {
  display: flex;
  gap: 0;
  width: 100%;
}
.photo-action-row.hidden { display: none !important; }
.analyse-btn {
  flex: 1;
  padding: 0.55rem 0.6rem;
  background: linear-gradient(135deg, rgba(201,169,110,0.15), rgba(201,169,110,0.08));
  border: 1px solid rgba(201,169,110,0.35);
  border-top: none;
  border-right: none;
  border-radius: 0 0 0 10px;
  color: var(--ink);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.2s;
}
.formulate-btn {
  flex: 1;
  padding: 0.55rem 0.6rem;
  background: linear-gradient(135deg, rgba(201,169,110,0.22), rgba(201,169,110,0.12));
  border: 1px solid rgba(201,169,110,0.35);
  border-top: none;
  border-radius: 0 0 10px 0;
  color: var(--ink);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.2s;
}
.analyse-btn:hover { background: rgba(201,169,110,0.22); }
.formulate-btn:hover { background: rgba(201,169,110,0.3); }
.analyse-btn.loading, .formulate-btn.loading { opacity: 0.7; cursor: not-allowed; pointer-events: none; }
.analyse-btn.hidden { display: none !important; }

.analyse-modal { max-width: 560px; width: 95%; max-height: 85vh; overflow-y: auto; }

.analyse-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 80px auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(201,169,110,0.1);
  font-size: 0.8rem;
}
.analyse-row:last-child { border-bottom: none; }
.analyse-row-label { color: var(--slate); font-weight: 500; font-size: 0.75rem; }
.analyse-row-detected { color: var(--ink); font-weight: 600; }
.analyse-row-current { color: var(--slate-light); font-size: 0.75rem; }
.analyse-conf {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}
.analyse-conf.high { background: rgba(100,180,100,0.15); color: #3a7a3a; }
.analyse-conf.medium { background: rgba(201,169,110,0.18); color: var(--gold-dark); }
.analyse-conf.low { background: rgba(220,80,80,0.1); color: #a04040; }

.analyse-accept-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--slate);
  cursor: pointer;
  white-space: nowrap;
}
.analyse-accept-toggle input { accent-color: var(--gold); width: 14px; height: 14px; cursor: pointer; }
.analyse-note {
  background: rgba(201,169,110,0.06);
  border-left: 3px solid var(--gold);
  padding: 0.65rem 0.75rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.78rem;
  color: var(--slate);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Confidence meter */
.confidence-bar {
  margin-top: 0.5rem;
  height: 4px;
  background: var(--mist);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--gold), var(--success));
}

.confidence-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  display: flex;
  justify-content: space-between;
  color: var(--slate);
  margin-top: 0.4rem;
}

.confidence-score {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gold-dark);
}

/* Formula output */
.formula-output {
  display: none;
  position: relative;
  z-index: 2;
  background: var(--parchment);
  border-radius: 12px;
}
body.dark .formula-output { background: var(--surface); }

.formula-output.visible {
  display: block;
}

.ai-shade-pick {
  background: linear-gradient(135deg, rgba(201,169,110,0.12), rgba(201,169,110,0.05));
  border: 1px solid rgba(201,169,110,0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--ink);
}

.ai-formula-body {
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--ink);
}

/* Style raw headings the AI might produce */
.ai-formula-body h2, .ai-formula-body h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  margin: 1rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(201,169,110,0.2);
}

/* Style paragraphs */
.ai-formula-body p {
  margin: 0.4rem 0;
}

/* Style raw strong tags */
.ai-formula-body strong {
  color: var(--ink);
  font-weight: 600;
}

.ai-formula-body .formula-zone {
  margin-bottom: 1.25rem;
}

.formula-zone {
  margin-bottom: 1.25rem;
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 8px;
  overflow: hidden;
}

.formula-zone-header {
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, rgba(201,169,110,0.12), rgba(201,169,110,0.06));
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid rgba(201,169,110,0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.formula-zone-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: var(--gold-dark);
  background: rgba(201,169,110,0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.formula-steps {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.formula-step {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.5);
  border-radius: 6px;
  border: 1px solid rgba(201,169,110,0.1);
}

.step-num {
  width: 20px;
  height: 20px;
  background: var(--gold);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-content {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink);
}

.step-content strong {
  font-weight: 600;
  color: var(--deep);
}

.step-product {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--gold-dark);
  background: rgba(201,169,110,0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 2px;
}

.step-timing {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  color: var(--slate);
  text-align: right;
  flex-shrink: 0;
}

/* AI commentary */
.ai-commentary {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(201,169,110,0.06), rgba(212,135,122,0.04));
  border-top: 1px solid rgba(201,169,110,0.15);
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--deep);
}

.ai-commentary::before {
  content: '"';
  font-size: 2rem;
  color: var(--gold-light);
  line-height: 0;
  vertical-align: -0.5rem;
  margin-right: 0.2rem;
}

/* Warning badges */
.warnings {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.warning-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.warning-badge.caution {
  background: rgba(212,135,122,0.1);
  border: 1px solid rgba(212,135,122,0.25);
  color: #8b3e32;
}

.warning-badge.info {
  background: rgba(201,169,110,0.1);
  border: 1px solid rgba(201,169,110,0.25);
  color: var(--gold-dark);
}

.warning-badge.allergy {
  background: rgba(180,80,80,0.08);
  border: 1px solid rgba(180,80,80,0.2);
  color: #7a2020;
}

/* Creative mode */
.creative-mode {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.creative-mode.visible { display: flex; }

.colour-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.colour-wheel-canvas {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  cursor: crosshair;
  border: 2px solid rgba(201,169,110,0.3);
}

.selected-creative-colour {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 6px;
  width: 100%;
}

.creative-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(201,169,110,0.3);
  flex-shrink: 0;
}

.creative-colour-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 500;
}

.creative-colour-hex {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--slate);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  gap: 0;
  border: 1px solid rgba(201,169,110,0.3);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.mode-btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--parchment);
  border: none;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mode-btn.active {
  background: var(--gold);
  color: white;
}

.mode-btn + .mode-btn {
  border-left: 1px solid rgba(201,169,110,0.3);
}

/* Client section */
.client-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  align-items: end;
}

/* Tabs for client history */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(201,169,110,0.15);
  border-radius: 6px;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:hover { border-color: var(--gold); background: rgba(255,255,255,0.7); }

.history-item-name {
  font-weight: 500;
  font-size: 0.82rem;
}

.history-item-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  color: var(--slate);
  margin-top: 0.15rem;
}

.history-item-date {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  color: var(--slate-light);
}

/* Section divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--slate-light);
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(201,169,110,0.2);
}

/* Upload area */
.upload-area {
  border: 1.5px dashed rgba(201,169,110,0.35);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.3);
}

.upload-area:hover {
  border-color: var(--gold);
  background: rgba(201,169,110,0.05);
}

.upload-area input { display: none; }

.upload-icon {
  color: var(--gold);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.upload-text {
  font-size: 0.78rem;
  color: var(--slate);
  line-height: 1.5;
}

.upload-text strong {
  color: var(--gold-dark);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.3); border-radius: 2px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,20,16,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--parchment);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(26,20,16,0.3);
}

.modal h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1rem;
}

.modal p {
  font-size: 0.82rem;
  color: var(--slate);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Animation */
.welcome-btn {
  width:100%;padding:0.9rem;
  background:linear-gradient(135deg,var(--gold),var(--gold-dark));
  color:white;border:none;border-radius:8px;
  font-family:'Cormorant Garamond',serif;font-size:1rem;letter-spacing:0.06em;
  cursor:pointer;transition:transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.welcome-btn:hover {
  transform:scale(1.03);
  box-shadow:0 8px 24px rgba(201,169,110,0.5);
  filter:brightness(1.1);
}
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(6px); }
}
@keyframes welcomeCardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.92) rotateX(8deg); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1) rotateX(0deg); filter: blur(0px); }
}
@keyframes goldPulse {
  0%, 100% { box-shadow: 0 24px 64px rgba(0,0,0,0.4), 0 0 0 0 rgba(201,169,110,0); }
  50% { box-shadow: 0 24px 64px rgba(0,0,0,0.4), 0 0 40px 8px rgba(201,169,110,0.18); }
}
#welcomeOverlay { animation: welcomeIn 0.6s ease forwards; }
#welcomeCard {
  animation: welcomeCardIn 0.7s cubic-bezier(0.22,1,0.36,1) forwards,
             goldPulse 3s ease-in-out 0.7s infinite;
  transform-style: preserve-3d;
  perspective: 800px;
}
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.35s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.generating { animation: pulse 1.2s ease infinite; }

/* ── Responsive / Mobile ── */

/* Tablet */
@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: 1.25rem;
    gap: 1.25rem;
    height: auto;
  }
  .left-col, .right-panel { overflow-y: visible; }
  .app-header { padding: 1.25rem 1.5rem; }
  .right-panel { order: -1; } /* preview moves above form on tablet */
}

/* Correction mode mobile layout — explicit ordering */
@media (max-width: 900px) {
  body.correction-mode .left-col { order: 1; }
  body.correction-mode .right-panel { order: 2; }
  body.correction-mode #correctionResult { order: 1; }
  body.correction-mode #correctionRightExtras { order: 2; }
  /* Hide photo formulate (irrelevant in correction mode) on mobile */
  body.correction-mode .target-preview { display: none; }
  body.correction-mode #confidenceCard { display: none !important; }
}

/* Mobile */
@media (max-width: 600px) {
  /* Header */
  .app-header {
    padding: 1rem 1.1rem 0.9rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  .logo { font-size: 1.6rem; }
  .logo-sub { display: none; }
  .header-actions {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
    justify-content: start;
  }
  .header-btn {
    justify-content: center;
    font-size: 0;        /* hide text */
    padding: 0.5rem;
    height: 2.1rem;
  }
  .header-btn::first-letter { font-size: 1rem; } /* keep emoji visible */
}

  /* Main layout */
  .app-main {
    padding: 0.85rem 0.85rem 5rem; /* bottom padding for floating button */
    gap: 0.85rem;
  }

  /* Cards */
  .card { padding: 1.1rem; }

  /* Client fields — stack on mobile */
  .client-fields {
    grid-template-columns: 1fr;
  }

  /* System chips — smaller, wrap freely */
  .system-chip {
    font-size: 0.68rem;
    padding: 0.3rem 0.6rem;
  }

  /* Zone tabs */
  .zone-tabs { gap: 0.35rem; }
  .zone-tab {
    font-size: 0.7rem;
    padding: 0.55rem 0.25rem;
  }

  /* Level grid — larger tap targets */
  .level-btn {
    border-radius: 5px;
    font-size: 0.65rem;
  }

  /* Form rows — single column on mobile */
  .form-row-2,
  .form-row-3 { grid-template-columns: 1fr; }

  /* Select & input — larger touch targets */
  .field select,
  .field input[type="text"],
  .field input[type="number"] {
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }

  /* Colour swatches — still 5 col but smaller labels */
  .colour-swatch-label { font-size: 0.48rem; }
  .colour-category-header { font-size: 0.92rem; }

  /* Mode toggle */
  .mode-btn { font-size: 0.74rem; padding: 0.55rem 0.5rem; }

  /* Preview images */
  .preview-images { grid-template-columns: 1fr 1fr; }
  .preview-slot { aspect-ratio: 2/3; }

  /* Formula steps — stack product badge below text */
  .formula-step {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .step-timing {
    grid-column: 2;
    text-align: left;
    color: var(--gold-dark);
    font-size: 0.62rem;
    margin-top: 0.2rem;
  }

  /* Toast — bottom centre */
  .toast {
    bottom: 1.5rem;
    left: 1rem;
    right: 1rem;
    text-align: center;
    z-index: 10100;
    pointer-events: none;
  }

  /* Modal full-screen on mobile */
  .modal {
    width: 95%;
    padding: 1.5rem 1.25rem;
    max-height: 85vh;
    overflow-y: auto;
  }
    left: 1rem;
    right: 1rem;
    text-align: center;
    z-index: 10100;
    pointer-events: none;
  }

  /* Confidence card */
  .confidence-score { font-size: 1rem; }

  /* AI commentary */
  .ai-commentary { font-size: 0.9rem; padding: 0.85rem; }

  /* Colour wheel — centre and size down slightly */
  .colour-wheel-canvas { width: 160px; height: 160px; }

  /* Upload area */
  .upload-area { padding: 1.1rem; }

  /* History list items */
  .history-item { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .history-item-date { align-self: flex-end; margin-top: -1.5rem; }

  /* Warnings */
  .warning-badge { font-size: 0.72rem; }
}



/* Print / PDF styles */
@media print {
  body { background: white; }
  .header-actions, .btn, .zone-tabs, .mode-toggle { display: none; }
  .formula-output { display: block !important; }
  #printSheet table { page-break-inside: avoid; }
  #printSheet { padding: 1.5rem 2rem; }
}

/* ── Hamburger Menu (mobile only) ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--parchment);
  border: 1px solid rgba(201,169,110,0.35);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.hamburger-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--parchment);
  border: 1px solid rgba(201,169,110,0.3);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(26,20,16,0.15);
  z-index: 200;
  padding: 0.5rem;
  overflow: hidden;
}
.hamburger-menu.open { display: block; }
.hamburger-menu-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
}
.hamburger-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: var(--parchment);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  width: 100%;
  border: 1px solid rgba(201,169,110,0.15);
}
.hamburger-item:hover { background: rgba(201,169,110,0.12); border-color: rgba(201,169,110,0.4); }
.header-desktop-actions { display: flex; flex-direction: column; gap: 0.3rem; }

/* Mobile quick-action icons (right of logo, left of hamburger) */
.mobile-quick-actions {
  display: none;
  gap: 0.35rem;
  align-items: center;
}
.mobile-quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--parchment);
  border: 1px solid rgba(201,169,110,0.35);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.mobile-quick-btn:hover { border-color: var(--gold); background: rgba(201,169,110,0.08); }

@media (max-width: 600px) {
  .hamburger-btn { display: flex; }
  .mobile-quick-actions { display: flex; }
  .header-desktop-actions { display: none; }
  /* Header: hamburger left | logo centre | quick icons right */
  .app-header {
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    padding: 0.9rem 1rem !important;
    gap: 0 !important;
    position: relative;
  }
  /* Logo wrapper takes all remaining space, centred */
  .app-header > div:first-child {
    flex: 1;
    display: flex;
    justify-content: center;
  }
  .logo { font-size: 1.55rem; }
  .logo-sub { display: none; }
  /* header-actions only holds the hamburger on mobile */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-direction: row;
  }
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(201,169,110,0.2);
  margin-bottom: 1.5rem;
}

.nav-tab {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.nav-tab.active {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
}

.nav-tab:hover:not(.active) { color: var(--ink); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Colour system selector chips */
.system-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.system-chip {
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(201,169,110,0.25);
  border-radius: 20px;
  font-size: 0.72rem;
  font-family: 'Instrument Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--slate);
  background: var(--parchment);
}

.system-chip.active {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.system-chip:hover:not(.active) {
  border-color: var(--gold);
  color: var(--ink);
}

/* Generate button */
.generate-btn {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1.1rem 2rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
  margin-top: 0.5rem;
  display: block;
}
.generate-btn:hover {
  background: linear-gradient(135deg, var(--gold-dark), #7a6030);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,169,110,0.4);
}
.generate-btn.generating {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Formula loading overlay ── */
.formula-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(26,20,16,0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
}
.formula-loader.visible { display: flex; }
.formula-loader-card {
  background: var(--parchment);
  border: 1px solid rgba(201,169,110,0.35);
  border-radius: 16px;
  padding: 2.25rem 2.5rem;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(26,20,16,0.35);
}
.formula-loader-history {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 3.5rem;
}
.loader-history-item {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.76rem;
  color: var(--slate-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s, transform 0.4s;
  text-decoration: line-through;
  text-decoration-color: rgba(201,169,110,0.3);
}
.loader-history-item.show {
  opacity: 0.55;
  transform: translateY(0);
}
.formula-loader-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
  animation: loaderBob 1.4s ease-in-out infinite;
}
@keyframes loaderBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.formula-loader-phrase {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
  min-height: 2.8rem;
  transition: opacity 0.3s;
}
.formula-loader-phrase.fade { opacity: 0; }
.formula-loader-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--slate-light);
  margin-top: 1.25rem;
}
.formula-loader-dots {
  display: inline-flex;
  gap: 5px;
  margin-top: 1rem;
}
.formula-loader-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: loaderDot 1.2s ease-in-out infinite;
}
.formula-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.formula-loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loaderDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}
body.dark .formula-loader-card {
  background: #1e1812;
  border-color: rgba(201,169,110,0.2);
}

/* Empty state */
.empty-formula {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--slate-light);
}

.empty-formula svg { opacity: 0.2; margin-bottom: 0.75rem; }
.empty-formula p { font-size: 0.82rem; line-height: 1.6; }
@media (max-width: 900px) { .empty-formula { display: none !important; } }
@media (max-width: 600px) { #correctionEmptyState { display: none !important; } }

/* Notification toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--deep);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.8rem;
  z-index: 10100;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  border-left: 3px solid var(--gold);
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ── Dark Mode ── */
body.dark {
  --ink: #f0ece6; --parchment: #1a1612; --cream: #221e19;
  --gold: #c9a96e; --gold-light: #5a4a2a; --gold-dark: #e8c88a;
  --slate: #9ca3af; --slate-light: #6b7280; --mist: #2a2520;
  --deep: #f0ece6; --shadow: rgba(0,0,0,0.4);
}
body.dark .card { background:rgba(30,25,20,0.85); border-color:rgba(201,169,110,0.15); }
body.dark .field select, body.dark .field input, body.dark textarea { background:rgba(20,16,12,0.8); color:var(--ink); border-color:rgba(201,169,110,0.2); }
body.dark #corrDiagFields select { background:rgba(20,16,12,0.8); color:var(--ink); border-color:rgba(201,169,110,0.2); }
body.dark .formula-step { background:rgba(20,16,12,0.5); }
body.dark .correction-step { background:rgba(20,16,12,0.5); border-color:rgba(201,169,110,0.08); }
body.dark .colour-category { border-color:rgba(201,169,110,0.15); }
body.dark .colour-category-header { background:rgba(201,169,110,0.06); }
body.dark .modal { background:#1a1612; }
body.dark .zone-tab { color:var(--slate); border-color:rgba(201,169,110,0.2); }
body.dark .mode-btn { color:var(--slate); }
body.dark .history-item, body.dark .fav-item { background:rgba(30,25,20,0.6); }
body.dark .upload-area { background:rgba(20,16,12,0.4); }
body.dark .warning-badge.info { background:rgba(201,169,110,0.08); }
body.dark .warning-badge.caution { background:rgba(212,135,122,0.08); }
body.dark .warning-badge.allergy { background:rgba(180,80,80,0.06); }
body.dark .contra-item { border-color:rgba(201,169,110,0.15); color:var(--ink); }
body.dark .correction-btn { background: rgba(40,33,25,0.9); border-color: rgba(201,169,110,0.25); }
body.dark .correction-btn .corr-label { color: var(--ink); }
body.dark .correction-btn.active { background: rgba(201,169,110,0.15); border-color: var(--gold); }
body.dark .mobile-quick-btn { background: rgba(40,33,25,0.9); border-color: rgba(201,169,110,0.35); color: var(--ink); }
body.dark .header-btn { background: rgba(40,33,25,0.9); border-color: rgba(201,169,110,0.35); }
body.dark .btn-outline { background: rgba(40,33,25,0.8); border-color: rgba(201,169,110,0.35); color: var(--ink); }
body.dark .mode-btn { background: rgba(30,25,20,0.95); color: var(--slate); }

/* Mobile: hide category step, fold into step1b as a pill row */
@media (max-width: 600px) {
  #corrStep1 { display: none !important; }
  #corrCategoryPills { display: flex; }
}
body.dark .timer-label-input { background:rgba(20,16,12,0.6); color:var(--ink); }
body.dark .print-sheet { background:#1a1612; color:#f0ece6; }
.dark-toggle { background:none; border:1px solid rgba(201,169,110,0.3); border-radius:20px; padding:0.35rem 0.65rem; cursor:pointer; font-size:0.82rem; color:var(--slate); transition:all 0.2s; }
.dark-toggle:hover { border-color:var(--gold); color:var(--ink); }

/* ── Underlying Pigment ── */
.pigment-section { margin-top:0.75rem; padding:0.65rem 0.85rem; background:rgba(201,169,110,0.06); border:1px solid rgba(201,169,110,0.2); border-radius:8px; }
.pigment-row { display:flex; align-items:center; gap:0.65rem; font-size:0.78rem; color:var(--ink); line-height:1.5; }
.pigment-dot { width:16px; height:16px; border-radius:50%; flex-shrink:0; border:1px solid rgba(0,0,0,0.15); }
.pigment-label { font-family:'DM Mono',monospace; font-size:0.58rem; letter-spacing:0.15em; text-transform:uppercase; color:var(--slate); margin-bottom:0.3rem; }
.pigment-neutralise { font-size:0.75rem; color:var(--slate); margin-top:0.35rem; font-style:italic; }

/* ── Application Mode toggle ── */
.app-mode-toggle { display:flex; gap:0.4rem; margin-bottom:0.6rem; }
.app-mode-pill { flex:1; padding:0.4rem; border:1px solid rgba(201,169,110,0.25); border-radius:6px; background:var(--parchment); font-family:'Instrument Sans',sans-serif; font-size:0.72rem; font-weight:500; color:var(--slate); cursor:pointer; transition:all 0.15s; text-align:center; }
.app-mode-pill.active { background:rgba(201,169,110,0.15); border-color:var(--gold); color:var(--ink); }

/* ── Grey Blend mode ── */
.grey-mode-toggle { display:flex; gap:0.4rem; margin-top:0.5rem; }
.grey-mode-pill { flex:1; padding:0.35rem; border:1px solid rgba(201,169,110,0.2); border-radius:6px; background:var(--parchment); font-family:'Instrument Sans',sans-serif; font-size:0.7rem; color:var(--slate); cursor:pointer; transition:all 0.15s; text-align:center; }
.grey-mode-pill.active { background:rgba(201,169,110,0.12); border-color:var(--gold); color:var(--ink); font-weight:600; }

/* ── Fade Forecast ── */
.fade-forecast { margin-top:1rem; padding:1rem; background:rgba(107,158,120,0.06); border:1px solid rgba(107,158,120,0.2); border-radius:8px; }
.fade-forecast-title { font-family:'Cormorant Garamond',serif; font-size:1rem; font-weight:500; color:var(--ink); margin-bottom:0.6rem; display:flex; align-items:center; gap:0.5rem; }
.fade-row { display:flex; gap:0.5rem; margin-bottom:0.35rem; font-size:0.78rem; line-height:1.5; }
.fade-week { font-family:'DM Mono',monospace; font-size:0.6rem; color:var(--gold-dark); min-width:4.5rem; flex-shrink:0; margin-top:0.1rem; }
.fade-maintenance { font-size:0.74rem; color:var(--slate); margin-top:0.5rem; padding-top:0.5rem; border-top:1px solid rgba(201,169,110,0.15); font-style:italic; }

/* ── Elasticity Test Card ── */
.elasticity-card { margin-bottom:1.25rem; border:1px solid rgba(201,169,110,0.3); border-radius:12px; background:rgba(212,135,122,0.05); }
.elasticity-card-header { padding:0.75rem 1rem; background:rgba(201,169,110,0.08); display:flex; align-items:center; gap:0.5rem; font-family:'Cormorant Garamond',serif; font-size:1rem; font-weight:500; color:var(--ink); }
.elasticity-card-body { padding:1rem; }
.elasticity-steps { list-style:none; margin-bottom:0.75rem; }
.elasticity-steps li { font-size:0.78rem; color:var(--ink); padding:0.3rem 0; border-bottom:1px solid rgba(201,169,110,0.1); line-height:1.5; }
.elasticity-steps li:last-child { border-bottom:none; }
.elasticity-steps li b { color:var(--gold-dark); }
.elasticity-selector { display:flex; gap:0.5rem; }
.elasticity-btn { flex:1; padding:0.5rem; border:1px solid rgba(201,169,110,0.2); border-radius:6px; background:var(--parchment); font-family:'Instrument Sans',sans-serif; font-size:0.75rem; cursor:pointer; transition:all 0.15s; }
.elasticity-btn.pass { border-color:var(--success); color:#3a6b47; background:rgba(107,158,120,0.1); }
.elasticity-btn.fail { border-color:var(--danger); color:#7a2020; background:rgba(180,80,80,0.1); }
.btn-large.warning-state { background:#c97a7a; }
.btn-large.warning-state:hover { background:#a85a5a; }

/* ── Strand Test Card ── */
.strand-result-select { width:100%; padding:0.5rem 0.75rem; border:1px solid rgba(201,169,110,0.25); border-radius:6px; background:rgba(255,255,255,0.8); font-family:'Instrument Sans',sans-serif; font-size:0.82rem; color:var(--ink); appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9a96e'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 0.75rem center; padding-right:2rem; }
.strand-adjustment { margin-top:0.6rem; padding:0.6rem 0.85rem; border-radius:6px; font-size:0.78rem; line-height:1.5; }
.strand-adjustment.ok { background:rgba(107,158,120,0.1); border:1px solid rgba(107,158,120,0.3); color:#3a6b47; }
.strand-adjustment.warn { background:rgba(212,169,106,0.1); border:1px solid rgba(212,169,106,0.3); color:#7a5a20; }
.strand-adjustment.danger { background:rgba(180,80,80,0.1); border:1px solid rgba(180,80,80,0.3); color:#7a2020; }

/* ── Pre-pigmentation ── */
.prepig-step { background:rgba(201,169,110,0.08); border:1px solid rgba(201,169,110,0.25); border-radius:8px; padding:0.75rem 1rem; margin-bottom:0.75rem; }
.prepig-label { font-family:'DM Mono',monospace; font-size:0.58rem; letter-spacing:0.2em; text-transform:uppercase; color:var(--gold-dark); margin-bottom:0.4rem; }

/* ── Cost Calculator ── */
.cost-card { margin-top:1rem; padding:1rem; background:rgba(201,169,110,0.05); border:1px solid rgba(201,169,110,0.2); border-radius:8px; }
.cost-row { display:flex; justify-content:space-between; align-items:center; padding:0.3rem 0; font-size:0.78rem; border-bottom:1px solid rgba(201,169,110,0.1); }
.cost-row:last-child { border-bottom:none; }
.cost-row .cost-label { color:var(--slate); }
.cost-row .cost-value { font-family:'DM Mono',monospace; color:var(--ink); font-weight:500; }
.cost-row.total { padding-top:0.5rem; font-weight:600; color:var(--gold-dark); }

/* ── Settings Modal ── */
.settings-modal { max-width:520px; width:95%; max-height:80vh; overflow-y:auto; }
.settings-section { margin-bottom:1.25rem; }
.settings-section-title { font-family:'Cormorant Garamond',serif; font-size:0.95rem; font-weight:500; color:var(--ink); margin-bottom:0.6rem; padding-bottom:0.4rem; border-bottom:1px solid rgba(201,169,110,0.2); }
.cost-input-row { display:flex; align-items:center; gap:0.5rem; padding:0.35rem 0; font-size:0.78rem; }
.cost-input-row label { flex:1; color:var(--ink); }
.cost-input-row input { width:4.5rem; padding:0.3rem 0.5rem; border:1px solid rgba(201,169,110,0.25); border-radius:5px; font-family:'DM Mono',monospace; font-size:0.75rem; text-align:right; background:rgba(255,255,255,0.8); color:var(--ink); }

/* ── Stock Tracker ── */
.stock-row { display:flex; align-items:center; gap:0.5rem; padding:0.4rem 0; border-bottom:1px solid rgba(201,169,110,0.1); font-size:0.78rem; }
.stock-row:last-child { border-bottom:none; }
.stock-system { flex:1; color:var(--ink); }
.stock-tubes { font-family:'DM Mono',monospace; color:var(--slate); min-width:3.5rem; text-align:right; }
.stock-badge { font-size:0.6rem; font-family:'DM Mono',monospace; padding:0.15rem 0.45rem; border-radius:10px; background:rgba(201,169,110,0.15); color:var(--gold-dark); letter-spacing:0.05em; }
.stock-badge.reorder { background:rgba(212,135,122,0.2); color:#8b3e32; }
.stock-reset-btn { font-size:0.6rem; font-family:'DM Mono',monospace; color:var(--slate-light); background:none; border:none; cursor:pointer; padding:0 0.25rem; }
.stock-reset-btn:hover { color:var(--danger); }

/* ── Client Timeline ── */
.timeline-modal { max-width:560px; width:95%; max-height:85vh; overflow-y:auto; }
.timeline-entry { display:flex; gap:0.85rem; padding:0.85rem 0; border-bottom:1px solid rgba(201,169,110,0.1); position:relative; }
.timeline-entry:last-child { border-bottom:none; }
.timeline-dot-col { display:flex; flex-direction:column; align-items:center; gap:0; flex-shrink:0; width:20px; }
.timeline-dot { width:12px; height:12px; border-radius:50%; border:2px solid var(--gold); background:white; flex-shrink:0; margin-top:0.3rem; }
.timeline-line { flex:1; width:2px; background:rgba(201,169,110,0.2); min-height:20px; }
.timeline-content { flex:1; }
.timeline-date { font-family:'DM Mono',monospace; font-size:0.58rem; color:var(--slate-light); letter-spacing:0.15em; margin-bottom:0.2rem; }
.timeline-shade { font-weight:600; font-size:0.82rem; color:var(--ink); display:flex; align-items:center; gap:0.5rem; }
.timeline-swatch { width:12px; height:12px; border-radius:50%; flex-shrink:0; border:1px solid rgba(0,0,0,0.1); }
.timeline-meta { font-size:0.72rem; color:var(--slate); margin-top:0.2rem; line-height:1.5; }
.timeline-notes { font-size:0.72rem; color:var(--slate-light); font-style:italic; margin-top:0.2rem; }
.timeline-btn { font-size:0.62rem; font-family:'DM Mono',monospace; color:var(--gold-dark); background:none; border:1px solid rgba(201,169,110,0.3); border-radius:4px; padding:0.15rem 0.45rem; cursor:pointer; white-space:nowrap; }
.timeline-btn:hover { border-color:var(--gold); background:rgba(201,169,110,0.08); }

/* ── Settings gear btn ── */
.settings-gear { background:none; border:1px solid rgba(201,169,110,0.3); border-radius:20px; padding:0.35rem 0.65rem; cursor:pointer; font-size:0.82rem; color:var(--slate); transition:all 0.2s; }
.settings-gear:hover { border-color:var(--gold); color:var(--ink); }

body.dark .elasticity-card { background:rgba(30,20,20,0.4); }
body.dark .strand-result-select { background:rgba(20,16,12,0.8); color:var(--ink); }
body.dark .cost-input-row input { background:rgba(20,16,12,0.8); color:var(--ink); }
body.dark .timeline-dot { background:var(--parchment); }

/* ── Feature 1: Client Pattern Intelligence ── */
.insight-card { margin-top:0.75rem; padding:0.75rem; background:rgba(201,169,110,0.07); border:1px solid rgba(201,169,110,0.2); border-radius:8px; }
.insight-row { display:flex; align-items:flex-start; gap:0.5rem; font-size:0.76rem; color:var(--ink); line-height:1.5; padding:0.25rem 0; border-bottom:1px solid rgba(201,169,110,0.08); }
.insight-row:last-child { border-bottom:none; }
.insight-icon { font-size:0.85rem; flex-shrink:0; margin-top:0.05rem; }
.insight-label { font-family:'DM Mono',monospace; font-size:0.55rem; letter-spacing:0.15em; text-transform:uppercase; color:var(--gold-dark); margin-bottom:0.15rem; }

/* ── Feature 2: Outcome Debrief ── */
.debrief-modal { max-width:500px; width:95%; max-height:85vh; overflow-y:auto; }
.debrief-rating { display:grid; grid-template-columns:repeat(5,1fr); gap:0.4rem; margin:0.5rem 0; }
.debrief-star { aspect-ratio:1; border:1px solid rgba(201,169,110,0.25); border-radius:6px; background:var(--parchment); font-size:1rem; cursor:pointer; transition:all 0.15s; display:flex; align-items:center; justify-content:center; }
.debrief-star.active { background:rgba(201,169,110,0.15); border-color:var(--gold); }
.debrief-outcome-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.4rem; margin:0.5rem 0; }
.debrief-outcome-btn { padding:0.5rem; border:1px solid rgba(201,169,110,0.2); border-radius:6px; background:var(--parchment); font-size:0.72rem; color:var(--slate); cursor:pointer; transition:all 0.15s; text-align:center; line-height:1.3; }
.debrief-outcome-btn.active { background:rgba(201,169,110,0.12); border-color:var(--gold); color:var(--ink); font-weight:600; }
.debrief-textarea { width:100%; padding:0.6rem 0.75rem; border:1px solid rgba(201,169,110,0.25); border-radius:6px; background:rgba(255,255,255,0.05); font-family:'Instrument Sans',sans-serif; font-size:0.8rem; color:var(--ink); resize:vertical; min-height:72px; line-height:1.5; margin-top:0.5rem; }
.debrief-textarea:focus { outline:none; border-color:var(--gold); }
.correction-library-entry { padding:0.6rem 0.85rem; border:1px solid rgba(201,169,110,0.15); border-radius:6px; margin-bottom:0.4rem; font-size:0.78rem; }
.correction-library-entry .cl-shade { font-weight:600; color:var(--ink); }
.correction-library-entry .cl-meta { color:var(--slate); font-size:0.7rem; margin-top:0.15rem; }
.correction-library-entry .cl-lesson { color:var(--gold-dark); font-size:0.72rem; font-style:italic; margin-top:0.2rem; }

/* ── Feature 3: Environmental Profile ── */
.env-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.5rem; }
.env-btn { padding:0.5rem 0.6rem; border:1px solid rgba(201,169,110,0.2); border-radius:6px; background:var(--parchment); font-size:0.72rem; color:var(--slate); cursor:pointer; transition:all 0.15s; text-align:left; line-height:1.3; }
.env-btn.active { background:rgba(201,169,110,0.1); border-color:var(--gold); color:var(--ink); }
.env-note { font-size:0.74rem; color:var(--slate); font-style:italic; margin-top:0.5rem; padding:0.5rem; background:rgba(201,169,110,0.06); border-radius:6px; line-height:1.5; }

/* ── Feature 4: Consultation Flow ── */
.consultation-modal {
  max-width: 560px;
  width: 95%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.consultation-modal .consult-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.consultation-modal .consult-body.no-scroll {
  overflow: hidden;
}
/* Lock body scroll when any modal is open */
body.modal-open { overflow: hidden; }
body.modal-open > *:not(.modal-overlay) { touch-action: none; }
.modal-overlay.open { touch-action: auto; }
.consult-step { display:none; }
.consult-step.active { display:block; }
.consult-question { font-family:'Cormorant Garamond',serif; font-size:1.3rem; font-weight:400; color:var(--ink); margin-bottom:1rem; line-height:1.4; }
.consult-options { display:flex; flex-direction:column; gap:0.5rem; }
.consult-option { padding:0.75rem 1rem; border:1px solid rgba(201,169,110,0.25); border-radius:8px; background:var(--parchment); font-family:'Instrument Sans',sans-serif; font-size:0.82rem; color:var(--ink); cursor:pointer; transition:all 0.2s; text-align:left; line-height:1.4; }
.consult-option:hover { border-color:var(--gold); background:rgba(201,169,110,0.07); }
.consult-option.selected { border-color:var(--gold); background:rgba(201,169,110,0.12); font-weight:600; }
.consult-progress { display:flex; gap:0.3rem; margin-bottom:1.25rem; }
.consult-pip { flex:1; height:3px; border-radius:2px; background:rgba(201,169,110,0.2); transition:background 0.2s; }
.consult-pip.done { background:var(--gold); }
.consult-pip.active { background:rgba(201,169,110,0.5); }
.consult-text-input { width:100%; padding:0.7rem 0.85rem; border:1px solid rgba(201,169,110,0.3); border-radius:8px; background:rgba(255,255,255,0.6); font-family:'Instrument Sans',sans-serif; font-size:0.88rem; color:var(--ink); outline:none; }
.consult-text-input:focus { border-color:var(--gold); }

/* Client autocomplete dropdown */
.client-autocomplete {
  position:absolute; top:100%; left:0; right:0; z-index:200;
  background:var(--parchment); border:1px solid rgba(201,169,110,0.3);
  border-radius:0 0 8px 8px; box-shadow:0 8px 20px rgba(0,0,0,0.12);
  max-height:200px; overflow-y:auto;
}
.client-autocomplete-item {
  padding:0.55rem 0.85rem; cursor:pointer; font-size:0.82rem;
  border-bottom:1px solid rgba(201,169,110,0.08); transition:background 0.15s;
}
.client-autocomplete-item:hover { background:rgba(201,169,110,0.1); }
.client-autocomplete-item:last-child { border-bottom:none; }
.client-autocomplete-sub { font-size:0.68rem; color:var(--slate); margin-top:0.1rem; }

/* Client profile banner */
.client-profile-banner {
  margin-top:0.75rem; padding:0.65rem 0.85rem;
  background:rgba(201,169,110,0.07); border:1px solid rgba(201,169,110,0.2);
  border-radius:8px; font-size:0.75rem; line-height:1.6;
}
.cpb-row { display:flex; gap:0.5rem; align-items:flex-start; }
.cpb-label { color:var(--slate); min-width:80px; flex-shrink:0; }
.client-debrief-flag {
  display:inline-flex; align-items:center; gap:0.3rem;
  padding:0.2rem 0.5rem; border-radius:4px; font-size:0.68rem;
  font-family:'DM Mono',monospace; margin-top:0.4rem;
}
.client-debrief-flag.warn { background:rgba(180,100,60,0.12); color:#a06030; border:1px solid rgba(180,100,60,0.25); }
.client-debrief-flag.ok   { background:rgba(80,160,80,0.1); color:#4a8a4a; border:1px solid rgba(80,160,80,0.2); }

/* Client autocomplete dropdown */
.client-autocomplete {
  position:absolute; top:100%; left:0; right:0; z-index:200;
  background:var(--parchment); border:1px solid rgba(201,169,110,0.3);
  border-radius:0 0 8px 8px; box-shadow:0 8px 20px rgba(0,0,0,0.12);
  max-height:200px; overflow-y:auto;
}
.client-autocomplete-item {
  padding:0.55rem 0.85rem; cursor:pointer; font-size:0.82rem;
  border-bottom:1px solid rgba(201,169,110,0.08); transition:background 0.15s;
}
.client-autocomplete-item:hover { background:rgba(201,169,110,0.1); }
.client-autocomplete-item:last-child { border-bottom:none; }
.client-autocomplete-sub { font-size:0.68rem; color:var(--slate); margin-top:0.1rem; }
.client-profile-banner {
  margin-top:0.75rem; padding:0.65rem 0.85rem;
  background:rgba(201,169,110,0.07); border:1px solid rgba(201,169,110,0.2);
  border-radius:8px; font-size:0.75rem; line-height:1.6;
}
.client-profile-banner .cpb-label { color:var(--slate); min-width:80px; flex-shrink:0; font-size:0.68rem; }
.client-debrief-flag {
  display:inline-flex; align-items:center; gap:0.3rem;
  padding:0.2rem 0.5rem; border-radius:4px; font-size:0.68rem;
  font-family:'DM Mono',monospace; margin-top:0.4rem;
}
.client-debrief-flag.warn { background:rgba(180,100,60,0.12); color:#a06030; border:1px solid rgba(180,100,60,0.25); }
.client-debrief-flag.ok   { background:rgba(80,160,80,0.1); color:#4a8a4a; border:1px solid rgba(80,160,80,0.2); }

/* Client autocomplete dropdown */
.client-autocomplete {
  position:absolute;top:100%;left:0;right:0;z-index:200;
  background:var(--parchment);border:1px solid rgba(201,169,110,0.3);
  border-radius:0 0 8px 8px;box-shadow:0 8px 20px rgba(0,0,0,0.12);
  max-height:200px;overflow-y:auto;
}
.client-autocomplete-item {
  padding:0.55rem 0.85rem;cursor:pointer;font-size:0.82rem;
  border-bottom:1px solid rgba(201,169,110,0.08);transition:background 0.15s;
}
.client-autocomplete-item:hover { background:rgba(201,169,110,0.1); }
.client-autocomplete-item:last-child { border-bottom:none; }
.client-autocomplete-sub { font-size:0.68rem;color:var(--slate);margin-top:0.1rem; }
.client-profile-banner {
  margin-top:0.75rem;padding:0.65rem 0.85rem;
  background:rgba(201,169,110,0.07);border:1px solid rgba(201,169,110,0.2);
  border-radius:8px;font-size:0.75rem;line-height:1.6;
}
.client-profile-banner .cpb-row { display:flex;gap:0.5rem;align-items:flex-start; }
.client-profile-banner .cpb-label { color:var(--slate);min-width:80px;flex-shrink:0; }
.client-debrief-flag {
  display:inline-flex;align-items:center;gap:0.3rem;
  padding:0.2rem 0.5rem;border-radius:4px;font-size:0.68rem;
  font-family:'DM Mono',monospace;margin-top:0.4rem;
}
.client-debrief-flag.warn { background:rgba(180,100,60,0.12);color:#a06030;border:1px solid rgba(180,100,60,0.25); }
.client-debrief-flag.ok   { background:rgba(80,160,80,0.1);color:#4a8a4a;border:1px solid rgba(80,160,80,0.2); }
.consult-recommendation { padding:1rem; background:rgba(201,169,110,0.08); border:1px solid rgba(201,169,110,0.25); border-radius:10px; }
.consult-rec-shade { font-family:'Cormorant Garamond',serif; font-size:1.4rem; font-weight:500; color:var(--ink); margin-bottom:0.35rem; }
.consult-rec-why { font-size:0.78rem; color:var(--slate); line-height:1.6; }

/* ── Feature 5: Pricing Intelligence ── */
.pricing-intel { margin-top:0.5rem; padding:0.75rem; background:rgba(107,158,120,0.07); border:1px solid rgba(107,158,120,0.2); border-radius:8px; font-size:0.78rem; line-height:1.6; color:var(--ink); }
.pricing-intel strong { color:var(--gold-dark); }
.pricing-script { margin-top:0.5rem; padding:0.6rem 0.85rem; background:rgba(255,255,255,0.4); border-left:3px solid var(--gold); border-radius:0 6px 6px 0; font-size:0.76rem; color:var(--slate); font-style:italic; line-height:1.5; }

/* ── Feature 6: Client Share Card ── */
.share-card-modal { max-width:400px; width:95%; max-height:90vh; overflow-y:auto; }
.share-card { background:linear-gradient(135deg,#1a1410 0%,#2d2318 100%); border-radius:16px; padding:1.75rem; color:#f0ece6; font-family:'Instrument Sans',sans-serif; position:relative; overflow:hidden; min-height:200px; }
.share-card::before { content:''; position:absolute; top:-40px; right:-40px; width:160px; height:160px; border-radius:50%; background:rgba(201,169,110,0.08); }
.share-card-logo { font-family:'Cormorant Garamond',serif; font-size:1rem; font-weight:300; letter-spacing:0.12em; color:var(--gold); margin-bottom:1.25rem; }
.share-card-name { font-size:1.1rem; font-weight:600; margin-bottom:0.2rem; }
.share-card-shade { font-size:0.78rem; color:rgba(240,236,230,0.65); margin-bottom:1.25rem; }
.share-card-swatch { width:48px; height:48px; border-radius:50%; border:2px solid rgba(201,169,110,0.4); margin-bottom:1rem; }
.share-card-row { display:flex; justify-content:space-between; padding:0.4rem 0; border-bottom:1px solid rgba(255,255,255,0.07); font-size:0.75rem; }
.share-card-row:last-child { border-bottom:none; }
.share-card-label { color:rgba(240,236,230,0.5); }
.share-card-value { color:#f0ece6; font-weight:500; }
.share-card-footer { margin-top:1rem; font-family:'DM Mono',monospace; font-size:0.5rem; letter-spacing:0.2em; color:rgba(201,169,110,0.5); text-transform:uppercase; }

/* ── Feature 7: Formula Versioning ── */
.version-diff { margin-top:0.5rem; }
.version-diff-row { display:flex; gap:0.5rem; font-size:0.74rem; padding:0.3rem 0; border-bottom:1px solid rgba(201,169,110,0.08); align-items:baseline; }
.version-diff-row:last-child { border-bottom:none; }
.version-diff-field { font-family:'DM Mono',monospace; font-size:0.58rem; color:var(--slate); min-width:5rem; flex-shrink:0; }
.version-diff-old { color:var(--danger); text-decoration:line-through; opacity:0.7; }
.version-diff-new { color:var(--success); font-weight:600; }
.version-diff-arrow { color:var(--slate-light); flex-shrink:0; }

/* ── Feature 8: Education Layer ── */
.edu-layer { margin-top:0.75rem; border:1px solid rgba(201,169,110,0.15); border-radius:8px; }
.edu-header { padding:0.6rem 0.85rem; background:rgba(201,169,110,0.06); display:flex; justify-content:space-between; align-items:center; cursor:pointer; font-size:0.78rem; color:var(--ink); font-weight:500; }
.edu-body { padding:0.85rem; font-size:0.77rem; color:var(--slate); line-height:1.7; display:none; }
.edu-body.open { display:block; }
.edu-why { margin-bottom:0.5rem; }
.edu-why strong { color:var(--ink); }

/* ── Currency picker ── */
.currency-row { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.75rem; flex-wrap:wrap; }
.currency-btn { padding:0.3rem 0.7rem; border:1px solid rgba(201,169,110,0.25); border-radius:20px; background:var(--parchment); font-family:'DM Mono',monospace; font-size:0.65rem; cursor:pointer; color:var(--slate); transition:all 0.15s; }
.currency-btn.active { background:var(--gold); color:white; border-color:var(--gold); }

/* ── Consult launch btn ── */
.consult-launch { width:100%; padding:0.75rem 1rem; border:none; border-radius:8px; background:linear-gradient(135deg, var(--gold), var(--gold-dark)); font-family:'Instrument Sans',sans-serif; font-size:0.85rem; font-weight:600; color:white; cursor:pointer; transition:all 0.2s; margin-bottom:1.25rem; display:flex; align-items:center; justify-content:center; gap:0.5rem; box-shadow:0 4px 14px rgba(201,169,110,0.35); }
.consult-launch:hover { transform:translateY(-1px); box-shadow:0 6px 20px rgba(201,169,110,0.45); }

body.dark .debrief-textarea { background:rgba(20,16,12,0.6); color:var(--ink); }
body.dark .share-card { box-shadow:0 8px 32px rgba(0,0,0,0.5); }

/* ── Help Tooltips ── */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(201,169,110,0.5);
  font-family: 'DM Mono', monospace;
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--gold-dark);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 0.3rem;
  position: relative;
  background: transparent;
  user-select: none;
}
.help-tip:hover { background: var(--gold); color: white; border-color: var(--gold); }

/* Tooltip bubble — fixed position, placed by JS */
#helpTipBubble {
  position: fixed;
  z-index: 9999;
  background: var(--deep);
  color: var(--parchment);
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  width: 220px;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  border: 1px solid rgba(201,169,110,0.2);
  display: none;
}
#helpTipBubble.visible { display: block; }
#helpTipArrow {
  position: fixed;
  z-index: 9999;
  width: 0;
  height: 0;
  pointer-events: none;
  display: none;
}
#helpTipArrow.visible { display: block; }
body.dark #helpTipBubble { background: #2d2318; border-color: rgba(201,169,110,0.3); color: #f0ece6; }

/* ── Floating Timer Widget ── */
.floating-timer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.floating-timer-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(201,169,110,0.45);
  color: white;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  gap: 0;
}
.floating-timer-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(201,169,110,0.55);
}
.floating-timer-fab.running {
  background: linear-gradient(135deg, var(--gold-dark), #9a6030);
  animation: timerPulse 2s ease-in-out infinite;
}
.floating-timer-fab.urgent {
  background: linear-gradient(135deg, var(--danger), #a04040);
  animation: timerPulse 0.8s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(201,169,110,0.45); }
  50% { box-shadow: 0 4px 28px rgba(201,169,110,0.7); }
}

.floating-timer-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  color: white;
  letter-spacing: 0.05em;
  line-height: 1;
}

.floating-timer-panel {
  display: none;
  background: var(--parchment);
  border: 1px solid rgba(201,169,110,0.3);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 40px rgba(26,20,16,0.18);
  width: 260px;
  flex-direction: column;
  gap: 0.6rem;
}
.floating-timer-panel.open {
  display: flex;
}

.floating-timer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.15rem;
}

.floating-timer-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 1.2rem;
}

.floating-timer-panel .timer-display {
  font-size: 2.4rem;
  text-align: center;
  line-height: 1;
  margin: 0.25rem 0;
}

.floating-timer-panel .timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.floating-timer-panel .timer-label-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 5px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.75rem;
  color: var(--ink);
  background: rgba(255,255,255,0.6);
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .floating-timer {
    bottom: 1rem;
    right: 1rem;
  }
  .floating-timer-panel {
    width: calc(100vw - 2rem);
    right: 0;
  }
}

/* ── Timer ── */
.timer-widget { border:1px solid rgba(201,169,110,0.2); border-radius:8px; overflow:hidden; }
.timer-header { padding:0.5rem 0.85rem; background:rgba(201,169,110,0.08); font-family:'DM Mono',monospace; font-size:0.6rem; letter-spacing:0.2em; text-transform:uppercase; color:var(--slate); display:flex; justify-content:space-between; align-items:center; }
.timer-body { padding:0.85rem; display:flex; flex-direction:column; gap:0.6rem; }
.timer-display { font-family:'Cormorant Garamond',serif; font-size:3rem; font-weight:300; text-align:center; letter-spacing:0.05em; color:var(--ink); line-height:1; transition:color 0.3s; }
.timer-display.running { color:var(--gold-dark); }
.timer-display.urgent { color:var(--danger); animation:pulse 1s ease infinite; }
.timer-display.done { color:var(--success); }
.timer-presets { display:flex; flex-wrap:wrap; gap:0.35rem; }
.timer-preset { padding:0.3rem 0.6rem; border:1px solid rgba(201,169,110,0.25); border-radius:4px; font-family:'DM Mono',monospace; font-size:0.62rem; cursor:pointer; color:var(--slate); background:var(--parchment); transition:all 0.15s; }
.timer-preset:hover { border-color:var(--gold); color:var(--ink); }
.timer-label-input { flex:1; padding:0.4rem 0.6rem; border:1px solid rgba(201,169,110,0.2); border-radius:5px; font-family:'Instrument Sans',sans-serif; font-size:0.75rem; color:var(--ink); background:rgba(255,255,255,0.05); }
.timer-note { font-family:'DM Mono',monospace; font-size:0.6rem; color:var(--slate-light); text-align:center; min-height:1rem; }

/* ── Contra-indications ── */
.contra-list { display:flex; flex-direction:column; gap:0.4rem; margin-bottom:0.75rem; }
.contra-item { display:flex; align-items:center; gap:0.6rem; padding:0.5rem 0.65rem; border:1px solid rgba(201,169,110,0.15); border-radius:6px; cursor:pointer; font-size:0.78rem; color:var(--ink); user-select:none; transition:border-color 0.15s; }
.contra-item:hover { border-color:var(--gold); }
.contra-item input[type=checkbox] { accent-color:var(--gold); width:14px; height:14px; flex-shrink:0; cursor:pointer; }
.contra-flag { padding:0.65rem 0.85rem; background:rgba(180,80,80,0.08); border:1px solid rgba(180,80,80,0.25); border-radius:6px; font-size:0.78rem; color:#8b3e32; line-height:1.5; display:none; }
.contra-flag.visible { display:block; }

/* ── Formula notes ── */
.formula-notes-field { width:100%; padding:0.6rem 0.75rem; border:1px solid rgba(201,169,110,0.25); border-radius:6px; background:rgba(255,255,255,0.05); font-family:'Instrument Sans',sans-serif; font-size:0.82rem; color:var(--ink); resize:vertical; min-height:64px; line-height:1.5; transition:border-color 0.2s; }
.formula-notes-field:focus { outline:none; border-color:var(--gold); }
.formula-notes-field::placeholder { color:var(--slate-light); }

/* ── Hair condition ── */
.condition-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.4rem; margin-bottom:0.5rem; }
.condition-btn { padding:0.5rem 0.6rem; border:1px solid rgba(201,169,110,0.2); border-radius:6px; background:var(--parchment); font-family:'Instrument Sans',sans-serif; font-size:0.74rem; color:var(--slate); cursor:pointer; transition:all 0.15s; text-align:left; line-height:1.3; }
.condition-btn .cond-label { font-weight:600; display:block; }
.condition-btn .cond-sub { font-size:0.62rem; color:var(--slate-light); }
.condition-btn.active { background:rgba(201,169,110,0.12); border-color:var(--gold); color:var(--ink); }
.condition-btn.active .cond-sub { color:var(--gold-dark); }

/* ── Print sheet ── */
@media print { body > *:not(#printSheet) { display:none !important; } #printSheet { display:block !important; position:static !important; } .print-close,.print-actions { display:none !important; } }
.print-sheet { display:none; position:fixed; inset:0; background:white; z-index:999; padding:2rem; overflow-y:auto; font-family:'Instrument Sans',sans-serif; color:#1a1410; }
.print-sheet.open { display:block; }
.print-sheet-logo { font-family:'Cormorant Garamond',serif; font-size:1.6rem; font-weight:300; letter-spacing:0.08em; }
.print-sheet-logo span { color:#c9a96e; }
.print-sheet-meta { font-family:'DM Mono',monospace; font-size:0.65rem; color:#6b7280; text-align:right; line-height:1.8; }
.print-close { position:fixed; top:1rem; right:1rem; background:#1a1410; color:white; border:none; border-radius:6px; padding:0.5rem 1rem; font-size:0.8rem; cursor:pointer; z-index:1000; }
.print-actions { display:flex; gap:0.5rem; position:fixed; bottom:1.5rem; right:1.5rem; }

/* ── Favourites ── */
.fav-list { display:flex; flex-direction:column; gap:0.4rem; }
.fav-item { padding:0.6rem 0.85rem; border:1px solid rgba(201,169,110,0.15); border-radius:6px; display:flex; justify-content:space-between; align-items:center; cursor:pointer; transition:all 0.15s; }
.fav-item:hover { border-color:var(--gold); background:rgba(201,169,110,0.05); }
.fav-item-name { font-size:0.82rem; font-weight:500; }
.fav-item-meta { font-family:'DM Mono',monospace; font-size:0.6rem; color:var(--slate); margin-top:0.15rem; }
.fav-btn { background:none; border:none; cursor:pointer; font-size:1rem; padding:0.15rem 0.25rem; color:var(--slate-light); transition:all 0.15s; }
.fav-btn.starred { color:var(--gold); }

/* ── Multi-formula ── */
.formula-tabs { display:flex; gap:0.4rem; flex-wrap:wrap; margin-bottom:0.75rem; align-items:center; }
.formula-tab { padding:0.35rem 0.75rem; border:1px solid rgba(201,169,110,0.25); border-radius:20px; font-size:0.72rem; font-family:'DM Mono',monospace; cursor:pointer; color:var(--slate); background:var(--parchment); transition:all 0.15s; display:flex; align-items:center; gap:0.35rem; }
.formula-tab.active { background:var(--gold); color:white; border-color:var(--gold); }
.formula-tab-remove { font-size:0.6rem; opacity:0.6; line-height:1; padding:0 0.1rem; margin-left:0.1rem; }
.formula-tab-remove:hover { opacity:1; }
.add-formula-btn { padding:0.35rem 0.65rem; border:1px dashed rgba(201,169,110,0.35); border-radius:20px; font-size:0.72rem; font-family:'DM Mono',monospace; cursor:pointer; color:var(--gold-dark); background:var(--parchment); transition:all 0.15s; }
.add-formula-btn:hover { border-color:var(--gold); background:rgba(201,169,110,0.06); }


/* ── Patch Test Tracker ── */
.patch-test-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  margin-bottom: 0.6rem;
  border: 1px solid transparent;
}
.patch-test-status.clear { background: rgba(107,158,120,0.1); border-color: rgba(107,158,120,0.3); color: #3a6b47; }
.patch-test-status.warning { background: rgba(212,169,106,0.1); border-color: rgba(212,169,106,0.3); color: #7a5a20; }
.patch-test-status.overdue { background: rgba(180,80,80,0.1); border-color: rgba(180,80,80,0.3); color: #7a2020; }
.patch-test-status.none { background: rgba(201,169,110,0.06); border-color: rgba(201,169,110,0.2); color: var(--slate); }
.patch-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.patch-dot.clear { background: #6b9e78; }
.patch-dot.warning { background: #d4a96a; }
.patch-dot.overdue { background: #c97a7a; }
.patch-dot.none { background: var(--slate-light); }

/* ── Before/After Gallery ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}
.gallery-pair {
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.gallery-pair:hover { border-color: var(--gold); transform: scale(1.02); }
.gallery-pair-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.gallery-pair-images img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.gallery-pair-meta {
  padding: 0.45rem 0.6rem;
  background: rgba(201,169,110,0.06);
  border-top: 1px solid rgba(201,169,110,0.12);
}
.gallery-pair-name { font-size: 0.74rem; font-weight: 600; color: var(--ink); }
.gallery-pair-date { font-family: 'DM Mono', monospace; font-size: 0.58rem; color: var(--slate); margin-top: 0.1rem; }
.gallery-pair-shade { font-family: 'DM Mono', monospace; font-size: 0.58rem; color: var(--gold-dark); }
.gallery-upload-btn {
  border: 1.5px dashed rgba(201,169,110,0.35);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.03);
  color: var(--slate);
  font-size: 0.78rem;
  line-height: 1.5;
}
.gallery-upload-btn:hover { border-color: var(--gold); color: var(--gold-dark); background: rgba(201,169,110,0.05); }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  z-index: 500; display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem; padding: 1.5rem;
}
.lightbox.open { display: flex; }
.lightbox-images { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 700px; width: 100%; }
.lightbox-images img { width: 100%; border-radius: 8px; object-fit: cover; max-height: 60vh; }
.lightbox-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 700px; width: 100%; }
.lightbox-label { font-family: 'DM Mono', monospace; font-size: 0.65rem; color: rgba(255,255,255,0.5); text-align: center; letter-spacing: 0.1em; }
.lightbox-meta { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; color: rgba(255,255,255,0.8); text-align: center; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; opacity: 0.7; }
.lightbox-close:hover { opacity: 1; }
.lightbox-delete { background: rgba(180,80,80,0.2); border: 1px solid rgba(180,80,80,0.4); color: #c97a7a; border-radius: 6px; padding: 0.4rem 0.85rem; font-size: 0.75rem; cursor: pointer; font-family: 'Instrument Sans', sans-serif; }

/* ── Colour Correction Mode ── */
.correction-flow { display: flex; flex-direction: column; gap: 0.85rem; }
.correction-problem-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
#corrCategoryGrid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 380px) { #corrCategoryGrid { grid-template-columns: 1fr 1fr; } }
.corr-step-card { animation: fadeSlideUp 0.25s ease both; }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.correction-btn {
  padding: 0.6rem 0.75rem; border: 1px solid rgba(201,169,110,0.2);
  border-radius: 6px; background: var(--parchment); cursor: pointer;
  font-family: 'Instrument Sans', sans-serif; font-size: 0.74rem;
  color: var(--slate); transition: all 0.15s; text-align: left; line-height: 1.3;
}
.correction-btn .corr-icon { font-size: 1rem; display: block; margin-bottom: 0.2rem; }
.correction-btn .corr-label { font-weight: 600; display: block; color: var(--ink); }
.correction-btn .corr-sub { font-size: 0.62rem; color: var(--slate-light); }
.correction-btn.active { background: rgba(201,169,110,0.12); border-color: var(--gold); }
.correction-btn.active .corr-sub { color: var(--gold-dark); }
.corr-pill {
  padding: 0.35rem 0.7rem; border: 1px solid rgba(201,169,110,0.3);
  border-radius: 20px; background: var(--parchment); cursor: pointer;
  font-family: 'Instrument Sans', sans-serif; font-size: 0.72rem;
  font-weight: 500; color: var(--slate); transition: all 0.15s; white-space: nowrap;
}
.corr-pill.active { background: rgba(201,169,110,0.15); border-color: var(--gold); color: var(--ink); font-weight: 600; }
body.dark .corr-pill { background: rgba(40,33,25,0.9); border-color: rgba(201,169,110,0.3); color: var(--slate); }
body.dark .corr-pill.active { background: rgba(201,169,110,0.18); border-color: var(--gold); color: var(--ink); }
/* Disabled generate button */
.btn-gold:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
/* Dark mode — icon and text visibility fixes */
body.dark .correction-btn .corr-sub { color: rgba(201,169,110,0.5); }
body.dark .correction-btn .corr-icon { filter: none; opacity: 0.9; }
body.dark .correction-step-num { background: rgba(201,169,110,0.15); color: var(--gold-dark); border-color: rgba(201,169,110,0.25); }
body.dark .corr-step-card { background: rgba(30,25,20,0.85); }
body.dark .section-label { color: var(--slate); }
body.dark .help-tip { color: var(--gold-dark); border-color: rgba(201,169,110,0.4); }
body.dark .target-preview-header { background: rgba(201,169,110,0.07); color: var(--ink); }
body.dark .correction-warning { background: rgba(180,80,80,0.08); border-color: rgba(180,80,80,0.25); color: #c97070; }
body.dark #corrStep1bTitle { color: var(--ink); }
.correction-result {
  /* Output container — shown via innerHTML injection */
}
.correction-result-title {
  font-family: 'Cormorant Garamond', serif; font-size: 1.05rem;
  font-weight: 500; color: var(--ink); margin-bottom: 0.6rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.correction-step {
  display: flex; gap: 0.65rem; align-items: flex-start;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.5);
  border-radius: 6px;
  border: 1px solid rgba(201,169,110,0.1);
  margin-bottom: 0.35rem;
  font-size: 0.8rem; line-height: 1.5; color: var(--ink);
}
.correction-step:last-child { margin-bottom: 0; }
.correction-step-num {
  width: 20px; height: 20px; background: var(--gold); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 0.6rem; flex-shrink: 0; margin-top: 1px;
}
.correction-warning {
  margin-top: 0.75rem; padding: 0.6rem 0.85rem;
  background: rgba(180,80,80,0.08); border: 1px solid rgba(180,80,80,0.2);
  border-radius: 6px; font-size: 0.75rem; color: var(--danger); line-height: 1.5;
}

/* ── Mode selector (Standard / Correction) ── */
.app-mode-bar {
  display: flex; gap: 0; border: 1px solid rgba(201,169,110,0.25);
  border-radius: 8px; overflow: hidden; margin-bottom: 1.25rem;
}
.app-mode-bar-btn {
  flex: 1; padding: 0.7rem 0.5rem; background: var(--parchment); border: none;
  font-family: 'Instrument Sans', sans-serif; font-size: 0.78rem; font-weight: 500;
  color: var(--slate); cursor: pointer; transition: all 0.2s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
}
.app-mode-bar-btn .mode-icon { font-size: 1rem; }
.app-mode-bar-btn.active { background: var(--gold); color: white; }
.app-mode-bar-btn + .app-mode-bar-btn { border-left: 1px solid rgba(201,169,110,0.25); }


/* ===== GALLERY EXPORT STYLES ===== */
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Helvetica Neue', Arial, sans-serif; background: #faf8f4; color: #1a1410; padding: 32px 24px; }
  h1 { font-family: Georgia, serif; font-size: 22px; font-weight: 400; color: #9a845a; margin-bottom: 4px; letter-spacing: 0.04em; }
  .meta { font-size: 12px; color: #aaa; font-family: monospace; margin-bottom: 24px; }
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
  @media print {
    body { background: white; padding: 16px; }
    .grid { grid-template-columns: repeat(2, 1fr); }
    h1, .meta { text-align: center; }
  }
