#bvcal {
  --bv-acc: #2c929c;
  --bv-acc-dark: #1d6f78;
  --bv-acc-soft: #e3f3f4;
  --bv-ink: #1f2937;
  --bv-muted: #6b7280;
  --bv-line: #e5e7eb;
  --bv-paper: #f4f9fa;
  font-family: 'Nunito', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--bv-ink);
  background: var(--bv-paper);
  border-radius: 22px;
  padding: 22px;
  max-width: 1180px;
  margin: 20px auto;
  box-sizing: border-box;
  line-height: 1.4;
}
#bvcal *, #bvcal *::before, #bvcal *::after { box-sizing: border-box; }

/* Capçalera */
#bvcal .bv-head {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bv-acc) 0%, #45b7a9 100%);
  color: #fff;
  border-radius: 18px;
  padding: 26px 28px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(44, 146, 156, .25);
}
#bvcal .bv-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(255,255,255,.13) 27px 28px);
  pointer-events: none;
}
#bvcal .bv-head h2 {
  margin: 0 0 6px;
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
}
#bvcal .bv-head p { margin: 0; font-size: 1.02rem; color: rgba(255,255,255,.92); }

/* Graella principal */
#bvcal .bv-grid {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  #bvcal { padding: 14px; }
  #bvcal .bv-grid { grid-template-columns: minmax(0, 1fr); }
  #bvcal .bv-head h2 { font-size: 1.45rem; }
}

/* Targetes */
#bvcal .bv-card {
  background: #fff;
  border: 1px solid var(--bv-line);
  border-left: 5px solid var(--bv-acc);
  border-radius: 14px;
  padding: 18px 18px 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, .05);
}
#bvcal .bv-card.neutre { border-left-color: #a9d8dc; }
#bvcal .bv-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--bv-acc-dark);
}

/* Formularis */
#bvcal label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 5px;
}
#bvcal textarea,
#bvcal select,
#bvcal input[type="text"],
#bvcal input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: .92rem;
  color: var(--bv-ink);
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 9px;
  padding: 8px 10px;
  margin: 0 0 12px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: none;
  height: auto;
  min-height: 0;
}
#bvcal textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
#bvcal textarea:focus,
#bvcal select:focus,
#bvcal input:focus {
  outline: none;
  border-color: var(--bv-acc);
  box-shadow: 0 0 0 3px rgba(44, 146, 156, .15);
}
#bvcal .bv-row { display: flex; gap: 10px; }
#bvcal .bv-row > div { flex: 1; min-width: 0; }
#bvcal .bv-hint { font-size: .78rem; color: var(--bv-muted); margin: -4px 0 10px; }

#bvcal label.bv-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .86rem;
  margin: 0 0 8px;
  cursor: pointer;
}
#bvcal label.bv-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--bv-acc); }

/* Botons */
#bvcal button { font-family: inherit; cursor: pointer; }
#bvcal .bv-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#bvcal .bv-chip {
  background: var(--bv-acc-soft);
  color: var(--bv-acc-dark);
  border: 1.5px solid #b7dfe2;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.2;
  transition: background .15s, transform .1s;
}
#bvcal .bv-chip:hover { background: #cdeaec; }
#bvcal .bv-chip:active { transform: scale(.96); }

#bvcal .bv-sil {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--bv-line);
}
#bvcal .bv-sil input { width: 64px; margin: 0; text-align: center; }
#bvcal .bv-small {
  background: #fff;
  color: var(--bv-acc-dark);
  border: 1.5px solid var(--bv-acc);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 700;
}
#bvcal .bv-small:hover { background: var(--bv-acc-soft); }

#bvcal .bv-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--bv-acc) 0%, #45b7a9 100%);
  box-shadow: 0 8px 20px rgba(44, 146, 156, .3);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
#bvcal .bv-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(44, 146, 156, .35); }
#bvcal .bv-btn:disabled { opacity: .6; transform: none; cursor: wait; }

/* Logo */
#bvcal .bv-logo { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
#bvcal #bv_logoprev {
  width: 70px;
  height: 70px;
  border: 1.5px dashed #d1d5db;
  border-radius: 10px;
  background: #fff;
  flex: none;
}

/* Previsualització */
#bvcal .bv-prevbox {
  position: sticky;
  top: 40px;
  background: #fff;
  border: 1px solid var(--bv-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(17, 24, 39, .05);
}
#bvcal .bv-prevhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-weight: 800;
  font-size: .92rem;
  border-bottom: 1px solid var(--bv-line);
  background: #fff;
}
#bvcal #bv_info {
  font-weight: 700;
  font-size: .78rem;
  color: var(--bv-acc-dark);
  background: var(--bv-acc-soft);
  border-radius: 999px;
  padding: 3px 10px;
}
#bvcal .bv-preview {
  background: #e8eef0;
  padding: 18px;
  max-height: calc(100vh - 140px);
  min-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
#bvcal .bv-preview canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
}
@media (max-width: 900px) {
  #bvcal .bv-prevbox { position: static; }
  #bvcal .bv-preview { max-height: none; }
}
