/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Base ───────────────────────────────────────────────────── */
html, body {
  min-height: 100%;
  font-family: Poppins, system-ui, sans-serif;
  background: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ─── Inputs: hide spinners ──────────────────────────────────── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input:focus, textarea:focus, select:focus {
  outline: none;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.oc-app {
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  background: transparent;
}

.oc-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 48px;
  gap: 14px;
}

/* ─── Tool header ────────────────────────────────────────────── */
.oc-tool-header {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Document card ──────────────────────────────────────────── */
.oc-doc {
  width: 100%;
  max-width: 900px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px 18px;
}

/* ─── Inline input ───────────────────────────────────────────── */
.di {
  background: rgba(255, 255, 255, .04);
  border: none;
  border-bottom: 1.5px solid rgba(255, 255, 255, .12);
  color: #fff;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 8px;
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: border-color .15s, background .15s;
}
.di:focus {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, .08);
}
.di::placeholder {
  color: rgba(255, 255, 255, .28);
  font-weight: 500;
}
.di-lg {
  font-size: 16px;
  font-weight: 800;
  padding: 8px 8px;
}
.di-sm {
  font-size: 12px;
  padding: 6px 8px;
}
textarea.di {
  resize: vertical;
  min-height: 48px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, .12);
}
textarea.di:focus {
  border-color: #8b5cf6;
}

/* ─── Section label ──────────────────────────────────────────── */
.sl {
  color: rgba(255, 255, 255, .50);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
  white-space: nowrap;
}

/* ─── Section title ──────────────────────────────────────────── */
.sec-title {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ─── Separator ──────────────────────────────────────────────── */
.oc-sep {
  border: none;
  border-top: 1.5px solid rgba(255, 255, 255, .10);
  margin: 18px 0;
}

/* ─── Logo area ──────────────────────────────────────────────── */
.logo-area {
  margin-bottom: 8px;
}
.logo-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px dashed rgba(139, 92, 246, .25);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 100px;
  min-height: 50px;
  transition: border-color .15s, background .15s;
}
.logo-upload:hover {
  border-color: rgba(139, 92, 246, .45);
  background: rgba(139, 92, 246, .04);
}
.logo-upload.has-logo {
  border: none;
  padding: 0;
  min-width: auto;
  min-height: auto;
}
.logo-placeholder {
  color: rgba(255, 255, 255, .35);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}
.logo-change {
  color: rgba(139, 92, 246, .6);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid rgba(139, 92, 246, .2);
  border-radius: 6px;
  transition: all .15s;
}
.logo-change:hover {
  color: #a78bfa;
  border-color: rgba(139, 92, 246, .4);
}
.logo-preview {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
}
.logo-preview img {
  border-radius: 6px;
  object-fit: contain;
  max-width: 140px;
  max-height: 55px;
}
.logo-rm {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .2);
  color: rgba(248, 113, 113, .6);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all .15s;
  flex-shrink: 0;
}
.logo-rm:hover {
  background: rgba(248, 113, 113, .15);
  color: #f87171;
}
.logo-err {
  color: #f87171;
  font-size: 11px;
  margin-top: 4px;
}

/* ─── Moneda selector ────────────────────────────────────────── */
.moneda-sel {
  display: inline-flex;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  overflow: hidden;
}
.moneda-opt {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, .35);
  font-family: Poppins, sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.moneda-opt.on {
  background: rgba(139, 92, 246, .15);
  color: #c4b5fd;
  border-bottom: 2px solid #8b5cf6;
}

/* ─── Two-column grid ────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.two-col-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.di-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ─── OC header (logos + title) ──────────────────────────────── */
.oc-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.oc-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

/* ─── Facturación auto-text ──────────────────────────────────── */
.fac-auto {
  background: rgba(139, 92, 246, .05);
  border: 1px solid rgba(139, 92, 246, .12);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 12px;
}
.fac-auto p {
  color: rgba(255, 255, 255, .50);
  font-size: 11px;
  line-height: 1.6;
}
.fac-auto strong {
  color: rgba(255, 255, 255, .70);
}

/* ─── Items table ────────────────────────────────────────────── */
.items-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.items-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  margin-bottom: 8px;
}
.items-table th {
  background: rgba(139, 92, 246, .08);
  color: rgba(255, 255, 255, .55);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 6px;
  text-align: left;
  border-bottom: 1.5px solid rgba(139, 92, 246, .15);
  white-space: nowrap;
}
.items-table th.r { text-align: right; }
.items-table td {
  padding: 3px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.items-table .item-input {
  width: 100%;
  background: rgba(255, 255, 255, .03);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  color: #fff;
  font-family: Poppins, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 4px 4px 0 0;
}
.items-table .item-input:focus {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, .06);
  outline: none;
}
.items-table .item-input::placeholder {
  color: rgba(255, 255, 255, .22);
}
.items-table textarea.item-input {
  resize: none;
  overflow: hidden;
  min-height: 34px;
  line-height: 1.4;
  display: block;
}
.items-table .item-total {
  text-align: right;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding-right: 6px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ─── Remove row ─────────────────────────────────────────────── */
.rm-row {
  background: transparent;
  border: none;
  color: rgba(248, 113, 113, .4);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.rm-row:hover {
  color: #f87171;
}

/* ─── Totals ─────────────────────────────────────────────────── */
.oc-totals {
  margin-left: auto;
  max-width: 320px;
  margin-top: 14px;
}
.oc-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  gap: 20px;
}
.oc-totals-label {
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
  font-weight: 700;
}
.oc-totals-val {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}
.oc-totals-row.total {
  border-top: 2px solid rgba(139, 92, 246, .30);
  margin-top: 6px;
  padding-top: 10px;
}
.oc-totals-row.total .oc-totals-label {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.oc-totals-row.total .oc-totals-val {
  color: #c4b5fd;
  font-size: 18px;
  font-weight: 900;
}
.oc-totals-row .di {
  width: 80px;
  text-align: right;
  font-size: 12px;
  padding: 5px 6px;
}

/* ─── Legal notes ────────────────────────────────────────────── */
.oc-legal {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 8px;
}
.oc-legal textarea.di {
  font-size: 11px;
  min-height: 36px;
  color: rgba(255, 255, 255, .50);
}

/* ─── Firmas ─────────────────────────────────────────────────── */
.firmas-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.firma-box {
  text-align: center;
}
.firma-line {
  border-top: 1.5px solid rgba(255, 255, 255, .15);
  margin-top: 50px;
  padding-top: 8px;
  color: rgba(255, 255, 255, .40);
  font-size: 11px;
  font-weight: 700;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.oc-btn {
  border: none;
  cursor: pointer;
  font-family: Poppins, sans-serif;
  font-weight: 700;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 11px;
  transition: all .18s;
  -webkit-tap-highlight-color: transparent;
}
.oc-btn-outline {
  background: rgba(139, 92, 246, .08);
  border: 1px solid rgba(139, 92, 246, .25);
  color: #c4b5fd;
}
.oc-btn-outline:hover {
  background: rgba(139, 92, 246, .14);
}
.oc-btn-primary {
  background: #8b5cf6;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 14px;
  width: 100%;
}
.oc-btn-primary:hover {
  background: #7c3aed;
}

/* ─── Utility ────────────────────────────────────────────────── */
.hide { display: none !important; }

/* ─── Footer ─────────────────────────────────────────────────── */
.oc-footer {
  width: 100%;
  max-width: 900px;
}

/* ─── CTA block ──────────────────────────────────────────────── */
.cta {
  margin-top: 4px;
  position: relative;
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(139, 92, 246, .5),
    rgba(167, 139, 250, .12),
    rgba(255, 255, 255, .08)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.cta-in {
  background: rgba(255, 255, 255, .04);
  border-radius: 16px;
  padding: 16px;
  position: relative;
}

/* ─── Tablet+ ────────────────────────────────────────────────── */
@media (min-width: 520px) {
  .oc-wrap {
    padding: 20px 16px 72px;
  }
  .oc-doc {
    border-radius: 24px;
    padding: 28px 26px;
  }
  .two-col {
    grid-template-columns: 1.2fr 1fr;
  }
}

@media (min-width: 768px) {
  .oc-wrap {
    padding: 24px 20px 100px;
  }
  .oc-doc {
    border-radius: 28px;
    padding: 32px 30px;
  }
  .cta-in {
    padding: 18px;
  }
}
