/* Clarins Gondola Audit Pilot — visual approximation of the Clarins retail
   identity from reference photos seen in this project (not an official
   brand kit): deep crimson, ivory background, charcoal text, gold accent
   for the Premium tier. */

:root {
  --red: #a6192e;
  --red-dark: #7d1322;
  --gold: #b08d57;
  --ivory: #f7f3ec;
  --ivory-deep: #efe8db;
  --charcoal: #2b2620;
  --muted: #746a5c;
  --line: #e3dacb;
  --ok: #3f7a4d;
  --warn: #b07d1f;
  --bad: #a6192e;
  --radius: 2px;
  --shadow: 0 8px 24px rgba(43, 38, 32, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ivory);
  color: var(--charcoal);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--ivory);
}

.wordmark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  letter-spacing: 0.35em;
  color: var(--red);
  text-indent: 0.35em; /* optically re-center after letter-spacing */
}

.subtitle {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.screen h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--charcoal);
}

.muted { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.card-narrow { max-width: 420px; margin: 0 auto; }

form#form-login { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

input[type="password"], input[type="text"] {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--ivory);
  color: var(--charcoal);
}
input:focus { outline: 2px solid var(--red); outline-offset: 1px; }

.btn {
  padding: 13px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: #fff; color: var(--red); border-color: var(--red); }
.btn-secondary:hover { background: var(--ivory-deep); }

.error { color: var(--bad); font-size: 13px; margin-top: 12px; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}
.grid-cards-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 640px) {
  .grid-cards, .grid-cards-3 { grid-template-columns: 1fr; }
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.option-card:hover { border-color: var(--red); transform: translateY(-1px); }
.option-card.selected { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.option-card-disabled { cursor: default; opacity: 0.45; }
.option-card-disabled:hover { border-color: var(--line); transform: none; }

.sketch { width: 88px; height: 74px; color: var(--charcoal); }
.option-title { font-size: 15px; font-weight: 600; }
.option-desc { font-size: 12px; color: var(--muted); }

.tier-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.tier-card:hover { border-color: var(--red); transform: translateY(-1px); }
.tier-card.selected { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.tier-card-premium { border-color: var(--gold); }
.tier-card-premium:hover, .tier-card-premium.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.tier-name {
  font-family: Georgia, serif;
  font-size: 18px;
}
.tier-card-premium .tier-name { color: var(--gold); }
.tier-desc { font-size: 13px; color: var(--charcoal); margin-bottom: 4px; }
.tier-meta { font-size: 12px; color: var(--muted); }
.tier-unavailable-note {
  margin-top: 6px;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

.link-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 12px;
}
.link-back:hover { color: var(--red); }

.model-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.model-choice-label { font-size: 13px; color: var(--muted); }
.model-choice-options { display: flex; gap: 8px; flex-wrap: wrap; }
.model-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.model-option:hover { border-color: var(--gold); }
.model-option.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); color: var(--gold); }
.model-option-cost { font-size: 11px; color: var(--muted); }
.model-option.selected .model-option-cost { color: var(--gold); }

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 18px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
}
.dropzone:hover { border-color: var(--red); }
#preview-img { max-width: 100%; max-height: 260px; border-radius: var(--radius); }

/* --- loader --- */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 60vh;
  text-align: center;
}
.loader-mark {
  font-family: Georgia, serif;
  font-size: 22px;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: var(--red);
}
.loader-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--red);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-message {
  font-size: 15px;
  color: var(--charcoal);
  min-height: 22px;
  transition: opacity 0.3s ease;
}
.loader-eta { font-size: 12px; color: var(--muted); }
.loader-note { font-size: 13px; color: var(--charcoal); margin-top: 10px; max-width: 320px; }
#btn-goto-history-from-loader { margin-top: 10px; }

/* --- history --- */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.history-item:hover { border-color: var(--red); }
.history-main { display: flex; flex-direction: column; gap: 3px; }
.history-title { font-size: 14px; font-weight: 600; }
.history-meta { font-size: 12px; color: var(--muted); }
.history-empty { font-size: 14px; color: var(--muted); padding: 20px 0; }

.status-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.status-processing { background: #f6ecd8; color: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
.status-done { background: #e7f1e8; color: var(--ok); }
.status-error { background: #f7e2e5; color: var(--bad); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* --- result --- */
.score-hero {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 6px;
}
.score-number { font-family: Georgia, serif; font-size: 52px; color: var(--red); }
.score-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--ivory-deep);
  color: var(--charcoal);
}
.score-badge.ok { background: #e7f1e8; color: var(--ok); }
.score-badge.warn { background: #f6ecd8; color: var(--warn); }
.score-badge.bad { background: #f7e2e5; color: var(--bad); }

.result-meta { font-size: 12px; color: var(--muted); margin-bottom: 26px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.tile-value { font-size: 22px; font-weight: 600; }
.tile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.summary-box {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 14px;
  margin-bottom: 28px;
}

.shelf-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.shelf-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.shelf-pct { color: var(--muted); font-weight: 400; font-size: 13px; }

table.tester-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
table.tester-table td { padding: 6px 4px; border-bottom: 1px solid var(--ivory-deep); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.tag-present { background: #e7f1e8; color: var(--ok); }
.tag-missing { background: #f7e2e5; color: var(--bad); }
.tag-notvisible { background: var(--ivory-deep); color: var(--muted); }
.tag-note { font-size: 11px; color: var(--muted); }

.action-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--charoal); }
.action-list li { margin-bottom: 4px; }

/* Resultado visual (foto anotada) - cierra el informe, ver motor.anotar_foto */
.visual-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 22px;
}
.visual-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.visual-hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.7; }
.visual-photo { font-size: 13px; color: var(--muted); }
/* La foto es alta y angosta: se limita el alto para que el informe no obligue a
   un scroll larguisimo, y se deja hacer zoom tocandola en el movil. */
.visual-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.visual-zoom { font-size: 12px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: #1e9e5a; }
.dot-missing { background: #d32f2f; }
.dot-unknown { background: #757575; }

.notice-list { list-style: none; margin: 0 0 24px; padding: 0; }
.notice-list li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  background: #fff;
}

#btn-restart { display: block; margin: 20px auto 0; }

/* --- admin panel --- */
.admin-h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  margin: 26px 0 8px;
  color: var(--charcoal);
}
.admin-count { font-size: 13px; color: var(--muted); }
.admin-scroll { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line);
}
.admin-table th, .admin-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--ivory-deep);
  white-space: nowrap;
}
.admin-table th {
  background: var(--ivory-deep);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[hidden] { display: none !important; }

/* ---- Guia de encuadre y pre-check de calidad (pantalla de upload) ---- */

.framing-guide {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ivory-deep);
}
.framing-guide svg { width: 76px; height: 64px; flex: 0 0 auto; }
.guide-frame { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 3; }
.guide-band { fill: var(--red); opacity: 0.55; }
.guide-split { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.framing-tip { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

.quality-panel { margin: 14px 0 4px; }
.quality-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.quality-verdict { font-size: 14px; font-weight: 600; }
.quality-verdict.is-ok { color: var(--ok); }
.quality-verdict.is-warning { color: var(--warn); }
.quality-verdict.is-reject { color: var(--bad); }
.quality-score { font-size: 12px; color: var(--muted); }

.quality-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.quality-item:last-child { border-bottom: none; }
.quality-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 50%;
}
.quality-item.is-warning .quality-dot { background: var(--warn); }
.quality-item.is-reject .quality-dot { background: var(--bad); }
.quality-title { margin: 0 0 2px; font-size: 13px; font-weight: 600; }
.quality-tip { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.quality-action {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}
.quality-checking { font-size: 13px; color: var(--muted); margin: 0; padding: 8px 0; }
.quality-retake { margin-top: 12px; }
