:root {
  --bg: #f7f7f4;
  --navy: #16315b;
  --cobalt: #2c6fbf;
  --card: #ffffff;
  --line: #e3e3dc;
  --radius: 10px;
}

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

body {
  background: var(--bg);
  color: var(--navy);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 40px 20px 80px; }

.brand-label {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cobalt);
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 600;
  margin: 6px 0 30px;
}

h2 {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-bottom: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.hidden { display: none !important; }

/* login */
.login-wrap {
  max-width: 380px;
  margin: 14vh auto 0;
  padding: 0 20px;
  text-align: center;
}
.login-wrap .card { text-align: left; }

label { display: block; font-size: 14px; margin-bottom: 6px; }

input[type="password"], input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 14px;
}

button, .btn {
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 11px 22px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--cobalt); }
button.secondary { background: transparent; color: var(--navy); border: 1px solid var(--line); }
button.secondary:hover { border-color: var(--cobalt); color: var(--cobalt); background: transparent; }
button:disabled { opacity: 0.5; cursor: default; }

.error { color: #a33; font-size: 14px; margin-bottom: 12px; }

/* dropzone */
#dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  color: #6b7688;
  cursor: pointer;
  transition: border-color 0.15s;
}
#dropzone.dragover, #dropzone:hover { border-color: var(--cobalt); color: var(--cobalt); }
#file-name { font-size: 14px; color: var(--cobalt); margin-top: 10px; }

#file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.file-item {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
}
.file-item:hover { background: transparent; border-color: var(--cobalt); color: var(--cobalt); }
.file-item.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.file-item.active:hover { background: var(--navy); color: #fff; }

/* ai instructions */
.ai-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.ai-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
#ai-note { white-space: pre-line; margin-top: 10px; }

/* palette mapping */
.map-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.map-row:last-child { border-bottom: 0; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.map-row .hex { font-family: ui-monospace, Menlo, monospace; font-size: 13px; width: 80px; }
.map-row .pct { font-size: 12px; color: #6b7688; width: 54px; }
.map-row .arrow { color: var(--cobalt); }
.map-row input[type="color"] {
  width: 42px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  background: #fff;
  cursor: pointer;
}
.map-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); }

.tolerance {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px; font-size: 14px;
}
.tolerance input[type="range"] { flex: 1; accent-color: var(--cobalt); }

/* preview */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare figure { margin: 0; }
.compare figcaption {
  font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
  color: #6b7688; margin-bottom: 8px;
}
.compare img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 / 16px 16px;
}

/* protection zones */
#zone-wrap { position: relative; display: inline-block; width: 100%; cursor: crosshair; }
#zone-wrap img { display: block; user-select: none; -webkit-user-drag: none; }
.zone {
  position: absolute;
  border: 2px dashed var(--cobalt);
  background: rgba(44, 111, 191, 0.18);
  cursor: pointer;
}
.zone::after {
  content: "protegida";
  position: absolute;
  top: 2px; left: 4px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 5px;
  border-radius: 3px;
}

/* progress */
.progress-track {
  background: var(--line);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  margin: 14px 0;
}
#progress-bar {
  background: var(--cobalt);
  height: 100%;
  width: 0;
  transition: width 0.4s;
}

.actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.note { font-size: 13px; color: #6b7688; margin-top: 10px; }

@media (max-width: 640px) {
  .compare { grid-template-columns: 1fr; }
  .map-row .pct { display: none; }
}
