:root {
  --ikea-blue: #0058a3;
  --ikea-yellow: #ffdb00;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 88, 163, 0.08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.header {
  background: var(--ikea-blue);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.loading-bar {
  position: sticky;
  top: 56px;
  z-index: 99;
  height: 4px;
  background: rgba(0, 88, 163, .12);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ikea-yellow), #ffed4e);
  transition: width .25s ease;
}

body.is-processing .btn-primary {
  animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 88, 163, .35); }
  50% { box-shadow: 0 0 0 6px rgba(0, 88, 163, 0); }
}

.inline-status {
  margin-top: .75rem;
  padding: .65rem .85rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ikea-blue);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: .85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo { font-weight: 700; font-size: 1rem; display: block; }
.brand-sub { font-size: .75rem; opacity: .85; }

.header-actions { display: flex; gap: .5rem; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
  transition: background .2s;
}

.btn-icon:hover { background: rgba(255,255,255,.25); }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ikea-blue);
  margin-bottom: .35rem;
}

.hero p { color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: .35rem;
  margin-bottom: 1rem;
  background: var(--bg);
  padding: .25rem;
  border-radius: 10px;
}

.tab {
  flex: 1;
  padding: .55rem .5rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
}

.tab.active {
  background: var(--card);
  color: var(--ikea-blue);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

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

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .4rem;
  color: var(--text);
}

textarea, input[type="email"] {
  width: 100%;
  padding: .75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color .2s;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--ikea-blue);
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.upload-zone.dragover {
  border-color: var(--ikea-blue);
  background: rgba(0, 88, 163, .04);
}

.upload-zone .hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--ikea-blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.file-name { font-size: .85rem; color: var(--muted); margin-top: .5rem; }

.btn-primary {
  width: 100%;
  margin-top: 1rem;
  padding: .9rem;
  background: var(--ikea-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background .2s, transform .1s;
}

.btn-primary:hover { background: #004080; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  padding: .75rem 1.25rem;
  background: var(--ikea-yellow);
  color: var(--text);
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-full {
  width: 100%;
  padding: .9rem 1.25rem;
  font-size: 1rem;
}

.btn-cta {
  padding: .9rem 1.25rem;
  background: var(--ikea-yellow);
  color: var(--text);
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.btn-cta:active { transform: scale(.98); }

.cta-block {
  margin: .25rem 0 .5rem;
}

.cta-block-bottom {
  margin-top: 1rem;
  margin-bottom: .5rem;
}

.cta-hint {
  margin-top: .45rem;
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
}

.section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ikea-blue);
  margin: .5rem 0 .65rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.spinner-dark {
  border-color: rgba(0, 88, 163, .2);
  border-top-color: var(--ikea-blue);
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-card {
  margin-top: 1rem;
  padding: 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  border-left: 4px solid var(--ikea-blue);
}

.progress-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .85rem;
}

.progress-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--ikea-blue);
}

.progress-sub {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .15rem;
}

.progress-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ikea-blue), #0077cc);
  border-radius: 999px;
  transition: width .25s ease;
}

.progress-meta {
  margin-top: .6rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text);
}

.progress-current {
  margin-top: .25rem;
  font-size: .8rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.eta-card h3 {
  font-size: .95rem;
  margin-bottom: .5rem;
  color: var(--ikea-blue);
}

.eta-list {
  list-style: none;
  font-size: .88rem;
  margin-bottom: .5rem;
}

.eta-list li { padding: .2rem 0; }

.eta-note {
  font-size: .8rem;
  color: var(--muted);
}

.failed-articles {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: .85rem 1rem;
}

.failed-title {
  font-size: .9rem;
  color: var(--danger);
  margin-bottom: .5rem;
}

.failed-item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .82rem;
  padding: .4rem 0;
  border-bottom: 1px solid #fecaca;
}

.failed-item:last-child { border-bottom: none; }

.failed-item span { color: var(--muted); }

.item-meta .origin {
  font-size: .75rem;
  color: var(--muted);
}

textarea:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.hidden { display: none !important; }

.errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: .85rem 1rem;
  color: var(--danger);
  font-size: .85rem;
}

.summary-card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--ikea-blue); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

.stat {
  background: var(--bg);
  border-radius: 10px;
  padding: .85rem;
  text-align: center;
}

.stat.highlight {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--ikea-blue), #0077cc);
  color: #fff;
}

.stat-value { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .75rem; opacity: .8; }

.pricing-details {
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.7;
}

.warnings { display: flex; flex-direction: column; gap: .5rem; }

.warning-item {
  background: #fffbeb;
  border-left: 4px solid var(--warning);
  padding: .75rem 1rem;
  border-radius: 0 10px 10px 0;
  font-size: .85rem;
}

.warning-item.ok {
  background: #f0fdf4;
  border-color: var(--success);
}

.items-list { display: flex; flex-direction: column; gap: .65rem; }

.item-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.item-card h4 { font-size: .95rem; margin-bottom: .25rem; }
.item-card .code { font-size: .8rem; color: var(--muted); }
.item-meta { display: flex; gap: 1rem; margin-top: .5rem; font-size: .85rem; }

.email-card h3 { font-size: 1rem; margin-bottom: .75rem; }

.email-form { display: flex; flex-direction: column; gap: .5rem; }

.info-card h3 { font-size: .95rem; margin-bottom: .5rem; color: var(--ikea-blue); }

.tariff-list {
  list-style: none;
  font-size: .85rem;
  color: var(--muted);
}

.tariff-list li {
  padding: .3rem 0;
  padding-left: 1rem;
  position: relative;
}

.tariff-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--ikea-blue);
}

.footer {
  max-width: 720px;
  margin: 1.5rem auto 0;
  padding: 1rem;
  text-align: center;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-bottom: .75rem;
}

.btn-footer {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .15s;
}

.btn-footer:hover { transform: translateY(-1px); }
.btn-footer.whatsapp { background: #25d366; color: #fff; }
.btn-footer.contact { background: var(--ikea-blue); color: #fff; }

.footer-copy { font-size: .75rem; color: var(--muted); }

.disclaimer-card {
  background: #fffbeb;
  border-left: 4px solid #d97706;
}

.disclaimer-text {
  font-size: .82rem;
  color: #78350f;
  line-height: 1.6;
  margin-bottom: .5rem;
}

.disclaimer-text:last-child { margin-bottom: 0; }

.errors p { margin-bottom: .35rem; }

@media (min-width: 480px) {
  .hero h1 { font-size: 1.75rem; }
  .email-form { flex-direction: row; }
  .email-form input { flex: 1; }
}

@media (min-width: 600px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat.highlight {
    grid-column: span 3;
  }
}

@media (min-width: 720px) {
  .summary-grid { grid-template-columns: repeat(5, 1fr); }
  .stat.highlight { grid-column: span 1; }
}
