.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.campo--ancho {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.actividad-form-lateral {
  display: grid;
  grid-template-columns: 0.85fr 1fr 0.9fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .actividad-form-lateral {
    grid-template-columns: 1fr;
  }
}

.actividad-form-columna {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.actividad-costos-columna {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.actividad-calculadora {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.margen-gauge {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.margen-gauge-cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.margen-gauge-titulo {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.margen-gauge-valor {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.margen-gauge-valor--positivo,
.calculadora-fila-valor.margen-gauge-valor--positivo {
  color: #2e8a54;
}

.margen-gauge-valor--negativo,
.calculadora-fila-valor.margen-gauge-valor--negativo {
  color: #b3261e;
}

.margen-gauge-pista {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgba(20, 12, 14, 0.12);
  overflow: hidden;
}

.margen-gauge-centro {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: var(--border);
  z-index: 1;
}

.margen-gauge-relleno {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--border);
  transition: left 0.15s ease, width 0.15s ease, background 0.15s ease;
}

.margen-gauge-relleno--positivo {
  background: #2e8a54;
}

.margen-gauge-relleno--negativo {
  background: #b3261e;
}

.margen-gauge-escala {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.calculadora-filas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.calculadora-fila {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.calculadora-fila-etiqueta {
  color: var(--text-muted);
  font-weight: 600;
}

.calculadora-fila-valor {
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}

.calculadora-fila-valor--costo {
  color: #b45309;
}

.calculadora-nota-markup {
  margin: -2px 0 0;
  padding: 0 12px;
  font-size: 11px;
  color: #b45309;
}

.calculadora-barra-pista {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 0 1px 2px rgba(20, 12, 14, 0.12);
  overflow: hidden;
}

.calculadora-barra-relleno {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.15s ease, background 0.15s ease;
}

.calculadora-barra-relleno--total {
  background: var(--accent-2);
}

.calculadora-barra-relleno--costo {
  background: #b45309;
}

.calculadora-barra-relleno--positivo {
  background: #2e8a54;
}

.calculadora-barra-relleno--negativo {
  background: #b3261e;
}

.actividad-costo-mini-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.actividad-costo-mini-form[hidden] {
  display: none;
}

.actividad-costo-mini-form .campo label {
  font-size: 12px;
}

.actividad-costo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 8px;
}

.actividad-costo-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.input-cantidad-costo-inline,
.input-cantidad-costo-actividad {
  width: 76px;
  flex: none;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.actividad-costo-item-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.actividad-costo-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.actividad-costo-item-total {
  font-size: 12.5px;
  font-weight: 700;
  color: #b45309;
  white-space: nowrap;
}

.btn-quitar-costo-inline {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(179, 38, 30, 0.12);
  color: #b3261e;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.btn-quitar-costo-inline:hover {
  background: rgba(179, 38, 30, 0.22);
}

.campo label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.campo-ayuda {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.campo input[type='text'],
.campo input[type='date'],
.campo input[type='number'],
.campo input[type='email'],
.campo select,
.campo textarea,
.campo input[type='file'] {
  font: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.campo textarea {
  resize: vertical;
  min-height: 64px;
}

.campo input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.campo input[type='number']::-webkit-outer-spin-button,
.campo input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.campo-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.campo-checkbox input {
  width: 16px;
  height: 16px;
}

.campo select:disabled,
.campo input:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  background: var(--bg);
}

.campo-etiqueta-grupo {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.checkbox-grupo {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 4px;
}

.checkbox-grupo label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.checkbox-grupo input {
  width: 16px;
  height: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.chip:hover {
  border-color: var(--accent-2);
  color: var(--accent);
}

.chip:active {
  transform: scale(0.96);
}

.chip.chip--activo {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.chip.chip--activo:hover {
  color: #fff;
}

.campo input:focus-visible,
.campo select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.form-btn:hover {
  opacity: 0.9;
}

.form-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-mensaje {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
}

.form-mensaje.ok {
  display: block;
  background: rgba(52, 150, 90, 0.12);
  color: #2f7d4f;
}

.form-mensaje--toast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  min-width: 280px;
  max-width: min(460px, 90vw);
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 600;
  line-height: 1.4;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(20, 12, 14, 0.28), 0 2px 8px rgba(20, 12, 14, 0.16);
  border-left: 4px solid transparent;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.form-mensaje--toast::before {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-size: 12px;
  background-repeat: no-repeat;
  background-position: center;
}

.form-mensaje--toast.error {
  background: var(--surface);
  color: #b3261e;
  border-left-color: #b3261e;
}

.form-mensaje--toast.error::before {
  background-color: rgba(200, 40, 40, 0.14);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3261e' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E");
}

.form-mensaje--toast.ok {
  background: var(--surface);
  color: #2f7d4f;
  border-left-color: #2f7d4f;
}

.form-mensaje--toast.ok::before {
  background-color: rgba(52, 150, 90, 0.16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f7d4f' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m5 13 4 4 10-10'/%3E%3C/svg%3E");
}

.form-mensaje--toast.form-mensaje--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.form-mensaje.error {
  display: block;
  background: rgba(200, 40, 40, 0.1);
  color: #b3261e;
}

.form-seccion-titulo {
  margin: 4px 0 2px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.campo-ayuda-enlace {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
