* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  line-height: 1.6;
}

.libro-app {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 24px 72px;
  background: radial-gradient(1100px 520px at 50% -180px, rgba(37, 99, 235, 0.08), transparent 70%), #ffffff;
}

.libro-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.libro-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 28px;
  border-radius: 14px;
  border: 1px solid #e5e5e5;
  background: #f9f9f9 ;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.libro-header-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.libro-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.libro-kicker {
  font-size: 12px;
  font-weight: 500;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.libro-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
  color: #1a1a1a;
}

.libro-subtitle {
  margin: 0;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.62);
  line-height: 1.6;
}

.libro-subtitle .required {
  color: #2563eb;
}

.libro-header-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  text-align: right;
}

.libro-tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  font-size: 11px;
  font-weight: 500;
  background: #ffffff;
  color: #1a1a1a;
}

.libro-tag-success {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-size: 11px;
  font-weight: 500;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.libro-date {
  font-size: 11px;
  color: rgba(26, 26, 26, 0.48);
}

.libro-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e5e5e5 48px, #e5e5e5 calc(100% - 48px), transparent);
}

.libro-brand-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-size: 12px;
  color: rgba(26, 26, 26, 0.55);
}

.libro-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 28px;
  border-radius: 14px;
  border: 1px solid #e5e5e5;
  background: #f9f9f9;
}

.libro-section-header {
  display: flex;
  align-items: baseline;
}

.libro-section-header h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  color: #1a1a1a;
}

.libro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}

.libro-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.libro-field label {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
}

.libro-field label .required {
  color: #2563eb;
}

.libro-app .libro-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  background: #ffffff;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-size: 13px;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.libro-app select.libro-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 1.2em;
  padding-right: 40px;
}

.libro-app .libro-input:focus,
.libro-app .libro-input:active {
  outline: none;
  background: #ffffff;
  border-color: #e5e5e5;
  box-shadow: none;
}

textarea.libro-app .libro-input {
  resize: vertical;
  min-height: 60px;
}

.libro-app select option {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #ffffff;
}

.libro-counter {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
  font-size: 11px;
  color: rgba(26, 26, 26, 0.45);
}

.libro-radios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
  font-size: 13px;
}

.libro-radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.libro-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.libro-radio:hover {
  background: rgba(37, 99, 235, 0.08);
}

.libro-radio input[type="radio"]:checked ~ span {
  font-weight: 600;
  color: #2563eb;
}

.libro-radio input[type="radio"],
.libro-radio input[type="checkbox"],
.libro-checkbox input[type="checkbox"] {
  cursor: pointer;
  width: 1em;
  height: 1em;
  accent-color: #2563eb;
  flex-shrink: 0;
  margin-top: 0;
}

.libro-radio span,
.libro-checkbox span {
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1;
}

.libro-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(26, 26, 26, 0.72);
}

.libro-checkbox input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.libro-tipo-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.libro-radio-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 2px solid #e5e5e5;
  background: #ffffff;
  cursor: pointer;
  flex: 1 1 240px;
  transition: all 0.2s ease;
  position: relative;
}

.libro-radio-card:hover {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.02);
}

.libro-radio-card input[type="radio"] {
  width: 1em;
  height: 1em;
  margin: 0;
  cursor: pointer;
  accent-color: #2563eb;
  flex-shrink: 0;
}

.libro-radio-card input[type="radio"]:checked ~ .radio-content {
  color: #2563eb;
}

.radio-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.radio-content span:first-child {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}

.radio-desc {
  font-size: 13px !important;
  color: rgba(26, 26, 26, 0.60) !important;
  line-height: 1.4;
}

.libro-file-upload {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px dashed #e5e5e5;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s ease;
}

.libro-file-upload:hover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.03);
}

.file-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-label span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

.file-sublabel {
  font-size: 11px;
  color: rgba(26, 26, 26, 0.50);
  line-height: 1.4;
}

.libro-conditional {
  animation: lr-in 0.25s ease both;
}

@keyframes lr-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.libro-terms {
  background: linear-gradient(180deg, #ffffff, rgba(37, 99, 235, 0.04));
}

.libro-disclaimer {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(26, 26, 26, 0.48);
}

.libro-btn {
  padding: 11px 20px;
  border-radius: 8px;
  border: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.libro-btn-primary {
  background: #2563eb;
  color: white;
  padding: 11px 24px;
}

.libro-btn-primary:hover:not(:disabled) {
  background: #60a5fa;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.libro-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.libro-btn-secondary {
  background: #ffffff;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
  pointer-events: none;
  padding: 11px 20px;
  font-size: 13px;
}

.libro-btn-ghost {
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
  padding: 11px 20px;
}

.libro-btn-ghost:hover {
  background: rgba(26, 26, 26, 0.02);
  border-color: #2563eb;
  color: #2563eb;
}

.libro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
}

.libro-submit-group {
  display: flex;
  align-items: center;
  gap: 50px;
}

.libro-status-hint {
  font-size: 12px;
  color: rgba(26, 26, 26, 0.45);
}

.libro-success {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.08);
  animation: lr-in 0.3s ease both;
  font-size: 14px;
}

.libro-success strong {
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}

.libro-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =====================================================
   RESPONSIVE DESIGN - DESKTOP XL (1025px - 1440px)
   ===================================================== */
@media (min-width: 1025px) and (max-width: 1440px) {
  .libro-app {
    padding: 40px 20px 60px;
  }

  .libro-header {
    padding: 24px 26px;
    gap: 14px;
  }

  .libro-section {
    padding: 24px 26px;
    gap: 16px;
  }

  .libro-title {
    font-size: 28px;
  }

  .libro-grid {
    gap: 12px 14px;
  }
}

/* =====================================================
   RESPONSIVE DESIGN - TABLET (769px - 1024px)
   ===================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
  .libro-app {
    padding: 32px 18px 50px;
  }

  .libro-header {
    padding: 20px 22px;
    gap: 12px;
  }

  .libro-header-content {
    gap: 12px;
  }

  .libro-title {
    font-size: 26px;
  }

  .libro-subtitle {
    font-size: 12px;
  }

  .libro-brand-info {
    gap: 8px 20px;
    font-size: 11px;
  }

  .libro-section {
    padding: 20px 22px;
    gap: 14px;
  }

  .libro-section-header h2 {
    font-size: 16px;
  }

  .libro-grid {
    gap: 12px 14px;
  }

  .libro-radios {
    padding: 10px 12px;
    gap: 12px;
    font-size: 12px;
  }

  .libro-radio-group {
    gap: 10px;
  }

  .libro-radio {
    padding: 7px 12px;
    font-size: 12px;
  }

  .libro-tipo-radios {
    gap: 10px;
  }

  .libro-radio-card {
    padding: 14px 16px;
    gap: 12px;
    flex: 1 1 200px;
  }

  .radio-content span:first-child {
    font-size: 13px;
  }

  .radio-desc {
    font-size: 12px !important;
  }

  .libro-field label {
    font-size: 12px;
  }

  .libro-app .libro-input {
    font-size: 12px;
    padding: 9px 11px;
  }

  .libro-btn {
    font-size: 12px;
    padding: 10px 18px;
    min-height: 38px;
  }

  .libro-btn-primary {
    padding: 10px 22px;
  }

  .libro-btn-secondary {
    font-size: 12px;
    padding: 10px 18px;
  }

  .libro-btn-ghost {
    padding: 10px 18px;
  }

  .libro-counter {
    font-size: 10px;
  }

  .libro-success {
    font-size: 13px;
    padding: 18px 22px;
    gap: 14px;
  }

  .libro-file-upload {
    padding: 14px 16px;
    gap: 14px;
  }
}

/* =====================================================
   RESPONSIVE DESIGN - MOBILE MEDIUM (480px - 768px)
   ===================================================== */
@media (min-width: 480px) and (max-width: 768px) {
  .libro-app {
    padding: 24px 14px 40px;
  }

  .libro-header {
    padding: 16px 18px;
    gap: 10px;
    border-radius: 10px;
  }

  .libro-header-content {
    flex-direction: column;
    gap: 10px;
  }

  .libro-header-left {
    gap: 4px;
  }

  .libro-header-right {
    align-items: flex-start;
    gap: 6px;
  }

  .libro-title {
    font-size: 22px;
    line-height: 1.2;
  }

  .libro-kicker {
    font-size: 11px;
  }

  .libro-subtitle {
    font-size: 11px;
    line-height: 1.5;
  }

  .libro-tag {
    font-size: 10px;
    padding: 5px 10px;
  }

  .libro-date {
    font-size: 10px;
  }

  .libro-brand-info {
    gap: 6px 16px;
    font-size: 10px;
    flex-direction: column;
  }

  .libro-section {
    padding: 16px 18px;
    gap: 12px;
    border-radius: 10px;
  }

  .libro-section-header h2 {
    font-size: 15px;
  }

  .libro-grid {
    grid-template-columns: 1fr;
    gap: 10px 12px;
  }

  .libro-field {
    gap: 4px;
  }

  .libro-field label {
    font-size: 11px;
  }

  .libro-app .libro-input {
    font-size: 11px;
    padding: 8px 10px;
    border-radius: 6px;
  }

  textarea.libro-app .libro-input {
    min-height: 50px;
  }

  .libro-radios {
    padding: 8px 10px;
    gap: 10px;
    border-radius: 8px;
    font-size: 11px;
  }

  .libro-radio-group {
    gap: 8px;
    flex-wrap: wrap;
  }

  .libro-radio {
    padding: 6px 10px;
    gap: 6px;
    font-size: 11px;
    border-radius: 6px;
  }

  .libro-radio input[type="radio"],
  .libro-radio input[type="checkbox"],
  .libro-checkbox input[type="checkbox"] {
    width: 1em;
    height: 1em;
  }

  .libro-tipo-radios {
    gap: 8px;
  }

  .libro-radio-card {
    padding: 12px 14px;
    gap: 12px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    flex: 1 1 100%;
  }

  .libro-radio-card input[type="radio"] {
    width: 1em;
    height: 1em;
  }

  .radio-content {
    gap: 2px;
  }

  .radio-content span:first-child {
    font-size: 12px;
  }

  .radio-desc {
    font-size: 11px !important;
  }

  .libro-checkbox {
    font-size: 11px;
    gap: 10px;
  }

  .libro-counter {
    font-size: 10px;
  }

  .libro-btn {
    font-size: 11px;
    padding: 9px 16px;
    border-radius: 6px;
    min-height: 36px;
  }

  .libro-btn-primary {
    padding: 9px 20px;
  }

  .libro-btn-secondary {
    font-size: 11px;
    padding: 9px 16px;
  }

  .libro-btn-ghost {
    padding: 9px 16px;
  }

  .libro-actions {
    gap: 10px;
    flex-direction: column;
  }

  .libro-actions button {
    width: 100%;
  }

  .libro-submit-group {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .libro-status-hint {
    font-size: 11px;
  }

  .libro-success {
    font-size: 12px;
    padding: 14px 16px;
    gap: 12px;
    border-radius: 10px;
  }

  .libro-file-upload {
    padding: 12px 14px;
    gap: 12px;
    border-radius: 8px;
  }

  .file-label {
    gap: 2px;
  }

  .file-label span:first-child {
    font-size: 12px;
  }

  .file-sublabel {
    font-size: 10px;
  }

  .libro-loading {
    gap: 10px;
    padding: 20px;
  }

  .spinner {
    width: 18px;
    height: 18px;
  }

  .libro-divider {
    background: linear-gradient(90deg, transparent, #e5e5e5 24px, #e5e5e5 calc(100% - 24px), transparent);
  }
}

/* =====================================================
   RESPONSIVE DESIGN - MOBILE (max-width: 479px)
   ===================================================== */
@media (max-width: 479px) {
  .libro-app {
    padding: 16px 12px 32px;
  }

  .libro-form {
    gap: 14px;
  }

  .libro-header {
    padding: 14px 14px;
    gap: 8px;
    border-radius: 8px;
  }

  .libro-header-content {
    flex-direction: column;
    gap: 8px;
  }

  .libro-header-left {
    gap: 3px;
  }

  .libro-header-right {
    align-items: flex-start;
    gap: 4px;
  }

  .libro-title {
    font-size: 20px;
    line-height: 1.2;
  }

  .libro-kicker {
    font-size: 10px;
    letter-spacing: 0.03em;
  }

  .libro-subtitle {
    font-size: 10px;
    line-height: 1.5;
  }

  .libro-tag {
    font-size: 9px;
    padding: 4px 8px;
  }

  .libro-tag-success {
    font-size: 9px;
    padding: 4px 8px;
  }

  .libro-date {
    font-size: 9px;
  }

  .libro-brand-info {
    gap: 4px 12px;
    font-size: 9px;
    flex-direction: column;
  }

  .libro-section {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 8px;
  }

  .libro-section-header h2 {
    font-size: 14px;
    font-weight: 600;
  }

  .libro-grid {
    grid-template-columns: 1fr;
    gap: 8px 10px;
  }

  .libro-field {
    gap: 3px;
  }

  .libro-field label {
    font-size: 10px;
    font-weight: 600;
  }

  .libro-app .libro-input {
    font-size: 10px;
    padding: 7px 9px;
    border-radius: 5px;
  }

  textarea.libro-app .libro-input {
    min-height: 40px;
    font-size: 10px;
  }

  .libro-radios {
    padding: 8px 10px;
    gap: 8px;
    border-radius: 6px;
    font-size: 10px;
    flex-wrap: wrap;
  }

  .libro-radio-group {
    gap: 6px;
    flex-wrap: wrap;
  }

  .libro-radio {
    padding: 5px 8px;
    gap: 6px;
    font-size: 10px;
    border-radius: 5px;
  }

  .libro-radio input[type="radio"],
  .libro-radio input[type="checkbox"],
  .libro-checkbox input[type="checkbox"] {
    width: 1em;
    height: 1em;
  }

  .libro-radio span,
  .libro-checkbox span {
    font-size: 10px;
  }

  .libro-tipo-radios {
    gap: 6px;
    flex-wrap: wrap;
  }

  .libro-radio-card {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    flex: 1 1 100%;
  }

  .libro-radio-card input[type="radio"] {
    width: 1em;
    height: 1em;
    margin-top: 0;
  }

  .radio-content {
    gap: 1px;
  }

  .radio-content span:first-child {
    font-size: 11px;
    font-weight: 600;
  }

  .radio-desc {
    font-size: 9px !important;
  }

  .libro-checkbox {
    font-size: 10px;
    gap: 8px;
    line-height: 1.4;
  }

  .libro-checkbox input[type="checkbox"] {
    width: 1em;
    height: 1em;
    margin-top: 0;
  }

  .libro-counter {
    font-size: 9px;
  }

  .libro-btn {
    font-size: 10px;
    padding: 8px 14px;
    border-radius: 5px;
    min-height: 34px;
  }

  .libro-btn-primary {
    padding: 8px 18px;
  }

  .libro-btn-secondary {
    font-size: 10px;
    padding: 8px 14px;
    width: 100%;
  }

  .libro-btn-ghost {
    padding: 8px 14px;
  }

  .libro-actions {
    gap: 8px;
    flex-direction: column;
  }

  .libro-actions button {
    width: 100%;
  }

  .libro-submit-group {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .libro-status-hint {
    font-size: 9px;
  }

  .libro-success {
    font-size: 11px;
    padding: 12px 12px;
    gap: 10px;
    border-radius: 8px;
    flex-direction: column;
  }

  .libro-success strong {
    font-size: 11px;
  }

  .libro-file-upload {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 6px;
    flex-direction: column;
    align-items: flex-start;
  }

  .file-label {
    gap: 2px;
    order: 0;
  }

  .file-label span:first-child {
    font-size: 11px;
  }

  .file-sublabel {
    font-size: 9px;
  }

  .libro-loading {
    gap: 8px;
    padding: 16px;
    font-size: 11px;
  }

  .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(37, 99, 235, 0.15);
  }

  .libro-divider {
    background: linear-gradient(90deg, transparent, #e5e5e5 12px, #e5e5e5 calc(100% - 12px), transparent);
  }

  .libro-disclaimer {
    font-size: 9px;
    line-height: 1.5;
  }
}

/* =====================================================
   OVERRIDE - Inputs con fondo blanco en focus/active
   ===================================================== */
.libro-app input[type=text]:focus,
.libro-app input[type=text]:active,
.libro-app input[type=url]:focus,
.libro-app input[type=url]:active,
.libro-app input[type=search]:focus,
.libro-app input[type=search]:active,
.libro-app input[type=email]:focus,
.libro-app input[type=email]:active,
.libro-app input[type=password]:focus,
.libro-app input[type=password]:active,
.libro-app input[type=tel]:focus,
.libro-app input[type=tel]:active,
.libro-app input[type=time]:focus,
.libro-app input[type=time]:active,
.libro-app select:focus,
.libro-app select:active,
.libro-app textarea:focus,
.libro-app textarea:active {
  background: #ffffff;
  border-color: #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
}
